use of android.app.DialogFragment in project packages_apps_AicpExtras by AICP.
the class ActionListViewSettings method showDialogInner.
private void showDialogInner(int id, int which, boolean longpress, boolean newAction) {
DialogFragment newFragment = MyAlertDialogFragment.newInstance(id, which, longpress, newAction);
newFragment.setTargetFragment(this, 0);
newFragment.show(getFragmentManager(), "dialog " + id);
}
use of android.app.DialogFragment in project android_packages_apps_Dialer by LineageOS.
the class SpecialCharSequenceMgr method handlePinEntry.
static boolean handlePinEntry(final Context context, final String input) {
if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) {
List<PhoneAccountHandle> subscriptionAccountHandles = PhoneAccountUtils.getSubscriptionPhoneAccounts(context);
boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(TelecomUtil.getDefaultOutgoingPhoneAccount(context, PhoneAccount.SCHEME_TEL));
if (subscriptionAccountHandles.size() <= 1 || hasUserSelectedDefault) {
// a subscription account.
return TelecomUtil.handleMmi(context, input, null);
} else {
SelectPhoneAccountListener listener = new HandleMmiAccountSelectedCallback(context, input);
DialogFragment dialogFragment = SelectPhoneAccountDialogFragment.newInstance(subscriptionAccountHandles, listener, null);
dialogFragment.show(((Activity) context).getFragmentManager(), TAG_SELECT_ACCT_FRAGMENT);
}
return true;
}
return false;
}
use of android.app.DialogFragment in project android_packages_apps_Dialer by LineageOS.
the class SpecialCharSequenceMgr method handleAdnEntry.
/**
* Handle ADN requests by filling in the SIM contact number into the requested EditText.
*
* <p>This code works alongside the Asynchronous query handler {@link QueryHandler} and query
* cancel handler implemented in {@link SimContactQueryCookie}.
*/
static boolean handleAdnEntry(Context context, String input, EditText textField) {
/* ADN entries are of the form "N(N)(N)#" */
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager == null || telephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM) {
return false;
}
// if the phone is keyguard-restricted, then just ignore this
// input. We want to make sure that sim card contacts are NOT
// exposed unless the phone is unlocked, and this code can be
// accessed from the emergency dialer.
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
if (keyguardManager.inKeyguardRestrictedInputMode()) {
return false;
}
int len = input.length();
if ((len > 1) && (len < 5) && (input.endsWith("#"))) {
try {
// get the ordinal number of the sim contact
final int index = Integer.parseInt(input.substring(0, len - 1));
// The original code that navigated to a SIM Contacts list view did not
// highlight the requested contact correctly, a requirement for PTCRB
// certification. This behaviour is consistent with the UI paradigm
// for touch-enabled lists, so it does not make sense to try to work
// around it. Instead we fill in the the requested phone number into
// the dialer text field.
// create the async query handler
final QueryHandler handler = new QueryHandler(context.getContentResolver());
// create the cookie object
final SimContactQueryCookie sc = new SimContactQueryCookie(index - 1, handler, ADN_QUERY_TOKEN);
// setup the cookie fields
sc.contactNum = index - 1;
sc.setTextField(textField);
// create the progress dialog
sc.progressDialog = new ProgressDialog(context);
sc.progressDialog.setTitle(R.string.simContacts_title);
sc.progressDialog.setMessage(context.getText(R.string.simContacts_emptyLoading));
sc.progressDialog.setIndeterminate(true);
sc.progressDialog.setCancelable(true);
sc.progressDialog.setOnCancelListener(sc);
sc.progressDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
List<PhoneAccountHandle> subscriptionAccountHandles = PhoneAccountUtils.getSubscriptionPhoneAccounts(context);
Context applicationContext = context.getApplicationContext();
boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(TelecomUtil.getDefaultOutgoingPhoneAccount(applicationContext, PhoneAccount.SCHEME_TEL));
if (subscriptionAccountHandles.size() <= 1 || hasUserSelectedDefault) {
Uri uri = TelecomUtil.getAdnUriForPhoneAccount(applicationContext, null);
handleAdnQuery(handler, sc, uri);
} else {
SelectPhoneAccountListener callback = new HandleAdnEntryAccountSelectedCallback(applicationContext, handler, sc);
DialogFragment dialogFragment = SelectPhoneAccountDialogFragment.newInstance(subscriptionAccountHandles, callback, null);
dialogFragment.show(((Activity) context).getFragmentManager(), TAG_SELECT_ACCT_FRAGMENT);
}
return true;
} catch (NumberFormatException ex) {
// Ignore
}
}
return false;
}
use of android.app.DialogFragment in project android_packages_apps_Settings by DirtyUnicorns.
the class SettingsPreferenceFragment method onDisplayPreferenceDialog.
@Override
public void onDisplayPreferenceDialog(Preference preference) {
if (preference.getKey() == null) {
// Auto-key preferences that don't have a key, so the dialog can find them.
preference.setKey(UUID.randomUUID().toString());
}
DialogFragment f = null;
if (preference instanceof RestrictedListPreference) {
f = RestrictedListPreference.RestrictedListPreferenceDialogFragment.newInstance(preference.getKey());
} else if (preference instanceof CustomListPreference) {
f = CustomListPreference.CustomListPreferenceDialogFragment.newInstance(preference.getKey());
} else if (preference instanceof CustomDialogPreference) {
f = CustomDialogPreference.CustomPreferenceDialogFragment.newInstance(preference.getKey());
} else if (preference instanceof CustomEditTextPreference) {
f = CustomEditTextPreference.CustomPreferenceDialogFragment.newInstance(preference.getKey());
} else {
super.onDisplayPreferenceDialog(preference);
return;
}
f.setTargetFragment(this, 0);
f.show(getFragmentManager(), "dialog_preference");
onDialogShowing();
}
use of android.app.DialogFragment in project android_packages_apps_Settings by DirtyUnicorns.
the class RunningServiceDetails method showConfirmStopDialog.
private void showConfirmStopDialog(ComponentName comp) {
DialogFragment newFragment = MyAlertDialogFragment.newConfirmStop(DIALOG_CONFIRM_STOP, comp);
newFragment.setTargetFragment(this, 0);
newFragment.show(getFragmentManager(), "confirmstop");
}
Aggregations