diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-11 15:03:03 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-11 15:03:03 -0700 |
commit | 82cee9a60795716273e38a2fcb647c11f9ea0dc0 (patch) | |
tree | 8688cf5f0e032798c6d698e475b2db0cd411936e /src | |
parent | 7b16f06f8d02f8861174b3b84da5b25eb7260ec1 (diff) | |
download | dsub-82cee9a60795716273e38a2fcb647c11f9ea0dc0.tar.gz dsub-82cee9a60795716273e38a2fcb647c11f9ea0dc0.tar.bz2 dsub-82cee9a60795716273e38a2fcb647c11f9ea0dc0.zip |
#397 Add rating to album cover art
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/view/AlbumCell.java | 3 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/view/UpdateView.java | 17 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/github/daneren2005/dsub/view/AlbumCell.java b/src/github/daneren2005/dsub/view/AlbumCell.java index e50aad32..0ad6861b 100644 --- a/src/github/daneren2005/dsub/view/AlbumCell.java +++ b/src/github/daneren2005/dsub/view/AlbumCell.java @@ -20,6 +20,7 @@ import android.view.LayoutInflater; import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
+import android.widget.RatingBar;
import android.widget.TextView;
import java.io.File;
@@ -50,6 +51,8 @@ public class AlbumCell extends UpdateView { titleView = (TextView) findViewById(R.id.album_title);
artistView = (TextView) findViewById(R.id.album_artist);
+ ratingBar = (RatingBar) findViewById(R.id.album_rating);
+ ratingBar.setFocusable(false);
starButton = (ImageButton) findViewById(R.id.album_star);
starButton.setFocusable(false);
moreButton = (ImageView) findViewById(R.id.album_more);
diff --git a/src/github/daneren2005/dsub/view/UpdateView.java b/src/github/daneren2005/dsub/view/UpdateView.java index 87d065b8..8ca3f29a 100644 --- a/src/github/daneren2005/dsub/view/UpdateView.java +++ b/src/github/daneren2005/dsub/view/UpdateView.java @@ -30,6 +30,8 @@ import android.widget.AbsListView; import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import android.widget.RatingBar;
+
import java.util.ArrayList;
import java.util.List;
import java.util.WeakHashMap;
@@ -49,6 +51,7 @@ public class UpdateView extends LinearLayout { private static int activeActivities = 0;
protected Context context;
+ protected RatingBar ratingBar;
protected ImageButton starButton;
protected ImageView moreButton;
@@ -263,16 +266,14 @@ public class UpdateView extends LinearLayout { }
}
- if(isRated != rating) {
- // Color the entire row based on rating
- if(isRated < 3 && isRated > 0) {
- this.setBackgroundColor(Color.RED);
- // Use darker colors the lower the rating goes
- this.getBackground().setAlpha(10 * (3 - isRated));
- } else {
- this.setBackgroundColor(0x00000000);
+ if(ratingBar != null && isRated != rating) {
+ if(isRated > 0 && rating == 0) {
+ ratingBar.setVisibility(View.VISIBLE);
+ } else if(isRated == 0 && rating > 0) {
+ ratingBar.setVisibility(View.GONE);
}
+ ratingBar.setRating(isRated);
rating = isRated;
}
}
|