diff options
-rw-r--r-- | res/layout/album_cell_item.xml | 24 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/view/AlbumCell.java | 3 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/view/UpdateView.java | 17 |
3 files changed, 32 insertions, 12 deletions
diff --git a/res/layout/album_cell_item.xml b/res/layout/album_cell_item.xml index 5f4735fe..3dd79477 100644 --- a/res/layout/album_cell_item.xml +++ b/res/layout/album_cell_item.xml @@ -4,12 +4,28 @@ android:layout_width="match_parent"
android:layout_height="match_parent">
- <github.daneren2005.dsub.view.SquareImageView
- android:id="@+id/album_coverart"
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_weight="1"
- android:src="@drawable/unknown_album"/>
+ android:layout_weight="1">
+
+ <github.daneren2005.dsub.view.SquareImageView
+ android:id="@+id/album_coverart"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:src="@drawable/unknown_album"/>
+
+ <RatingBar
+ android:id="@+id/album_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:layout_alignParentBottom="true"
+ android:visibility="gone"/>
+ </RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
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;
}
}
|