Cleanup Settings code style

This commit is contained in:
tarsin committed 2023-06-02 15:35:34 +08:00
1 parent e4e04a4508
commit 3f4ca1bcbf
1 file changed
+17 -16
@@ -71,22 +71,23 @@ object Settings : DefaultPreferences() {
private var downloadFragment by stringOrNullPref("image_fragment", null)
var downloadLocation: UniFile
get() = Uri.Builder().apply {
scheme(downloadScheme)
encodedAuthority(downloadAuthority)
encodedPath(downloadPath)
encodedQuery(downloadQuery)
encodedFragment(downloadFragment)
}.build().let { UniFile.fromUri(appCtx, it) } ?: UniFile.fromFile(AppConfig.getDefaultDownloadDir())!!
set(value) {
with(value.uri) {
edit {
downloadScheme = scheme
downloadAuthority = encodedAuthority
downloadPath = encodedPath
downloadQuery = encodedQuery
downloadFragment = encodedFragment
}
get() = UniFile.fromUri(
appCtx,
Uri.Builder().apply {
scheme(downloadScheme)
encodedAuthority(downloadAuthority)
encodedPath(downloadPath)
encodedQuery(downloadQuery)
encodedFragment(downloadFragment)
}.build(),
) ?: UniFile.fromFile(AppConfig.getDefaultDownloadDir())!!
set(value) = with(value.uri) {
edit {
downloadScheme = scheme
downloadAuthority = encodedAuthority
downloadPath = encodedPath
downloadQuery = encodedQuery
downloadFragment = encodedFragment
}
}