diff --git a/tedimagepicker/src/main/java/gun0912/tedimagepicker/TedImagePickerActivity.kt b/tedimagepicker/src/main/java/gun0912/tedimagepicker/TedImagePickerActivity.kt index b391895..731a914 100644 --- a/tedimagepicker/src/main/java/gun0912/tedimagepicker/TedImagePickerActivity.kt +++ b/tedimagepicker/src/main/java/gun0912/tedimagepicker/TedImagePickerActivity.kt @@ -448,7 +448,7 @@ internal class TedImagePickerActivity root.isGone = true return@with } - root.isVisible = isPartialAccessGranted + root.isVisible = builder.mediaType.isPartialAccessGranted tvPartialAccessManage.setOnClickListener { showPartialAccessManageDialog() } val mediaTypeText = getString(builder.mediaType.nameResId) tvPartialAccessNotice.text = diff --git a/tedimagepicker/src/main/java/gun0912/tedimagepicker/builder/TedImagePickerBaseBuilder.kt b/tedimagepicker/src/main/java/gun0912/tedimagepicker/builder/TedImagePickerBaseBuilder.kt index fc13656..9e1ea89 100644 --- a/tedimagepicker/src/main/java/gun0912/tedimagepicker/builder/TedImagePickerBaseBuilder.kt +++ b/tedimagepicker/src/main/java/gun0912/tedimagepicker/builder/TedImagePickerBaseBuilder.kt @@ -98,14 +98,14 @@ open class TedImagePickerBaseBuilder>( @SuppressLint("CheckResult") protected fun startInternal(context: Context) { val requestPermissions = getRequestPermissions() - if (TedPermissionUtil.isGranted(*requestPermissions) || isPartialAccessGranted) { + if (TedPermissionUtil.isGranted(*requestPermissions) || mediaType.isPartialAccessGranted) { startActivity(context) } else { TedPermission.create() .setPermissions(*requestPermissions) .request() .subscribe({ permissionResult -> - if (permissionResult.isGranted || isPartialAccessGranted) { + if (permissionResult.isGranted || mediaType.isPartialAccessGranted) { startActivity(context) } }, { throwable -> onErrorListener?.onError(throwable) }) diff --git a/tedimagepicker/src/main/java/gun0912/tedimagepicker/partialaccess/PartialAccessManageBottomSheet.kt b/tedimagepicker/src/main/java/gun0912/tedimagepicker/partialaccess/PartialAccessManageBottomSheet.kt index c9075e5..b8d94d2 100644 --- a/tedimagepicker/src/main/java/gun0912/tedimagepicker/partialaccess/PartialAccessManageBottomSheet.kt +++ b/tedimagepicker/src/main/java/gun0912/tedimagepicker/partialaccess/PartialAccessManageBottomSheet.kt @@ -33,7 +33,7 @@ class PartialAccessManageBottomSheet : BottomSheetDialogFragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View = BottomsheetPartialAccessManageBinding.inflate(inflater, container, false).also { binding = it }.root diff --git a/tedimagepicker/src/main/java/gun0912/tedimagepicker/util/Permission.kt b/tedimagepicker/src/main/java/gun0912/tedimagepicker/util/Permission.kt index fe1fc5c..ee377b2 100644 --- a/tedimagepicker/src/main/java/gun0912/tedimagepicker/util/Permission.kt +++ b/tedimagepicker/src/main/java/gun0912/tedimagepicker/util/Permission.kt @@ -6,9 +6,10 @@ import com.gun0912.tedpermission.TedPermissionUtil import gun0912.tedimagepicker.builder.type.MediaType -internal val isPartialAccessGranted: Boolean +internal val MediaType.isPartialAccessGranted: Boolean get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && TedPermissionUtil.isGranted(Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED) + && !TedPermissionUtil.isGranted(*permissions) internal val MediaType.isFullOrPartialAccessGranted: Boolean