feat(ImageProvider): add bitmapLrucache size setting

This commit is contained in:
Xwite
2022-05-29 14:57:55 +08:00
parent 83bc051f79
commit eda8567f6a
8 changed files with 22 additions and 10 deletions
@@ -105,14 +105,17 @@ class OtherConfigFragment : PreferenceFragment(),
PreferKey.cleanCache -> clearCache() PreferKey.cleanCache -> clearCache()
PreferKey.uploadRule -> showDialogFragment<DirectLinkUploadConfig>() PreferKey.uploadRule -> showDialogFragment<DirectLinkUploadConfig>()
PreferKey.checkSource -> showDialogFragment<CheckSourceConfig>() PreferKey.checkSource -> showDialogFragment<CheckSourceConfig>()
PreferKey.bitmapCacheSize -> NumberPickerDialog(requireContext()) PreferKey.bitmapCacheSize -> {
.setTitle(getString(R.string.bitmap_cache_size)) toastOnUi(R.string.restart_to_apply_changes)
.setMaxValue(9999) NumberPickerDialog(requireContext())
.setMinValue(1) .setTitle(getString(R.string.bitmap_cache_size))
.setValue(AppConfig.bitmapCacheSize) .setMaxValue(9999)
.show { .setMinValue(1)
AppConfig.bitmapCacheSize = it .setValue(AppConfig.bitmapCacheSize)
} .show {
AppConfig.bitmapCacheSize = it
}
}
} }
return super.onPreferenceTreeClick(preference) return super.onPreferenceTreeClick(preference)
} }
@@ -152,8 +155,6 @@ class OtherConfigFragment : PreferenceFragment(),
} }
PreferKey.bitmapCacheSize -> { PreferKey.bitmapCacheSize -> {
upPreferenceSummary(key, AppConfig.bitmapCacheSize.toString()) upPreferenceSummary(key, AppConfig.bitmapCacheSize.toString())
// restart to apply changes
appCtx.restart()
} }
} }
} }
@@ -990,5 +990,7 @@
<string name="add_remote_book">WebDavBook</string> <string name="add_remote_book">WebDavBook</string>
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string> <string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string> <string name="bitmap_cache_size">bitmap cache size</string>
<string name="restart_to_apply_changes">Restart to apply changes</string>
<!-- string end --> <!-- string end -->
</resources> </resources>
@@ -993,5 +993,7 @@
<string name="add_remote_book">WebDavBook</string> <string name="add_remote_book">WebDavBook</string>
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string> <string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string> <string name="bitmap_cache_size">bitmap cache size</string>
<string name="restart_to_apply_changes">Restart to apply changes</string>
<!-- string end --> <!-- string end -->
</resources> </resources>
@@ -993,5 +993,7 @@
<string name="add_remote_book">WebDavBook</string> <string name="add_remote_book">WebDavBook</string>
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string> <string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string> <string name="bitmap_cache_size">bitmap cache size</string>
<string name="restart_to_apply_changes">Restart to apply changes</string>
<!-- string end --> <!-- string end -->
</resources> </resources>
@@ -990,6 +990,7 @@
<string name="add_remote_book">WebDav书籍</string> <string name="add_remote_book">WebDav书籍</string>
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string> <string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string> <string name="bitmap_cache_size">图片绘制缓存</string>
<string name="restart_to_apply_changes">重启应用更改</string>
<!-- string end --> <!-- string end -->
</resources> </resources>
@@ -992,6 +992,7 @@
<string name="add_remote_book">WebDav书籍</string> <string name="add_remote_book">WebDav书籍</string>
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string> <string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string> <string name="bitmap_cache_size">图片绘制缓存</string>
<string name="restart_to_apply_changes">重启应用更改</string>
<!-- string end --> <!-- string end -->
</resources> </resources>
+1
View File
@@ -992,6 +992,7 @@
<string name="add_remote_book">WebDav书籍</string> <string name="add_remote_book">WebDav书籍</string>
<string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string> <string name="bitmap_cache_size_summary">当前最大缓存 %1$s MB</string>
<string name="bitmap_cache_size">图片绘制缓存</string> <string name="bitmap_cache_size">图片绘制缓存</string>
<string name="restart_to_apply_changes">重启应用更改</string>
<!-- string end --> <!-- string end -->
</resources> </resources>
+2
View File
@@ -993,5 +993,7 @@
<string name="add_remote_book">WebDavBook</string> <string name="add_remote_book">WebDavBook</string>
<string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string> <string name="bitmap_cache_size_summary">Current cache max size %1$s MB</string>
<string name="bitmap_cache_size">bitmap cache size</string> <string name="bitmap_cache_size">bitmap cache size</string>
<string name="restart_to_apply_changes">Restart to apply changes</string>
<!-- string end --> <!-- string end -->
</resources> </resources>