do not show the Date Taken value fixing related toast messages at bin

This commit is contained in:
tibbi 2019-05-05 23:27:12 +02:00
parent dcfca72064
commit 376c3d0d1e
2 changed files with 14 additions and 6 deletions

View file

@ -331,7 +331,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
private fun fixDateTaken() {
Thread {
activity.fixDateTaken(getSelectedPaths()) {
activity.fixDateTaken(getSelectedPaths(), true) {
listener?.refreshItems()
finishActMode()
}

View file

@ -278,7 +278,7 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList<String>, mediumDa
callback()
}
fixDateTaken(newPaths)
fixDateTaken(newPaths, false)
}.start()
}
@ -328,9 +328,12 @@ fun Activity.hasNavBar(): Boolean {
return (realDisplayMetrics.widthPixels - displayMetrics.widthPixels > 0) || (realDisplayMetrics.heightPixels - displayMetrics.heightPixels > 0)
}
fun Activity.fixDateTaken(paths: ArrayList<String>, callback: (() -> Unit)? = null) {
fun Activity.fixDateTaken(paths: ArrayList<String>, showToasts: Boolean, callback: (() -> Unit)? = null) {
val BATCH_SIZE = 50
if (showToasts) {
toast(R.string.fixing)
}
try {
var didUpdateFile = false
val operations = ArrayList<ContentProviderOperation>()
@ -371,15 +374,20 @@ fun Activity.fixDateTaken(paths: ArrayList<String>, callback: (() -> Unit)? = nu
didUpdateFile = false
}
toast(if (didUpdateFile) R.string.dates_fixed_successfully else R.string.unknown_error_occurred)
runOnUiThread {
if (showToasts) {
toast(if (didUpdateFile) R.string.dates_fixed_successfully else R.string.unknown_error_occurred)
}
callback?.invoke()
}
}
} catch (e: Exception) {
if (showToasts) {
showErrorToast(e)
}
}
}
fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String, degrees: Int, showToasts: Boolean, callback: () -> Unit) {
var newDegrees = degrees