Fields Summary |
---|
private static final int | DIGIT_PRESS_WAKE_MILLIS |
private final KeyguardUpdateMonitor | mUpdateMonitor |
private final KeyguardScreenCallback | mCallback |
private final boolean | mCreatedWithKeyboardOpen |
private android.widget.TextView | mHeaderText |
private android.widget.TextView | mPinText |
private android.widget.TextView | mOkButton |
private android.widget.TextView | mEmergencyCallButton |
private android.view.View | mBackSpaceButton |
private final int[] | mEnteredPin |
private int | mEnteredDigits |
private android.app.ProgressDialog | mSimUnlockProgressDialog |
private static final char[] | DIGITS |
Methods Summary |
---|
private void | checkPin()
// make sure that the pin is at least 4 digits long.
if (mEnteredDigits < 4) {
// otherwise, display a message to the user, and don't submit.
mHeaderText.setText(R.string.invalidPin);
mPinText.setText("");
mEnteredDigits = 0;
mCallback.pokeWakelock();
return;
}
getSimUnlockProgressDialog().show();
new CheckSimPin(mPinText.getText().toString()) {
void onSimLockChangedResponse(boolean success) {
if (mSimUnlockProgressDialog != null) {
mSimUnlockProgressDialog.hide();
}
if (success) {
// before closing the keyguard, report back that
// the sim is unlocked so it knows right away
mUpdateMonitor.reportSimPinUnlocked();
mCallback.goToUnlockScreen();
} else {
mHeaderText.setText(R.string.keyguard_password_wrong_pin_code);
mPinText.setText("");
mEnteredDigits = 0;
mCallback.pokeWakelock();
}
}
}.start();
|
public void | cleanUp(){@inheritDoc}
// hide the dialog.
if (mSimUnlockProgressDialog != null) {
mSimUnlockProgressDialog.hide();
}
mUpdateMonitor.removeCallback(this);
|
private android.app.Dialog | getSimUnlockProgressDialog()
if (mSimUnlockProgressDialog == null) {
mSimUnlockProgressDialog = new ProgressDialog(mContext);
mSimUnlockProgressDialog.setMessage(
mContext.getString(R.string.lockscreen_sim_unlock_progress_dialog_message));
mSimUnlockProgressDialog.setIndeterminate(true);
mSimUnlockProgressDialog.setCancelable(false);
mSimUnlockProgressDialog.getWindow().setType(
WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
mSimUnlockProgressDialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
return mSimUnlockProgressDialog;
|
public boolean | needsInput(){@inheritDoc}
return true;
|
public void | onClick(android.view.View v)
if (v == mBackSpaceButton) {
final Editable digits = mPinText.getEditableText();
final int len = digits.length();
if (len > 0) {
digits.delete(len-1, len);
mEnteredDigits--;
}
mCallback.pokeWakelock();
} else if (v == mEmergencyCallButton) {
mCallback.takeEmergencyCallAction();
} else if (v == mOkButton) {
checkPin();
}
|
public boolean | onKeyDown(int keyCode, android.view.KeyEvent event)
if (keyCode == KeyEvent.KEYCODE_BACK) {
mCallback.goToLockScreen();
return true;
}
final char match = event.getMatch(DIGITS);
if (match != 0) {
reportDigit(match - '0");
return true;
}
if (keyCode == KeyEvent.KEYCODE_DEL) {
if (mEnteredDigits > 0) {
mPinText.onKeyDown(keyCode, event);
mEnteredDigits--;
}
return true;
}
if (keyCode == KeyEvent.KEYCODE_ENTER) {
checkPin();
return true;
}
return false;
|
public void | onKeyboardChange(boolean isKeyboardOpen)
if (isKeyboardOpen != mCreatedWithKeyboardOpen) {
mCallback.recreateMe();
}
|
public void | onOrientationChange(boolean inPortrait)
|
public void | onPause(){@inheritDoc}
|
public void | onResume(){@inheritDoc}
// start fresh
mHeaderText.setText(R.string.keyguard_password_enter_pin_code);
// make sure that the number of entered digits is consistent when we
// erase the SIM unlock code, including orientation changes.
mPinText.setText("");
mEnteredDigits = 0;
|
private void | reportDigit(int digit)
if (mEnteredDigits == 0) {
mPinText.setText("");
}
if (mEnteredDigits == 8) {
return;
}
mPinText.append(Integer.toString(digit));
mEnteredPin[mEnteredDigits++] = digit;
|