adding some try/catch blocks
This commit is contained in:
parent
7e0ebaace9
commit
60b44c27be
|
@ -77,7 +77,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.30.17'
|
||||
implementation 'com.simplemobiletools:commons:5.30.25'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
|
||||
|
|
|
@ -481,20 +481,23 @@ class MediaFetcher(val context: Context) {
|
|||
|
||||
val uri = Files.getContentUri("external")
|
||||
|
||||
val cursor = context.contentResolver.query(uri, projection, null, null, null)
|
||||
cursor?.use {
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
try {
|
||||
val dateTaken = cursor.getLongValue(Images.Media.DATE_TAKEN)
|
||||
if (dateTaken != 0L) {
|
||||
val path = cursor.getStringValue(Images.Media.DATA)
|
||||
dateTakens[path] = dateTaken
|
||||
try {
|
||||
val cursor = context.contentResolver.query(uri, projection, null, null, null)
|
||||
cursor?.use {
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
try {
|
||||
val dateTaken = cursor.getLongValue(Images.Media.DATE_TAKEN)
|
||||
if (dateTaken != 0L) {
|
||||
val path = cursor.getStringValue(Images.Media.DATA)
|
||||
dateTakens[path] = dateTaken
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
} while (cursor.moveToNext())
|
||||
} while (cursor.moveToNext())
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
|
||||
val dateTakenValues = context.dateTakensDB.getAllDateTakens()
|
||||
|
@ -547,20 +550,23 @@ class MediaFetcher(val context: Context) {
|
|||
|
||||
val uri = Files.getContentUri("external")
|
||||
|
||||
val cursor = context.contentResolver.query(uri, projection, null, null, null)
|
||||
cursor?.use {
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
try {
|
||||
val lastModified = cursor.getLongValue(Images.Media.DATE_MODIFIED) * 1000
|
||||
if (lastModified != 0L) {
|
||||
val path = cursor.getStringValue(Images.Media.DATA)
|
||||
lastModifieds[path] = lastModified
|
||||
try {
|
||||
val cursor = context.contentResolver.query(uri, projection, null, null, null)
|
||||
cursor?.use {
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
try {
|
||||
val lastModified = cursor.getLongValue(Images.Media.DATE_MODIFIED) * 1000
|
||||
if (lastModified != 0L) {
|
||||
val path = cursor.getStringValue(Images.Media.DATA)
|
||||
lastModifieds[path] = lastModified
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
} while (cursor.moveToNext())
|
||||
} while (cursor.moveToNext())
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
|
||||
return lastModifieds
|
||||
|
|
Loading…
Reference in New Issue