mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 22:37:59 +01:00
adding a confirmation dialog at recycle bin emptying
This commit is contained in:
parent
2dacf695fe
commit
e57a8d60eb
2 changed files with 13 additions and 5 deletions
|
@ -47,7 +47,7 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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.theartofdev.edmodo:android-image-cropper:2.7.0'
|
||||||
implementation 'com.android.support:multidex:1.0.3'
|
implementation 'com.android.support:multidex:1.0.3'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.*
|
||||||
|
|
||||||
class SettingsActivity : SimpleActivity() {
|
class SettingsActivity : SimpleActivity() {
|
||||||
lateinit var res: Resources
|
lateinit var res: Resources
|
||||||
|
private var mRecycleBinContentSize = 0L
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -424,15 +425,22 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupEmptyRecycleBin() {
|
private fun setupEmptyRecycleBin() {
|
||||||
Thread {
|
Thread {
|
||||||
val size = galleryDB.MediumDao().getDeletedMedia().sumByLong { it.size }
|
mRecycleBinContentSize = galleryDB.MediumDao().getDeletedMedia().sumByLong { it.size }
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
settings_empty_recycle_bin_size.text = size.formatSize()
|
settings_empty_recycle_bin_size.text = mRecycleBinContentSize.formatSize()
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
|
|
||||||
settings_empty_recycle_bin_holder.setOnClickListener {
|
settings_empty_recycle_bin_holder.setOnClickListener {
|
||||||
|
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()
|
emptyTheRecycleBin()
|
||||||
|
mRecycleBinContentSize = 0L
|
||||||
settings_empty_recycle_bin_size.text = 0L.formatSize()
|
settings_empty_recycle_bin_size.text = 0L.formatSize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue