Skip to content

Commit

Permalink
Merge pull request #152 from ted-prnd/feature/targetSdkVersion-34-REA…
Browse files Browse the repository at this point in the history
…D_MEDIA_VISUAL_USER_SELECTED

TargetSdkVersion update to 34
  • Loading branch information
ted-prnd authored Aug 13, 2024
2 parents 86fd875 + 0415d52 commit 441c0fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ext {
versions = [
'minSdkVersion' : 14,
'compileSdkVersion': 30,
'targetSdkVersion' : 30,
'compileSdkVersion': 34,
'targetSdkVersion' : 34,
'kotlin' : '1.9.10',
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,21 @@ private static boolean isGranted(@NonNull String permission) {
} else {
return true;
}
} else if (permission.equals(Manifest.permission.READ_MEDIA_VIDEO) || permission.equals(Manifest.permission.READ_MEDIA_IMAGES)) {
return isFullOrPartialAccessGranted(permission);
} else {
return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
}
}

private static boolean isFullOrPartialAccessGranted(@NonNull String permission) {
boolean isPartialAccessGranted =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
&& ContextCompat.checkSelfPermission(context, Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED) == PackageManager.PERMISSION_GRANTED;

return isPartialAccessGranted || ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
}

public static List<String> getDeniedPermissions(@NonNull String... permissions) {
List<String> deniedPermissions = new ArrayList<>();
for (String permission : permissions) {
Expand Down

0 comments on commit 441c0fa

Please sign in to comment.