Search in sources :

Example 1 with RationaleDialogFragment

use of pub.devrel.easypermissions.RationaleDialogFragment in project easypermissions by googlesamples.

the class BaseFrameworkPermissionsHelper 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 = getFragmentManager();
    // Check if fragment is already showing
    Fragment fragment = fm.findFragmentByTag(RationaleDialogFragment.TAG);
    if (fragment instanceof RationaleDialogFragment) {
        Log.d(TAG, "Found existing fragment, not showing rationale.");
        return;
    }
    RationaleDialogFragment.newInstance(positiveButton, negativeButton, rationale, theme, requestCode, perms).showAllowingStateLoss(fm, RationaleDialogFragment.TAG);
}
Also used : FragmentManager(android.app.FragmentManager) RationaleDialogFragment(pub.devrel.easypermissions.RationaleDialogFragment) Fragment(android.app.Fragment) RationaleDialogFragment(pub.devrel.easypermissions.RationaleDialogFragment)

Aggregations

Fragment (android.app.Fragment)1 FragmentManager (android.app.FragmentManager)1 RationaleDialogFragment (pub.devrel.easypermissions.RationaleDialogFragment)1