mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
do not show the Date Taken value fixing related toast messages at bin
This commit is contained in:
parent
dcfca72064
commit
376c3d0d1e
2 changed files with 14 additions and 6 deletions
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
toast(R.string.fixing)
|
||||
if (showToasts) {
|
||||
toast(R.string.fixing)
|
||||
}
|
||||
|
||||
try {
|
||||
var didUpdateFile = false
|
||||
val operations = ArrayList<ContentProviderOperation>()
|
||||
|
@ -371,13 +374,18 @@ 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) {
|
||||
showErrorToast(e)
|
||||
if (showToasts) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue