Search in sources :

Example 51 with DialogFragment

use of android.app.DialogFragment in project FluxyAndroidTodo by armueller.

the class TodoListArrayAdapter method setHolderListeners.

private void setHolderListeners(final ViewHolder holder, final TodoItem item) {
    holder.todoDescription.setOnLongClickListener(new View.OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            DialogFragment editOrDeleteDialog = new EditOrDeleteDialogFragment();
            Bundle args = new Bundle();
            args.putLong("todoItemId", item.getId());
            editOrDeleteDialog.setArguments(args);
            editOrDeleteDialog.show(activity.getFragmentManager(), String.valueOf(item.getId()));
            return true;
        }
    });
    holder.todoEditDescription.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                actionCreator.createEditTodoAction(item.getId(), v.getText().toString());
                handled = true;
            }
            return handled;
        }
    });
    holder.todoCheckBox.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            actionCreator.createToggleTodoCompleteAction(item.getId());
        }
    });
}
Also used : KeyEvent(android.view.KeyEvent) Bundle(android.os.Bundle) DialogFragment(android.app.DialogFragment) TextView(android.widget.TextView) InjectView(butterknife.InjectView) TextView(android.widget.TextView) View(android.view.View)

Example 52 with DialogFragment

use of android.app.DialogFragment in project Fairphone by Kwamecorp.

the class WallpaperChooser method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.wallpaper_chooser_base);
    Fragment fragmentView = getFragmentManager().findFragmentById(R.id.wallpaper_chooser_fragment);
    // needs to be revived again.
    if (fragmentView == null) {
        /* When the screen is XLarge, the fragment is not included in the layout, so show it
             * as a dialog
             */
        DialogFragment fragment = WallpaperChooserDialogFragment.newInstance();
        fragment.show(getFragmentManager(), "dialog");
    }
}
Also used : DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) DialogFragment(android.app.DialogFragment)

Example 53 with DialogFragment

use of android.app.DialogFragment in project Aegis by Decad3nce.

the class AdvancedSettingsFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.advanced_preferences);
    final Preference removeAdmin = findPreference("remove_admin");
    final Preference installToSystem = findPreference("install_to_system");
    final DevicePolicyManager mDPM = (DevicePolicyManager) getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
    if (mDPM.getActiveAdmins() == null || !mDPM.isAdminActive(AegisActivity.DEVICE_ADMIN_COMPONENT)) {
        PreferenceCategory mCategory = (PreferenceCategory) findPreference("advanced_category");
        mCategory.removePreference(removeAdmin);
    }
    Preference.OnPreferenceClickListener preferenceListener = (new OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (preference.getKey().equals(ADVANCED_PREFERENCES_REMOVE_ADMIN)) {
                if (mDPM.isAdminActive(AegisActivity.DEVICE_ADMIN_COMPONENT)) {
                    removeAdmin(mDPM, removeAdmin);
                }
            }
            if (preference.getKey().equals(ADVANCED_PREFERENCES_INSTALL_TO_SYSTEM)) {
                DialogFragment dialog = new InstallToSystemDialogFragment();
                dialog.show(getActivity().getFragmentManager(), "InstallToSystemDialogFragment");
            }
            return false;
        }
    });
    removeAdmin.setOnPreferenceClickListener(preferenceListener);
    installToSystem.setOnPreferenceClickListener(preferenceListener);
}
Also used : DevicePolicyManager(android.app.admin.DevicePolicyManager) OnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener) OnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener) DialogFragment(android.app.DialogFragment)

Example 54 with DialogFragment

use of android.app.DialogFragment in project Aegis by Decad3nce.

the class BackupGoogleAccountsActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.backup_layout);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    progressBar.setVisibility(View.VISIBLE);
    context = this;
    Intent intent;
    cr = getContentResolver();
    credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE);
    try {
        intent = getIntent();
        if (intent.hasExtra("fromReceiver")) {
            address = intent.getStringExtra("fromReceiver");
            Log.i(TAG, "Backup intent from receiver");
            recoverData();
        } else {
            Log.i(TAG, "Backup intent from elsewhere");
            DialogFragment dialog = new BackupAccountsDialogFragment();
            dialog.show(getFragmentManager(), "BackupAccountsDialogFragment");
        }
    } catch (Exception e) {
        recoverData();
    }
}
Also used : BackupAccountsDialogFragment(com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment) DialogFragment(android.app.DialogFragment) BackupAccountsDialogFragment(com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment) GoogleAuthException(com.google.android.gms.auth.GoogleAuthException) UserRecoverableAuthIOException(com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException) IOException(java.io.IOException)

Example 55 with DialogFragment

use of android.app.DialogFragment in project NotificationPeekPort by lzanita09.

the class DialogHelper method showHelpDialog.

public static void showHelpDialog(Activity activity) {
    FragmentManager fm = activity.getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ((DialogFragment) Fragment.instantiate(activity, HelpDialogFragment.class.getName())).show(ft, ABOUT_DIALOG_TAG);
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) 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