use of android.app.DialogFragment in project android_packages_apps_Settings by DirtyUnicorns.
the class SupportItemAdapter method tryStartDisclaimerAndSupport.
/**
* Show a disclaimer dialog and start support action after disclaimer has been acknowledged.
*/
private void tryStartDisclaimerAndSupport(@SupportFeatureProvider.SupportType final int type) {
if (mSupportFeatureProvider.shouldShowDisclaimerDialog(mActivity)) {
DialogFragment fragment = SupportDisclaimerDialogFragment.newInstance(mAccounts[mSelectedAccountIndex], type);
fragment.show(mActivity.getFragmentManager(), SupportDisclaimerDialogFragment.TAG);
return;
}
mSupportFeatureProvider.startSupport(mActivity, mAccounts[mSelectedAccountIndex], type);
}
use of android.app.DialogFragment in project android_packages_apps_Settings by crdroidandroid.
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 CustomDialogPref) {
f = CustomDialogPref.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 crdroidandroid.
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");
}
use of android.app.DialogFragment in project android_packages_apps_Gallery2 by LineageOS.
the class VideoSettingsActivity method removeOldFragmentByTag.
/**
* remove old DialogFragment
*
* @param tag
* the tag of DialogFragment to be removed
*/
private void removeOldFragmentByTag(String tag) {
FragmentManager fragmentManager = getFragmentManager();
DialogFragment oldFragment = (DialogFragment) fragmentManager.findFragmentByTag(tag);
if (null != oldFragment) {
oldFragment.dismissAllowingStateLoss();
}
}
use of android.app.DialogFragment in project android_packages_apps_Dialer by MoKee.
the class SpecialCharSequenceMgr method handleAdnEntry.
/**
* Handle ADN requests by filling in the SIM contact number into the requested
* EditText.
*
* 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);
dialogFragment.show(((Activity) context).getFragmentManager(), TAG_SELECT_ACCT_FRAGMENT);
}
return true;
} catch (NumberFormatException ex) {
// Ignore
}
}
return false;
}
Aggregations