adding a confirmation dialog at recycle bin emptying
This commit is contained in:
parent
2dacf695fe
commit
e57a8d60eb
|
@ -47,7 +47,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:4.3.6'
|
||||
implementation 'com.simplemobiletools:commons:4.3.7'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.*
|
|||
|
||||
class SettingsActivity : SimpleActivity() {
|
||||
lateinit var res: Resources
|
||||
private var mRecycleBinContentSize = 0L
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -424,15 +425,22 @@ class SettingsActivity : SimpleActivity() {
|
|||
|
||||
private fun setupEmptyRecycleBin() {
|
||||
Thread {
|
||||
val size = galleryDB.MediumDao().getDeletedMedia().sumByLong { it.size }
|
||||
mRecycleBinContentSize = galleryDB.MediumDao().getDeletedMedia().sumByLong { it.size }
|
||||
runOnUiThread {
|
||||
settings_empty_recycle_bin_size.text = size.formatSize()
|
||||
settings_empty_recycle_bin_size.text = mRecycleBinContentSize.formatSize()
|
||||
}
|
||||
}.start()
|
||||
|
||||
settings_empty_recycle_bin_holder.setOnClickListener {
|
||||
emptyTheRecycleBin()
|
||||
settings_empty_recycle_bin_size.text = 0L.formatSize()
|
||||
if (mRecycleBinContentSize == 0L) {
|
||||
toast(R.string.recycle_bin_empty)
|
||||
} else {
|
||||
ConfirmationDialog(this, "", R.string.empty_recycle_bin_confirmation, R.string.yes, R.string.no) {
|
||||
emptyTheRecycleBin()
|
||||
mRecycleBinContentSize = 0L
|
||||
settings_empty_recycle_bin_size.text = 0L.formatSize()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue