diff options
author | Amith Yamasani <yamasani@google.com> | 2011-10-07 13:58:39 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2011-10-07 14:02:44 -0700 |
commit | 552bc61ae2aaf67fd2f19564ca2ced002e8675e6 (patch) | |
tree | 59f81d50f72d782089cc8256139c0ecb55286a7b /src/com/android/settings/ChooseLockPassword.java | |
parent | 3f28ff1a065d713480cc5422a702373c2ffb280a (diff) | |
download | packages_apps_settings-552bc61ae2aaf67fd2f19564ca2ced002e8675e6.zip packages_apps_settings-552bc61ae2aaf67fd2f19564ca2ced002e8675e6.tar.gz packages_apps_settings-552bc61ae2aaf67fd2f19564ca2ced002e8675e6.tar.bz2 |
Remove pending message when fragment is paused.
Bug: 5422788
Converted the runnable to a message and removed any pending messages in onPause.
Change-Id: I048413ae2abd69a359b1fa2c648d98df3c3ae343
Diffstat (limited to 'src/com/android/settings/ChooseLockPassword.java')
-rw-r--r-- | src/com/android/settings/ChooseLockPassword.java | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java index 11dd09f..2940442 100644 --- a/src/com/android/settings/ChooseLockPassword.java +++ b/src/com/android/settings/ChooseLockPassword.java @@ -27,6 +27,7 @@ import android.content.Intent; import android.inputmethodservice.KeyboardView; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.preference.PreferenceActivity; import android.text.Editable; import android.text.InputType; @@ -44,7 +45,6 @@ import android.widget.Button; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; - public class ChooseLockPassword extends PreferenceActivity { public static final String PASSWORD_MIN_KEY = "lockscreen.password_min"; public static final String PASSWORD_MAX_KEY = "lockscreen.password_max"; @@ -98,10 +98,19 @@ public class ChooseLockPassword extends PreferenceActivity { private boolean mIsAlphaMode; private Button mCancelButton; private Button mNextButton; - private static Handler mHandler = new Handler(); private static final int CONFIRM_EXISTING_REQUEST = 58; static final int RESULT_FINISHED = RESULT_FIRST_USER; private static final long ERROR_MESSAGE_TIMEOUT = 3000; + private static final int MSG_SHOW_ERROR = 1; + + private Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + if (msg.what == MSG_SHOW_ERROR) { + updateStage((Stage) msg.obj); + } + } + }; /** * Keep track internally of where the user is in choosing a pattern. @@ -235,6 +244,13 @@ public class ChooseLockPassword extends PreferenceActivity { } @Override + public void onPause() { + mHandler.removeMessages(MSG_SHOW_ERROR); + + super.onPause(); + } + + @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_UI_STAGE, mUiStage.name()); @@ -399,11 +415,9 @@ public class ChooseLockPassword extends PreferenceActivity { private void showError(String msg, final Stage next) { mHeaderText.setText(msg); - mHandler.postDelayed(new Runnable() { - public void run() { - updateStage(next); - } - }, ERROR_MESSAGE_TIMEOUT); + Message mesg = mHandler.obtainMessage(MSG_SHOW_ERROR, next); + mHandler.removeMessages(MSG_SHOW_ERROR); + mHandler.sendMessageDelayed(mesg, ERROR_MESSAGE_TIMEOUT); } public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { |