Search in sources :

Example 31 with DialogFragment

use of android.app.DialogFragment in project k-9 by k9mail.

the class MessageViewFragment method removeDialog.

private void removeDialog(int dialogId) {
    FragmentManager fm = getFragmentManager();
    if (fm == null || isRemoving() || isDetached()) {
        return;
    }
    // Make sure the "show dialog" transaction has been processed when we call
    // findFragmentByTag() below. Otherwise the fragment won't be found and the dialog will
    // never be dismissed.
    fm.executePendingTransactions();
    DialogFragment fragment = (DialogFragment) fm.findFragmentByTag(getDialogTag(dialogId));
    if (fragment != null) {
        fragment.dismiss();
    }
}
Also used : FragmentManager(android.app.FragmentManager) ProgressDialogFragment(com.fsck.k9.fragment.ProgressDialogFragment) ConfirmationDialogFragment(com.fsck.k9.fragment.ConfirmationDialogFragment) DialogFragment(android.app.DialogFragment)

Example 32 with DialogFragment

use of android.app.DialogFragment in project k-9 by k9mail.

the class MessageViewFragment method showDialog.

private void showDialog(int dialogId) {
    DialogFragment fragment;
    switch(dialogId) {
        case R.id.dialog_confirm_delete:
            {
                String title = getString(R.string.dialog_confirm_delete_title);
                String message = getString(R.string.dialog_confirm_delete_message);
                String confirmText = getString(R.string.dialog_confirm_delete_confirm_button);
                String cancelText = getString(R.string.dialog_confirm_delete_cancel_button);
                fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message, confirmText, cancelText);
                break;
            }
        case R.id.dialog_confirm_spam:
            {
                String title = getString(R.string.dialog_confirm_spam_title);
                String message = getResources().getQuantityString(R.plurals.dialog_confirm_spam_message, 1);
                String confirmText = getString(R.string.dialog_confirm_spam_confirm_button);
                String cancelText = getString(R.string.dialog_confirm_spam_cancel_button);
                fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message, confirmText, cancelText);
                break;
            }
        case R.id.dialog_attachment_progress:
            {
                String message = getString(R.string.dialog_attachment_progress_title);
                fragment = ProgressDialogFragment.newInstance(null, message);
                break;
            }
        default:
            {
                throw new RuntimeException("Called showDialog(int) with unknown dialog id.");
            }
    }
    fragment.setTargetFragment(this, dialogId);
    fragment.show(getFragmentManager(), getDialogTag(dialogId));
}
Also used : ProgressDialogFragment(com.fsck.k9.fragment.ProgressDialogFragment) ConfirmationDialogFragment(com.fsck.k9.fragment.ConfirmationDialogFragment) DialogFragment(android.app.DialogFragment)

Example 33 with DialogFragment

use of android.app.DialogFragment in project BeyondUPnP by kevinshine.

the class MainActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    //noinspection SimplifiableIfStatement
    if (id == R.id.action_select) {
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        Fragment prev = getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG);
        if (prev != null) {
            ft.remove(prev);
        }
        ft.addToBackStack(null);
        // Create and show the dialog.
        DialogFragment newFragment = DeviceListDialogFragment.newInstance();
        newFragment.show(ft, DIALOG_FRAGMENT_TAG);
    }
    return super.onOptionsItemSelected(item);
}
Also used : FragmentTransaction(android.app.FragmentTransaction) DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) DialogFragment(android.app.DialogFragment)

Example 34 with DialogFragment

use of android.app.DialogFragment in project coursera-android by aporter.

the class TimePickerFragmentActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // Capture UI elements
    mTimeDisplay = (TextView) findViewById(R.id.timeDisplay);
    mPickTime = (Button) findViewById(R.id.pickTime);
    // Set an OnClickListener for the Change the Time Button
    mPickTime.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // Create a new DatePickerFragment
            DialogFragment newFragment = new TimePickerFragment();
            // Display DatePickerFragment
            newFragment.show(getFragmentManager(), "TimePicker");
        }
    });
}
Also used : DialogFragment(android.app.DialogFragment) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View)

Example 35 with DialogFragment

use of android.app.DialogFragment in project cardslib by gabrielemariotti.

