mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
allow clearing the app cache, related to #1504
This commit is contained in:
parent
ce6e3315c0
commit
560aedfb6e
3 changed files with 51 additions and 1 deletions
|
@ -77,7 +77,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
|
||||||
|
|
|
@ -90,6 +90,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
setupEmptyRecycleBin()
|
setupEmptyRecycleBin()
|
||||||
updateTextColors(settings_holder)
|
updateTextColors(settings_holder)
|
||||||
setupSectionColors()
|
setupSectionColors()
|
||||||
|
setupClearCache()
|
||||||
setupExportSettings()
|
setupExportSettings()
|
||||||
setupImportSettings()
|
setupImportSettings()
|
||||||
invalidateOptionsMenu()
|
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() {
|
private fun setupExportSettings() {
|
||||||
settings_export_holder.setOnClickListener {
|
settings_export_holder.setOnClickListener {
|
||||||
val configItems = LinkedHashMap<String, Any>().apply {
|
val configItems = LinkedHashMap<String, Any>().apply {
|
||||||
|
|
|
@ -1236,6 +1236,38 @@
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:textSize="@dimen/smaller_text_size" />
|
android:textSize="@dimen/smaller_text_size" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_clear_cache_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:paddingStart="@dimen/normal_margin"
|
||||||
|
android:paddingTop="@dimen/bigger_margin"
|
||||||
|
android:paddingEnd="@dimen/normal_margin"
|
||||||
|
android:paddingBottom="@dimen/bigger_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/settings_clear_cache_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toStartOf="@+id/settings_clear_cache_size"
|
||||||
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:paddingEnd="@dimen/medium_margin"
|
||||||
|
android:text="@string/clear_cache" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/settings_clear_cache_size"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginEnd="@dimen/medium_margin"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_export_holder"
|
android:id="@+id/settings_export_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue