From 703e6ac05d45851aeab085a18ca1c87d84d2b7a9 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 5 Sep 2014 19:05:42 -0700 Subject: Remove green highlight, apply red highlighting to down rated albums too --- src/github/daneren2005/dsub/view/AlbumCell.java | 1 + src/github/daneren2005/dsub/view/AlbumView.java | 1 + src/github/daneren2005/dsub/view/SongView.java | 7 +------ src/github/daneren2005/dsub/view/UpdateView.java | 16 ++++++++++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/github/daneren2005/dsub/view/AlbumCell.java b/src/github/daneren2005/dsub/view/AlbumCell.java index 522834d1..e50aad32 100644 --- a/src/github/daneren2005/dsub/view/AlbumCell.java +++ b/src/github/daneren2005/dsub/view/AlbumCell.java @@ -92,5 +92,6 @@ public class AlbumCell extends UpdateView { exists = file.exists(); isStarred = album.isStarred(); + isRated = album.getRating(); } } diff --git a/src/github/daneren2005/dsub/view/AlbumView.java b/src/github/daneren2005/dsub/view/AlbumView.java index e28eeadd..c499763f 100644 --- a/src/github/daneren2005/dsub/view/AlbumView.java +++ b/src/github/daneren2005/dsub/view/AlbumView.java @@ -92,5 +92,6 @@ public class AlbumView extends UpdateView { exists = file.exists(); isStarred = album.isStarred(); + isRated = album.getRating(); } } diff --git a/src/github/daneren2005/dsub/view/SongView.java b/src/github/daneren2005/dsub/view/SongView.java index 8d986090..73efc9b9 100644 --- a/src/github/daneren2005/dsub/view/SongView.java +++ b/src/github/daneren2005/dsub/view/SongView.java @@ -66,8 +66,6 @@ public class SongView extends UpdateView implements Checkable { private boolean loaded = false; private boolean isBookmarked = false; private boolean bookmarked = false; - private int isRated = 0; - private int rating = 0; public SongView(Context context) { super(context); @@ -260,10 +258,7 @@ public class SongView extends UpdateView implements Checkable { if(isRated != rating) { // Color the entire row based on rating - if(isRated > 3) { - this.setBackgroundColor(Color.GREEN); - this.getBackground().setAlpha(5 * (isRated - 3)); - } else if(isRated < 3 && isRated > 0) { + if(isRated < 3 && isRated > 0) { this.setBackgroundColor(Color.RED); // Use darker colors the lower the rating goes this.getBackground().setAlpha(10 * (3 - isRated)); diff --git a/src/github/daneren2005/dsub/view/UpdateView.java b/src/github/daneren2005/dsub/view/UpdateView.java index 5f34a765..87d065b8 100644 --- a/src/github/daneren2005/dsub/view/UpdateView.java +++ b/src/github/daneren2005/dsub/view/UpdateView.java @@ -20,6 +20,7 @@ package github.daneren2005.dsub.view; import android.content.Context; import android.content.res.TypedArray; +import android.graphics.Color; import android.os.Handler; import android.os.Looper; import android.util.Log; @@ -56,6 +57,8 @@ public class UpdateView extends LinearLayout { protected boolean shaded = false; protected boolean starred = false; protected boolean isStarred = false; + protected int isRated = 0; + protected int rating = 0; protected SilentBackgroundTask imageTask = null; protected final boolean autoUpdate; @@ -259,5 +262,18 @@ 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); + } + + rating = isRated; + } } } -- cgit v1.2.3