From 976ed49ec199035718285a3d5e0bc76fa9ba849a Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 12 Sep 2020 11:54:17 -0700 Subject: [PATCH] Go back to just using getExternalFilesDirs on Android 11+ getExternalMediaDirs was depreciated in Android 11 since they want people to just contribute to MediaStore directly instead: https://developer.android.com/reference/android/content/Context#getExternalMediaDirs() --- app/src/main/java/github/daneren2005/dsub/util/FileUtil.java | 2 +- .../github/daneren2005/dsub/view/CacheLocationPreference.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java b/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java index fb395c770..e581173b4 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java +++ b/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java @@ -453,7 +453,7 @@ public static File getSubsonicDirectory(Context context) { public static File getDefaultMusicDirectory(Context context) { if(DEFAULT_MUSIC_DIR == null) { File[] dirs; - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { dirs = context.getExternalMediaDirs(); } else { dirs = ContextCompat.getExternalFilesDirs(context, null); diff --git a/app/src/main/java/github/daneren2005/dsub/view/CacheLocationPreference.java b/app/src/main/java/github/daneren2005/dsub/view/CacheLocationPreference.java index 35ce71bcd..002f02453 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/CacheLocationPreference.java +++ b/app/src/main/java/github/daneren2005/dsub/view/CacheLocationPreference.java @@ -67,7 +67,7 @@ protected void onBindDialogView(View view) { Button externalLocation = (Button) cacheButtonsWrapper.findViewById(R.id.location_external); File[] dirs; - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { dirs = context.getExternalMediaDirs(); } else { dirs = ContextCompat.getExternalFilesDirs(context, null);