diff --git a/MyTracks/src/com/google/android/apps/mytracks/DialogManager.java b/MyTracks/src/com/google/android/apps/mytracks/DialogManager.java index 6401f7b63..d928cdbce 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/DialogManager.java +++ b/MyTracks/src/com/google/android/apps/mytracks/DialogManager.java @@ -34,28 +34,6 @@ import android.view.WindowManager.BadTokenException; */ public class DialogManager { - private MyTracks activity; - - public DialogManager(MyTracks activity) { - this.activity = activity; - } - - /** - * Shows a dialog with the given message. - * Does it on the UI thread. - * - * @param success if true, displays an info icon/title, otherwise an error - * icon/title - * @param message resource string id - */ - public void showMessageDialog(final int message, final boolean success) { - activity.runOnUiThread(new Runnable() { - public void run() { - showMessageDialog(activity, message, success, null); - } - }); - } - public static void showMessageDialog( Context ctx, int message, boolean success, DialogInterface.OnClickListener okListener) { AlertDialog dialog = null; @@ -68,27 +46,6 @@ public class DialogManager { dialog = builder.create(); dialog.show(); } - - /** - * Just like showDialog, but will catch a {@link BadTokenException} that - * sometimes (very rarely) gets thrown. This might happen if the user hits - * the "back" button immediately after sending tracks to google. - * - * @param id the dialog id - */ - public void showDialogSafely(final int id) { - activity.runOnUiThread(new Runnable() { - public void run() { - try { - activity.showDialog(id); - } catch (BadTokenException e) { - Log.w(TAG, "Could not display dialog with id " + id, e); - } catch (IllegalStateException e) { - Log.w(TAG, "Could not display dialog with id " + id, e); - } - } - }); - } /** * The equivalent of {@link #showDialogSafely(int)}, but for a specific @@ -108,21 +65,6 @@ public class DialogManager { }); } - /** - * Dismisses the progress dialog if it is showing. Executed on the UI thread. - */ - public void dismissDialogSafely(final int id) { - activity.runOnUiThread(new Runnable() { - public void run() { - try { - activity.dismissDialog(id); - } catch (IllegalArgumentException e) { - // This will be thrown if this dialog was not shown before. - } - } - }); - } - /** * The equivalent of {@link #dismissDialogSafely(int)}, but for a specific * dialog instance. @@ -138,4 +80,6 @@ public class DialogManager { } }); } + + private DialogManager() {} } diff --git a/MyTracks/src/com/google/android/apps/mytracks/MyTracks.java b/MyTracks/src/com/google/android/apps/mytracks/MyTracks.java index 37ec8b0b0..f84715872 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/MyTracks.java +++ b/MyTracks/src/com/google/android/apps/mytracks/MyTracks.java @@ -63,11 +63,6 @@ import android.widget.Toast; public class MyTracks extends TabActivity implements OnTouchListener { private TrackDataHub dataHub; - /* - * Dialogs manager. - */ - private DialogManager dialogManager; - /* * Menu manager. */ @@ -135,7 +130,6 @@ public class MyTracks extends TabActivity implements OnTouchListener { preferences = getSharedPreferences(Constants.SETTINGS_NAME, 0); dataHub = new TrackDataHub(this, preferences, providerUtils); menuManager = new MenuManager(this); - dialogManager = new DialogManager(this); serviceBinder = TrackRecordingServiceBinder.getInstance(this); // The volume we want to control is the Text-To-Speech volume