Search in sources :

Example 1 with RationaleDialogFragmentCompat

use of pub.devrel.easypermissions.RationaleDialogFragmentCompat 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)

Aggregations

Fragment (androidx.fragment.app.Fragment)1 FragmentManager (androidx.fragment.app.FragmentManager)1 RationaleDialogFragmentCompat (pub.devrel.easypermissions.RationaleDialogFragmentCompat)1