Skip to content

Commit

Permalink
Fixes using the right value for 'stars'
Browse files Browse the repository at this point in the history
  • Loading branch information
damontecres committed Feb 20, 2024
1 parent 8aaa192 commit 4acca76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,18 @@ class DetailsDescriptionPresenter(val ratingCallback: RatingCallback) :
)
}
val serverPreferences = ServerPreferences(viewHolder.view.context)
val type =
serverPreferences.preferences.getString(ServerPreferences.PREF_RATING_TYPE, "star")
val precision =
serverPreferences.preferences.getFloat(ServerPreferences.PREF_RATING_PRECISION, 1.0f)

val ratingBar = viewHolder.view.findViewById<RatingBar>(R.id.rating)
val ratingBarDecimal = viewHolder.view.findViewById<SeekBar>(R.id.rating_decimal)
val ratingBarDecimalHolder = viewHolder.view.findViewById<View>(R.id.rating_decimal_holder)
val ratingBarDecimalText = viewHolder.view.findViewById<TextView>(R.id.rating_decimal_text)
if (type == "decimal") {
ratingBar.visibility = View.GONE
} else {
// star
if (serverPreferences.ratingsAsStars) {
ratingBarDecimalHolder.visibility = View.GONE
} else {
// decimal
ratingBar.visibility = View.GONE
}

var currentRating = scene.rating100 ?: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ServerPreferences(private val context: Context) {

val minimumPlayPercent get() = preferences.getInt(PREF_MINIMUM_PLAY_PERCENT, 20)

val ratingsAsStars get() = preferences.getString(PREF_RATING_TYPE, "stars") == "star"
val ratingsAsStars get() = preferences.getString(PREF_RATING_TYPE, "stars") == "stars"

suspend fun updatePreferences() {
val queryEngine = QueryEngine(context)
Expand Down

0 comments on commit 4acca76

Please sign in to comment.