@@ -0,0 +1,2329 @@
+package com.dailystudio.app.fragment;%0A%0Aimport android.content.Context;%0Aimport android.content.pm.PackageManager;%0Aimport android.os.Bundle;%0Aimport androidx.annotation.NonNull;%0Aimport androidx.annotation.Nullable;%0Aimport androidx.core.content.ContextCompat;%0Aimport com.dailystudio.app.utils.ArrayUtils;%0Aimport com.dailystudio.development.Logger;%0A%0Apublic abstract class AbsPermissionsFragment extends BaseIntentFragment %7B%0A%0A    private final static int REQUEST_PERMISSIONS = 10;%0A%0A    @Override%0A    public void onCreate(@Nullable Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A%0A        final String%5B%5D requiredPermissions = getRequiredPermissions();%0A        Logger.debug(%22requiredPermissions: %25s%22,%0A                ArrayUtils.stringArrayToString(requiredPermissions,%22,%22));%0A%0A        if (!hasPermissions(requireContext(), requiredPermissions)) %7B%0A            Logger.debug(%22request required permissions%22);%0A            requestPermissions(requiredPermissions, REQUEST_PERMISSIONS);%0A        %7D else %7B%0A            onPermissionsGranted();%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void onRequestPermissionsResult(int requestCode, @NonNull String%5B%5D permissions, @NonNull int%5B%5D grantResults) %7B%0A        super.onRequestPermissionsResult(requestCode, permissions, grantResults);%0A%0A        if (requestCode == REQUEST_PERMISSIONS) %7B%0A            if (grantResults%5B0%5D == PackageManager.PERMISSION_GRANTED) %7B%0A                // Take the user to the success fragment when permission is granted%0A                Logger.warn(%22Permission request granted%22);%0A                onPermissionsGranted();%0A            %7D else %7B%0A                Logger.warn(%22Permission request denied%22);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public abstract String%5B%5D getRequiredPermissions();%0A    public abstract void onPermissionsGranted();%0A%0A    public static boolean hasPermissions(Context context,%0A                                         String%5B%5D permissions) %7B%0A        if (permissions == null %7C%7C permissions.length %3C= 0) %7B%0A            return true;%0A        %7D%0A%0A        int granted;%0A        for (String perm: permissions) %7B%0A            granted = ContextCompat.checkSelfPermission(context,%0A                    perm);%0A%0A            if (granted != PackageManager.PERMISSION_GRANTED) %7B%0A                return false;%0A            %7D%0A        %7D%0A%0A        return true;%0A    %7D%0A%0A%7D%0A

add new fragment for permission requests;