aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/settings
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/settings')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt22
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt20
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt12
4 files changed, 31 insertions, 27 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
index 7305f9ef..07aff0aa 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
@@ -21,7 +21,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
header(R.string.theme_customization)
- text(R.string.theme, { Prefs.theme }, { Prefs.theme = it }) {
+ text(R.string.theme, Prefs::theme, { Prefs.theme = it }) {
onClick = {
materialDialogThemed {
title(R.string.theme)
@@ -52,7 +52,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
}
fun KPrefColorPicker.KPrefColorContract.dependsOnCustom() {
- enabler = { Prefs.isCustomTheme }
+ enabler = Prefs::isCustomTheme
onDisabledClick = { frostSnackbar(R.string.requires_custom_theme) }
allowCustom = true
}
@@ -61,7 +61,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
CssAssets.CUSTOM.injector.invalidate()
}
- colorPicker(R.string.text_color, { Prefs.customTextColor }, {
+ colorPicker(R.string.text_color, Prefs::customTextColor, {
Prefs.customTextColor = it
reload()
invalidateCustomTheme()
@@ -71,7 +71,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
allowCustomAlpha = false
}
- colorPicker(R.string.accent_color, { Prefs.customAccentColor }, {
+ colorPicker(R.string.accent_color, Prefs::customAccentColor, {
Prefs.customAccentColor = it
reload()
invalidateCustomTheme()
@@ -82,7 +82,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
}
- colorPicker(R.string.background_color, { Prefs.customBackgroundColor }, {
+ colorPicker(R.string.background_color, Prefs::customBackgroundColor, {
Prefs.customBackgroundColor = it
bgCanvas.ripple(it, duration = 500L)
invalidateCustomTheme()
@@ -93,7 +93,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
allowCustomAlpha = true
}
- colorPicker(R.string.header_color, { Prefs.customHeaderColor }, {
+ colorPicker(R.string.header_color, Prefs::customHeaderColor, {
Prefs.customHeaderColor = it
frostNavigationBar()
toolbarCanvas.ripple(it, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L)
@@ -104,7 +104,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
allowCustomAlpha = true
}
- colorPicker(R.string.icon_color, { Prefs.customIconColor }, {
+ colorPicker(R.string.icon_color, Prefs::customIconColor, {
Prefs.customIconColor = it
invalidateOptionsMenu()
shouldRestartMain()
@@ -115,7 +115,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
header(R.string.global_customization)
- text(R.string.main_activity_layout, { Prefs.mainActivityLayoutType }, { Prefs.mainActivityLayoutType = it }) {
+ text(R.string.main_activity_layout, Prefs::mainActivityLayoutType, { Prefs.mainActivityLayoutType = it }) {
textGetter = { string(Prefs.mainActivityLayout.titleRes) }
onClick = {
materialDialogThemed {
@@ -138,14 +138,14 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
onClick = { launchTabCustomizerActivity() }
}
- checkbox(R.string.rounded_icons, { Prefs.showRoundedIcons }, {
+ checkbox(R.string.rounded_icons, Prefs::showRoundedIcons, {
Prefs.showRoundedIcons = it
setFrostResult(REQUEST_REFRESH)
}) {
descRes = R.string.rounded_icons_desc
}
- checkbox(R.string.tint_nav, { Prefs.tintNavBar }, {
+ checkbox(R.string.tint_nav, Prefs::tintNavBar, {
Prefs.tintNavBar = it
frostNavigationBar()
setFrostResult(REQUEST_NAV)
@@ -156,5 +156,5 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
list.add(KPrefTextSeekbar(
KPrefSeekbar.KPrefSeekbarBuilder(
globalOptions,
- R.string.web_text_scaling, { Prefs.webTextScaling }, { Prefs.webTextScaling = it; setFrostResult(REQUEST_TEXT_ZOOM) })))
+ R.string.web_text_scaling, Prefs::webTextScaling, { Prefs.webTextScaling = it; setFrostResult(REQUEST_TEXT_ZOOM) })))
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
index 4d0cd9d8..02a86e58 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
@@ -11,35 +11,39 @@ import com.pitchedapps.frost.utils.REQUEST_REFRESH
*/
fun SettingsActivity.getBehaviourPrefs(): KPrefAdapterBuilder.() -> Unit = {
- checkbox(R.string.fancy_animations, { Prefs.animate }, { Prefs.animate = it; animate = it }) {
+ checkbox(R.string.fancy_animations, Prefs::animate, { Prefs.animate = it; animate = it }) {
descRes = R.string.fancy_animations_desc
}
- checkbox(R.string.overlay_swipe, { Prefs.overlayEnabled }, { Prefs.overlayEnabled = it; setFrostResult(REQUEST_REFRESH) }) {
+ checkbox(R.string.overlay_swipe, Prefs::overlayEnabled, { Prefs.overlayEnabled = it; setFrostResult(REQUEST_REFRESH) }) {
descRes = R.string.overlay_swipe_desc
}
- checkbox(R.string.overlay_full_screen_swipe, { Prefs.overlayFullScreenSwipe }, { Prefs.overlayFullScreenSwipe = it }) {
+ checkbox(R.string.overlay_full_screen_swipe, Prefs::overlayFullScreenSwipe, { Prefs.overlayFullScreenSwipe = it }) {
descRes = R.string.overlay_full_screen_swipe_desc
}
- checkbox(R.string.open_links_in_default, { Prefs.linksInDefaultApp }, { Prefs.linksInDefaultApp = it }) {
+ checkbox(R.string.open_links_in_default, Prefs::linksInDefaultApp, { Prefs.linksInDefaultApp = it }) {
descRes = R.string.open_links_in_default_desc
}
- checkbox(R.string.viewpager_swipe, { Prefs.viewpagerSwipe }, { Prefs.viewpagerSwipe = it }) {
+ checkbox(R.string.viewpager_swipe, Prefs::viewpagerSwipe, { Prefs.viewpagerSwipe = it }) {
descRes = R.string.viewpager_swipe_desc
}
- checkbox(R.string.force_message_bottom, { Prefs.messageScrollToBottom }, { Prefs.messageScrollToBottom = it }) {
+ checkbox(R.string.force_message_bottom, Prefs::messageScrollToBottom, { Prefs.messageScrollToBottom = it }) {
descRes = R.string.force_message_bottom_desc
}
- checkbox(R.string.exit_confirmation, { Prefs.exitConfirmation }, { Prefs.exitConfirmation = it }) {
+ checkbox(R.string.enable_pip, Prefs::enablePip, { Prefs.enablePip = it }) {
+ descRes = R.string.enable_pip_desc
+ }
+
+ checkbox(R.string.exit_confirmation, Prefs::exitConfirmation, { Prefs.exitConfirmation = it }) {
descRes = R.string.exit_confirmation_desc
}
- checkbox(R.string.analytics, { Prefs.analytics }, { Prefs.analytics = it }) {
+ checkbox(R.string.analytics, Prefs::analytics, { Prefs.analytics = it }) {
descRes = R.string.analytics_desc
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
index d6124140..fe95e7f1 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
@@ -18,7 +18,7 @@ fun SettingsActivity.getExperimentalPrefs(): KPrefAdapterBuilder.() -> Unit = {
descRes = R.string.experimental_disclaimer_info
}
- checkbox(R.string.experimental_by_default, { Showcase.experimentalDefault }, { Showcase.experimentalDefault = it }) {
+ checkbox(R.string.experimental_by_default, Showcase::experimentalDefault, { Showcase.experimentalDefault = it }) {
descRes = R.string.experimental_by_default_desc
}
@@ -27,7 +27,7 @@ fun SettingsActivity.getExperimentalPrefs(): KPrefAdapterBuilder.() -> Unit = {
// Experimental content ends here --------------------
- checkbox(R.string.verbose_logging, { Prefs.verboseLogging }, {
+ checkbox(R.string.verbose_logging, Prefs::verboseLogging, {
Prefs.verboseLogging = it
KL.shouldLog = { it != Log.VERBOSE }
}) {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
index 00ce5116..78898eeb 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
@@ -14,7 +14,7 @@ import com.pitchedapps.frost.utils.materialDialogThemed
*/
fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
- text(R.string.newsfeed_sort, { Prefs.feedSort }, { Prefs.feedSort = it }) {
+ text(R.string.newsfeed_sort, Prefs::feedSort, { Prefs.feedSort = it }) {
descRes = R.string.newsfeed_sort_desc
onClick = {
materialDialogThemed {
@@ -32,14 +32,14 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
textGetter = { string(FeedSort(it).textRes) }
}
- checkbox(R.string.aggressive_recents, { Prefs.aggressiveRecents }, {
+ checkbox(R.string.aggressive_recents, Prefs::aggressiveRecents, {
Prefs.aggressiveRecents = it
setFrostResult(REQUEST_REFRESH)
}) {
descRes = R.string.aggressive_recents_desc
}
- checkbox(R.string.composer, { Prefs.showComposer }, {
+ checkbox(R.string.composer, Prefs::showComposer, {
Prefs.showComposer = it
setFrostResult(REQUEST_REFRESH)
}) {
@@ -48,7 +48,7 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
header(R.string.pro_features)
- checkbox(R.string.suggested_friends, { Prefs.showSuggestedFriends }, {
+ checkbox(R.string.suggested_friends, Prefs::showSuggestedFriends, {
Prefs.showSuggestedFriends = it
setFrostResult(REQUEST_REFRESH)
}) {
@@ -56,7 +56,7 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
dependsOnPro()
}
- checkbox(R.string.suggested_groups, { Prefs.showSuggestedGroups }, {
+ checkbox(R.string.suggested_groups, Prefs::showSuggestedGroups, {
Prefs.showSuggestedGroups = it
setFrostResult(REQUEST_REFRESH)
}) {
@@ -64,7 +64,7 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
dependsOnPro()
}
- checkbox(R.string.facebook_ads, { Prefs.showFacebookAds }, {
+ checkbox(R.string.facebook_ads, Prefs::showFacebookAds, {
Prefs.showFacebookAds = it
setFrostResult(REQUEST_REFRESH)
}) {