diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-11 17:43:05 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-11 17:43:05 -0700 |
commit | 3cd0c587c2883a43e8adbe20825e13f8e1bc2814 (patch) | |
tree | 92a580da2f692fa5cee7d7b9e1241b7104bae197 /src/github | |
parent | ddebf2736cab3e9a604f64e70426554160b3ff64 (diff) | |
download | dsub-3cd0c587c2883a43e8adbe20825e13f8e1bc2814.tar.gz dsub-3cd0c587c2883a43e8adbe20825e13f8e1bc2814.tar.bz2 dsub-3cd0c587c2883a43e8adbe20825e13f8e1bc2814.zip |
Add rating bars for songs as well
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/view/SongView.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/github/daneren2005/dsub/view/SongView.java b/src/github/daneren2005/dsub/view/SongView.java index 3354b58b..f795cbce 100644 --- a/src/github/daneren2005/dsub/view/SongView.java +++ b/src/github/daneren2005/dsub/view/SongView.java @@ -78,6 +78,7 @@ public class SongView extends UpdateView implements Checkable { durationTextView = (TextView) findViewById(R.id.song_duration); statusTextView = (TextView) findViewById(R.id.song_status); statusImageView = (ImageView) findViewById(R.id.song_status_icon); + ratingBar = (RatingBar) findViewById(R.id.song_rating); starButton = (ImageButton) findViewById(R.id.song_star); starButton.setFocusable(false); bookmarkButton = (ImageButton) findViewById(R.id.song_bookmark); @@ -147,6 +148,7 @@ public class SongView extends UpdateView implements Checkable { checkedTextView.setVisibility(checkable && !song.isVideo() ? View.VISIBLE : View.GONE); this.setBackgroundColor(0x00000000); + ratingBar.setVisibility(View.GONE); rating = 0; revision = -1; @@ -264,12 +266,24 @@ public class SongView extends UpdateView implements Checkable { } if(isRated != rating) { - // Color the entire row based on rating - if(isRated < 3 && isRated > 0) { + if(isRated > 1) { + if(rating <= 1) { + ratingBar.setVisibility(View.VISIBLE); + } + + ratingBar.setNumStars(isRated); + ratingBar.setRating(isRated); + } else if(isRated <= 1) { + if(rating > 1) { + ratingBar.setVisibility(View.GONE); + } + } + + // Still highlight red if a 1-star + if(isRated == 1) { this.setBackgroundColor(Color.RED); - // Use darker colors the lower the rating goes - this.getBackground().setAlpha(10 * (3 - isRated)); - } else { + this.getBackground().setAlpha(20); + } else if(rating == 1) { this.setBackgroundColor(0x00000000); } |