Search in sources :

Example 71 with DialogFragment

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);
}
Also used : DialogFragment(android.app.DialogFragment)

Example 72 with DialogFragment

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;
}
Also used : PhoneAccountHandle(android.telecom.PhoneAccountHandle) DialogFragment(android.app.DialogFragment) SelectPhoneAccountDialogFragment(com.android.contacts.common.widget.SelectPhoneAccountDialogFragment) SelectPhoneAccountListener(com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener)

Example 73 with DialogFragment

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;
}
Also used : Context(android.content.Context) NoNullCursorAsyncQueryHandler(com.android.contacts.common.database.NoNullCursorAsyncQueryHandler) PhoneAccountHandle(android.telecom.PhoneAccountHandle) DialogFragment(android.app.DialogFragment) SelectPhoneAccountDialogFragment(com.android.contacts.common.widget.SelectPhoneAccountDialogFragment) ProgressDialog(android.app.ProgressDialog) Uri(android.net.Uri) TelephonyManager(android.telephony.TelephonyManager) SelectPhoneAccountListener(com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener) KeyguardManager(android.app.KeyguardManager)

Example 74 with DialogFragment

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();
}
Also used : CustomEditTextPreference(com.android.settingslib.CustomEditTextPreference) InstrumentedDialogFragment(com.android.settings.core.instrumentation.InstrumentedDialogFragment) DialogFragment(android.app.DialogFragment) CustomDialogPreference(com.android.settingslib.CustomDialogPreference)

Example 75 with DialogFragment

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");
}
Also used : InstrumentedDialogFragment(com.android.settings.core.instrumentation.InstrumentedDialogFragment) DialogFragment(android.app.DialogFragment)

Aggregations

DialogFragment (android.app.DialogFragment)110 InstrumentedDialogFragment (com.android.settings.core.instrumentation.InstrumentedDialogFragment)26 Fragment (android.app.Fragment)13 Activity (android.app.Activity)12 FragmentManager (android.app.FragmentManager)8 SelectPhoneAccountDialogFragment (com.android.contacts.common.widget.SelectPhoneAccountDialogFragment)8 FragmentTransaction (android.app.FragmentTransaction)7 PhoneAccountHandle (android.telecom.PhoneAccountHandle)7 SupportDisclaimerDialogFragment (com.android.settings.support.SupportDisclaimerDialogFragment)7 SupportPhoneDialogFragment (com.android.settings.support.SupportPhoneDialogFragment)7 SelectPhoneAccountListener (com.android.contacts.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener)6 Context (android.content.Context)5 Bundle (android.os.Bundle)5 CustomDialogPreference (com.android.settingslib.CustomDialogPreference)5 CustomEditTextPreference (com.android.settingslib.CustomEditTextPreference)5 Intent (android.content.Intent)4 KeyguardManager (android.app.KeyguardManager)3 ProgressDialog (android.app.ProgressDialog)3 Uri (android.net.Uri)3 TelephonyManager (android.telephony.TelephonyManager)3