Search in sources :

Example 61 with Fragment

use of androidx.fragment.app.Fragment in project AndroidUtilCode by Blankj.

the class FragmentUtils method hide.

/**
 * Hide fragment.
 *
 * @param fm The manager of fragment.
 */
public static void hide(@NonNull final FragmentManager fm) {
    List<Fragment> fragments = getFragments(fm);
    for (Fragment hide : fragments) {
        putArgs(hide, true);
    }
    operateNoAnim(TYPE_HIDE_FRAGMENT, fm, null, fragments.toArray(new Fragment[0]));
}
Also used : Fragment(androidx.fragment.app.Fragment)

Example 62 with Fragment

use of androidx.fragment.app.Fragment in project AndroidUtilCode by Blankj.

the class FragmentUtils method getFragmentsInStack.

/**
 * Return the fragments in stack in manager.
 *
 * @param fm The manager of fragment.
 * @return the fragments in stack in manager
 */
public static List<Fragment> getFragmentsInStack(@NonNull final FragmentManager fm) {
    List<Fragment> fragments = getFragments(fm);
    List<Fragment> result = new ArrayList<>();
    for (Fragment fragment : fragments) {
        if (fragment != null) {
            Bundle args = fragment.getArguments();
            if (args != null && args.getBoolean(ARGS_IS_ADD_STACK)) {
                result.add(fragment);
            }
        }
    }
    return result;
}
Also used : Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) Fragment(androidx.fragment.app.Fragment)

Example 63 with Fragment

use of androidx.fragment.app.Fragment in project easypermissions by googlesamples.

the class BaseSupportPermissionsHelper method showRequestPermissionRationale.

@Override
public void showRequestPermissionRationale(@NonNull String rationale, @NonNull String positiveButton, @NonNull String negativeButton, @StyleRes int theme, int requestCode, @NonNull String... perms) {
    FragmentManager fm = getSupportFragmentManager();
    // Check if fragment is already showing
    Fragment fragment = fm.findFragmentByTag(RationaleDialogFragmentCompat.TAG);
    if (fragment instanceof RationaleDialogFragmentCompat) {
        Log.d(TAG, "Found existing fragment, not showing rationale.");
        return;
    }
    RationaleDialogFragmentCompat.newInstance(rationale, positiveButton, negativeButton, theme, requestCode, perms).showAllowingStateLoss(fm, RationaleDialogFragmentCompat.TAG);
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) RationaleDialogFragmentCompat(pub.devrel.easypermissions.RationaleDialogFragmentCompat) Fragment(androidx.fragment.app.Fragment)

Example 64 with Fragment

use of androidx.fragment.app.Fragment in project zype-android by zype.

the class ChromecastFragment method showTracksChooserDialog.

private void showTracksChooserDialog() throws TransientNetworkDisconnectionException, NoConnectionException {
    FragmentTransaction transaction = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag(DIALOG_TAG);
    if (prev != null) {
        transaction.remove(prev);
    }
    transaction.addToBackStack(null);
    // Create and show the dialog.
    TracksChooserDialog dialogFragment = TracksChooserDialog.newInstance(mCastManager.getRemoteMediaInformation());
    dialogFragment.show(transaction, DIALOG_TAG);
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) TracksChooserDialog(com.google.android.libraries.cast.companionlibrary.cast.tracks.ui.TracksChooserDialog) Fragment(androidx.fragment.app.Fragment) BaseFragment(com.zype.android.ui.base.BaseFragment)

Example 65 with Fragment

use of androidx.fragment.app.Fragment in project zype-android by zype.

the class VideoCastControllerFragment method onAttach.

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    sDialogCanceled = false;
    Fragment fragment = getFragmentManager().findFragmentById(R.id.video_container);
    mCastController = (VideoCastController) fragment;
    mHandler = new Handler();
    mCastManager = VideoCastManager.getInstance();
}
Also used : Handler(android.os.Handler) Fragment(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment)

Aggregations

Fragment (androidx.fragment.app.Fragment)239 FragmentTransaction (androidx.fragment.app.FragmentTransaction)54 Bundle (android.os.Bundle)46 FragmentManager (androidx.fragment.app.FragmentManager)38 FileFragment (com.owncloud.android.ui.fragment.FileFragment)23 DialogFragment (androidx.fragment.app.DialogFragment)22 View (android.view.View)21 FileDetailFragment (com.owncloud.android.ui.fragment.FileDetailFragment)20 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)20 Intent (android.content.Intent)19 SortingOrderDialogFragment (com.owncloud.android.ui.dialog.SortingOrderDialogFragment)19 GalleryFragment (com.owncloud.android.ui.fragment.GalleryFragment)18 TaskRetainerFragment (com.owncloud.android.ui.fragment.TaskRetainerFragment)18 UnifiedSearchFragment (com.owncloud.android.ui.fragment.UnifiedSearchFragment)18 PreviewImageFragment (com.owncloud.android.ui.preview.PreviewImageFragment)18 PreviewMediaFragment (com.owncloud.android.ui.preview.PreviewMediaFragment)18 PreviewTextFileFragment (com.owncloud.android.ui.preview.PreviewTextFileFragment)18 PreviewTextFragment (com.owncloud.android.ui.preview.PreviewTextFragment)18 PreviewTextStringFragment (com.owncloud.android.ui.preview.PreviewTextStringFragment)18 PreviewPdfFragment (com.owncloud.android.ui.preview.pdf.PreviewPdfFragment)18