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]));
}
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;
}
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);
}
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);
}
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();
}
Aggregations