Skip to content

Commit

Permalink
Fixed external media dirs listing because they can return null sometimes
Browse files Browse the repository at this point in the history
Version bump
  • Loading branch information
izderadicka committed Jun 20, 2018
1 parent 0441cd8 commit 122ab24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId "eu.zderadicka.audioserve"
minSdkVersion 21
targetSdkVersion 27
versionCode 16
versionName "0.6.9"
versionCode 17
versionName "0.6.10"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/eu/zderadicka/audioserve/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,12 @@ class SettingsFragment: PreferenceFragment(), SharedPreferences.OnSharedPreferen
l.add(Pair(getString(sname) + " (${freeSize(sfile.freeSpace)})",sfile.absolutePath))

activity.externalMediaDirs.forEachIndexed { index, file ->
if (Environment.getExternalStorageState(file) == Environment.MEDIA_MOUNTED) {
val name = getString(R.string.storage_external, index.toString())
l.add(Pair(name+ " (${freeSize(file.freeSpace)})",file.absolutePath))
}

if (file != null && Environment.getExternalStorageState(file) == Environment.MEDIA_MOUNTED) {
val name = getString(R.string.storage_external, index.toString())
l.add(Pair(name + " (${freeSize(file.freeSpace)})", file.absolutePath))
}

}
return l
}
Expand Down

0 comments on commit 122ab24

Please sign in to comment.