diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-02 19:27:16 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-02 19:27:16 -0700 |
commit | 50171f3c0a5524159081d76414636a53513de233 (patch) | |
tree | 5f09c296d09848aa136c27e77c21032367cf4011 | |
parent | 7e014451727f4dad729ce2f3b0889df53aecdf51 (diff) | |
download | dsub-50171f3c0a5524159081d76414636a53513de233.tar.gz dsub-50171f3c0a5524159081d76414636a53513de233.tar.bz2 dsub-50171f3c0a5524159081d76414636a53513de233.zip |
More work on Set Rating
-rw-r--r-- | res/layout/rating.xml | 15 | ||||
-rw-r--r-- | res/menu/select_song_context.xml | 2 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 11 |
3 files changed, 22 insertions, 6 deletions
diff --git a/res/layout/rating.xml b/res/layout/rating.xml new file mode 100644 index 00000000..cf38fba1 --- /dev/null +++ b/res/layout/rating.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <RatingBar
+ android:id="@+id/rating_bar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:numStars="5"
+ android:stepSize="1"
+ android:layout_gravity="center_horizontal"/>
+
+</LinearLayout>
\ No newline at end of file diff --git a/res/menu/select_song_context.xml b/res/menu/select_song_context.xml index 93576a52..7f15ccbf 100644 --- a/res/menu/select_song_context.xml +++ b/res/menu/select_song_context.xml @@ -62,7 +62,7 @@ <item android:id="@+id/menu_rate" - android:title="@/string/menu.rate"/> + android:title="@string/menu.rate"/> <group android:id="@+id/server_1.9"> <item diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 6e7aa9e2..b1548bb7 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -46,6 +46,7 @@ import android.widget.Button; import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
+import android.widget.RatingBar;
import android.widget.TextView;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.activity.DownloadActivity;
@@ -1179,7 +1180,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR msg += "\nLength: " + Util.formatDuration(song.getDuration());
}
if(song.getBookmark() != null) {
- msg += "\nBookmark Position: " + Util.formatDuration(song.getBookmark().getPosition());
+ msg += "\nBookmark Position: " + Util.formatDuration(song.getBookmark().getPosition() / 1000);
}
if(song.getRating() != 0) {
msg += "\nRating: " + song.getRating() + " stars";
@@ -1505,13 +1506,13 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR }
protected void setRating(final Entry entry) {
- final RatingBar ratingBar = new RatingBar(context);
- ratingBar.setNumStars(5);
+ View layout = context.getLayoutInflater().inflate(R.layout.rating, null);
+ final RatingBar ratingBar = (RatingBar) layout.findViewById(R.id.rating_bar);
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)
+ .setView(layout)
.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
@@ -1519,7 +1520,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR setRating(entry, rating);
}
})
- .setNegativeButton(R.string.common_cancel);
+ .setNegativeButton(R.string.common_cancel, null);
AlertDialog dialog = builder.create();
dialog.show();
|