• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


コミットメタ情報

リビジョン8f1bd8a7526edf49196430be214acb54e66a63ee (tree)
日時2011-06-07 07:48:08
作者Gilles Debunne <debunne@goog...>
コミッターGilles Debunne

ログメッセージ

Bug 4539424: confirmation dialog always shown

Change-Id: Id1e2a52a07255e2c98cbd0e8151a82d7a2612517

変更サマリ

差分

--- a/src/com/android/settings/deviceinfo/Memory.java
+++ b/src/com/android/settings/deviceinfo/Memory.java
@@ -21,7 +21,6 @@ import android.app.Dialog;
2121 import android.content.BroadcastReceiver;
2222 import android.content.Context;
2323 import android.content.DialogInterface;
24-import android.content.DialogInterface.OnCancelListener;
2524 import android.content.Intent;
2625 import android.content.IntentFilter;
2726 import android.content.res.Resources;
@@ -42,7 +41,7 @@ import android.widget.Toast;
4241 import com.android.settings.R;
4342 import com.android.settings.SettingsPreferenceFragment;
4443
45-public class Memory extends SettingsPreferenceFragment implements OnCancelListener {
44+public class Memory extends SettingsPreferenceFragment {
4645 private static final String TAG = "MemorySettings";
4746
4847 private static final int DLG_CONFIRM_UNMOUNT = 1;
@@ -50,9 +49,10 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
5049
5150 private Resources mResources;
5251
53- // The mountToggle Preference that has been clicked.
54- // The click event will be discarded if this value is not null. Reset to null after (un)mount.
55- private Preference mClickedMountToggle;
52+ // The mountToggle Preference that has last been clicked.
53+ // Assumes no two successive unmount event on 2 different volumes are performed before the first
54+ // one's preference is disabled
55+ private Preference mLastClickedMountToggle;
5656 private String mClickedMountPoint;
5757
5858 // Access using getMountService()
@@ -157,9 +157,8 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
157157 return true;
158158 }
159159
160- boolean mountToggleClicked = svpc.mountToggleClicked(preference);
161- if (mountToggleClicked && mClickedMountToggle == null) {
162- mClickedMountToggle = preference;
160+ if (svpc.mountToggleClicked(preference)) {
161+ mLastClickedMountToggle = preference;
163162 final StorageVolume storageVolume = svpc.getStorageVolume();
164163 mClickedMountPoint = storageVolume.getPath();
165164 String state = mStorageManager.getVolumeState(storageVolume.getPath());
@@ -208,32 +207,19 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
208207 return null;
209208 }
210209
211- @Override
212- protected void showDialog(int id) {
213- super.showDialog(id);
214-
215- switch (id) {
216- case DLG_CONFIRM_UNMOUNT:
217- case DLG_ERROR_UNMOUNT:
218- setOnCancelListener(this);
219- break;
220- }
221- }
222-
223210 private void doUnmount() {
224211 // Present a toast here
225212 Toast.makeText(getActivity(), R.string.unmount_inform_text, Toast.LENGTH_SHORT).show();
226213 IMountService mountService = getMountService();
227214 try {
228- mClickedMountToggle.setEnabled(false);
229- mClickedMountToggle.setTitle(mResources.getString(R.string.sd_ejecting_title));
230- mClickedMountToggle.setSummary(mResources.getString(R.string.sd_ejecting_summary));
215+ mLastClickedMountToggle.setEnabled(false);
216+ mLastClickedMountToggle.setTitle(mResources.getString(R.string.sd_ejecting_title));
217+ mLastClickedMountToggle.setSummary(mResources.getString(R.string.sd_ejecting_summary));
231218 mountService.unmountVolume(mClickedMountPoint, true);
232219 } catch (RemoteException e) {
233220 // Informative dialog to user that unmount failed.
234221 showDialogInner(DLG_ERROR_UNMOUNT);
235222 }
236- mClickedMountToggle = null;
237223 }
238224
239225 private void showDialogInner(int id) {
@@ -274,7 +260,6 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
274260 // Very unlikely. But present an error dialog anyway
275261 Log.e(TAG, "Is MountService running?");
276262 showDialogInner(DLG_ERROR_UNMOUNT);
277- mClickedMountToggle = null;
278263 }
279264 }
280265
@@ -289,10 +274,5 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
289274 } catch (RemoteException ex) {
290275 // Not much can be done
291276 }
292- mClickedMountToggle = null;
293- }
294-
295- public void onCancel(DialogInterface dialog) {
296- mClickedMountToggle = null;
297277 }
298278 }