デフォルト値と同じ設定を削除するタイミングを変更。Boolean型以外の設定もデフォルト値と同じなら削除する。

This commit is contained in:
tateisu 2020-01-31 18:34:48 +09:00
parent 5a2dd5d715
commit da78c85cc6
4 changed files with 167 additions and 246 deletions

View File

@ -109,7 +109,6 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
adapter = MyAdapter() adapter = MyAdapter()
lvList.adapter = adapter lvList.adapter = adapter
load(null, null)
etSearch = findViewById<EditText>(R.id.etSearch).apply { etSearch = findViewById<EditText>(R.id.etSearch).apply {
addTextChangedListener(object : TextWatcher { addTextChangedListener(object : TextWatcher {
@ -140,8 +139,18 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
findViewById<View>(R.id.btnSearchReset).apply { findViewById<View>(R.id.btnSearchReset).apply {
setOnClickListener(this@ActAppSetting) setOnClickListener(this@ActAppSetting)
} }
val e = pref.edit()
var dirty = false
appSettingRoot.scan{
if( it.pref?.removeDefault(pref,e) ==true ) dirty = true
}
if(dirty) e.apply()
load(null, null)
} }
override fun onSaveInstanceState(outState : Bundle) { override fun onSaveInstanceState(outState : Bundle) {
super.onSaveInstanceState(outState) super.onSaveInstanceState(outState)
val sv = customShareTarget?.name val sv = customShareTarget?.name
@ -209,10 +218,10 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
private val divider = Any() private val divider = Any()
private val list = ArrayList<Any>() private val list = ArrayList<Any>()
private var lastSection : AppSettingGroup? = null private var lastSection : AppSettingItem? = null
private var lastQuery : String? = null private var lastQuery : String? = null
private fun load(section : AppSettingGroup?, query : String?) { private fun load(section : AppSettingItem?, query : String?) {
list.clear() list.clear()
var lastPath : String? = null var lastPath : String? = null
@ -239,7 +248,7 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
if(item.caption == 0) return if(item.caption == 0) return
if(item.type != SettingType.Section) { if(item.type != SettingType.Section) {
var match = getString(item.caption).contains(query, ignoreCase = true) var match = getString(item.caption).contains(query, ignoreCase = true)
if(item.type == SettingType.Group && item is AppSettingGroup) { if(item.type == SettingType.Group) {
for(child in item.items) { for(child in item.items) {
if(child.caption == 0) continue if(child.caption == 0) continue
if(getString(item.caption).contains(query, ignoreCase = true)) { if(getString(item.caption).contains(query, ignoreCase = true)) {
@ -256,15 +265,15 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
} }
} }
return return
} else if(match) { }
if(match) {
addParentPath(item) addParentPath(item)
list.add(item) list.add(item)
} }
} }
if(item is AppSettingGroup) { for(child in item.items) {
for(child in item.items) { scanGroup(level + 1, child)
scanGroup(level + 1, child)
}
} }
} }
scanGroup(0, appSettingRoot) scanGroup(0, appSettingRoot)
@ -283,12 +292,12 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
// show section page // show section page
lastSection = section lastSection = section
lastQuery = null lastQuery = null
fun scanGroup(level : Int, parent : AppSettingGroup?) { fun scanGroup(level : Int, parent : AppSettingItem?) {
parent ?: return parent ?: return
for(item in parent.items) { for(item in parent.items) {
list.add(divider) list.add(divider)
list.add(item) list.add(item)
if(item is AppSettingGroup) { if(item.items.isNotEmpty()) {
if(item.type == SettingType.Group) { if(item.type == SettingType.Group) {
for(child in item.items) { for(child in item.items) {
list.add(child) list.add(child)
@ -502,8 +511,8 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
} }
SettingType.CheckBox -> { SettingType.CheckBox -> {
val bp :BooleanPref = item.pref.cast() ?: error("$name has no boolean pref") val bp : BooleanPref =
if(pref.contains(bp.key) && bp(pref) == bp.defVal) pref.edit().remove(bp).apply() item.pref.cast() ?: error("$name has no boolean pref")
checkBox.vg(false) // skip animation checkBox.vg(false) // skip animation
checkBox.text = name checkBox.text = name
checkBox.isEnabled = item.enabled checkBox.isEnabled = item.enabled
@ -512,8 +521,8 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
} }
SettingType.Switch -> { SettingType.Switch -> {
val bp :BooleanPref = item.pref.cast() ?: error("$name has no boolean pref") val bp : BooleanPref =
if(pref.contains(bp.key) && bp(pref) == bp.defVal) pref.edit().remove(bp).apply() item.pref.cast() ?: error("$name has no boolean pref")
showCaption(name) showCaption(name)
swSwitch.vg(false) // skip animation swSwitch.vg(false) // skip animation
App1.setSwitchColor1(activity, pref, swSwitch) App1.setSwitchColor1(activity, pref, swSwitch)
@ -735,7 +744,7 @@ class ActAppSetting : AppCompatActivity(), ColorPickerDialogListener, View.OnCli
if(bindingBusy) return if(bindingBusy) return
val item = item ?: return val item = item ?: return
when(val pi = item.pref) { when(val pi = item.pref) {
is BooleanPref -> pref.edit().putOrRemove(pi, isChecked).apply() is BooleanPref -> pref.edit().put(pi, isChecked).apply()
else -> error("CompoundButton has no booleanPref $pi") else -> error("CompoundButton has no booleanPref $pi")
} }
item.changed.invoke(activity) item.changed.invoke(activity)

View File

@ -28,11 +28,11 @@ enum class SettingType(val id : Int) {
Section(12) Section(12)
} }
open class AppSettingItem( class AppSettingItem(
val parent : AppSettingItem?, val parent : AppSettingItem?,
val type : SettingType, val type : SettingType,
val pref : BasePref<*>?, @StringRes val caption : Int,
@StringRes val caption : Int val pref : BasePref<*>? = null
) { ) {
@StringRes @StringRes
@ -78,51 +78,20 @@ open class AppSettingItem(
var toFloat : ActAppSetting.(String) -> Float = { 0f } var toFloat : ActAppSetting.(String) -> Float = { 0f }
var fromFloat : ActAppSetting.(Float) -> String = { it.toString() } var fromFloat : ActAppSetting.(Float) -> String = { it.toString() }
companion object {
var SAMPLE_CCD_HEADER : AppSettingItem? = null
var SAMPLE_CCD_BODY : AppSettingItem? = null
var SAMPLE_FOOTER : AppSettingItem? = null
var CUSTOM_TRANSLATE : AppSettingItem? = null
var CUSTOM_SHARE_1 : AppSettingItem? = null
var CUSTOM_SHARE_2 : AppSettingItem? = null
var CUSTOM_SHARE_3 : AppSettingItem? = null
var TIMELINE_FONT : AppSettingItem? = null
var TIMELINE_FONT_BOLD : AppSettingItem? = null
var FONT_SIZE_TIMELINE : AppSettingItem? = null
var FONT_SIZE_NOTIFICATION_TL : AppSettingItem? = null
}
}
class AppSettingGroup(
parent : AppSettingGroup?,
type : SettingType,
@StringRes caption : Int
) : AppSettingItem(
parent = parent,
type = type,
pref = null,
caption = caption
) {
val items = ArrayList<AppSettingItem>() val items = ArrayList<AppSettingItem>()
fun section( fun section(
@StringRes caption : Int, @StringRes caption : Int,
initializer : AppSettingGroup.() -> Unit = {} initializer : AppSettingItem.() -> Unit = {}
) { ) {
items.add(AppSettingGroup(this, SettingType.Section, caption).apply { initializer() }) items.add(AppSettingItem(this, SettingType.Section, caption).apply { initializer() })
} }
fun group( fun group(
@StringRes caption : Int, @StringRes caption : Int,
initializer : AppSettingGroup.() -> Unit = {} initializer : AppSettingItem.() -> Unit = {}
) { ) {
items.add(AppSettingGroup(this, SettingType.Group, caption).apply { initializer() }) items.add(AppSettingItem(this, SettingType.Group, caption).apply { initializer() })
} }
fun item( fun item(
@ -131,7 +100,7 @@ class AppSettingGroup(
@StringRes caption : Int, @StringRes caption : Int,
initializer : AppSettingItem.() -> Unit = {} initializer : AppSettingItem.() -> Unit = {}
) : AppSettingItem { ) : AppSettingItem {
val item = AppSettingItem(this, type, pref, caption).apply { initializer() } val item = AppSettingItem(this, type, caption, pref).apply { initializer() }
items.add(item) items.add(item)
return item return item
} }
@ -210,9 +179,31 @@ class AppSettingGroup(
this.sampleUpdate = sampleUpdate this.sampleUpdate = sampleUpdate
} }
fun scan(block:(AppSettingItem)->Unit){
block(this)
for( item in items) item.scan(block)
}
companion object {
var SAMPLE_CCD_HEADER : AppSettingItem? = null
var SAMPLE_CCD_BODY : AppSettingItem? = null
var SAMPLE_FOOTER : AppSettingItem? = null
var CUSTOM_TRANSLATE : AppSettingItem? = null
var CUSTOM_SHARE_1 : AppSettingItem? = null
var CUSTOM_SHARE_2 : AppSettingItem? = null
var CUSTOM_SHARE_3 : AppSettingItem? = null
var TIMELINE_FONT : AppSettingItem? = null
var TIMELINE_FONT_BOLD : AppSettingItem? = null
var FONT_SIZE_TIMELINE : AppSettingItem? = null
var FONT_SIZE_NOTIFICATION_TL : AppSettingItem? = null
}
} }
val appSettingRoot = AppSettingGroup(null, SettingType.Section, R.string.app_setting).apply { val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_setting).apply {
section(R.string.notifications) { section(R.string.notifications) {

View File

@ -7,10 +7,10 @@ import androidx.preference.PreferenceManager
import jp.juggler.util.optInt import jp.juggler.util.optInt
@Suppress("EqualsOrHashCode") @Suppress("EqualsOrHashCode")
abstract class BasePref<T>(val key : String) { abstract class BasePref<T>(val key : String,val defVal : T) {
init { init {
if( Pref.map[key] != null ) if(Pref.map[key] != null)
error("Preference key duplicate: ${key}") error("Preference key duplicate: ${key}")
else else
@Suppress("LeakingThis") @Suppress("LeakingThis")
@ -32,114 +32,97 @@ abstract class BasePref<T>(val key : String) {
return invoke(Pref.pref(context)) return invoke(Pref.pref(context))
} }
fun removeDefault(pref : SharedPreferences, e : SharedPreferences.Editor) :Boolean{
if(pref.contains(key) && this.invoke(pref) == defVal){
e.remove(key)
return true
}
return false
}
} }
fun SharedPreferences.Editor.remove(item : BasePref<*>) : SharedPreferences.Editor { fun SharedPreferences.Editor.remove(item : BasePref<*>) : SharedPreferences.Editor {
item.remove(this) item.remove(this)
return this return this
} }
class BooleanPref( class BooleanPref(key : String,defVal:Boolean)
key : String, : BasePref<Boolean>(key,defVal) {
val defVal : Boolean,
val id : Int =0
) : BasePref<Boolean>(key) {
override operator fun invoke(pref : SharedPreferences) : Boolean { override operator fun invoke(pref : SharedPreferences) : Boolean {
return pref.getBoolean(key, defVal) return pref.getBoolean(key, defVal)
} }
override fun put(editor : SharedPreferences.Editor, v : Boolean) {
editor.putBoolean(key, v)
}
// put if value is not default, remove if value is same to default // put if value is not default, remove if value is same to default
fun putOrRemove(editor : SharedPreferences.Editor, v : Boolean) { override fun put(editor : SharedPreferences.Editor, v : Boolean) {
if( v != defVal) { if(v == defVal) editor.remove(key) else editor.putBoolean(key, v)
editor.putBoolean(key, v)
}else{
editor.remove(key)
}
} }
} }
class IntPref(key : String, val defVal : Int) : BasePref<Int>(key) { class IntPref(key : String,defVal : Int) : BasePref<Int>(key,defVal) {
override operator fun invoke(pref : SharedPreferences) : Int { override operator fun invoke(pref : SharedPreferences) : Int {
return pref.getInt(key, defVal) return pref.getInt(key, defVal)
} }
override fun put(editor : SharedPreferences.Editor, v : Int) { override fun put(editor : SharedPreferences.Editor, v : Int) {
editor.putInt(key, v) if(v == defVal) editor.remove(key) else editor.putInt(key, v)
} }
} }
class LongPref(key : String, private val defVal : Long) : BasePref<Long>(key) { class LongPref(key : String, defVal : Long) : BasePref<Long>(key,defVal) {
override operator fun invoke(pref : SharedPreferences) : Long { override operator fun invoke(pref : SharedPreferences) : Long {
return pref.getLong(key, defVal) return pref.getLong(key, defVal)
} }
override fun put(editor : SharedPreferences.Editor, v : Long) { override fun put(editor : SharedPreferences.Editor, v : Long) {
editor.putLong(key, v) if(v == defVal) editor.remove(key) else editor.putLong(key, v)
} }
} }
class FloatPref(key : String, private val defVal : Float) : BasePref<Float>(key) { class FloatPref(key : String, defVal : Float) : BasePref<Float>(key,defVal) {
override operator fun invoke(pref : SharedPreferences) : Float { override operator fun invoke(pref : SharedPreferences) : Float {
return pref.getFloat(key, defVal) return pref.getFloat(key, defVal)
} }
override fun put(editor : SharedPreferences.Editor, v : Float) { override fun put(editor : SharedPreferences.Editor, v : Float) {
editor.putFloat(key, v) if(v == defVal) editor.remove(key) else editor.putFloat(key, v)
} }
} }
class StringPref( class StringPref(
key : String, key : String,
val defVal : String, defVal : String,
val skipImport : Boolean = false val skipImport : Boolean = false
) : BasePref<String>(key) { ) : BasePref<String>(key,defVal) {
override operator fun invoke(pref : SharedPreferences) : String { override operator fun invoke(pref : SharedPreferences) : String {
return pref.getString(key,defVal) ?: defVal return pref.getString(key, defVal) ?: defVal
} }
override fun put(editor : SharedPreferences.Editor, v : String) { override fun put(editor : SharedPreferences.Editor, v : String) {
editor.putString(key, v) if(v == defVal) editor.remove(key) else editor.putString(key, v)
} }
fun toInt(pref : SharedPreferences) = invoke(pref).optInt() ?: defVal.toInt() fun toInt(pref : SharedPreferences) = invoke(pref).optInt() ?: defVal.toInt()
} }
fun SharedPreferences.Editor.put(item : BooleanPref, v : Boolean) : SharedPreferences.Editor { fun SharedPreferences.Editor.put(item : BooleanPref, v : Boolean) =
item.put(this, v) this.apply { item.put(this, v) }
return this
}
fun SharedPreferences.Editor.putOrRemove(item : BooleanPref, v : Boolean) : SharedPreferences.Editor {
item.putOrRemove(this, v)
return this
}
fun SharedPreferences.Editor.put(item : StringPref, v : String) : SharedPreferences.Editor { fun SharedPreferences.Editor.put(item : StringPref, v : String) =
item.put(this, v) this.apply { item.put(this, v) }
return this
}
fun SharedPreferences.Editor.put(item : IntPref, v : Int) : SharedPreferences.Editor { fun SharedPreferences.Editor.put(item : IntPref, v : Int) =
item.put(this, v) this.apply { item.put(this, v) }
return this
}
fun SharedPreferences.Editor.put(item : LongPref, v : Long) : SharedPreferences.Editor { fun SharedPreferences.Editor.put(item : LongPref, v : Long) =
item.put(this, v) this.apply { item.put(this, v) }
return this
}
fun SharedPreferences.Editor.put(item : FloatPref, v : Float) : SharedPreferences.Editor { fun SharedPreferences.Editor.put(item : FloatPref, v : Float) =
item.put(this, v) this.apply { item.put(this, v) }
return this
}
object Pref { object Pref {
@ -147,364 +130,302 @@ object Pref {
return PreferenceManager.getDefaultSharedPreferences(context) return PreferenceManager.getDefaultSharedPreferences(context)
} }
// キー名と設定項目のマップ。インポートやアプリ設定で使う // キー名と設定項目のマップ。インポートやアプリ設定で使う
val map = HashMap<String, BasePref<*>>() val map = HashMap<String, BasePref<*>>()
// boolean // boolean
val bpDisableEmojiAnimation = BooleanPref( val bpDisableEmojiAnimation = BooleanPref(
"disable_emoji_animation", "disable_emoji_animation",
false, false
R.id.swDisableEmojiAnimation
) )
// val bpDisableFastScroller = BooleanPref("disable_fast_scroller", true, 0) // R.id.swDisableFastScroller) // val bpDisableFastScroller = BooleanPref("disable_fast_scroller", true, 0) // R.id.swDisableFastScroller)
val bpDisableTabletMode = BooleanPref( val bpDisableTabletMode = BooleanPref(
"disable_tablet_mode", "disable_tablet_mode",
false, false
R.id.swDisableTabletMode
) )
val bpDontConfirmBeforeCloseColumn = BooleanPref( val bpDontConfirmBeforeCloseColumn = BooleanPref(
"DontConfirmBeforeCloseColumn", "DontConfirmBeforeCloseColumn",
false, false
R.id.swDontConfirmBeforeCloseColumn
) )
val bpDontCropMediaThumb = BooleanPref( val bpDontCropMediaThumb = BooleanPref(
"DontCropMediaThumb", "DontCropMediaThumb",
false, false
R.id.swDontCropMediaThumb
) )
val bpDontDuplicationCheck = BooleanPref( val bpDontDuplicationCheck = BooleanPref(
"dont_duplication_check", "dont_duplication_check",
false, false
R.id.swDontDuplicationCheck
) )
val bpDontRefreshOnResume = BooleanPref( val bpDontRefreshOnResume = BooleanPref(
"dont_refresh_on_resume", "dont_refresh_on_resume",
false, false
R.id.swDontRefreshOnResume
) )
val bpDontRound = BooleanPref( val bpDontRound = BooleanPref(
"dont_round", "dont_round",
false, false
R.id.swDontRound
) )
val bpDontScreenOff = BooleanPref( val bpDontScreenOff = BooleanPref(
"dont_screen_off", "dont_screen_off",
false, false
R.id.swDontScreenOff
) )
val bpDontUseActionButtonWithQuickTootBar = BooleanPref( val bpDontUseActionButtonWithQuickTootBar = BooleanPref(
"dont_use_action_button", "dont_use_action_button",
false, false
R.id.swDontUseActionButtonWithQuickTootBar
) )
val bpDontUseStreaming = BooleanPref( val bpDontUseStreaming = BooleanPref(
"dont_use_streaming", "dont_use_streaming",
false, false
R.id.swDontUseStreaming
) )
val bpEnableGifAnimation = BooleanPref( val bpEnableGifAnimation = BooleanPref(
"enable_gif_animation", "enable_gif_animation",
false, false
R.id.swEnableGifAnimation
) )
val bpExitAppWhenCloseProtectedColumn = BooleanPref( val bpExitAppWhenCloseProtectedColumn = BooleanPref(
"ExitAppWhenCloseProtectedColumn", "ExitAppWhenCloseProtectedColumn",
false, false
R.id.swExitAppWhenCloseProtectedColumn
) )
val bpMentionFullAcct = BooleanPref( val bpMentionFullAcct = BooleanPref(
"mention_full_acct", "mention_full_acct",
false, false
R.id.swMentionFullAcct
) )
val bpNotificationLED = BooleanPref( val bpNotificationLED = BooleanPref(
"notification_led", "notification_led",
true, true
R.id.cbNotificationLED
) )
val bpNotificationSound = BooleanPref( val bpNotificationSound = BooleanPref(
"notification_sound", "notification_sound",
true, true
R.id.cbNotificationSound
) )
val bpNotificationVibration = BooleanPref( val bpNotificationVibration = BooleanPref(
"notification_vibration", "notification_vibration",
true, true
R.id.cbNotificationVibration
) )
val bpPostButtonBarTop = BooleanPref( val bpPostButtonBarTop = BooleanPref(
"post_button_bar_at_top", "post_button_bar_at_top",
true, true
R.id.swPostButtonBarTop
) )
val bpPriorChrome = BooleanPref( val bpPriorChrome = BooleanPref(
"prior_chrome", "prior_chrome",
true, true
R.id.swPriorChrome
) )
val bpDontUseCustomTabs = BooleanPref( val bpDontUseCustomTabs = BooleanPref(
"DontUseCustomTabs", "DontUseCustomTabs",
false, false
R.id.swDontUseCustomTabs
) )
val bpPriorLocalURL = BooleanPref( val bpPriorLocalURL = BooleanPref(
"prior_local_url", "prior_local_url",
false, false
R.id.swPriorLocalURL
) )
val bpQuickTootBar = BooleanPref( val bpQuickTootBar = BooleanPref(
"quick_toot_bar", "quick_toot_bar",
false, false
R.id.swQuickTootBar
) )
val bpRelativeTimestamp = BooleanPref( val bpRelativeTimestamp = BooleanPref(
"relative_timestamp", "relative_timestamp",
true, true
R.id.swRelativeTimestamp
) )
val bpShortAcctLocalUser = BooleanPref( val bpShortAcctLocalUser = BooleanPref(
"short_acct_local_user", "short_acct_local_user",
true, true
R.id.swShortAcctLocalUser
) )
val bpShowFollowButtonInButtonBar = BooleanPref( val bpShowFollowButtonInButtonBar = BooleanPref(
"ShowFollowButtonInButtonBar", "ShowFollowButtonInButtonBar",
false, false
R.id.swShowFollowButtonInButtonBar
) )
val bpSimpleList = BooleanPref( val bpSimpleList = BooleanPref(
"simple_list", "simple_list",
true, true
R.id.swSimpleList
) )
val bpUseInternalMediaViewer = BooleanPref( val bpUseInternalMediaViewer = BooleanPref(
"use_internal_media_viewer", "use_internal_media_viewer",
true, true
R.id.swUseInternalMediaViewer
) )
val bpShowAppName = BooleanPref( val bpShowAppName = BooleanPref(
"show_app_name", "show_app_name",
false, false
R.id.swShowAppName
) )
val bpShowLanguage = BooleanPref( val bpShowLanguage = BooleanPref(
"ShowLanguage", "ShowLanguage",
false, false
R.id.swShowLanguage
) )
val bpForceGap = BooleanPref( val bpForceGap = BooleanPref(
"force_gap", "force_gap",
false, false
R.id.swForceGap
) )
val bpShareViewPool = BooleanPref( val bpShareViewPool = BooleanPref(
"ShareViewPool", "ShareViewPool",
true, true
R.id.swShareViewPool
) )
val bpAllowColumnDuplication = BooleanPref( val bpAllowColumnDuplication = BooleanPref(
"AllowColumnDuplication", "AllowColumnDuplication",
true, true
R.id.swShareViewPool
) )
val bpAppendAttachmentUrlToContent = BooleanPref( val bpAppendAttachmentUrlToContent = BooleanPref(
"AppendAttachmentUrlToContent", "AppendAttachmentUrlToContent",
false, false
R.id.swAppendAttachmentUrlToContent
) )
val bpVerticalArrangeThumbnails = BooleanPref( val bpVerticalArrangeThumbnails = BooleanPref(
"VerticalArrangeThumbnails", "VerticalArrangeThumbnails",
false, false
R.id.swVerticalArrangeThumbnails
) )
val bpDontShowPreviewCard = BooleanPref( val bpDontShowPreviewCard = BooleanPref(
"DontShowPreviewCard", "DontShowPreviewCard",
false, false
R.id.swDontShowPreviewCard
) )
val bpScrollTopFromColumnStrip = BooleanPref( val bpScrollTopFromColumnStrip = BooleanPref(
"ScrollTopFromColumnStrip", "ScrollTopFromColumnStrip",
false, false
R.id.swScrollTopFromColumnStrip
) )
val bpInstanceTicker = BooleanPref( val bpInstanceTicker = BooleanPref(
"InstanceTicker", "InstanceTicker",
false, false
R.id.swInstanceTicker
) )
val bpLinksInContextMenu = BooleanPref( val bpLinksInContextMenu = BooleanPref(
"LinksInContextMenu", "LinksInContextMenu",
false, false
R.id.swLinksInContextMenu
) )
val bpMoveNotificationsQuickFilter = BooleanPref( val bpMoveNotificationsQuickFilter = BooleanPref(
"MoveNotificationsQuickFilter", "MoveNotificationsQuickFilter",
false, false
R.id.swMoveNotificationsQuickFilter
) )
val bpShowAcctInSystemNotification = BooleanPref( val bpShowAcctInSystemNotification = BooleanPref(
"ShowAcctInSystemNotification", "ShowAcctInSystemNotification",
false, false
R.id.swShowAcctInSystemNotification
) )
val bpShowLinkUnderline = BooleanPref( val bpShowLinkUnderline = BooleanPref(
"ShowLinkUnderline", "ShowLinkUnderline",
false, false
R.id.swShowLinkUnderline
) )
val bpShowSearchClear = BooleanPref( val bpShowSearchClear = BooleanPref(
"ShowSearchClear", "ShowSearchClear",
false, false
R.id.swShowSearchClear
) )
val bpDontRemoveDeletedToot = BooleanPref( val bpDontRemoveDeletedToot = BooleanPref(
"DontRemoveDeletedToot", "DontRemoveDeletedToot",
false, false
R.id.swDontRemoveDeletedToot
) )
val bpDontShowColumnBackgroundImage = BooleanPref( val bpDontShowColumnBackgroundImage = BooleanPref(
"DontShowColumnBackgroundImage", "DontShowColumnBackgroundImage",
false, false
R.id.swDontShowColumnBackgroundImage
) )
val bpCustomEmojiSeparatorZwsp = BooleanPref( val bpCustomEmojiSeparatorZwsp = BooleanPref(
"CustomEmojiSeparatorZwsp", "CustomEmojiSeparatorZwsp",
false, false
R.id.swCustomEmojiSeparatorZwsp
) )
val bpShowTranslateButton = BooleanPref( val bpShowTranslateButton = BooleanPref(
"ShowTranslateButton", "ShowTranslateButton",
false, false
R.id.swShowTranslateButton
) )
val bpDirectoryLastActive = BooleanPref( val bpDirectoryLastActive = BooleanPref(
"DirectoryLastActive", "DirectoryLastActive",
true, true
R.id.swDirectoryLastActive
) )
val bpDirectoryFollowers = BooleanPref( val bpDirectoryFollowers = BooleanPref(
"DirectoryFollowers", "DirectoryFollowers",
true, true
R.id.swDirectoryFollowers
) )
val bpDirectoryTootCount = BooleanPref( val bpDirectoryTootCount = BooleanPref(
"DirectoryTootCount", "DirectoryTootCount",
true, true
R.id.swDirectoryTootCount
) )
val bpDirectoryNote = BooleanPref( val bpDirectoryNote = BooleanPref(
"DirectoryNote", "DirectoryNote",
true, true
R.id.swDirectoryNote
) )
val bpWarnHashtagAsciiAndNonAscii = BooleanPref( val bpWarnHashtagAsciiAndNonAscii = BooleanPref(
"WarnHashtagAsciiAndNonAscii", "WarnHashtagAsciiAndNonAscii",
false, false
R.id.swWarnHashtagAsciiAndNonAscii
) )
val bpEnablePixelfed = BooleanPref( val bpEnablePixelfed = BooleanPref(
"EnablePixelfed", "EnablePixelfed",
false, false
R.id.swEnablePixelfed
) )
val bpQuickTootOmitAccountSelection = BooleanPref( val bpQuickTootOmitAccountSelection = BooleanPref(
"QuickTootOmitAccountSelection", "QuickTootOmitAccountSelection",
false, false
R.id.swQuickTootOmitAccountSelection
) )
val bpSeparateReplyNotificationGroup = BooleanPref( val bpSeparateReplyNotificationGroup = BooleanPref(
"SeparateReplyNotificationGroup", "SeparateReplyNotificationGroup",
false, false
R.id.swSeparateReplyNotificationGroup
) )
val bpAlwaysExpandContextMenuItems = BooleanPref( val bpAlwaysExpandContextMenuItems = BooleanPref(
"AlwaysExpandContextMenuItems", "AlwaysExpandContextMenuItems",
false, false
R.id.swAlwaysExpandContextMenuItems
) )
val bpShowBookmarkButton = BooleanPref( val bpShowBookmarkButton = BooleanPref(
"ShowBookmarkButton2", "ShowBookmarkButton2",
true, true
R.id.swShowBookmarkButton
) )
val bpShowFilteredWord = BooleanPref( val bpShowFilteredWord = BooleanPref(
"ShowFilteredWord", "ShowFilteredWord",
false, false
R.id.swShowFilteredWord
) )
val bpEnableDomainTimeline = BooleanPref( val bpEnableDomainTimeline = BooleanPref(
"EnableDomainTimeline", "EnableDomainTimeline",
false, false
R.id.swEnableDomainTimeline
) )
val bpDivideNotification = BooleanPref( val bpDivideNotification = BooleanPref(
"DivideNotification", "DivideNotification",
false, false
R.id.swDivideNotification
) )
val bpHideFollowCount = BooleanPref( val bpHideFollowCount = BooleanPref(
"HideFollowCount", "HideFollowCount",
false, false
R.id.swHideFollowCount
) )
val bpEmojioneShortcode = BooleanPref( val bpEmojioneShortcode = BooleanPref(
"EmojioneShortcode", "EmojioneShortcode",
true, true
R.id.swEmojioneShortcode
) )
// int // int
@ -519,7 +440,7 @@ object Pref {
val ipUiTheme = IntPref("ui_theme", 0) val ipUiTheme = IntPref("ui_theme", 0)
val ipResizeImage = IntPref("resize_image", 4) val ipResizeImage = IntPref("resize_image", 4)
val ipRepliesCount = IntPref("RepliesCount",0) val ipRepliesCount = IntPref("RepliesCount", 0)
const val RC_SIMPLE = 0 const val RC_SIMPLE = 0
const val RC_ACTUAL = 1 const val RC_ACTUAL = 1
@Suppress("unused") @Suppress("unused")
@ -542,8 +463,7 @@ object Pref {
const val ABP_BOTTOM = 1 const val ABP_BOTTOM = 1
const val ABP_START = 2 const val ABP_START = 2
const val ABP_END = 3 const val ABP_END = 3
val ipAdditionalButtonsPosition = IntPref( "AdditionalButtonsPosition",ABP_END) val ipAdditionalButtonsPosition = IntPref("AdditionalButtonsPosition", ABP_END)
val ipFooterButtonBgColor = IntPref("footer_button_bg_color", 0) val ipFooterButtonBgColor = IntPref("footer_button_bg_color", 0)
val ipFooterButtonFgColor = IntPref("footer_button_fg_color", 0) val ipFooterButtonFgColor = IntPref("footer_button_fg_color", 0)
@ -558,7 +478,8 @@ object Pref {
const val JWCP_DEFAULT = 0 const val JWCP_DEFAULT = 0
const val JWCP_START = 1 const val JWCP_START = 1
const val JWCP_END = 2 const val JWCP_END = 2
val ipJustifyWindowContentPortrait = IntPref("JustifyWindowContentPortrait", 0) // 0=default,1=start,2=end val ipJustifyWindowContentPortrait =
IntPref("JustifyWindowContentPortrait", 0) // 0=default,1=start,2=end
val ipLinkColor = IntPref("LinkColor", 0) val ipLinkColor = IntPref("LinkColor", 0)
@ -589,8 +510,8 @@ object Pref {
val ipCcdContentText = IntPref("ipCcdContentText", 0) val ipCcdContentText = IntPref("ipCcdContentText", 0)
// val ipTrendTagCountShowing = IntPref("TrendTagCountShowing", 0) // val ipTrendTagCountShowing = IntPref("TrendTagCountShowing", 0)
// const val TTCS_WEEKLY = 0 // const val TTCS_WEEKLY = 0
// const val TTCS_DAILY = 1 // const val TTCS_DAILY = 1
// string // string
val spColumnWidth = StringPref("ColumnWidth", "") val spColumnWidth = StringPref("ColumnWidth", "")
@ -621,19 +542,19 @@ object Pref {
val spUserAgent = StringPref("UserAgent", "") val spUserAgent = StringPref("UserAgent", "")
val spMediaReadTimeout = StringPref("spMediaReadTimeout", "60") val spMediaReadTimeout = StringPref("spMediaReadTimeout", "60")
val spAgreedPrivacyPolicyDigest= StringPref("spAgreedPrivacyPolicyDigest", "") val spAgreedPrivacyPolicyDigest = StringPref("spAgreedPrivacyPolicyDigest", "")
val spTimeZone = StringPref("TimeZone","") val spTimeZone = StringPref("TimeZone", "")
val spQuickTootMacro = StringPref("QuickTootMacro","") val spQuickTootMacro = StringPref("QuickTootMacro", "")
val spQuickTootVisibility = StringPref("QuickTootVisibility","") val spQuickTootVisibility = StringPref("QuickTootVisibility", "")
val spTranslateAppComponent = StringPref("TranslateAppComponent","") val spTranslateAppComponent = StringPref("TranslateAppComponent", "")
val spCustomShare1 = StringPref("CustomShare1","") val spCustomShare1 = StringPref("CustomShare1", "")
val spCustomShare2 = StringPref("CustomShare2","") val spCustomShare2 = StringPref("CustomShare2", "")
val spCustomShare3 = StringPref("CustomShare3","") val spCustomShare3 = StringPref("CustomShare3", "")
val spTimelineSpacing = StringPref("TimelineSpacing","") val spTimelineSpacing = StringPref("TimelineSpacing", "")
// long // long
val lpTabletTootDefaultAccount = LongPref("tablet_toot_default_account", - 1L) val lpTabletTootDefaultAccount = LongPref("tablet_toot_default_account", - 1L)

View File

@ -40,5 +40,5 @@ public interface ColorPickerDialogListener {
* The dialog id used to create the dialog instance. * The dialog id used to create the dialog instance.
*/ */
void onDialogDismissed(int dialogId); void onDialogDismissed(int dialogId);
} }