From 976ed49ec199035718285a3d5e0bc76fa9ba849a Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 12 Sep 2020 11:54:17 -0700 Subject: 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 +- .../main/java/github/daneren2005/dsub/view/CacheLocationPreference.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app/src') 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 fb395c77..e581173b 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 class FileUtil { 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 35ce71bc..002f0245 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 @@ public class CacheLocationPreference extends EditTextPreference { 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); -- cgit v1.2.3