diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-06-10 08:40:07 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-06-10 08:40:07 -0700 |
commit | 67c2d3412f322b6c681a7dd04d4399080aa28b17 (patch) | |
tree | 284a3fe7552a46b74658771a0fefab54fa5fbeff /subsonic-android/src | |
parent | e18f29369683f6563164b43c49e9eaa41de3835f (diff) | |
download | dsub-67c2d3412f322b6c681a7dd04d4399080aa28b17.tar.gz dsub-67c2d3412f322b6c681a7dd04d4399080aa28b17.tar.bz2 dsub-67c2d3412f322b6c681a7dd04d4399080aa28b17.zip |
Fix inconsistencies. Make dialog more like others
Diffstat (limited to 'subsonic-android/src')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java index 9a0f512a..645f2ae2 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java @@ -27,6 +27,7 @@ import com.actionbarsherlock.view.MenuInflater; import github.daneren2005.dsub.service.MusicService;
import github.daneren2005.dsub.service.MusicServiceFactory;
import github.daneren2005.dsub.util.ModalBackgroundTask;
+import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.view.ChangeLog;
import java.io.File;
import java.util.ArrayList;
@@ -228,44 +229,42 @@ public class MainFragment extends SubsonicFragment { private void showOfflineScrobblesDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setIcon(android.R.drawable.ic_dialog_info);
-
- builder.setTitle(R.string.select_album_offline_scrobbles_dialog_title);
- builder.setMessage(R.string.select_album_offline_scrobbles_dialog_message);
-
- //want this on the left and delete on the right hence the backwards button types
- builder.setNegativeButton(R.string.select_album_offline_scrobbles_dialog_yes,
- new DialogInterface.OnClickListener() {
+ builder.setIcon(android.R.drawable.ic_dialog_info)
+ .setTitle(R.string.offline_scrobbles_dialog_title)
+ .setMessage(R.string.offline_scrobbles_dialog_message)
+ .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
- new Thread("Scrobble offline") {
+ new SilentBackgroundTask<Void>(context) {
@Override
- public void run() {
- try {
- MusicService musicService = MusicServiceFactory.getMusicService(context);
- musicService.processOfflineScrobbles(context, null);
- } catch (Exception x) {
- Log.i(TAG, "Failed to process offline sc/robbles");
- }
+ protected Void doInBackground() throws Throwable {
+ MusicService musicService = MusicServiceFactory.getMusicService(context);
+ musicService.processOfflineScrobbles(context, null);
+ return null;
+ }
+
+ @Override
+ protected void done(Void result) {
+ Util.toast(context, R.string.offline_scrobbles_success);
}
- }.start();
- }
- });
- builder.setPositiveButton(R.string.select_album_offline_scrobbles_dialog_delete,
- new DialogInterface.OnClickListener() {
+ @Override
+ protected void error(Throwable error) {
+ String msg = context.getResources().getString(R.string.offline_scrobbles_error) + " " + getErrorMessage(error);
+ Util.toast(context, msg);
+ }
+ }.execute();
+ }
+ }).setNeutralButton(R.string.common_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
- FileUtil.getOfflineScrobblesFile().delete();
}
- });
-
- builder.setNeutralButton(R.string.select_album_offline_scrobbles_dialog_no,
- new DialogInterface.OnClickListener() {
+ }).setNegativeButton(R.string.common_delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
+ FileUtil.getOfflineScrobblesFile().delete();
}
});
|