Methods Summary |
---|
private void | enableSimPin()
Message callback = Message.obtain(mHandler, ENABLE_SIM_PIN_COMPLETE);
if (DBG) log("enableSimPin:");
mPhone.getSimCard().setSimLockEnabled(mEnable, getPin(), callback);
if (DBG) log("enableSimPin: please wait...");
|
private java.lang.String | getPin()
return mPinField.getText().toString();
|
private void | handleResult(android.os.AsyncResult ar)
if (ar.exception == null) {
if (DBG) log("handleResult: success!");
showStatus(getResources().getText(
mEnable ? R.string.enable_pin_ok : R.string.disable_pin_ok));
} else if (ar.exception instanceof CommandException
/* && ((CommandException)ar.exception).getCommandError() ==
CommandException.Error.GENERIC_FAILURE */ ) {
if (DBG) log("handleResult: failed!");
showStatus(getResources().getText(
R.string.pin_failed));
}
mHandler.postDelayed(new Runnable() {
public void run() {
finish();
}
}, 3000);
|
private void | log(java.lang.String msg)
Log.d(LOG_TAG, "[EnableSimPin] " + msg);
|
protected void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
setContentView(R.layout.enable_sim_pin_screen);
setupView();
mPhone = PhoneFactory.getDefaultPhone();
mEnable = !mPhone.getSimCard().getSimLockEnabled();
int id = mEnable ? R.string.enable_sim_pin : R.string.disable_sim_pin;
setTitle(getResources().getText(id));
|
private void | setupView()
mPinField = (EditText) findViewById(R.id.pin);
mPinField.setKeyListener(DigitsKeyListener.getInstance());
mPinField.setMovementMethod(null);
mPinField.setOnClickListener(mClicked);
mPinFieldContainer = (LinearLayout) findViewById(R.id.pinc);
mStatusField = (TextView) findViewById(R.id.status);
|
private void | showStatus(java.lang.CharSequence statusMsg)
if (statusMsg != null) {
mStatusField.setText(statusMsg);
mStatusField.setVisibility(View.VISIBLE);
mPinFieldContainer.setVisibility(View.GONE);
} else {
mPinFieldContainer.setVisibility(View.VISIBLE);
mStatusField.setVisibility(View.GONE);
}
|