aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-09-02 14:06:48 -0700
committerScott Jackson <daneren2005@gmail.com>2014-09-02 14:06:48 -0700
commit4108b2f3ce2f04e84ed56321efe838c51ca0ef3d (patch)
tree483c394bc6923053ee151524f3aac59f48648de1 /src
parent1af681b8a64a615beafa8e76794ec4ec19f70234 (diff)
downloaddsub-4108b2f3ce2f04e84ed56321efe838c51ca0ef3d.tar.gz
dsub-4108b2f3ce2f04e84ed56321efe838c51ca0ef3d.tar.bz2
dsub-4108b2f3ce2f04e84ed56321efe838c51ca0ef3d.zip
Add context menu method to set rating
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/fragments/SubsonicFragment.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index 5fa4956d..d61ed9eb 100644
--- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -379,6 +379,9 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
case R.id.bookmark_menu_delete:
deleteBookmark(entry, null);
break;
+ case R.id.menu_rate:
+ setRating(entry);
+ break;
default:
return false;
}
@@ -1494,6 +1497,27 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
}
});
}
+
+ protected void setRating(final Entry entry) {
+ final RatingBar ratingBar = new RatingBar(context);
+ ratingBar.setNumStars(5);
+ ratingBar.setRating((float) entry.getRating());
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setTitle(context.getResources().getString(R.string.rating_title, entry.getTitle()))
+ .setView(ratingBar)
+ .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ int rating = (int) ratingBar.getRating();
+ setRating(entry, rating);
+ }
+ })
+ .setNegativeButton(R.string.common_cancel);
+
+ AlertDialog dialog = builder.create();
+ dialog.show();
+ }
protected void setRating(final Entry entry, final int rating) {
new SilentBackgroundTask<Void>(context) {