Skip to content
This repository was archived by the owner on Mar 18, 2023. It is now read-only.

Commit 3966706

Browse files
committed
Fixing an exception that happens using the library and a potential SDK min version error
1 parent efc4cf1 commit 3966706

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

AndroidFilePickerLightLibrary/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ android {
3737
minSdkVersion 26
3838
targetSdkVersion 30
3939
compileSdkVersion 31
40-
versionCode 21
41-
versionName "1.2.0"
40+
versionCode 22
41+
versionName "1.2.1"
4242
buildToolsVersion "30.0.1"
4343

4444
}

AndroidFilePickerLightLibrary/src/main/java/com/maxieds/androidfilepickerlightlibrary/BasicFileProvider.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private boolean setLegacyBaseFolderByName(String namedSubFolder) {
167167
}
168168

169169
public boolean selectBaseDirectoryByType(FileChooserBuilder.BaseFolderPathType baseFolderType) {
170-
Context appCtx = FileChooserActivity.getInstance();
170+
FileChooserActivity appCtx = FileChooserActivity.getInstance();
171171
switch(baseFolderType) {
172172
case BASE_PATH_TYPE_FILES_DIR:
173173
baseDirPath = appCtx.getFilesDir();
@@ -201,7 +201,11 @@ public boolean selectBaseDirectoryByType(FileChooserBuilder.BaseFolderPathType b
201201
setLegacyBaseFolderByName("Pictures");
202202
break;
203203
case BASE_PATH_TYPE_EXTERNAL_FILES_SCREENSHOTS:
204-
baseDirPath = appCtx.getExternalFilesDir(Environment.DIRECTORY_SCREENSHOTS);
204+
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
205+
baseDirPath = appCtx.getExternalFilesDir(Environment.DIRECTORY_SCREENSHOTS);
206+
} else {
207+
baseDirPath = new File(appCtx.getFilesDir(), "Pictures/Screenshots");
208+
}
205209
setLegacyBaseFolderByName("Pictures/Screenshots");
206210
break;
207211
case BASE_PATH_TYPE_USER_DATA_DIR:

0 commit comments

Comments
 (0)