the class MainNativeActivity method openDialogFragment.

private void openDialogFragment(DialogFragment dialogStandardFragment) {
    if (dialogStandardFragment != null) {
        FragmentManager fm = getFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        Fragment prev = fm.findFragmentByTag("carddemo_dialog");
        if (prev != null) {
            ft.remove(prev);
        }
        //ft.addToBackStack(null);
        dialogStandardFragment.show(ft, "carddemo_dialog");
    }
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) BaseFragment(it.gmariotti.cardslib.demo.fragment.BaseFragment) GridBaseFragment(it.gmariotti.cardslib.demo.fragment.v1.GridBaseFragment) ListGplayCursorCardCABFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCursorCardCABFragment) GridGplayCABFragment(it.gmariotti.cardslib.demo.fragment.v1.GridGplayCABFragment) ListSectionedCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListSectionedCardFragment) BirthDayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.BirthDayCardFragment) GridGplayFragment(it.gmariotti.cardslib.demo.fragment.v1.GridGplayFragment) NativeCardFragment(it.gmariotti.cardslib.demo.fragment.nativeview.NativeCardFragment) DismissAnimFragment(it.gmariotti.cardslib.demo.fragment.v1.DismissAnimFragment) ShadowFragment(it.gmariotti.cardslib.demo.fragment.v1.ShadowFragment) ListCursorCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListCursorCardFragment) ListColorFragment(it.gmariotti.cardslib.demo.fragment.v1.ListColorFragment) ListDifferentInnerBaseFragment(it.gmariotti.cardslib.demo.fragment.v1.ListDifferentInnerBaseFragment) NativeListBaseFragment(it.gmariotti.cardslib.demo.fragment.nativeview.NativeListBaseFragment) GPlayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.GPlayCardFragment) NativeHeaderFragment(it.gmariotti.cardslib.demo.fragment.nativeview.NativeHeaderFragment) ListGplayCardCABFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCardCABFragment) StockCardFragment(it.gmariotti.cardslib.demo.fragment.v1.StockCardFragment) ListGplayUndoCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayUndoCardFragment) GridCursorCardFragment(it.gmariotti.cardslib.demo.fragment.v1.GridCursorCardFragment) CardExpandFragment(it.gmariotti.cardslib.demo.fragment.v1.CardExpandFragment) CardWithListFragment(it.gmariotti.cardslib.demo.fragment.v1.CardWithListFragment) DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) MiscCardFragment(it.gmariotti.cardslib.demo.fragment.v1.MiscCardFragment) ListExpandCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListExpandCardFragment) NativeThumbnailFragment(it.gmariotti.cardslib.demo.fragment.nativeview.NativeThumbnailFragment) ListGplayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCardFragment) TodoNativeCardFragment(it.gmariotti.cardslib.demo.fragment.nativeview.TodoNativeCardFragment) ChangeValueCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ChangeValueCardFragment)

Aggregations

DialogFragment (android.app.DialogFragment)48 Fragment (android.app.Fragment)10 FragmentManager (android.app.FragmentManager)7 FragmentTransaction (android.app.FragmentTransaction)7 ConfirmationDialogFragment (com.fsck.k9.fragment.ConfirmationDialogFragment)3 Intent (android.content.Intent)2 Bundle (android.os.Bundle)2 View (android.view.View)2 TextView (android.widget.TextView)2 GPSAlertDialogFragment (com.agup.gps.fragments.GPSAlertDialogFragment)2 NetworkAlertDialogFragment (com.agup.gps.fragments.NetworkAlertDialogFragment)2 BackupAccountsDialogFragment (com.decad3nce.aegis.Fragments.BackupAccountsDialogFragment)2 ProgressDialogFragment (com.fsck.k9.fragment.ProgressDialogFragment)2 BaseFragment (it.gmariotti.cardslib.demo.fragment.BaseFragment)2 Activity (android.app.Activity)1 DevicePolicyManager (android.app.admin.DevicePolicyManager)1 BroadcastReceiver (android.content.BroadcastReceiver)1 ComponentName (android.content.ComponentName)1 Context (android.content.Context)1 IntentFilter (android.content.IntentFilter)1