2018-01-04 19:52:25 +01:00
|
|
|
package jp.juggler.subwaytooter
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.SharedPreferences
|
2019-07-23 20:48:21 +02:00
|
|
|
import android.graphics.Color
|
2019-09-12 15:43:11 +02:00
|
|
|
import androidx.preference.PreferenceManager
|
2018-12-01 00:02:18 +01:00
|
|
|
import jp.juggler.util.optInt
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
@Suppress("EqualsOrHashCode")
|
2020-01-31 12:49:54 +01:00
|
|
|
abstract class BasePref<T>(val key : String, val defVal : T) {
|
2018-01-17 02:16:26 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
init {
|
2020-01-31 10:34:48 +01:00
|
|
|
if(Pref.map[key] != null)
|
2019-05-05 06:41:13 +02:00
|
|
|
error("Preference key duplicate: ${key}")
|
|
|
|
else
|
|
|
|
@Suppress("LeakingThis")
|
|
|
|
Pref.map[key] = this
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
override fun equals(other : Any?) : Boolean {
|
|
|
|
return this === other
|
|
|
|
}
|
|
|
|
|
|
|
|
fun remove(e : SharedPreferences.Editor) {
|
|
|
|
e.remove(key)
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract fun put(editor : SharedPreferences.Editor, v : T)
|
|
|
|
abstract fun invoke(pref : SharedPreferences) : T
|
|
|
|
|
|
|
|
operator fun invoke(context : Context) : T {
|
|
|
|
return invoke(Pref.pref(context))
|
|
|
|
}
|
|
|
|
|
2020-01-31 12:49:54 +01:00
|
|
|
fun removeDefault(pref : SharedPreferences, e : SharedPreferences.Editor) : Boolean {
|
|
|
|
if(pref.contains(key) && this.invoke(pref) == defVal) {
|
2020-01-31 10:34:48 +01:00
|
|
|
e.remove(key)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
2018-09-14 19:26:24 +02:00
|
|
|
}
|
2020-01-31 10:34:48 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
fun SharedPreferences.Editor.remove(item : BasePref<*>) : SharedPreferences.Editor {
|
|
|
|
item.remove(this)
|
|
|
|
return this
|
|
|
|
}
|
|
|
|
|
2020-01-31 12:49:54 +01:00
|
|
|
class BooleanPref(key : String, defVal : Boolean) : BasePref<Boolean>(key, defVal) {
|
2018-09-14 19:26:24 +02:00
|
|
|
|
|
|
|
override operator fun invoke(pref : SharedPreferences) : Boolean {
|
|
|
|
return pref.getBoolean(key, defVal)
|
|
|
|
}
|
2018-01-17 02:27:56 +01:00
|
|
|
|
2020-01-28 03:44:08 +01:00
|
|
|
// put if value is not default, remove if value is same to default
|
2020-01-31 10:34:48 +01:00
|
|
|
override fun put(editor : SharedPreferences.Editor, v : Boolean) {
|
|
|
|
if(v == defVal) editor.remove(key) else editor.putBoolean(key, v)
|
2020-01-28 03:44:08 +01:00
|
|
|
}
|
2018-09-14 19:26:24 +02:00
|
|
|
}
|
|
|
|
|
2020-01-31 12:49:54 +01:00
|
|
|
class IntPref(key : String, defVal : Int) : BasePref<Int>(key, defVal) {
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
override operator fun invoke(pref : SharedPreferences) : Int {
|
|
|
|
return pref.getInt(key, defVal)
|
2018-01-17 02:16:26 +01:00
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
override fun put(editor : SharedPreferences.Editor, v : Int) {
|
2020-01-31 10:34:48 +01:00
|
|
|
if(v == defVal) editor.remove(key) else editor.putInt(key, v)
|
2018-01-17 02:16:26 +01:00
|
|
|
}
|
2018-09-14 19:26:24 +02:00
|
|
|
}
|
|
|
|
|
2020-01-31 12:49:54 +01:00
|
|
|
class LongPref(key : String, defVal : Long) : BasePref<Long>(key, defVal) {
|
2018-09-14 19:26:24 +02:00
|
|
|
|
|
|
|
override operator fun invoke(pref : SharedPreferences) : Long {
|
|
|
|
return pref.getLong(key, defVal)
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun put(editor : SharedPreferences.Editor, v : Long) {
|
2020-01-31 10:34:48 +01:00
|
|
|
if(v == defVal) editor.remove(key) else editor.putLong(key, v)
|
2018-09-14 19:26:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-31 12:49:54 +01:00
|
|
|
class FloatPref(key : String, defVal : Float) : BasePref<Float>(key, defVal) {
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
override operator fun invoke(pref : SharedPreferences) : Float {
|
|
|
|
return pref.getFloat(key, defVal)
|
2018-01-17 02:16:26 +01:00
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
override fun put(editor : SharedPreferences.Editor, v : Float) {
|
2020-01-31 10:34:48 +01:00
|
|
|
if(v == defVal) editor.remove(key) else editor.putFloat(key, v)
|
2018-09-14 19:26:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class StringPref(
|
|
|
|
key : String,
|
2020-01-31 10:34:48 +01:00
|
|
|
defVal : String,
|
2018-09-14 19:26:24 +02:00
|
|
|
val skipImport : Boolean = false
|
2020-01-31 12:49:54 +01:00
|
|
|
) : BasePref<String>(key, defVal) {
|
2018-09-14 19:26:24 +02:00
|
|
|
|
|
|
|
override operator fun invoke(pref : SharedPreferences) : String {
|
2020-01-31 10:34:48 +01:00
|
|
|
return pref.getString(key, defVal) ?: defVal
|
2018-01-17 02:16:26 +01:00
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
override fun put(editor : SharedPreferences.Editor, v : String) {
|
2020-01-31 10:34:48 +01:00
|
|
|
if(v == defVal) editor.remove(key) else editor.putString(key, v)
|
2018-01-17 02:16:26 +01:00
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
fun toInt(pref : SharedPreferences) = invoke(pref).optInt() ?: defVal.toInt()
|
|
|
|
}
|
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
fun SharedPreferences.Editor.put(item : BooleanPref, v : Boolean) =
|
|
|
|
this.apply { item.put(this, v) }
|
2018-09-14 19:26:24 +02:00
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
fun SharedPreferences.Editor.put(item : StringPref, v : String) =
|
|
|
|
this.apply { item.put(this, v) }
|
2018-09-14 19:26:24 +02:00
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
fun SharedPreferences.Editor.put(item : IntPref, v : Int) =
|
|
|
|
this.apply { item.put(this, v) }
|
2018-09-14 19:26:24 +02:00
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
fun SharedPreferences.Editor.put(item : LongPref, v : Long) =
|
|
|
|
this.apply { item.put(this, v) }
|
2018-09-14 19:26:24 +02:00
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
fun SharedPreferences.Editor.put(item : FloatPref, v : Float) =
|
|
|
|
this.apply { item.put(this, v) }
|
2018-09-14 19:26:24 +02:00
|
|
|
|
|
|
|
object Pref {
|
|
|
|
|
|
|
|
fun pref(context : Context) : SharedPreferences {
|
|
|
|
return PreferenceManager.getDefaultSharedPreferences(context)
|
|
|
|
}
|
|
|
|
|
|
|
|
// キー名と設定項目のマップ。インポートやアプリ設定で使う
|
|
|
|
val map = HashMap<String, BasePref<*>>()
|
|
|
|
|
2018-01-17 02:16:26 +01:00
|
|
|
// boolean
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
val bpDisableEmojiAnimation = BooleanPref(
|
|
|
|
"disable_emoji_animation",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// val bpDisableFastScroller = BooleanPref("disable_fast_scroller", true, 0) // R.id.swDisableFastScroller)
|
|
|
|
|
|
|
|
val bpDisableTabletMode = BooleanPref(
|
|
|
|
"disable_tablet_mode",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontConfirmBeforeCloseColumn = BooleanPref(
|
|
|
|
"DontConfirmBeforeCloseColumn",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontCropMediaThumb = BooleanPref(
|
|
|
|
"DontCropMediaThumb",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontDuplicationCheck = BooleanPref(
|
|
|
|
"dont_duplication_check",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontRefreshOnResume = BooleanPref(
|
|
|
|
"dont_refresh_on_resume",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontRound = BooleanPref(
|
|
|
|
"dont_round",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontScreenOff = BooleanPref(
|
|
|
|
"dont_screen_off",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontUseActionButtonWithQuickTootBar = BooleanPref(
|
|
|
|
"dont_use_action_button",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontUseStreaming = BooleanPref(
|
|
|
|
"dont_use_streaming",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpEnableGifAnimation = BooleanPref(
|
|
|
|
"enable_gif_animation",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpExitAppWhenCloseProtectedColumn = BooleanPref(
|
|
|
|
"ExitAppWhenCloseProtectedColumn",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpMentionFullAcct = BooleanPref(
|
|
|
|
"mention_full_acct",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpNotificationLED = BooleanPref(
|
|
|
|
"notification_led",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpNotificationSound = BooleanPref(
|
|
|
|
"notification_sound",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpNotificationVibration = BooleanPref(
|
|
|
|
"notification_vibration",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpPostButtonBarTop = BooleanPref(
|
|
|
|
"post_button_bar_at_top",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpPriorChrome = BooleanPref(
|
|
|
|
"prior_chrome",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
2018-09-22 09:01:20 +02:00
|
|
|
val bpDontUseCustomTabs = BooleanPref(
|
|
|
|
"DontUseCustomTabs",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-09-22 09:01:20 +02:00
|
|
|
)
|
2018-01-17 18:39:16 +01:00
|
|
|
val bpPriorLocalURL = BooleanPref(
|
|
|
|
"prior_local_url",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpQuickTootBar = BooleanPref(
|
|
|
|
"quick_toot_bar",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpRelativeTimestamp = BooleanPref(
|
|
|
|
"relative_timestamp",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpShortAcctLocalUser = BooleanPref(
|
|
|
|
"short_acct_local_user",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpShowFollowButtonInButtonBar = BooleanPref(
|
|
|
|
"ShowFollowButtonInButtonBar",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpSimpleList = BooleanPref(
|
|
|
|
"simple_list",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpUseInternalMediaViewer = BooleanPref(
|
|
|
|
"use_internal_media_viewer",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpShowAppName = BooleanPref(
|
|
|
|
"show_app_name",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
2019-12-13 20:49:45 +01:00
|
|
|
val bpShowLanguage = BooleanPref(
|
|
|
|
"ShowLanguage",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-12-13 20:49:45 +01:00
|
|
|
)
|
2018-01-17 18:39:16 +01:00
|
|
|
val bpForceGap = BooleanPref(
|
|
|
|
"force_gap",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
2018-01-17 02:16:26 +01:00
|
|
|
|
2018-01-18 08:53:32 +01:00
|
|
|
val bpShareViewPool = BooleanPref(
|
|
|
|
"ShareViewPool",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-01-18 08:53:32 +01:00
|
|
|
)
|
|
|
|
|
2018-02-06 21:41:30 +01:00
|
|
|
val bpAllowColumnDuplication = BooleanPref(
|
|
|
|
"AllowColumnDuplication",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2018-02-06 21:41:30 +01:00
|
|
|
)
|
|
|
|
|
2018-03-10 12:40:15 +01:00
|
|
|
val bpAppendAttachmentUrlToContent = BooleanPref(
|
|
|
|
"AppendAttachmentUrlToContent",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-03-10 12:40:15 +01:00
|
|
|
)
|
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
val bpVerticalArrangeThumbnails = BooleanPref(
|
|
|
|
"VerticalArrangeThumbnails",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-03-21 16:39:10 +01:00
|
|
|
)
|
|
|
|
|
2018-11-20 01:33:57 +01:00
|
|
|
val bpDontShowPreviewCard = BooleanPref(
|
|
|
|
"DontShowPreviewCard",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-04-30 16:55:27 +02:00
|
|
|
)
|
2018-11-20 01:33:57 +01:00
|
|
|
|
2018-07-10 08:44:34 +02:00
|
|
|
val bpScrollTopFromColumnStrip = BooleanPref(
|
|
|
|
"ScrollTopFromColumnStrip",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-07-10 08:44:34 +02:00
|
|
|
)
|
2018-04-30 16:55:27 +02:00
|
|
|
|
2018-12-08 16:29:07 +01:00
|
|
|
val bpInstanceTicker = BooleanPref(
|
|
|
|
"InstanceTicker",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2018-12-08 16:29:07 +01:00
|
|
|
)
|
2019-01-08 10:41:07 +01:00
|
|
|
val bpLinksInContextMenu = BooleanPref(
|
|
|
|
"LinksInContextMenu",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-01-08 10:41:07 +01:00
|
|
|
)
|
2019-01-09 09:08:51 +01:00
|
|
|
val bpMoveNotificationsQuickFilter = BooleanPref(
|
|
|
|
"MoveNotificationsQuickFilter",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-01-09 09:08:51 +01:00
|
|
|
)
|
2019-01-16 14:27:26 +01:00
|
|
|
val bpShowAcctInSystemNotification = BooleanPref(
|
|
|
|
"ShowAcctInSystemNotification",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-01-16 14:27:26 +01:00
|
|
|
)
|
2019-01-25 15:38:21 +01:00
|
|
|
val bpShowLinkUnderline = BooleanPref(
|
|
|
|
"ShowLinkUnderline",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-01-25 15:38:21 +01:00
|
|
|
)
|
2019-02-03 15:12:03 +01:00
|
|
|
|
|
|
|
val bpShowSearchClear = BooleanPref(
|
|
|
|
"ShowSearchClear",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-02-03 15:12:03 +01:00
|
|
|
)
|
|
|
|
|
2019-02-23 10:45:54 +01:00
|
|
|
val bpDontRemoveDeletedToot = BooleanPref(
|
|
|
|
"DontRemoveDeletedToot",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-02-23 10:45:54 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDontShowColumnBackgroundImage = BooleanPref(
|
|
|
|
"DontShowColumnBackgroundImage",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-02-23 10:45:54 +01:00
|
|
|
)
|
|
|
|
|
2019-06-03 22:50:18 +02:00
|
|
|
val bpCustomEmojiSeparatorZwsp = BooleanPref(
|
|
|
|
"CustomEmojiSeparatorZwsp",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-06-03 22:50:18 +02:00
|
|
|
)
|
|
|
|
|
2019-06-25 22:28:02 +02:00
|
|
|
val bpShowTranslateButton = BooleanPref(
|
|
|
|
"ShowTranslateButton",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-06-25 22:28:02 +02:00
|
|
|
)
|
|
|
|
|
2019-08-30 05:05:19 +02:00
|
|
|
val bpDirectoryLastActive = BooleanPref(
|
|
|
|
"DirectoryLastActive",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2019-08-30 05:05:19 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDirectoryFollowers = BooleanPref(
|
|
|
|
"DirectoryFollowers",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2019-08-30 05:05:19 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
val bpDirectoryTootCount = BooleanPref(
|
|
|
|
"DirectoryTootCount",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2019-08-30 05:05:19 +02:00
|
|
|
)
|
2019-08-30 06:02:08 +02:00
|
|
|
val bpDirectoryNote = BooleanPref(
|
|
|
|
"DirectoryNote",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2019-08-30 06:02:08 +02:00
|
|
|
)
|
2019-08-30 05:05:19 +02:00
|
|
|
|
2019-09-30 23:27:21 +02:00
|
|
|
val bpWarnHashtagAsciiAndNonAscii = BooleanPref(
|
|
|
|
"WarnHashtagAsciiAndNonAscii",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-09-30 23:27:21 +02:00
|
|
|
)
|
|
|
|
|
2019-10-02 11:37:41 +02:00
|
|
|
val bpEnablePixelfed = BooleanPref(
|
|
|
|
"EnablePixelfed",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-10-02 11:37:41 +02:00
|
|
|
)
|
2019-08-30 05:05:19 +02:00
|
|
|
|
2019-10-09 17:21:58 +02:00
|
|
|
val bpQuickTootOmitAccountSelection = BooleanPref(
|
|
|
|
"QuickTootOmitAccountSelection",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-10-09 17:21:58 +02:00
|
|
|
)
|
|
|
|
|
2019-10-22 20:21:03 +02:00
|
|
|
val bpSeparateReplyNotificationGroup = BooleanPref(
|
|
|
|
"SeparateReplyNotificationGroup",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-10-22 20:21:03 +02:00
|
|
|
)
|
|
|
|
|
2019-11-11 13:47:57 +01:00
|
|
|
val bpAlwaysExpandContextMenuItems = BooleanPref(
|
|
|
|
"AlwaysExpandContextMenuItems",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-11-11 13:47:57 +01:00
|
|
|
)
|
|
|
|
|
2019-12-02 02:57:17 +01:00
|
|
|
val bpShowBookmarkButton = BooleanPref(
|
2020-01-30 05:27:40 +01:00
|
|
|
"ShowBookmarkButton2",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2019-12-02 02:57:17 +01:00
|
|
|
)
|
2019-12-06 07:45:04 +01:00
|
|
|
|
|
|
|
val bpShowFilteredWord = BooleanPref(
|
|
|
|
"ShowFilteredWord",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-12-06 07:45:04 +01:00
|
|
|
)
|
|
|
|
|
2019-12-07 17:23:44 +01:00
|
|
|
val bpEnableDomainTimeline = BooleanPref(
|
|
|
|
"EnableDomainTimeline",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2019-12-07 17:23:44 +01:00
|
|
|
)
|
2020-01-31 10:34:48 +01:00
|
|
|
|
2020-01-16 07:54:59 +01:00
|
|
|
val bpDivideNotification = BooleanPref(
|
|
|
|
"DivideNotification",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2020-01-16 07:54:59 +01:00
|
|
|
)
|
2019-12-07 17:23:44 +01:00
|
|
|
|
2020-01-28 02:34:52 +01:00
|
|
|
val bpHideFollowCount = BooleanPref(
|
|
|
|
"HideFollowCount",
|
2020-01-31 10:34:48 +01:00
|
|
|
false
|
2020-01-28 02:34:52 +01:00
|
|
|
)
|
|
|
|
|
2020-01-28 03:16:20 +01:00
|
|
|
val bpEmojioneShortcode = BooleanPref(
|
|
|
|
"EmojioneShortcode",
|
2020-01-31 10:34:48 +01:00
|
|
|
true
|
2020-01-28 03:16:20 +01:00
|
|
|
)
|
2020-01-28 02:34:52 +01:00
|
|
|
|
2018-01-17 02:16:26 +01:00
|
|
|
// int
|
|
|
|
|
2018-01-17 02:27:56 +01:00
|
|
|
val ipBackButtonAction = IntPref("back_button_action", 0)
|
2018-12-03 09:07:07 +01:00
|
|
|
@Suppress("unused")
|
|
|
|
const val BACK_ASK_ALWAYS = 0
|
|
|
|
const val BACK_CLOSE_COLUMN = 1
|
|
|
|
const val BACK_OPEN_COLUMN_LIST = 2
|
|
|
|
const val BACK_EXIT_APP = 3
|
|
|
|
|
2018-01-17 02:27:56 +01:00
|
|
|
val ipUiTheme = IntPref("ui_theme", 0)
|
|
|
|
val ipResizeImage = IntPref("resize_image", 4)
|
2018-08-20 19:37:42 +02:00
|
|
|
|
2020-04-07 08:28:33 +02:00
|
|
|
|
2018-08-16 10:02:55 +02:00
|
|
|
const val RC_SIMPLE = 0
|
|
|
|
const val RC_ACTUAL = 1
|
2018-09-14 19:26:24 +02:00
|
|
|
@Suppress("unused")
|
2018-08-16 10:02:55 +02:00
|
|
|
const val RC_NONE = 2
|
2020-04-07 08:28:33 +02:00
|
|
|
val ipRepliesCount = IntPref("RepliesCount", RC_SIMPLE)
|
|
|
|
val ipBoostsCount = IntPref("BoostsCount", RC_ACTUAL)
|
|
|
|
val ipFavouritesCount = IntPref("FavouritesCount", RC_ACTUAL)
|
|
|
|
|
2018-01-17 02:16:26 +01:00
|
|
|
|
2018-01-17 02:27:56 +01:00
|
|
|
val ipRefreshAfterToot = IntPref("refresh_after_toot", 0)
|
2018-05-30 21:50:07 +02:00
|
|
|
const val RAT_REFRESH_SCROLL = 0
|
2018-09-14 19:26:24 +02:00
|
|
|
@Suppress("unused")
|
2018-05-30 21:50:07 +02:00
|
|
|
const val RAT_REFRESH_DONT_SCROLL = 1
|
|
|
|
const val RAT_DONT_REFRESH = 2
|
2018-01-17 02:16:26 +01:00
|
|
|
|
2018-09-14 19:26:24 +02:00
|
|
|
@Suppress("unused")
|
2018-08-20 19:37:42 +02:00
|
|
|
const val VS_BY_ACCOUNT = 0
|
|
|
|
const val VS_MASTODON = 1
|
|
|
|
const val VS_MISSKEY = 2
|
2019-07-21 18:10:23 +02:00
|
|
|
val ipVisibilityStyle = IntPref("ipVisibilityStyle", VS_BY_ACCOUNT)
|
|
|
|
|
|
|
|
const val ABP_TOP = 0
|
|
|
|
@Suppress("unused")
|
|
|
|
const val ABP_BOTTOM = 1
|
|
|
|
const val ABP_START = 2
|
|
|
|
const val ABP_END = 3
|
2020-01-31 10:34:48 +01:00
|
|
|
val ipAdditionalButtonsPosition = IntPref("AdditionalButtonsPosition", ABP_END)
|
2018-08-20 19:37:42 +02:00
|
|
|
|
2018-01-17 02:27:56 +01:00
|
|
|
val ipFooterButtonBgColor = IntPref("footer_button_bg_color", 0)
|
|
|
|
val ipFooterButtonFgColor = IntPref("footer_button_fg_color", 0)
|
|
|
|
val ipFooterTabBgColor = IntPref("footer_tab_bg_color", 0)
|
|
|
|
val ipFooterTabDividerColor = IntPref("footer_tab_divider_color", 0)
|
|
|
|
val ipFooterTabIndicatorColor = IntPref("footer_tab_indicator_color", 0)
|
2018-08-15 12:22:19 +02:00
|
|
|
val ipListDividerColor = IntPref("listDividerColor", 0)
|
2018-01-17 02:27:56 +01:00
|
|
|
val ipLastColumnPos = IntPref("last_column_pos", - 1)
|
2018-08-24 02:26:45 +02:00
|
|
|
val ipBoostButtonJustify = IntPref("ipBoostButtonJustify", 0) // 0=左,1=中央,2=右
|
2018-01-17 02:16:26 +01:00
|
|
|
|
2020-01-28 03:18:05 +01:00
|
|
|
@Suppress("unused")
|
2019-12-15 20:12:57 +01:00
|
|
|
const val JWCP_DEFAULT = 0
|
|
|
|
const val JWCP_START = 1
|
|
|
|
const val JWCP_END = 2
|
2020-01-31 10:34:48 +01:00
|
|
|
val ipJustifyWindowContentPortrait =
|
|
|
|
IntPref("JustifyWindowContentPortrait", 0) // 0=default,1=start,2=end
|
2019-12-15 20:12:57 +01:00
|
|
|
|
2018-09-07 14:38:01 +02:00
|
|
|
val ipLinkColor = IntPref("LinkColor", 0)
|
|
|
|
|
2019-07-23 20:48:21 +02:00
|
|
|
val ipSwitchOnColor = IntPref("SwitchOnColor", Color.BLACK or 0x0080ff)
|
|
|
|
|
2020-06-24 20:46:18 +02:00
|
|
|
val ipButtonBoostedColor = IntPref("ButtonBoostedColor", 0)
|
|
|
|
val ipButtonFavoritedColor = IntPref("ButtonFavoritedColor", 0)
|
|
|
|
val ipButtonBookmarkedColor = IntPref("ButtonBookmarkedColor", 0)
|
|
|
|
val ipButtonFollowingColor = IntPref("ButtonFollowingColor", 0)
|
|
|
|
val ipButtonFollowRequestColor = IntPref("ButtonFollowRequestColor", 0)
|
|
|
|
|
2019-09-29 21:43:06 +02:00
|
|
|
val ipStatusBarColor = IntPref("StatusBarColor", 0)
|
|
|
|
val ipNavigationBarColor = IntPref("NavigationBarColor", 0)
|
|
|
|
|
2018-08-24 07:04:55 +02:00
|
|
|
val ipTootColorUnlisted = IntPref("ipTootColorUnlisted", 0)
|
|
|
|
val ipTootColorFollower = IntPref("ipTootColorFollower", 0)
|
|
|
|
val ipTootColorDirectUser = IntPref("ipTootColorDirectUser", 0)
|
|
|
|
val ipTootColorDirectMe = IntPref("ipTootColorDirectMe", 0)
|
|
|
|
|
2019-02-03 17:58:37 +01:00
|
|
|
val ipEventBgColorBoost = IntPref("EventBgColorBoost", 0)
|
|
|
|
val ipEventBgColorFavourite = IntPref("EventBgColorFavourite", 0)
|
2020-04-07 03:38:29 +02:00
|
|
|
val ipEventBgColorBookmark = IntPref("EventBgColorBookmark", 0)
|
2019-02-03 17:58:37 +01:00
|
|
|
val ipEventBgColorFollow = IntPref("EventBgColorFollow", 0)
|
|
|
|
val ipEventBgColorMention = IntPref("EventBgColorMention", 0)
|
|
|
|
val ipEventBgColorUnfollow = IntPref("EventBgColorUnfollow", 0)
|
|
|
|
val ipEventBgColorReaction = IntPref("EventBgColorReaction", 0)
|
|
|
|
val ipEventBgColorQuote = IntPref("EventBgColorQuote", 0)
|
|
|
|
val ipEventBgColorVote = IntPref("EventBgColorVote", 0)
|
|
|
|
val ipEventBgColorFollowRequest = IntPref("EventBgColorFollowRequest", 0)
|
|
|
|
|
2018-11-19 23:46:14 +01:00
|
|
|
val ipCcdHeaderBg = IntPref("ipCcdHeaderBg", 0)
|
|
|
|
val ipCcdHeaderFg = IntPref("ipCcdHeaderFg", 0)
|
|
|
|
val ipCcdContentBg = IntPref("ipCcdContentBg", 0)
|
|
|
|
val ipCcdContentAcct = IntPref("ipCcdContentAcct", 0)
|
|
|
|
val ipCcdContentText = IntPref("ipCcdContentText", 0)
|
|
|
|
|
2020-06-24 20:46:18 +02:00
|
|
|
val ipSearchBgColor = IntPref("SearchBgColor", 0)
|
|
|
|
val ipAnnouncementsBgColor = IntPref("AnnouncementsBgColor", 0)
|
|
|
|
val ipConversationMainTootBgColor = IntPref("ConversationMainTootBgColor", 0)
|
|
|
|
val ipVerifiedLinkBgColor = IntPref("VerifiedLinkBgColor", 0)
|
|
|
|
val ipVerifiedLinkFgColor = IntPref("VerifiedLinkFgColor", 0)
|
|
|
|
|
|
|
|
|
2018-08-24 07:04:55 +02:00
|
|
|
// val ipTrendTagCountShowing = IntPref("TrendTagCountShowing", 0)
|
2020-01-31 10:34:48 +01:00
|
|
|
// const val TTCS_WEEKLY = 0
|
|
|
|
// const val TTCS_DAILY = 1
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-17 02:16:26 +01:00
|
|
|
// string
|
2018-01-17 02:27:56 +01:00
|
|
|
val spColumnWidth = StringPref("ColumnWidth", "")
|
|
|
|
val spMediaThumbHeight = StringPref("MediaThumbHeight", "")
|
|
|
|
val spClientName = StringPref("client_name", "")
|
|
|
|
val spQuoteNameFormat = StringPref("quote_name_format", "")
|
|
|
|
val spAutoCWLines = StringPref("auto_cw_lines", "0")
|
2018-11-02 14:28:09 +01:00
|
|
|
val spCardDescriptionLength = StringPref("CardDescriptionLength", "64")
|
2018-01-17 02:27:56 +01:00
|
|
|
val spAvatarIconSize = StringPref("avatar_icon_size", "48")
|
2019-01-16 13:33:07 +01:00
|
|
|
val spNotificationTlIconSize = StringPref("notification_tl_icon_size", "24")
|
2018-08-23 02:34:00 +02:00
|
|
|
val spBoostButtonSize = StringPref("BoostButtonSize", "35")
|
2019-01-08 03:10:57 +01:00
|
|
|
val spReplyIconSize = StringPref("ReplyIconSize", "24")
|
2019-01-16 13:33:07 +01:00
|
|
|
val spHeaderIconSize = StringPref("HeaderIconSize", "24")
|
2019-01-18 17:47:58 +01:00
|
|
|
val spStripIconSize = StringPref("StripIconSize", "30")
|
2018-01-17 02:27:56 +01:00
|
|
|
val spMediaSizeMax = StringPref("max_media_size", "8")
|
2018-09-05 16:22:24 +02:00
|
|
|
val spMovieSizeMax = StringPref("max_movie_size", "40")
|
2019-09-30 22:31:55 +02:00
|
|
|
val spMediaSizeMaxPixelfed = StringPref("MediaSizeMaxPixelfed", "15")
|
2018-01-17 02:27:56 +01:00
|
|
|
val spTimelineFont = StringPref("timeline_font", "", skipImport = true)
|
|
|
|
val spTimelineFontBold = StringPref("timeline_font_bold", "", skipImport = true)
|
|
|
|
val spMspUserToken = StringPref("mastodon_search_portal_user_token", "")
|
|
|
|
val spEmojiPickerRecent = StringPref("emoji_picker_recent", "")
|
2018-01-18 08:53:32 +01:00
|
|
|
val spRoundRatio = StringPref("round_ratio", "33")
|
2018-11-18 15:29:35 +01:00
|
|
|
val spBoostAlpha = StringPref("BoostAlpha", "60")
|
|
|
|
|
2019-11-14 02:30:39 +01:00
|
|
|
val spVersionNameWhenReleaseNoteTap = StringPref("VersionNameWhenReleaseNoteTap", "")
|
2019-11-11 13:47:57 +01:00
|
|
|
|
2018-04-10 09:08:30 +02:00
|
|
|
val spPullNotificationCheckInterval = StringPref("PullNotificationCheckInterval", "15")
|
2018-05-18 22:48:29 +02:00
|
|
|
val spUserAgent = StringPref("UserAgent", "")
|
2018-08-31 14:47:40 +02:00
|
|
|
|
|
|
|
val spMediaReadTimeout = StringPref("spMediaReadTimeout", "60")
|
2020-01-31 10:34:48 +01:00
|
|
|
val spAgreedPrivacyPolicyDigest = StringPref("spAgreedPrivacyPolicyDigest", "")
|
2018-08-31 14:47:40 +02:00
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
val spTimeZone = StringPref("TimeZone", "")
|
2019-01-30 17:20:49 +01:00
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
val spQuickTootMacro = StringPref("QuickTootMacro", "")
|
|
|
|
val spQuickTootVisibility = StringPref("QuickTootVisibility", "")
|
2019-04-12 22:19:15 +02:00
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
val spTranslateAppComponent = StringPref("TranslateAppComponent", "")
|
|
|
|
val spCustomShare1 = StringPref("CustomShare1", "")
|
|
|
|
val spCustomShare2 = StringPref("CustomShare2", "")
|
|
|
|
val spCustomShare3 = StringPref("CustomShare3", "")
|
2019-06-25 22:28:02 +02:00
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
val spTimelineSpacing = StringPref("TimelineSpacing", "")
|
2019-10-22 20:56:24 +02:00
|
|
|
|
2018-01-17 02:16:26 +01:00
|
|
|
// long
|
2018-01-17 02:27:56 +01:00
|
|
|
val lpTabletTootDefaultAccount = LongPref("tablet_toot_default_account", - 1L)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-17 02:16:26 +01:00
|
|
|
// float
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-17 02:27:56 +01:00
|
|
|
val fpTimelineFontSize = FloatPref("timeline_font_size", Float.NaN)
|
|
|
|
val fpAcctFontSize = FloatPref("acct_font_size", Float.NaN)
|
2018-06-24 03:12:45 +02:00
|
|
|
val fpNotificationTlFontSize = FloatPref("notification_tl_font_size", Float.NaN)
|
2019-01-11 10:47:30 +01:00
|
|
|
val fpHeaderTextSize = FloatPref("HeaderTextSize", Float.NaN)
|
2018-12-03 09:07:07 +01:00
|
|
|
internal const val default_timeline_font_size = 14f
|
|
|
|
internal const val default_acct_font_size = 12f
|
|
|
|
internal const val default_notification_tl_font_size = 14f
|
2019-01-11 10:47:30 +01:00
|
|
|
internal const val default_header_font_size = 14f
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
}
|