aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout/song_list_item.xml10
-rw-r--r--src/github/daneren2005/dsub/view/SongView.java24
2 files changed, 29 insertions, 5 deletions
diff --git a/res/layout/song_list_item.xml b/res/layout/song_list_item.xml
index 8febace9..d433df69 100644
--- a/res/layout/song_list_item.xml
+++ b/res/layout/song_list_item.xml
@@ -93,6 +93,16 @@
android:ellipsize="middle"
android:paddingLeft="6dip"/>
+ <RatingBar
+ android:id="@+id/song_rating"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:isIndicator="true"
+ android:layout_centerHorizontal="true"
+ android:numStars="5"
+ style="@android:style/Widget.Holo.RatingBar.Small"
+ android:visibility="gone"/>
+
<TextView
android:id="@+id/song_duration"
android:layout_width="wrap_content"
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);
}