void displayAlertDlg(GDAlertDialog dialog, int type) { Log.d(TAG, " ==== displayAlertDlg == " + type); switch (type) { case DLG_TYPE_SMARTCARD_INFO: { dialog.setTitle(R.string.smartcard_status_title); dialog.showSingleButton(); if (mSmartcardState == SMARTCARD_STATE_INSERTED || mSmartcardState == SMARTCARD_STATE_INSERTING) { dialog.setMessage(R.string.smartcard_status_in); } else if (mSmartcardState == SMARTCARD_STATE_REMOVED || mSmartcardState == SMARTCARD_STATE_REMOVING) { dialog.setMessage(R.string.smartcard_status_out); } else { dialog.setMessage(R.string.smartcard_status_invlid); } break; } } if (dialog != null) { dialog.mOkButton.requestFocus(); } }
protected Dialog onCreateDialog(int id) { Dialog dialog = null; switch (id) { case DLG_ID_SMARTCARD: { mSmartcardDlg = new GDAlertDialog(this, id); mSmartcardDlg.setOnShowListener(mOnShowListener); mSmartcardDlg.setOnDismissListener(mOnDismissListener); dialog = mSmartcardDlg; break; } } return dialog; }
protected void handSmartcardStateChange(int state) { mSmartcardState = state; mAlertType = DLG_TYPE_SMARTCARD_INFO; Log.d(TAG, " ======== display smartcard state ==== " + mSmartcardState); if (mSmartcardDlg == null || !mSmartcardDlg.isShowing()) { showDialog(DLG_ID_SMARTCARD); } else { displayAlertDlg(mSmartcardDlg, mAlertType); } if (mSmartcardState == SMARTCARD_STATE_INSERTED) { hideDlgDelay(); } else { stopTimer(); } }
void hideAlertDlg() { mSmartcardDlg.dismiss(); }