Skip to content

Commit

Permalink
Fixes fishwjy#70 check getExternalCacheDir for null result
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark van de Korput committed Sep 25, 2020
1 parent f39db9f commit 601fb37
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ public void OnSelectStateChanged(boolean state, VideoFile file) {
});

mProgressBar = (ProgressBar) findViewById(R.id.pb_video_pick);
File folder = new File(getExternalCacheDir().getAbsolutePath() + File.separator + THUMBNAIL_PATH);
if (!folder.exists()) {
mProgressBar.setVisibility(View.VISIBLE);
} else {
mProgressBar.setVisibility(View.GONE);
}

File thumbnailFolderFile = this.getThumbnailFolderFile();
mProgressBar.setVisibility(
thumbnailFolderFile == null || !thumbnailFolderFile.exists()
? View.VISIBLE
: View.GONE);

rl_done = (RelativeLayout) findViewById(R.id.rl_done);
rl_done.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -159,6 +159,15 @@ public void onFolderListClick(Directory directory) {
}
}

/**
* @return null if there is no external storage available, otherwise a File
* instance referencing to the thumbnail file.
*/
private File getThumbnailFolderFile() {
File f = getExternalCacheDir();
return f == null ? null : new File(f.getAbsolutePath(), THUMBNAIL_PATH);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Dec 29 18:00:03 IST 2019
#Fri Sep 25 10:43:54 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

0 comments on commit 601fb37

Please sign in to comment.