if no Date Taken values have been fixed, show an error, not success

This commit is contained in:
tibbi 2018-11-19 12:51:47 +01:00
parent cdf87c0038
commit de9d7f580f

View file

@ -313,6 +313,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
activity.toast(R.string.fixing) activity.toast(R.string.fixing)
Thread { Thread {
try { try {
var didUpdateFile = false
val operations = ArrayList<ContentProviderOperation>() val operations = ArrayList<ContentProviderOperation>()
val mediumDao = activity.galleryDB.MediumDao() val mediumDao = activity.galleryDB.MediumDao()
val paths = getSelectedPaths() val paths = getSelectedPaths()
@ -343,10 +344,11 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
} }
mediumDao.updateFavoriteDateTaken(path, timestamp) mediumDao.updateFavoriteDateTaken(path, timestamp)
didUpdateFile = true
} }
activity.contentResolver.applyBatch(MediaStore.AUTHORITY, operations) activity.contentResolver.applyBatch(MediaStore.AUTHORITY, operations)
activity.toast(R.string.dates_fixed_successfully) activity.toast(if (didUpdateFile) R.string.dates_fixed_successfully else R.string.unknown_error_occurred)
activity.runOnUiThread { activity.runOnUiThread {
listener?.refreshItems() listener?.refreshItems()
finishActMode() finishActMode()