diff --git a/app/build.gradle b/app/build.gradle index c07608bc0..c543a4927 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.32.25' + implementation 'com.simplemobiletools:commons:5.32.28' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index 84e089a88..274394aaa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -90,6 +90,7 @@ class SettingsActivity : SimpleActivity() { setupEmptyRecycleBin() updateTextColors(settings_holder) setupSectionColors() + setupClearCache() setupExportSettings() setupImportSettings() invalidateOptionsMenu() @@ -624,6 +625,23 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupClearCache() { + ensureBackgroundThread { + runOnUiThread { + settings_clear_cache_size.text = cacheDir.getProperSize(true).formatSize() + } + } + + settings_clear_cache_holder.setOnClickListener { + ensureBackgroundThread { + cacheDir.deleteRecursively() + runOnUiThread { + settings_clear_cache_size.text = cacheDir.getProperSize(true).formatSize() + } + } + } + } + private fun setupExportSettings() { settings_export_holder.setOnClickListener { val configItems = LinkedHashMap().apply { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 399715167..b8bfda998 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -1236,6 +1236,38 @@ android:textAllCaps="true" android:textSize="@dimen/smaller_text_size" /> + + + + + + + +