|
|
@ -20,6 +20,9 @@ import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
import io.legado.app.help.permission.Permissions |
|
|
|
import io.legado.app.help.permission.Permissions |
|
|
|
import io.legado.app.help.permission.PermissionsCompat |
|
|
|
import io.legado.app.help.permission.PermissionsCompat |
|
|
|
|
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
|
|
|
|
import io.legado.app.lib.dialogs.noButton |
|
|
|
|
|
|
|
import io.legado.app.lib.dialogs.okButton |
|
|
|
import io.legado.app.lib.dialogs.selector |
|
|
|
import io.legado.app.lib.dialogs.selector |
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
import io.legado.app.receiver.SharedReceiverActivity |
|
|
|
import io.legado.app.receiver.SharedReceiverActivity |
|
|
@ -79,11 +82,7 @@ class OtherConfigFragment : BasePreferenceFragment(), |
|
|
|
.show { |
|
|
|
.show { |
|
|
|
putPrefInt(PreferKey.webPort, it) |
|
|
|
putPrefInt(PreferKey.webPort, it) |
|
|
|
} |
|
|
|
} |
|
|
|
PreferKey.cleanCache -> { |
|
|
|
PreferKey.cleanCache -> clearCache() |
|
|
|
BookHelp.clearCache() |
|
|
|
|
|
|
|
FileUtils.deleteFile(requireActivity().cacheDir.absolutePath) |
|
|
|
|
|
|
|
toast(R.string.clear_cache_success) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
PreferKey.defaultCover -> if (getPrefString(PreferKey.defaultCover).isNullOrEmpty()) { |
|
|
|
PreferKey.defaultCover -> if (getPrefString(PreferKey.defaultCover).isNullOrEmpty()) { |
|
|
|
selectDefaultCover() |
|
|
|
selectDefaultCover() |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -145,6 +144,18 @@ class OtherConfigFragment : BasePreferenceFragment(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun clearCache() { |
|
|
|
|
|
|
|
requireContext().alert(titleResource = R.string.clear_cache, |
|
|
|
|
|
|
|
messageResource = R.string.sure_del) { |
|
|
|
|
|
|
|
okButton { |
|
|
|
|
|
|
|
BookHelp.clearCache() |
|
|
|
|
|
|
|
FileUtils.deleteFile(requireActivity().cacheDir.absolutePath) |
|
|
|
|
|
|
|
toast(R.string.clear_cache_success) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
noButton() |
|
|
|
|
|
|
|
}.show().applyTint() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun selectDefaultCover() { |
|
|
|
private fun selectDefaultCover() { |
|
|
|
val intent = Intent(Intent.ACTION_GET_CONTENT) |
|
|
|
val intent = Intent(Intent.ACTION_GET_CONTENT) |
|
|
|
intent.addCategory(Intent.CATEGORY_OPENABLE) |
|
|
|
intent.addCategory(Intent.CATEGORY_OPENABLE) |
|
|
|