aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-07-07 16:27:55 -0700
committerScott Jackson <daneren2005@gmail.com>2013-07-07 16:27:55 -0700
commitf798f0d85b6a595ee0b32ddc066441b84e5d483a (patch)
treed1ab2b94fcc8eed43be96c57cf6618e8057b52f7 /subsonic-android
parentd2cc173f9db49ee831d9bed806b9e7f8d9d7cc2a (diff)
downloaddsub-f798f0d85b6a595ee0b32ddc066441b84e5d483a.tar.gz
dsub-f798f0d85b6a595ee0b32ddc066441b84e5d483a.tar.bz2
dsub-f798f0d85b6a595ee0b32ddc066441b84e5d483a.zip
Abstract out info dialog more, use it for details dialogs
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java6
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java6
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/Util.java24
3 files changed, 12 insertions, 24 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
index 0d7fce76..de74cdb2 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
@@ -226,11 +226,7 @@ public class SelectPlaylistFragment extends SubsonicFragment implements AdapterV
"\nSong Count: " + playlist.getSongCount() +
((playlist.getPublic() == null) ? "" : ("\nPublic: " + playlist.getPublic())) +
"\nCreation Date: " + playlist.getCreated().replace('T', ' ');
- new AlertDialog.Builder(context)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setTitle(playlist.getName())
- .setMessage(message)
- .show();
+ Util.info(context, playlist.getName(), message);
}
private void updatePlaylistInfo(final Playlist playlist) {
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index 3f6be234..bc823be6 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -871,11 +871,7 @@ public class SubsonicFragment extends SherlockFragment {
msg += "\nLength: " + Util.formatDuration(song.getDuration());
}
- new AlertDialog.Builder(context)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setTitle(song.getTitle())
- .setMessage(msg)
- .show();
+ Util.info(context, song.getTitle(), msg);
}
protected void playVideo(MusicDirectory.Entry entry) {
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Util.java b/subsonic-android/src/github/daneren2005/dsub/util/Util.java
index 9929ad30..e909b4c8 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/Util.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/Util.java
@@ -786,24 +786,20 @@ public final class Util {
public static void info(Context context, int titleId, String message) {
showDialog(context, android.R.drawable.ic_dialog_info, titleId, message);
}
+ public static void info(Context context, String title, String message) {
+ showDialog(context, android.R.drawable.ic_dialog_info, title, message);
+ }
- private static void showDialog(Context context, int icon, int titleId, int messageId) {
- new AlertDialog.Builder(context)
- .setIcon(icon)
- .setTitle(titleId)
- .setMessage(messageId)
- .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int i) {
- dialog.dismiss();
- }
- })
- .show();
- }
+ private static void showDialog(Context context, int icon, int titleId, int messageId) {
+ showDialog(context, icon, context.getResources().getString(titleId), context.getResources().getString(messageId));
+ }
private static void showDialog(Context context, int icon, int titleId, String message) {
+ showDialog(context, icon, context.getResources().getString(titleId), message);
+ }
+ private static void showDialog(Context context, int icon, String title, String message) {
new AlertDialog.Builder(context)
.setIcon(icon)
- .setTitle(titleId)
+ .setTitle(title)
.setMessage(message)
.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
@Override