1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
package com.pitchedapps.frost.settings
import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
import ca.allanwang.kau.utils.string
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.MainActivity
import com.pitchedapps.frost.activities.SettingsActivity
import com.pitchedapps.frost.enums.FeedSort
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.launchWebOverlay
import com.pitchedapps.frost.utils.materialDialogThemed
/**
* Created by Allan Wang on 2017-06-29.
*/
fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
text(R.string.newsfeed_sort, { Prefs.feedSort }, { Prefs.feedSort = it }) {
descRes = R.string.newsfeed_sort_desc
onClick = { _, _, item ->
materialDialogThemed {
title(R.string.newsfeed_sort)
items(FeedSort.values().map { string(it.textRes) })
itemsCallbackSingleChoice(item.pref, { _, _, which, _ ->
if (item.pref != which) {
item.pref = which
shouldRestartMain()
}
true
})
}
true
}
textGetter = { string(FeedSort(it).textRes) }
}
checkbox(R.string.aggressive_recents, { Prefs.aggressiveRecents }, {
Prefs.aggressiveRecents = it
setFrostResult(MainActivity.REQUEST_REFRESH)
}) {
descRes = R.string.aggressive_recents_desc
}
plainText(R.string.autoplay_settings) {
descRes = R.string.autoplay_settings_desc
onClick = { _, _, _ -> launchWebOverlay("https://touch.facebook.com/settings/videos"); true }
}
checkbox(R.string.composer, { Prefs.showComposer }, {
Prefs.showComposer = it
setFrostResult(MainActivity.REQUEST_REFRESH)
}) {
descRes = R.string.composer_desc
}
header(R.string.pro_features)
checkbox(R.string.suggested_friends, { Prefs.showSuggestedFriends }, {
Prefs.showSuggestedFriends = it
setFrostResult(MainActivity.REQUEST_REFRESH)
}) {
descRes = R.string.suggested_friends_desc
dependsOnPro()
}
checkbox(R.string.suggested_groups, { Prefs.showSuggestedGroups }, {
Prefs.showSuggestedGroups = it
setFrostResult(MainActivity.REQUEST_REFRESH)
}) {
descRes = R.string.suggested_groups_desc
dependsOnPro()
}
checkbox(R.string.facebook_ads, { Prefs.showFacebookAds }, {
Prefs.showFacebookAds = it
setFrostResult(MainActivity.REQUEST_REFRESH)
}) {
descRes = R.string.facebook_ads_desc
dependsOnPro()
}
}
|