Added Download Folder Dialog

This commit is contained in:
tom5079
2020-09-02 21:59:17 +09:00
parent 37be8ccf7f
commit 1edf986acf
14 changed files with 351 additions and 243 deletions

View File

@@ -53,7 +53,7 @@ data class Metadata(
class Cache private constructor(context: Context, val galleryID: Int) : ContextWrapper(context) {
companion object {
private val instances = SparseArray<Cache>()
val instances = SparseArray<Cache>()
fun getInstance(context: Context, galleryID: Int) =
instances[galleryID] ?: synchronized(this) {

View File

@@ -97,7 +97,14 @@ val formatMap = mapOf<String, GalleryBlock.() -> (String)>(
* Formats download folder name with given Metadata
*/
fun GalleryBlock.formatDownloadFolder(): String =
Preferences["download_folder_name", "-id-"].let {
Preferences["download_folder_name", "[-id-] -title-"].let {
formatMap.entries.fold(it) { str, (k, v) ->
str.replace(k, v.invoke(this), true)
}
}
fun GalleryBlock.formatDownloadFolderTest(format: String): String =
format.let {
formatMap.entries.fold(it) { str, (k, v) ->
str.replace(k, v.invoke(this), true)
}