Methods Summary |
---|
private void | authenticatePin2()
Intent intent = new Intent();
intent.setClass(this, GetPin2Screen.class);
startActivityForResult(intent, PIN2_REQUEST_CODE);
|
private void | deleteContact()
StringBuilder buf = new StringBuilder();
buf.append("tag='");
buf.append(mName);
buf.append("' AND number='");
buf.append(mNumber);
buf.append("' AND pin2='");
buf.append(mPin2);
buf.append("'");
Uri uri = Uri.parse("content://sim/fdn");
mQueryHandler = new QueryHandler(getContentResolver());
mQueryHandler.startDelete(0, null, uri, buf.toString(), null);
displayProgress(true);
|
private void | displayProgress(boolean flag)
getWindow().setFeatureInt(
Window.FEATURE_INDETERMINATE_PROGRESS,
flag ? PROGRESS_VISIBILITY_ON : PROGRESS_VISIBILITY_OFF);
|
private void | handleResult(boolean success)
if (success) {
if (DBG) log("handleResult: success!");
showStatus(getResources().getText(R.string.fdn_contact_deleted));
} else {
if (DBG) log("handleResult: failed!");
showStatus(getResources().getText(R.string.pin2_invalid));
}
mHandler.postDelayed(new Runnable() {
public void run() {
finish();
}
}, 2000);
|
private void | log(java.lang.String msg)
Log.d(LOG_TAG, "[DeleteFdnContact] " + msg);
|
protected void | onActivityResult(int requestCode, int resultCode, android.content.Intent intent)
if (DBG) log("onActivityResult");
switch (requestCode) {
case PIN2_REQUEST_CODE:
Bundle extras = (intent != null) ? intent.getExtras() : null;
if (extras != null) {
mPin2 = extras.getString("pin2");
showStatus(getResources().getText(
R.string.deleting_fdn_contact));
deleteContact();
} else {
// if they cancelled, then we just cancel too.
if (DBG) log("onActivityResult: CANCELLED");
displayProgress(false);
finish();
}
break;
}
|
protected void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
resolveIntent();
authenticatePin2();
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.delete_fdn_contact_screen);
|
private void | resolveIntent()
Intent intent = getIntent();
mName = intent.getStringExtra(INTENT_EXTRA_NAME);
mNumber = intent.getStringExtra(INTENT_EXTRA_NUMBER);
if (TextUtils.isEmpty(mName)) {
finish();
}
|
private void | showStatus(java.lang.CharSequence statusMsg)
if (statusMsg != null) {
Toast.makeText(this, statusMsg, Toast.LENGTH_SHORT)
.show();
}
|