2021-06-28 09:09:00 +02:00
|
|
|
package jp.juggler.subwaytooter.appsetting
|
2020-01-31 08:46:30 +01:00
|
|
|
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.res.ColorStateList
|
|
|
|
import android.os.Build
|
|
|
|
import android.view.View
|
|
|
|
import android.widget.ImageView
|
|
|
|
import android.widget.Spinner
|
|
|
|
import android.widget.TextView
|
|
|
|
import androidx.annotation.StringRes
|
|
|
|
import androidx.appcompat.widget.AppCompatImageView
|
2021-06-28 09:09:00 +02:00
|
|
|
import jp.juggler.subwaytooter.*
|
2021-11-06 21:36:59 +01:00
|
|
|
import jp.juggler.subwaytooter.drawable.MediaBackgroundDrawable
|
2021-06-28 09:09:00 +02:00
|
|
|
import jp.juggler.subwaytooter.itemviewholder.AdditionalButtonsPosition
|
2021-11-06 04:00:29 +01:00
|
|
|
import jp.juggler.subwaytooter.pref.*
|
|
|
|
import jp.juggler.subwaytooter.pref.impl.*
|
2020-09-09 20:13:11 +02:00
|
|
|
import jp.juggler.subwaytooter.util.CustomShareTarget
|
2020-09-29 19:44:56 +02:00
|
|
|
import jp.juggler.subwaytooter.util.openBrowser
|
2020-01-31 08:46:30 +01:00
|
|
|
import jp.juggler.util.*
|
2020-09-07 11:12:25 +02:00
|
|
|
import org.jetbrains.anko.backgroundDrawable
|
2020-01-31 08:46:30 +01:00
|
|
|
|
2020-12-19 07:46:42 +01:00
|
|
|
enum class SettingType(val id: Int) {
|
|
|
|
Path(0),
|
|
|
|
Divider(1),
|
|
|
|
Switch(2),
|
|
|
|
EditText(3),
|
|
|
|
Spinner(4),
|
|
|
|
ColorOpaque(5),
|
|
|
|
ColorAlpha(6),
|
|
|
|
Action(7),
|
|
|
|
Sample(8),
|
|
|
|
Group(9),
|
|
|
|
TextWithSelector(10),
|
|
|
|
CheckBox(11),
|
|
|
|
Section(12)
|
2020-01-31 08:46:30 +01:00
|
|
|
}
|
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
class AppSettingItem(
|
2021-05-22 00:03:16 +02:00
|
|
|
val parent: AppSettingItem?,
|
|
|
|
val type: SettingType,
|
|
|
|
@StringRes val caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
val pref: BasePref<*>? = null,
|
2020-01-31 08:46:30 +01:00
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
@StringRes
|
|
|
|
var desc: Int = 0
|
|
|
|
var descClickSet = false
|
|
|
|
var descClick: ActAppSetting.() -> Unit = {}
|
|
|
|
set(value) {
|
|
|
|
field = value
|
|
|
|
descClickSet = true
|
|
|
|
}
|
|
|
|
|
|
|
|
var getError: ActAppSetting.(String) -> String? = { null }
|
|
|
|
|
|
|
|
// may be open exportAppData() or importAppData()
|
|
|
|
var action: ActAppSetting.() -> Unit = {}
|
|
|
|
|
|
|
|
var changed: ActAppSetting.() -> Unit = {}
|
|
|
|
|
|
|
|
// used for EditText
|
|
|
|
var inputType = InputTypeEx.text
|
|
|
|
|
|
|
|
var sampleLayoutId: Int = 0
|
|
|
|
var sampleUpdate: (ActAppSetting, View) -> Unit = { _, _ -> }
|
|
|
|
|
|
|
|
var spinnerArgs: IntArray? = null
|
|
|
|
var spinnerArgsProc: (ActAppSetting) -> List<String> = { _ -> emptyList() }
|
|
|
|
var spinnerInitializer: ActAppSetting.(Spinner) -> Unit = {}
|
|
|
|
var spinnerOnSelected: ActAppSetting.(Spinner, Int) -> Unit = { _, _ -> }
|
|
|
|
|
|
|
|
var enabled: Boolean = true
|
|
|
|
|
|
|
|
var onClickEdit: ActAppSetting.() -> Unit = {}
|
|
|
|
var onClickReset: ActAppSetting.() -> Unit = {}
|
|
|
|
var showTextView: ActAppSetting.(TextView) -> Unit = {}
|
|
|
|
|
|
|
|
// for EditText
|
|
|
|
var hint: String? = null
|
|
|
|
var filter: (String) -> String = { it.trim() }
|
|
|
|
var captionFontSize: ActAppSetting.() -> Float? = { null }
|
|
|
|
var captionSpacing: ActAppSetting.() -> Float? = { null }
|
|
|
|
|
|
|
|
// cast before save
|
|
|
|
var toFloat: ActAppSetting.(String) -> Float = { 0f }
|
|
|
|
var fromFloat: ActAppSetting.(Float) -> String = { it.toString() }
|
|
|
|
|
|
|
|
val items = ArrayList<AppSettingItem>()
|
|
|
|
|
|
|
|
fun section(
|
2021-05-22 00:03:16 +02:00
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
items.add(AppSettingItem(this, SettingType.Section, caption).apply { initializer() })
|
|
|
|
}
|
|
|
|
|
|
|
|
fun group(
|
2021-05-22 00:03:16 +02:00
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
items.add(AppSettingItem(this, SettingType.Group, caption).apply { initializer() })
|
|
|
|
}
|
|
|
|
|
|
|
|
fun item(
|
2021-05-22 00:03:16 +02:00
|
|
|
type: SettingType,
|
|
|
|
pref: BasePref<*>?,
|
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
): AppSettingItem {
|
2020-12-19 07:46:42 +01:00
|
|
|
val item = AppSettingItem(this, type, caption, pref).apply { initializer() }
|
|
|
|
items.add(item)
|
|
|
|
return item
|
|
|
|
}
|
|
|
|
|
|
|
|
fun spinner(
|
2021-05-22 00:03:16 +02:00
|
|
|
pref: IntPref,
|
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
vararg args: Int,
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.Spinner, pref, caption) {
|
2020-12-19 07:46:42 +01:00
|
|
|
spinnerArgs = args
|
|
|
|
}
|
|
|
|
|
|
|
|
fun spinner(
|
2021-05-22 00:03:16 +02:00
|
|
|
pref: IntPref,
|
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
argsProc: (ActAppSetting) -> List<String>,
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.Spinner, pref, caption) {
|
2020-12-19 07:46:42 +01:00
|
|
|
spinnerArgsProc = argsProc
|
|
|
|
}
|
|
|
|
|
|
|
|
fun sw(
|
2021-05-22 00:03:16 +02:00
|
|
|
pref: BooleanPref,
|
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.Switch, pref, caption, initializer)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
fun checkbox(
|
2021-05-22 00:03:16 +02:00
|
|
|
pref: BooleanPref,
|
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.CheckBox, pref, caption, initializer)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
fun action(
|
2021-05-22 00:03:16 +02:00
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.Action, null, caption, initializer)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
fun colorOpaque(
|
2021-05-22 00:03:16 +02:00
|
|
|
pref: IntPref,
|
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.ColorOpaque, pref, caption, initializer)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
fun colorAlpha(
|
2021-05-22 00:03:16 +02:00
|
|
|
pref: IntPref,
|
|
|
|
@StringRes caption: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.ColorAlpha, pref, caption, initializer)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
fun text(
|
2021-05-22 00:03:16 +02:00
|
|
|
pref: StringPref,
|
|
|
|
@StringRes caption: Int,
|
|
|
|
inputType: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.EditText, pref, caption) {
|
2020-12-19 07:46:42 +01:00
|
|
|
this.inputType = inputType
|
|
|
|
this.initializer()
|
|
|
|
}
|
|
|
|
|
|
|
|
fun textX(
|
2021-05-22 00:03:16 +02:00
|
|
|
pref: BasePref<*>,
|
|
|
|
@StringRes caption: Int,
|
|
|
|
inputType: Int,
|
2021-06-20 15:12:25 +02:00
|
|
|
initializer: AppSettingItem.() -> Unit = {},
|
2021-05-22 00:03:16 +02:00
|
|
|
) = item(SettingType.EditText, pref, caption) {
|
2020-12-19 07:46:42 +01:00
|
|
|
this.inputType = inputType
|
|
|
|
this.initializer()
|
|
|
|
}
|
|
|
|
|
|
|
|
fun sample(
|
2021-05-22 00:03:16 +02:00
|
|
|
sampleLayoutId: Int = 0,
|
2021-06-20 15:12:25 +02:00
|
|
|
sampleUpdate: (ActAppSetting, View) -> Unit = { _, _ -> },
|
2021-05-22 00:03:16 +02:00
|
|
|
// ,initializer : AppSettingItem.() -> Unit = {}
|
|
|
|
) = item(SettingType.Sample, pref, caption) {
|
2020-12-19 07:46:42 +01:00
|
|
|
this.sampleLayoutId = sampleLayoutId
|
|
|
|
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 TIMELINE_FONT: AppSettingItem? = null
|
|
|
|
var TIMELINE_FONT_BOLD: AppSettingItem? = null
|
|
|
|
|
|
|
|
var FONT_SIZE_TIMELINE: AppSettingItem? = null
|
|
|
|
var FONT_SIZE_NOTIFICATION_TL: AppSettingItem? = null
|
|
|
|
}
|
2020-01-31 08:46:30 +01:00
|
|
|
}
|
|
|
|
|
2020-01-31 10:34:48 +01:00
|
|
|
val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_setting).apply {
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
section(R.string.notifications) {
|
|
|
|
|
|
|
|
group(R.string.notification_style_before_oreo) {
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
checkbox(PrefB.bpNotificationSound, R.string.sound) {
|
2020-12-19 07:46:42 +01:00
|
|
|
enabled = Build.VERSION.SDK_INT < 26
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
checkbox(PrefB.bpNotificationVibration, R.string.vibration) {
|
2020-12-19 07:46:42 +01:00
|
|
|
enabled = Build.VERSION.SDK_INT < 26
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
checkbox(PrefB.bpNotificationLED, R.string.led) {
|
2020-12-19 07:46:42 +01:00
|
|
|
enabled = Build.VERSION.SDK_INT < 26
|
|
|
|
}
|
|
|
|
|
|
|
|
sample(R.layout.setting_sample_notification_desc)
|
|
|
|
}
|
|
|
|
|
|
|
|
text(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spPullNotificationCheckInterval,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.pull_notification_check_interval,
|
|
|
|
InputTypeEx.number
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpShowAcctInSystemNotification, R.string.show_acct_in_system_notification)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpSeparateReplyNotificationGroup, R.string.separate_notification_group_for_reply) {
|
2020-12-19 07:46:42 +01:00
|
|
|
enabled = Build.VERSION.SDK_INT >= 26
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpDivideNotification, R.string.divide_notification)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.behavior) {
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpDontConfirmBeforeCloseColumn, R.string.dont_confirm_before_close_column)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipBackButtonAction,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.back_button_action,
|
|
|
|
R.string.ask_always,
|
|
|
|
R.string.close_column,
|
|
|
|
R.string.open_column_list,
|
|
|
|
R.string.app_exit
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpExitAppWhenCloseProtectedColumn, R.string.exit_app_when_close_protected_column)
|
|
|
|
sw(PrefB.bpScrollTopFromColumnStrip, R.string.scroll_top_from_column_strip)
|
|
|
|
sw(PrefB.bpDontScreenOff, R.string.dont_screen_off)
|
|
|
|
sw(PrefB.bpDontUseCustomTabs, R.string.dont_use_custom_tabs)
|
|
|
|
sw(PrefB.bpPriorChrome, R.string.prior_chrome_custom_tabs)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-11-06 03:11:28 +01:00
|
|
|
// item(
|
|
|
|
// SettingType.TextWithSelector,
|
|
|
|
// PrefS.spWebBrowser,
|
|
|
|
// R.string.web_browser
|
|
|
|
// ) {
|
|
|
|
// onClickEdit = {
|
|
|
|
// openWebBrowserChooser(
|
|
|
|
// this@item,
|
|
|
|
// intent = Intent(Intent.ACTION_VIEW, "https://joinmastodon.org/".toUri()).apply {
|
|
|
|
// addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
|
|
// addCategory(Intent.CATEGORY_BROWSABLE)
|
|
|
|
// },
|
|
|
|
// filter = {
|
|
|
|
// when {
|
|
|
|
// it.activityInfo.packageName == packageName -> false
|
|
|
|
// !it.activityInfo.exported -> false
|
|
|
|
//
|
|
|
|
// // Huaweiの謎Activityのせいでうまく働かないことがある
|
|
|
|
// -1 != it.activityInfo.packageName.indexOf("com.huawei.android.internal") -> false
|
|
|
|
//
|
|
|
|
// // 標準アプリが設定されていない場合、アプリを選択するためのActivityが出てくる場合がある
|
|
|
|
// it.activityInfo.packageName == "android" -> false
|
|
|
|
// it.activityInfo.javaClass.name.startsWith("com.android.internal") -> false
|
|
|
|
// it.activityInfo.javaClass.name.startsWith("com.android.systemui") -> false
|
|
|
|
//
|
|
|
|
// // たぶんChromeとかfirefoxとか
|
|
|
|
// else -> true
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// )
|
|
|
|
// }
|
|
|
|
// onClickReset = { setWebBrowser(this@item, "") }
|
|
|
|
// showTextView = {
|
|
|
|
// showWebBrowser(it, this@item.pref.cast<StringPref>()!!.invoke(pref))
|
|
|
|
// }
|
|
|
|
// }
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpAllowColumnDuplication, R.string.allow_column_duplication)
|
|
|
|
sw(PrefB.bpForceGap, R.string.force_gap_when_refresh)
|
2020-12-19 07:46:42 +01:00
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipGapHeadScrollPosition,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.scroll_position_after_read_gap_from_head,
|
|
|
|
R.string.gap_head,
|
|
|
|
R.string.gap_tail,
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipGapTailScrollPosition,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.scroll_position_after_read_gap_from_tail,
|
|
|
|
R.string.gap_head,
|
|
|
|
R.string.gap_tail,
|
|
|
|
)
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spClientName, R.string.client_name, InputTypeEx.text)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spUserAgent, R.string.user_agent, InputTypeEx.textMultiLine) {
|
2020-12-19 07:46:42 +01:00
|
|
|
hint = App1.userAgentDefault
|
|
|
|
filter = { it.replace(ActAppSetting.reLinefeed, " ").trim() }
|
|
|
|
getError = {
|
|
|
|
val m = App1.reNotAllowedInUserAgent.matcher(it)
|
|
|
|
when (m.find()) {
|
2021-05-22 00:03:16 +02:00
|
|
|
true -> getString(R.string.user_agent_error, m.group())
|
2020-12-19 07:46:42 +01:00
|
|
|
else -> null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpDontRemoveDeletedToot, R.string.dont_remove_deleted_toot_from_timeline)
|
|
|
|
sw(PrefB.bpCustomEmojiSeparatorZwsp, R.string.custom_emoji_separator_zwsp)
|
|
|
|
sw(PrefB.bpShowTranslateButton, R.string.show_translate_button)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
item(
|
2021-05-22 00:03:16 +02:00
|
|
|
SettingType.TextWithSelector,
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spTranslateAppComponent,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.translation_app
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val target = CustomShareTarget.Translate
|
|
|
|
onClickEdit = { openCustomShareChooser(this@item, target) }
|
|
|
|
onClickReset = { setCustomShare(this@item, target, "") }
|
|
|
|
showTextView = { showCustomShareIcon(it, target) }
|
|
|
|
}
|
|
|
|
|
|
|
|
item(
|
2021-05-22 00:03:16 +02:00
|
|
|
SettingType.TextWithSelector,
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spCustomShare1,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.custom_share_button_1
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val target = CustomShareTarget.CustomShare1
|
|
|
|
onClickEdit = { openCustomShareChooser(this@item, target) }
|
|
|
|
onClickReset = { setCustomShare(this@item, target, "") }
|
|
|
|
showTextView = { showCustomShareIcon(it, target) }
|
|
|
|
}
|
|
|
|
|
|
|
|
item(
|
2021-05-22 00:03:16 +02:00
|
|
|
SettingType.TextWithSelector,
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spCustomShare2,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.custom_share_button_2
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val target = CustomShareTarget.CustomShare2
|
|
|
|
onClickEdit = { openCustomShareChooser(this@item, target) }
|
|
|
|
onClickReset = { setCustomShare(this@item, target, "") }
|
|
|
|
showTextView = { showCustomShareIcon(it, target) }
|
|
|
|
}
|
|
|
|
item(
|
2021-05-22 00:03:16 +02:00
|
|
|
SettingType.TextWithSelector,
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spCustomShare3,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.custom_share_button_3
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val target = CustomShareTarget.CustomShare3
|
|
|
|
onClickEdit = { openCustomShareChooser(this@item, target) }
|
|
|
|
onClickReset = { setCustomShare(this@item, target, "") }
|
|
|
|
showTextView = { showCustomShareIcon(it, target) }
|
|
|
|
}
|
|
|
|
|
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipAdditionalButtonsPosition,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.additional_buttons_position,
|
2021-11-06 21:36:59 +01:00
|
|
|
*(AdditionalButtonsPosition.values().sortedBy { it.idx }.map { it.captionId }
|
|
|
|
.toIntArray())
|
2021-05-22 00:03:16 +02:00
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpEnablePixelfed, R.string.enable_connect_to_pixelfed_server)
|
|
|
|
sw(PrefB.bpShowFilteredWord, R.string.show_filtered_word)
|
|
|
|
sw(PrefB.bpEnableDomainTimeline, R.string.enable_domain_timeline)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.post) {
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
// spinner(PrefI.ipResizeImage, R.string.resize_image) { activity ->
|
2021-02-09 23:25:06 +01:00
|
|
|
// ActPost.resizeConfigList.map {
|
|
|
|
// when (it.type) {
|
|
|
|
// ResizeType.None -> activity.getString(R.string.dont_resize)
|
|
|
|
// ResizeType.LongSide -> activity.getString(R.string.long_side_pixel, it.size)
|
|
|
|
// ResizeType.SquarePixel -> activity.getString(
|
|
|
|
// R.string.resize_square_pixels,
|
|
|
|
// it.size * it.size,
|
|
|
|
// it.size
|
|
|
|
// )
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
2021-06-22 10:31:51 +02:00
|
|
|
// text(PrefS.spMediaSizeMax, R.string.media_attachment_max_byte_size, InputTypeEx.number)
|
|
|
|
// text(PrefS.spMovieSizeMax, R.string.media_attachment_max_byte_size_movie, InputTypeEx.number)
|
2021-02-09 23:25:06 +01:00
|
|
|
// text(
|
2021-06-22 10:31:51 +02:00
|
|
|
// PrefS.spMediaSizeMaxPixelfed,
|
2021-02-09 23:25:06 +01:00
|
|
|
// R.string.media_attachment_max_byte_size_pixelfed,
|
|
|
|
// InputTypeEx.number
|
|
|
|
// )
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipRefreshAfterToot,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.refresh_after_toot,
|
|
|
|
R.string.refresh_scroll_to_toot,
|
|
|
|
R.string.refresh_no_scroll,
|
|
|
|
R.string.dont_refresh
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpPostButtonBarTop, R.string.show_post_button_bar_top)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpDontDuplicationCheck,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.dont_add_duplication_check_header
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-28 09:09:00 +02:00
|
|
|
sw(PrefB.bpQuickPostBar, R.string.show_quick_toot_bar)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
sw(
|
2021-06-28 09:09:00 +02:00
|
|
|
PrefB.bpDontUseActionButtonWithQuickPostBar,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.dont_use_action_button_with_quick_toot_bar
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spQuoteNameFormat, R.string.format_of_quote_name, InputTypeEx.text) {
|
2020-12-19 07:46:42 +01:00
|
|
|
filter = { it } // don't trim
|
|
|
|
}
|
|
|
|
|
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpAppendAttachmentUrlToContent,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.append_attachment_url_to_content
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpWarnHashtagAsciiAndNonAscii,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.warn_hashtag_ascii_and_non_ascii
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpEmojiPickerCloseOnSelected,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.close_emoji_picker_when_selected
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpIgnoreTextInSharedMedia, R.string.ignore_text_in_shared_media)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.tablet_mode) {
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpDisableTabletMode, R.string.disable_tablet_mode)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spColumnWidth, R.string.minimum_column_width, InputTypeEx.number)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
item(
|
2021-05-22 00:03:16 +02:00
|
|
|
SettingType.Spinner,
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefL.lpTabletTootDefaultAccount,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.toot_button_default_account
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val lp = pref.cast<LongPref>()!!
|
|
|
|
spinnerInitializer = { spinner ->
|
|
|
|
val adapter = AccountAdapter()
|
|
|
|
spinner.adapter = adapter
|
|
|
|
spinner.setSelection(adapter.getIndexFromId(lp(pref)))
|
|
|
|
}
|
|
|
|
spinnerOnSelected = { spinner, index ->
|
|
|
|
val adapter = spinner.adapter.cast<ActAppSetting.AccountAdapter>()
|
|
|
|
?: error("spinnerOnSelected: missing AccountAdapter")
|
|
|
|
pref.edit().put(lp, adapter.getIdFromIndex(index)).apply()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpQuickTootOmitAccountSelection,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.quick_toot_omit_account_selection
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipJustifyWindowContentPortrait,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.justify_window_content_portrait,
|
|
|
|
R.string.default_,
|
|
|
|
R.string.start,
|
|
|
|
R.string.end
|
|
|
|
)
|
2021-05-30 04:01:12 +02:00
|
|
|
|
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpMultiWindowPost,
|
2021-05-30 04:01:12 +02:00
|
|
|
R.string.multi_window_post
|
|
|
|
)
|
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpManyWindowPost,
|
2021-05-30 04:01:12 +02:00
|
|
|
R.string.many_window_post
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.media_attachment) {
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpUseInternalMediaViewer, R.string.use_internal_media_viewer)
|
2021-11-06 21:36:59 +01:00
|
|
|
|
|
|
|
spinner(PrefI.ipMediaBackground, R.string.background_pattern) {
|
|
|
|
MediaBackgroundDrawable.Kind.values().map { it.name }
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpPriorLocalURL, R.string.prior_local_url_when_open_attachment)
|
|
|
|
text(PrefS.spMediaThumbHeight, R.string.media_thumbnail_height, InputTypeEx.number)
|
|
|
|
sw(PrefB.bpDontCropMediaThumb, R.string.dont_crop_media_thumbnail)
|
|
|
|
sw(PrefB.bpVerticalArrangeThumbnails, R.string.thumbnails_arrange_vertically)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.animation) {
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpEnableGifAnimation, R.string.enable_gif_animation)
|
|
|
|
sw(PrefB.bpDisableEmojiAnimation, R.string.disable_custom_emoji_animation)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.appearance) {
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpSimpleList, R.string.simple_list)
|
|
|
|
sw(PrefB.bpShowFollowButtonInButtonBar, R.string.show_follow_button_in_button_bar)
|
|
|
|
sw(PrefB.bpDontShowPreviewCard, R.string.dont_show_preview_card)
|
|
|
|
sw(PrefB.bpShortAcctLocalUser, R.string.short_acct_local_user)
|
|
|
|
sw(PrefB.bpMentionFullAcct, R.string.mention_full_acct)
|
|
|
|
sw(PrefB.bpRelativeTimestamp, R.string.relative_timestamp)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
item(
|
2021-05-22 00:03:16 +02:00
|
|
|
SettingType.Spinner,
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spTimeZone,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.timezone
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val sp: StringPref = pref.cast()!!
|
|
|
|
spinnerInitializer = { spinner ->
|
|
|
|
val adapter = TimeZoneAdapter()
|
|
|
|
spinner.adapter = adapter
|
|
|
|
spinner.setSelection(adapter.getIndexFromId(sp(pref)))
|
|
|
|
}
|
|
|
|
spinnerOnSelected = { spinner, index ->
|
|
|
|
val adapter = spinner.adapter.cast<ActAppSetting.TimeZoneAdapter>()
|
|
|
|
?: error("spinnerOnSelected: missing TimeZoneAdapter")
|
|
|
|
pref.edit().put(sp, adapter.getIdFromIndex(index)).apply()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpShowAppName, R.string.always_show_application)
|
|
|
|
sw(PrefB.bpShowLanguage, R.string.always_show_language)
|
|
|
|
text(PrefS.spAutoCWLines, R.string.auto_cw, InputTypeEx.number)
|
|
|
|
text(PrefS.spCardDescriptionLength, R.string.card_description_length, InputTypeEx.number)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipRepliesCount,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.display_replies_count,
|
|
|
|
R.string.replies_count_simple,
|
|
|
|
R.string.replies_count_actual,
|
|
|
|
R.string.replies_count_none
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipBoostsCount,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.display_boost_count,
|
|
|
|
R.string.replies_count_simple,
|
|
|
|
R.string.replies_count_actual,
|
|
|
|
R.string.replies_count_none
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipFavouritesCount,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.display_favourite_count,
|
|
|
|
R.string.replies_count_simple,
|
|
|
|
R.string.replies_count_actual,
|
|
|
|
R.string.replies_count_none
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipVisibilityStyle,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.visibility_style,
|
|
|
|
R.string.visibility_style_by_account,
|
|
|
|
R.string.mastodon,
|
|
|
|
R.string.misskey
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
AppSettingItem.TIMELINE_FONT = item(
|
2021-05-22 00:03:16 +02:00
|
|
|
SettingType.TextWithSelector,
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spTimelineFont,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.timeline_font
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val item = this
|
|
|
|
onClickEdit = {
|
|
|
|
try {
|
|
|
|
val intent = intentOpenDocument("*/*")
|
2021-05-22 00:03:16 +02:00
|
|
|
arTimelineFont.launch(intent)
|
2020-12-19 07:46:42 +01:00
|
|
|
} catch (ex: Throwable) {
|
|
|
|
showToast(ex, "could not open picker for font")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onClickReset = {
|
|
|
|
pref.edit().remove(item.pref?.key).apply()
|
|
|
|
showTimelineFont(item)
|
|
|
|
}
|
|
|
|
showTextView = { showTimelineFont(item, it) }
|
|
|
|
}
|
|
|
|
|
|
|
|
AppSettingItem.TIMELINE_FONT_BOLD = item(
|
2021-05-22 00:03:16 +02:00
|
|
|
SettingType.TextWithSelector,
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spTimelineFontBold,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.timeline_font_bold
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val item = this
|
|
|
|
onClickEdit = {
|
|
|
|
try {
|
|
|
|
val intent = intentOpenDocument("*/*")
|
2021-05-22 00:03:16 +02:00
|
|
|
arTimelineFontBold.launch(intent)
|
2020-12-19 07:46:42 +01:00
|
|
|
} catch (ex: Throwable) {
|
|
|
|
showToast(ex, "could not open picker for font")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onClickReset = {
|
|
|
|
pref.edit().remove(item.pref?.key).apply()
|
|
|
|
showTimelineFont(AppSettingItem.TIMELINE_FONT_BOLD)
|
|
|
|
}
|
|
|
|
showTextView = { showTimelineFont(item, it) }
|
|
|
|
}
|
|
|
|
|
|
|
|
AppSettingItem.FONT_SIZE_TIMELINE = textX(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefF.fpTimelineFontSize,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.timeline_font_size,
|
|
|
|
InputTypeEx.numberDecimal
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
val item = this
|
|
|
|
val fp: FloatPref = item.pref.cast()!!
|
|
|
|
|
|
|
|
toFloat = { parseFontSize(it) }
|
|
|
|
fromFloat = { formatFontSize(it) }
|
|
|
|
|
|
|
|
captionFontSize = {
|
|
|
|
val fv = fp(pref)
|
|
|
|
when {
|
2021-06-22 10:31:51 +02:00
|
|
|
!fv.isFinite() -> PrefF.default_timeline_font_size
|
2020-12-19 07:46:42 +01:00
|
|
|
fv < 1f -> 1f
|
|
|
|
else -> fv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
captionSpacing = {
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spTimelineSpacing(pref).toFloatOrNull()
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
changed = {
|
|
|
|
findItemViewHolder(item)?.updateCaption()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
textX(PrefF.fpAcctFontSize, R.string.acct_font_size, InputTypeEx.numberDecimal) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val item = this
|
|
|
|
val fp: FloatPref = item.pref.cast()!!
|
|
|
|
|
|
|
|
toFloat = { parseFontSize(it) }
|
|
|
|
fromFloat = { formatFontSize(it) }
|
|
|
|
|
|
|
|
captionFontSize = {
|
|
|
|
val fv = fp(pref)
|
|
|
|
when {
|
2021-06-22 10:31:51 +02:00
|
|
|
!fv.isFinite() -> PrefF.default_acct_font_size
|
2020-12-19 07:46:42 +01:00
|
|
|
fv < 1f -> 1f
|
|
|
|
else -> fv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
changed = { findItemViewHolder(item)?.updateCaption() }
|
|
|
|
}
|
|
|
|
|
|
|
|
AppSettingItem.FONT_SIZE_NOTIFICATION_TL = textX(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefF.fpNotificationTlFontSize,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.notification_tl_font_size,
|
|
|
|
InputTypeEx.numberDecimal
|
|
|
|
) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val item = this
|
|
|
|
val fp: FloatPref = item.pref.cast()!!
|
|
|
|
|
|
|
|
toFloat = { parseFontSize(it) }
|
|
|
|
fromFloat = { formatFontSize(it) }
|
|
|
|
|
|
|
|
captionFontSize = {
|
|
|
|
val fv = fp(pref)
|
|
|
|
when {
|
2021-06-22 10:31:51 +02:00
|
|
|
!fv.isFinite() -> PrefF.default_notification_tl_font_size
|
2020-12-19 07:46:42 +01:00
|
|
|
fv < 1f -> 1f
|
|
|
|
else -> fv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
captionSpacing = {
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spTimelineSpacing(pref).toFloatOrNull()
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
changed = {
|
|
|
|
findItemViewHolder(item)?.updateCaption()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
text(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefS.spNotificationTlIconSize,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.notification_tl_icon_size,
|
|
|
|
InputTypeEx.numberDecimal
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spTimelineSpacing, R.string.timeline_line_spacing, InputTypeEx.numberDecimal) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = {
|
|
|
|
findItemViewHolder(AppSettingItem.FONT_SIZE_TIMELINE)?.updateCaption()
|
|
|
|
findItemViewHolder(AppSettingItem.FONT_SIZE_NOTIFICATION_TL)?.updateCaption()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spBoostButtonSize, R.string.boost_button_size, InputTypeEx.numberDecimal)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipBoostButtonJustify,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.boost_button_alignment,
|
|
|
|
R.string.start,
|
|
|
|
R.string.center,
|
|
|
|
R.string.end
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spAvatarIconSize, R.string.avatar_icon_size, InputTypeEx.numberDecimal)
|
|
|
|
text(PrefS.spRoundRatio, R.string.avatar_icon_round_ratio, InputTypeEx.numberDecimal)
|
|
|
|
sw(PrefB.bpDontRound, R.string.avatar_icon_dont_round)
|
|
|
|
text(PrefS.spReplyIconSize, R.string.reply_icon_size, InputTypeEx.numberDecimal)
|
|
|
|
text(PrefS.spHeaderIconSize, R.string.header_icon_size, InputTypeEx.numberDecimal)
|
|
|
|
textX(PrefF.fpHeaderTextSize, R.string.header_text_size, InputTypeEx.numberDecimal) {
|
2020-12-19 07:46:42 +01:00
|
|
|
val item = this
|
|
|
|
val fp: FloatPref = item.pref.cast()!!
|
|
|
|
|
|
|
|
toFloat = { parseFontSize(it) }
|
|
|
|
fromFloat = { formatFontSize(it) }
|
|
|
|
|
|
|
|
captionFontSize = {
|
|
|
|
val fv = fp(pref)
|
|
|
|
when {
|
2021-06-22 10:31:51 +02:00
|
|
|
!fv.isFinite() -> PrefF.default_header_font_size
|
2020-12-19 07:46:42 +01:00
|
|
|
fv < 1f -> 1f
|
|
|
|
else -> fv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
changed = {
|
|
|
|
findItemViewHolder(item)?.updateCaption()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spStripIconSize, R.string.strip_icon_size, InputTypeEx.numberDecimal)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spScreenBottomPadding, R.string.screen_bottom_padding, InputTypeEx.numberDecimal)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpOpenSticker, R.string.show_open_sticker) {
|
2020-12-19 07:46:42 +01:00
|
|
|
desc = R.string.powered_by_open_sticker
|
|
|
|
descClick = { openBrowser("https://github.com/cutls/OpenSticker") }
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpLinksInContextMenu, R.string.show_links_in_context_menu)
|
|
|
|
sw(PrefB.bpShowLinkUnderline, R.string.show_link_underline)
|
2021-11-06 01:36:00 +01:00
|
|
|
|
|
|
|
sw(PrefB.bpMfmDecorationEnabled, R.string.mfm_decoration_enabled)
|
|
|
|
sw(PrefB.bpMfmDecorationShowUnsupportedMarkup, R.string.mfm_show_unsupported_markup)
|
|
|
|
|
2020-12-19 07:46:42 +01:00
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpMoveNotificationsQuickFilter,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.move_notifications_quick_filter_to_column_setting
|
|
|
|
)
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpShowSearchClear, R.string.show_clear_button_in_search_bar)
|
2020-12-19 07:46:42 +01:00
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpDontShowColumnBackgroundImage,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.dont_show_column_background_image
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
group(R.string.show_in_directory) {
|
2021-06-22 10:31:51 +02:00
|
|
|
checkbox(PrefB.bpDirectoryLastActive, R.string.last_active)
|
|
|
|
checkbox(PrefB.bpDirectoryFollowers, R.string.followers)
|
|
|
|
checkbox(PrefB.bpDirectoryTootCount, R.string.toot_count)
|
|
|
|
checkbox(PrefB.bpDirectoryNote, R.string.note)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sw(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefB.bpAlwaysExpandContextMenuItems,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.always_expand_context_menu_sub_items
|
|
|
|
)
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpShowBookmarkButton, R.string.show_bookmark_button)
|
|
|
|
sw(PrefB.bpHideFollowCount, R.string.hide_followers_count)
|
|
|
|
sw(PrefB.bpEmojioneShortcode, R.string.emojione_shortcode_support) {
|
2020-12-19 07:46:42 +01:00
|
|
|
desc = R.string.emojione_shortcode_support_desc
|
|
|
|
}
|
2021-11-08 12:05:03 +01:00
|
|
|
sw(PrefB.bpUseTwemoji, R.string.use_twemoji_emoji)
|
2021-05-21 08:29:32 +02:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpKeepReactionSpace, R.string.keep_reaction_space)
|
2021-12-03 17:57:07 +01:00
|
|
|
|
|
|
|
text(PrefS.spEventTextAlpha, R.string.event_text_alpha, InputTypeEx.numberDecimal)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.color) {
|
|
|
|
|
|
|
|
spinner(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipUiTheme,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.ui_theme,
|
|
|
|
R.string.theme_light,
|
|
|
|
R.string.theme_dark
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorAlpha(PrefI.ipListDividerColor, R.string.list_divider_color)
|
|
|
|
colorAlpha(PrefI.ipLinkColor, R.string.link_color)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
group(R.string.toot_background_color) {
|
2021-06-22 10:31:51 +02:00
|
|
|
colorAlpha(PrefI.ipTootColorUnlisted, R.string.unlisted_visibility)
|
|
|
|
colorAlpha(PrefI.ipTootColorFollower, R.string.followers_visibility)
|
|
|
|
colorAlpha(PrefI.ipTootColorDirectUser, R.string.direct_with_user_visibility)
|
|
|
|
colorAlpha(PrefI.ipTootColorDirectMe, R.string.direct_only_me_visibility)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
group(R.string.event_background_color) {
|
2021-06-22 10:31:51 +02:00
|
|
|
colorAlpha(PrefI.ipEventBgColorBoost, R.string.boost)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorFavourite, R.string.favourites)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorBookmark, R.string.bookmarks)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorMention, R.string.reply)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorFollow, R.string.follow)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorUnfollow, R.string.unfollow_misskey)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorFollowRequest, R.string.follow_request)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorReaction, R.string.reaction)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorQuote, R.string.quote_renote)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorVote, R.string.vote_polls)
|
|
|
|
colorAlpha(PrefI.ipEventBgColorStatus, R.string.status)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
colorAlpha(
|
2021-06-22 10:31:51 +02:00
|
|
|
PrefI.ipConversationMainTootBgColor,
|
2021-05-22 00:03:16 +02:00
|
|
|
R.string.conversation_main_toot_background_color
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorAlpha(PrefI.ipEventBgColorGap, R.string.gap)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
group(R.string.button_accent_color) {
|
2021-06-22 10:31:51 +02:00
|
|
|
colorAlpha(PrefI.ipButtonBoostedColor, R.string.boost)
|
|
|
|
colorAlpha(PrefI.ipButtonFavoritedColor, R.string.favourites)
|
|
|
|
colorAlpha(PrefI.ipButtonBookmarkedColor, R.string.bookmarks)
|
|
|
|
colorAlpha(PrefI.ipButtonFollowingColor, R.string.follow)
|
|
|
|
colorAlpha(PrefI.ipButtonFollowRequestColor, R.string.follow_request)
|
|
|
|
colorAlpha(PrefI.ipButtonReactionedColor, R.string.reaction)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
group(R.string.column_color_default) {
|
|
|
|
AppSettingItem.SAMPLE_CCD_HEADER =
|
|
|
|
sample(R.layout.setting_sample_column_header) { activity, viewRoot ->
|
|
|
|
|
|
|
|
val llColumnHeader: View = viewRoot.findViewById(R.id.llColumnHeader)
|
|
|
|
val ivColumnHeader: ImageView = viewRoot.findViewById(R.id.ivColumnHeader)
|
|
|
|
val tvColumnName: TextView = viewRoot.findViewById(R.id.tvColumnName)
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
val colorColumnHeaderBg = PrefI.ipCcdHeaderBg(activity.pref)
|
|
|
|
val colorColumnHeaderFg = PrefI.ipCcdHeaderFg(activity.pref)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
val headerBg = when {
|
|
|
|
colorColumnHeaderBg != 0 -> colorColumnHeaderBg
|
2021-01-04 02:11:45 +01:00
|
|
|
else -> activity.attrColor(R.attr.color_column_header)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
val headerFg = when {
|
|
|
|
colorColumnHeaderFg != 0 -> colorColumnHeaderFg
|
2021-01-04 02:11:45 +01:00
|
|
|
else -> activity.attrColor(R.attr.colorColumnHeaderName)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
llColumnHeader.background = getAdaptiveRippleDrawable(headerBg, headerFg)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
tvColumnName.setTextColor(headerFg)
|
2020-12-19 07:46:42 +01:00
|
|
|
ivColumnHeader.setImageResource(R.drawable.ic_bike)
|
2021-06-20 15:12:25 +02:00
|
|
|
ivColumnHeader.imageTintList = ColorStateList.valueOf(headerFg)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipCcdHeaderBg, R.string.header_background_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_CCD_HEADER) }
|
|
|
|
}
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipCcdHeaderFg, R.string.header_foreground_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_CCD_HEADER) }
|
|
|
|
}
|
|
|
|
|
|
|
|
AppSettingItem.SAMPLE_CCD_BODY =
|
|
|
|
sample(R.layout.setting_sample_column_body) { activity, viewRoot ->
|
|
|
|
val flColumnBackground: View = viewRoot.findViewById(R.id.flColumnBackground)
|
|
|
|
val tvSampleAcct: TextView = viewRoot.findViewById(R.id.tvSampleAcct)
|
|
|
|
val tvSampleContent: TextView = viewRoot.findViewById(R.id.tvSampleContent)
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
val colorColumnBg = PrefI.ipCcdContentBg(activity.pref)
|
|
|
|
val colorColumnAcct = PrefI.ipCcdContentAcct(activity.pref)
|
|
|
|
val colorColumnText = PrefI.ipCcdContentText(activity.pref)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
flColumnBackground.setBackgroundColor(colorColumnBg) // may 0
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
tvSampleAcct.setTextColor(
|
2021-06-20 15:12:25 +02:00
|
|
|
colorColumnAcct.notZero()
|
2021-05-22 00:03:16 +02:00
|
|
|
?: activity.attrColor(R.attr.colorTimeSmall)
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
tvSampleContent.setTextColor(
|
2021-06-20 15:12:25 +02:00
|
|
|
colorColumnText.notZero()
|
2021-05-22 00:03:16 +02:00
|
|
|
?: activity.attrColor(R.attr.colorContentText)
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipCcdContentBg, R.string.content_background_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_CCD_BODY) }
|
|
|
|
}
|
2021-06-22 10:31:51 +02:00
|
|
|
colorAlpha(PrefI.ipCcdContentAcct, R.string.content_acct_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_CCD_BODY) }
|
|
|
|
}
|
2021-06-22 10:31:51 +02:00
|
|
|
colorAlpha(PrefI.ipCcdContentText, R.string.content_text_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_CCD_BODY) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
text(PrefS.spBoostAlpha, R.string.boost_button_alpha, InputTypeEx.numberDecimal)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
group(R.string.footer_color) {
|
|
|
|
AppSettingItem.SAMPLE_FOOTER =
|
|
|
|
sample(R.layout.setting_sample_footer) { activity, viewRoot ->
|
|
|
|
val pref = activity.pref
|
|
|
|
val ivFooterToot: AppCompatImageView = viewRoot.findViewById(R.id.ivFooterToot)
|
|
|
|
val ivFooterMenu: AppCompatImageView = viewRoot.findViewById(R.id.ivFooterMenu)
|
|
|
|
val llFooterBG: View = viewRoot.findViewById(R.id.llFooterBG)
|
|
|
|
val vFooterDivider1: View = viewRoot.findViewById(R.id.vFooterDivider1)
|
|
|
|
val vFooterDivider2: View = viewRoot.findViewById(R.id.vFooterDivider2)
|
|
|
|
val vIndicator: View = viewRoot.findViewById(R.id.vIndicator)
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
val footerButtonBgColor = PrefI.ipFooterButtonBgColor(pref)
|
|
|
|
val footerButtonFgColor = PrefI.ipFooterButtonFgColor(pref)
|
|
|
|
val footerTabBgColor = PrefI.ipFooterTabBgColor(pref)
|
|
|
|
val footerTabDividerColor = PrefI.ipFooterTabDividerColor(pref)
|
|
|
|
val footerTabIndicatorColor = PrefI.ipFooterTabIndicatorColor(pref)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
val colorColumnStripBackground = footerTabBgColor.notZero()
|
2021-01-04 02:11:45 +01:00
|
|
|
?: activity.attrColor(R.attr.colorColumnStripBackground)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
llFooterBG.setBackgroundColor(colorColumnStripBackground)
|
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
val colorButtonBg = footerButtonBgColor.notZero()
|
2020-12-19 07:46:42 +01:00
|
|
|
?: colorColumnStripBackground
|
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
val colorButtonFg = footerButtonFgColor.notZero()
|
2021-01-04 02:11:45 +01:00
|
|
|
?: activity.attrColor(R.attr.colorRippleEffect)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
|
|
|
ivFooterMenu.backgroundDrawable =
|
|
|
|
getAdaptiveRippleDrawableRound(activity, colorButtonBg, colorButtonFg)
|
|
|
|
ivFooterToot.backgroundDrawable =
|
|
|
|
getAdaptiveRippleDrawableRound(activity, colorButtonBg, colorButtonFg)
|
|
|
|
|
|
|
|
val csl = ColorStateList.valueOf(
|
2021-06-20 15:12:25 +02:00
|
|
|
footerButtonFgColor.notZero()
|
2021-05-22 00:03:16 +02:00
|
|
|
?: activity.attrColor(R.attr.colorVectorDrawable)
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
ivFooterToot.imageTintList = csl
|
|
|
|
ivFooterMenu.imageTintList = csl
|
|
|
|
|
2021-06-20 15:12:25 +02:00
|
|
|
val c = footerTabDividerColor.notZero()
|
2020-12-19 07:46:42 +01:00
|
|
|
?: colorColumnStripBackground
|
|
|
|
vFooterDivider1.setBackgroundColor(c)
|
|
|
|
vFooterDivider2.setBackgroundColor(c)
|
|
|
|
|
|
|
|
vIndicator.setBackgroundColor(
|
2021-06-20 15:12:25 +02:00
|
|
|
footerTabIndicatorColor.notZero()
|
2021-05-22 00:03:16 +02:00
|
|
|
?: activity.attrColor(R.attr.colorAccent)
|
|
|
|
)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipFooterButtonBgColor, R.string.button_background_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_FOOTER) }
|
|
|
|
}
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipFooterButtonFgColor, R.string.button_foreground_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_FOOTER) }
|
|
|
|
}
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipFooterTabBgColor, R.string.quick_toot_bar_background_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_FOOTER) }
|
|
|
|
}
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipFooterTabDividerColor, R.string.tab_divider_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_FOOTER) }
|
|
|
|
}
|
2021-06-22 10:31:51 +02:00
|
|
|
colorAlpha(PrefI.ipFooterTabIndicatorColor, R.string.tab_indicator_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { showSample(AppSettingItem.SAMPLE_FOOTER) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipSwitchOnColor, R.string.switch_button_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { setSwitchColor() }
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipStatusBarColor, R.string.status_bar_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { setStatusBarColor() }
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipNavigationBarColor, R.string.navigation_bar_color) {
|
2020-12-19 07:46:42 +01:00
|
|
|
changed = { setStatusBarColor() }
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
colorOpaque(PrefI.ipSearchBgColor, R.string.search_bar_background_color)
|
|
|
|
colorAlpha(PrefI.ipAnnouncementsBgColor, R.string.announcement_background_color)
|
|
|
|
colorAlpha(PrefI.ipVerifiedLinkBgColor, R.string.verified_link_background_color)
|
|
|
|
colorAlpha(PrefI.ipVerifiedLinkFgColor, R.string.verified_link_foreground_color)
|
2020-12-19 07:46:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.performance) {
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpShareViewPool, R.string.share_view_pool)
|
|
|
|
sw(PrefB.bpDontUseStreaming, R.string.dont_use_streaming_api)
|
|
|
|
sw(PrefB.bpDontRefreshOnResume, R.string.dont_refresh_on_activity_resume)
|
|
|
|
text(PrefS.spMediaReadTimeout, R.string.timeout_for_embed_media_viewer, InputTypeEx.number)
|
2020-12-19 07:46:42 +01:00
|
|
|
action(R.string.delete_custom_emoji_cache) {
|
|
|
|
action = {
|
|
|
|
App1.custom_emoji_cache.delete()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
section(R.string.developer_options) {
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpCheckBetaVersion, R.string.check_beta_release)
|
2020-12-19 07:46:42 +01:00
|
|
|
|
2021-06-22 10:31:51 +02:00
|
|
|
sw(PrefB.bpEmojiPickerCategoryOther, R.string.show_emoji_picker_other_category)
|
2020-12-19 07:46:42 +01:00
|
|
|
action(R.string.drawable_list) {
|
|
|
|
action = { startActivity(Intent(this, ActDrawableList::class.java)) }
|
|
|
|
}
|
2021-02-15 08:45:22 +01:00
|
|
|
|
2020-12-19 07:46:42 +01:00
|
|
|
action(R.string.exit_reasons) {
|
|
|
|
action = {
|
|
|
|
if (Build.VERSION.SDK_INT >= 30) {
|
|
|
|
startActivity(Intent(this, ActExitReasons::class.java))
|
|
|
|
} else {
|
|
|
|
showToast(false, "this feature requires Android 11")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
action(R.string.app_data_export) {
|
|
|
|
action = { exportAppData() }
|
|
|
|
}
|
|
|
|
|
|
|
|
action(R.string.app_data_import) {
|
|
|
|
action = { importAppData1() }
|
|
|
|
desc = R.string.app_data_import_desc
|
|
|
|
}
|
2020-01-31 08:46:30 +01:00
|
|
|
}
|