設定キーの一覧を複数ファイルに分割。「カラム設定/添付メディアの説明文を表示する」を追加。

This commit is contained in:
tateisu 2021-11-06 12:00:29 +09:00
parent 4108c82e75
commit 243dfc0bc5
97 changed files with 948 additions and 717 deletions

View File

@ -3,11 +3,11 @@
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8">
<module name="apng" target="1.7" />
<module name="SubwayTooter.apng_android" target="14" />
<module name="SubwayTooter.app" target="14" />
<module name="SubwayTooter.colorpicker" target="14" />
<module name="SubwayTooter.emoji" target="14" />
<module name="SubwayTooter.sample_apng" target="14" />
<module name="SubwayTooter.apng_android" target="11" />
<module name="SubwayTooter.app" target="11" />
<module name="SubwayTooter.colorpicker" target="11" />
<module name="SubwayTooter.emoji" target="11" />
<module name="SubwayTooter.sample_apng" target="11" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -7,7 +7,7 @@
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="azul-14" />
<option name="gradleJvm" value="Embedded JDK" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View File

@ -11,3 +11,22 @@ dependencies {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileKotlin {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
kotlinOptions {
jvmTarget = jvm_target
useIR = true
freeCompilerArgs += [
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-Xopt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-Xopt-in=androidx.compose.animation.ExperimentalAnimationApi",
]
}
}

View File

@ -17,6 +17,7 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {

View File

@ -27,6 +27,7 @@ android {
versionName "4.6.6"
applicationId "jp.juggler.subwaytooter"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
kotlinOptions {

View File

@ -31,6 +31,8 @@ import jp.juggler.subwaytooter.dialog.ActionsDialog
import jp.juggler.subwaytooter.notification.NotificationHelper
import jp.juggler.subwaytooter.notification.PollingWorker
import jp.juggler.subwaytooter.notification.PushSubscriptionHelper
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.table.AcctColor
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.*

View File

@ -29,6 +29,11 @@ import jp.juggler.subwaytooter.appsetting.SettingType
import jp.juggler.subwaytooter.appsetting.appSettingRoot
import jp.juggler.subwaytooter.dialog.DlgAppPicker
import jp.juggler.subwaytooter.notification.PollingWorker
import jp.juggler.subwaytooter.pref.*
import jp.juggler.subwaytooter.pref.impl.BooleanPref
import jp.juggler.subwaytooter.pref.impl.FloatPref
import jp.juggler.subwaytooter.pref.impl.IntPref
import jp.juggler.subwaytooter.pref.impl.StringPref
import jp.juggler.subwaytooter.table.AcctColor
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.CustomShare

View File

@ -30,6 +30,10 @@ import jp.juggler.subwaytooter.column.*
import jp.juggler.subwaytooter.dialog.DlgQuickTootMenu
import jp.juggler.subwaytooter.itemviewholder.StatusButtonsPopup
import jp.juggler.subwaytooter.notification.PollingWorker
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.pref.put
import jp.juggler.subwaytooter.span.MyClickableSpan
import jp.juggler.subwaytooter.span.MyClickableSpanHandler
import jp.juggler.subwaytooter.table.SavedAccount

View File

@ -56,6 +56,7 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
internal const val EXTRA_IDX = "idx"
internal const val EXTRA_DATA = "data"
internal const val EXTRA_SERVICE_TYPE = "serviceType"
internal const val EXTRA_SHOW_DESCRIPTION = "showDescription"
internal const val STATE_PLAYER_POS = "playerPos"
internal const val STATE_PLAYER_PLAY_WHEN_READY = "playerPlayWhenReady"
@ -74,6 +75,7 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
fun open(
activity: ActMain,
showDescription: Boolean,
serviceType: ServiceType,
list: ArrayList<TootAttachmentLike>,
idx: Int,
@ -82,6 +84,7 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
intent.putExtra(EXTRA_IDX, idx)
intent.putExtra(EXTRA_SERVICE_TYPE, serviceType.ordinal)
intent.putExtra(EXTRA_DATA, encodeMediaList(list))
intent.putExtra(EXTRA_SHOW_DESCRIPTION, showDescription)
activity.startActivity(intent)
activity.overridePendingTransition(R.anim.slide_from_bottom, android.R.anim.fade_out)
}
@ -90,6 +93,7 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
internal var idx: Int = 0
private lateinit var mediaList: ArrayList<TootAttachment>
private lateinit var serviceType: ServiceType
private var showDescription = true
private lateinit var pbvImage: PinchBitmapView
private lateinit var btnPrevious: View
@ -175,6 +179,8 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
val intent = intent
this.showDescription = intent.getBooleanExtra(EXTRA_SHOW_DESCRIPTION, showDescription)
this.idx = savedInstanceState?.getInt(EXTRA_IDX) ?: intent.getIntExtra(EXTRA_IDX, idx)
this.serviceType = ServiceType.values()[
@ -303,7 +309,7 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
}
val ta = mediaList[idx]
val description = ta.description
if (description?.isNotEmpty() == true) {
if (showDescription && description?.isNotEmpty() == true) {
svDescription.visibility = View.VISIBLE
tvDescription.text = description
}

View File

@ -19,6 +19,7 @@ import jp.juggler.subwaytooter.actpost.*
import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.dialog.*
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.span.MyClickableSpan
import jp.juggler.subwaytooter.span.MyClickableSpanHandler
import jp.juggler.subwaytooter.table.SavedAccount

View File

@ -21,6 +21,9 @@ import com.bumptech.glide.load.model.GlideUrl
import jp.juggler.subwaytooter.api.TootApiClient
import jp.juggler.subwaytooter.column.ColumnType
import jp.juggler.subwaytooter.emoji.EmojiMap
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.pref.pref
import jp.juggler.subwaytooter.table.*
import jp.juggler.subwaytooter.util.CustomEmojiCache
import jp.juggler.subwaytooter.util.CustomEmojiLister

View File

@ -7,6 +7,7 @@ import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import jp.juggler.subwaytooter.notification.PollingForegrounder
import jp.juggler.subwaytooter.notification.PollingWorker
import jp.juggler.subwaytooter.pref.PrefDevice
import jp.juggler.util.LogCategory

View File

@ -1,654 +0,0 @@
package jp.juggler.subwaytooter
import android.content.Context
import android.content.SharedPreferences
import android.graphics.Color
import jp.juggler.subwaytooter.itemviewholder.AdditionalButtonsPosition
import jp.juggler.util.optInt
fun Context.pref(): SharedPreferences =
this.getSharedPreferences(this.packageName + "_preferences", Context.MODE_PRIVATE)
@Suppress("EqualsOrHashCode")
abstract class BasePref<T>(val key: String, val defVal: T) {
companion object {
// キー名と設定項目のマップ。インポートやアプリ設定で使う
val allPref = HashMap<String, BasePref<*>>()
}
init {
when {
allPref[key] != null -> error("Preference key duplicate: $key")
else -> {
@Suppress("LeakingThis")
allPref[key] = this
}
}
}
abstract fun put(editor: SharedPreferences.Editor, v: T)
abstract operator fun invoke(pref: SharedPreferences): T
override fun equals(other: Any?) =
this === other
override fun hashCode(): Int = key.hashCode()
operator fun invoke(context: Context): T =
invoke(context.pref())
fun remove(e: SharedPreferences.Editor): SharedPreferences.Editor =
e.remove(key)
fun removeDefault(pref: SharedPreferences, e: SharedPreferences.Editor) =
if (pref.contains(key) && this.invoke(pref) == defVal) {
e.remove(key)
true
} else {
false
}
}
fun SharedPreferences.Editor.remove(item: BasePref<*>): SharedPreferences.Editor {
item.remove(this)
return this
}
class BooleanPref(key: String, defVal: Boolean) : BasePref<Boolean>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): Boolean =
pref.getBoolean(key, defVal)
// put if value is not default, remove if value is same to default
override fun put(editor: SharedPreferences.Editor, v: Boolean) {
if (v == defVal) editor.remove(key) else editor.putBoolean(key, v)
}
}
class IntPref(key: String, defVal: Int) : BasePref<Int>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): Int =
pref.getInt(key, defVal)
override fun put(editor: SharedPreferences.Editor, v: Int) {
if (v == defVal) editor.remove(key) else editor.putInt(key, v)
}
}
class LongPref(key: String, defVal: Long) : BasePref<Long>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): Long =
pref.getLong(key, defVal)
override fun put(editor: SharedPreferences.Editor, v: Long) {
if (v == defVal) editor.remove(key) else editor.putLong(key, v)
}
}
class FloatPref(key: String, defVal: Float) : BasePref<Float>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): Float =
pref.getFloat(key, defVal)
override fun put(editor: SharedPreferences.Editor, v: Float) {
if (v == defVal) editor.remove(key) else editor.putFloat(key, v)
}
}
class StringPref(
key: String,
defVal: String,
val skipImport: Boolean = false,
) : BasePref<String>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): String =
pref.getString(key, defVal) ?: defVal
override fun put(editor: SharedPreferences.Editor, v: String) {
if (v == defVal) editor.remove(key) else editor.putString(key, v)
}
fun toInt(pref: SharedPreferences) = invoke(pref).optInt() ?: defVal.toInt()
}
fun SharedPreferences.Editor.put(item: BooleanPref, v: Boolean) =
this.apply { item.put(this, v) }
fun SharedPreferences.Editor.put(item: StringPref, v: String) =
this.apply { item.put(this, v) }
fun SharedPreferences.Editor.put(item: IntPref, v: Int) =
this.apply { item.put(this, v) }
fun SharedPreferences.Editor.put(item: LongPref, v: Long) =
this.apply { item.put(this, v) }
fun SharedPreferences.Editor.put(item: FloatPref, v: Float) =
this.apply { item.put(this, v) }
object PrefB {
// boolean
val bpDisableEmojiAnimation = BooleanPref(
"disable_emoji_animation",
false
)
// val bpDisableFastScroller = BooleanPref("disable_fast_scroller", true, 0) // R.id.swDisableFastScroller)
val bpDisableTabletMode = BooleanPref(
"disable_tablet_mode",
false
)
val bpDontConfirmBeforeCloseColumn = BooleanPref(
"DontConfirmBeforeCloseColumn",
false
)
val bpDontCropMediaThumb = BooleanPref(
"DontCropMediaThumb",
true
)
val bpDontDuplicationCheck = BooleanPref(
"dont_duplication_check",
false
)
val bpDontRefreshOnResume = BooleanPref(
"dont_refresh_on_resume",
false
)
val bpDontRound = BooleanPref(
"dont_round",
false
)
val bpDontScreenOff = BooleanPref(
"dont_screen_off",
false
)
val bpDontUseActionButtonWithQuickPostBar = BooleanPref(
"dont_use_action_button",
false
)
val bpDontUseStreaming = BooleanPref(
"dont_use_streaming",
false
)
val bpEnableGifAnimation = BooleanPref(
"enable_gif_animation",
false
)
val bpExitAppWhenCloseProtectedColumn = BooleanPref(
"ExitAppWhenCloseProtectedColumn",
false
)
val bpMentionFullAcct = BooleanPref(
"mention_full_acct",
false
)
val bpNotificationLED = BooleanPref(
"notification_led",
true
)
val bpNotificationSound = BooleanPref(
"notification_sound",
true
)
val bpNotificationVibration = BooleanPref(
"notification_vibration",
true
)
val bpPostButtonBarTop = BooleanPref(
"post_button_bar_at_top",
true
)
val bpPriorChrome = BooleanPref(
"prior_chrome",
true
)
val bpDontUseCustomTabs = BooleanPref(
"DontUseCustomTabs",
false
)
val bpPriorLocalURL = BooleanPref(
"prior_local_url",
false
)
val bpQuickPostBar = BooleanPref(
"quick_toot_bar",
false
)
val bpRelativeTimestamp = BooleanPref(
"relative_timestamp",
true
)
val bpShortAcctLocalUser = BooleanPref(
"short_acct_local_user",
true
)
val bpShowFollowButtonInButtonBar = BooleanPref(
"ShowFollowButtonInButtonBar",
false
)
val bpSimpleList = BooleanPref(
"simple_list",
true
)
val bpUseInternalMediaViewer = BooleanPref(
"use_internal_media_viewer",
true
)
val bpShowAppName = BooleanPref(
"show_app_name",
false
)
val bpShowLanguage = BooleanPref(
"ShowLanguage",
false
)
val bpForceGap = BooleanPref(
"force_gap",
false
)
val bpShareViewPool = BooleanPref(
"ShareViewPool",
true
)
val bpAllowColumnDuplication = BooleanPref(
"AllowColumnDuplication",
true
)
val bpAppendAttachmentUrlToContent = BooleanPref(
"AppendAttachmentUrlToContent",
false
)
val bpVerticalArrangeThumbnails = BooleanPref(
"VerticalArrangeThumbnails",
false
)
val bpDontShowPreviewCard = BooleanPref(
"DontShowPreviewCard",
false
)
val bpScrollTopFromColumnStrip = BooleanPref(
"ScrollTopFromColumnStrip",
false
)
val bpOpenSticker = BooleanPref(
"InstanceTicker", // 歴史的な理由でキー名が異なる
false
)
val bpLinksInContextMenu = BooleanPref(
"LinksInContextMenu",
false
)
val bpMoveNotificationsQuickFilter = BooleanPref(
"MoveNotificationsQuickFilter",
false
)
val bpShowAcctInSystemNotification = BooleanPref(
"ShowAcctInSystemNotification",
false
)
val bpShowLinkUnderline = BooleanPref(
"ShowLinkUnderline",
false
)
val bpShowSearchClear = BooleanPref(
"ShowSearchClear",
false
)
val bpDontRemoveDeletedToot = BooleanPref(
"DontRemoveDeletedToot",
false
)
val bpDontShowColumnBackgroundImage = BooleanPref(
"DontShowColumnBackgroundImage",
false
)
val bpCustomEmojiSeparatorZwsp = BooleanPref(
"CustomEmojiSeparatorZwsp",
false
)
val bpShowTranslateButton = BooleanPref(
"ShowTranslateButton",
false
)
val bpDirectoryLastActive = BooleanPref(
"DirectoryLastActive",
true
)
val bpDirectoryFollowers = BooleanPref(
"DirectoryFollowers",
true
)
val bpDirectoryTootCount = BooleanPref(
"DirectoryTootCount",
true
)
val bpDirectoryNote = BooleanPref(
"DirectoryNote",
true
)
val bpWarnHashtagAsciiAndNonAscii = BooleanPref(
"WarnHashtagAsciiAndNonAscii",
false
)
val bpEnablePixelfed = BooleanPref(
"EnablePixelfed",
false
)
val bpQuickTootOmitAccountSelection = BooleanPref(
"QuickTootOmitAccountSelection",
false
)
val bpSeparateReplyNotificationGroup = BooleanPref(
"SeparateReplyNotificationGroup",
false
)
val bpAlwaysExpandContextMenuItems = BooleanPref(
"AlwaysExpandContextMenuItems",
false
)
val bpShowBookmarkButton = BooleanPref(
"ShowBookmarkButton2",
true
)
val bpShowFilteredWord = BooleanPref(
"ShowFilteredWord",
false
)
val bpEnableDomainTimeline = BooleanPref(
"EnableDomainTimeline",
false
)
val bpDivideNotification = BooleanPref(
"DivideNotification",
false
)
val bpHideFollowCount = BooleanPref(
"HideFollowCount",
false
)
val bpEmojioneShortcode = BooleanPref(
"EmojioneShortcode",
true
)
val bpEmojiPickerCloseOnSelected = BooleanPref(
"EmojiPickerCloseOnSelected",
true
)
val bpCheckBetaVersion = BooleanPref(
"CheckBetaVersion",
false
)
val bpIgnoreTextInSharedMedia = BooleanPref(
"IgnoreTextInSharedMedia",
false
)
val bpEmojiPickerCategoryOther = BooleanPref(
"EmojiPickerCategoryOther",
false
)
val bpInAppUnicodeEmoji = BooleanPref(
"InAppUnicodeEmoji",
true
)
val bpKeepReactionSpace = BooleanPref(
"KeepReactionSpace",
false
)
val bpMultiWindowPost = BooleanPref(
"MultiWindowPost",
false
)
val bpManyWindowPost = BooleanPref(
"ManyWindowPost",
false
)
val bpMfmDecorationEnabled = BooleanPref(
"MfmDecorationEnabled",
true
)
val bpMfmDecorationShowUnsupportedMarkup = BooleanPref(
"MfmDecorationShowUnsupportedMarkup",
true
)
}
object PrefI {
// int
val ipBackButtonAction = IntPref("back_button_action", 0)
@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
val ipUiTheme = IntPref("ui_theme", 0)
// val ipResizeImage = IntPref("resize_image", 4)
const val RC_SIMPLE = 0
const val RC_ACTUAL = 1
@Suppress("unused")
const val RC_NONE = 2
val ipRepliesCount = IntPref("RepliesCount", RC_SIMPLE)
val ipBoostsCount = IntPref("BoostsCount", RC_ACTUAL)
val ipFavouritesCount = IntPref("FavouritesCount", RC_ACTUAL)
val ipRefreshAfterToot = IntPref("refresh_after_toot", 0)
const val RAT_REFRESH_SCROLL = 0
@Suppress("unused")
const val RAT_REFRESH_DONT_SCROLL = 1
const val RAT_DONT_REFRESH = 2
@Suppress("unused")
const val VS_BY_ACCOUNT = 0
const val VS_MASTODON = 1
const val VS_MISSKEY = 2
val ipVisibilityStyle = IntPref("ipVisibilityStyle", VS_BY_ACCOUNT)
val ipAdditionalButtonsPosition =
IntPref("AdditionalButtonsPosition", AdditionalButtonsPosition.End.idx)
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)
val ipListDividerColor = IntPref("listDividerColor", 0)
val ipLastColumnPos = IntPref("last_column_pos", -1)
val ipBoostButtonJustify = IntPref("ipBoostButtonJustify", 0) // 0=左,1=中央,2=右
private const val JWCP_DEFAULT = 0
const val JWCP_START = 1
const val JWCP_END = 2
val ipJustifyWindowContentPortrait =
IntPref("JustifyWindowContentPortrait", JWCP_DEFAULT) // 0=default,1=start,2=end
const val GSP_HEAD = 0
private const val GSP_TAIL = 1
val ipGapHeadScrollPosition = IntPref("GapHeadScrollPosition", GSP_TAIL)
val ipGapTailScrollPosition = IntPref("GapTailScrollPosition", GSP_TAIL)
val ipLinkColor = IntPref("LinkColor", 0)
val ipSwitchOnColor = IntPref("SwitchOnColor", Color.BLACK or 0x0080ff)
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)
val ipButtonReactionedColor = IntPref("ButtonReactionedColor", 0)
val ipStatusBarColor = IntPref("StatusBarColor", 0)
val ipNavigationBarColor = IntPref("NavigationBarColor", 0)
val ipTootColorUnlisted = IntPref("ipTootColorUnlisted", 0)
val ipTootColorFollower = IntPref("ipTootColorFollower", 0)
val ipTootColorDirectUser = IntPref("ipTootColorDirectUser", 0)
val ipTootColorDirectMe = IntPref("ipTootColorDirectMe", 0)
val ipEventBgColorBoost = IntPref("EventBgColorBoost", 0)
val ipEventBgColorFavourite = IntPref("EventBgColorFavourite", 0)
val ipEventBgColorBookmark = IntPref("EventBgColorBookmark", 0)
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)
val ipEventBgColorStatus = IntPref("EventBgColorStatus", 0)
val ipEventBgColorGap = IntPref("EventBgColorGap", 0)
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)
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)
// val ipTrendTagCountShowing = IntPref("TrendTagCountShowing", 0)
// const val TTCS_WEEKLY = 0
// const val TTCS_DAILY = 1
}
object PrefS {
// string
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")
val spCardDescriptionLength = StringPref("CardDescriptionLength", "64")
val spAvatarIconSize = StringPref("avatar_icon_size", "48")
val spNotificationTlIconSize = StringPref("notification_tl_icon_size", "24")
val spBoostButtonSize = StringPref("BoostButtonSize", "35")
val spReplyIconSize = StringPref("ReplyIconSize", "24")
val spHeaderIconSize = StringPref("HeaderIconSize", "24")
val spStripIconSize = StringPref("StripIconSize", "30")
// val spMediaSizeMax = StringPref("max_media_size", "8")
// val spMovieSizeMax = StringPref("max_movie_size", "40")
// val spMediaSizeMaxPixelfed = StringPref("MediaSizeMaxPixelfed", "15")
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", "")
val spRoundRatio = StringPref("round_ratio", "33")
val spBoostAlpha = StringPref("BoostAlpha", "60")
val spScreenBottomPadding = StringPref("ScreenBottomPadding", "8")
val spPullNotificationCheckInterval = StringPref("PullNotificationCheckInterval", "15")
val spUserAgent = StringPref("UserAgent", "")
val spMediaReadTimeout = StringPref("spMediaReadTimeout", "60")
val spAgreedPrivacyPolicyDigest = StringPref("spAgreedPrivacyPolicyDigest", "")
val spTimeZone = StringPref("TimeZone", "")
val spQuickTootMacro = StringPref("QuickTootMacro", "")
val spQuickTootVisibility = StringPref("QuickTootVisibility", "")
val spTranslateAppComponent = StringPref("TranslateAppComponent", "")
val spCustomShare1 = StringPref("CustomShare1", "")
val spCustomShare2 = StringPref("CustomShare2", "")
val spCustomShare3 = StringPref("CustomShare3", "")
// val spWebBrowser = StringPref("WebBrowser", "")
val spTimelineSpacing = StringPref("TimelineSpacing", "")
}
object PrefL {
// long
val lpTabletTootDefaultAccount = LongPref("tablet_toot_default_account", -1L)
}
object PrefF {
// float
val fpTimelineFontSize = FloatPref("timeline_font_size", Float.NaN)
val fpAcctFontSize = FloatPref("acct_font_size", Float.NaN)
val fpNotificationTlFontSize = FloatPref("notification_tl_font_size", Float.NaN)
val fpHeaderTextSize = FloatPref("HeaderTextSize", Float.NaN)
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
internal const val default_header_font_size = 14f
}

View File

@ -15,6 +15,8 @@ import androidx.core.content.ContextCompat
import jp.juggler.subwaytooter.emoji.EmojiMap
import jp.juggler.subwaytooter.api.entity.TootAccount
import jp.juggler.subwaytooter.api.entity.TootVisibility
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.pref.pref
import jp.juggler.subwaytooter.span.EmojiImageSpan
import jp.juggler.subwaytooter.span.createSpan
import jp.juggler.subwaytooter.table.UserRelation

View File

@ -13,6 +13,7 @@ import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.column.ColumnType
import jp.juggler.subwaytooter.dialog.*
import jp.juggler.subwaytooter.notification.PollingWorker
import jp.juggler.subwaytooter.pref.*
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.LinkHelper
import jp.juggler.subwaytooter.util.openBrowser

View File

@ -16,6 +16,9 @@ import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.api.runApiTask
import jp.juggler.subwaytooter.api.syncStatus
import jp.juggler.subwaytooter.dialog.pickAccount
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefDevice
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.matchHost
import jp.juggler.util.LogCategory

View File

@ -2,7 +2,7 @@ package jp.juggler.subwaytooter.actmain
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefL
import jp.juggler.subwaytooter.pref.PrefL
import jp.juggler.subwaytooter.column.fireShowColumnHeader
import jp.juggler.subwaytooter.table.SavedAccount
import java.util.ArrayList

View File

@ -5,8 +5,8 @@ import android.view.View
import android.widget.TextView
import androidx.core.view.GravityCompat
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.PrefI
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.action.openColumnList
import jp.juggler.subwaytooter.action.openPost

View File

@ -3,7 +3,7 @@ package jp.juggler.subwaytooter.actmain
import android.content.Intent
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.ActPost
import jp.juggler.subwaytooter.PrefI
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.api.entity.Acct
import jp.juggler.subwaytooter.api.entity.EntityId
import jp.juggler.subwaytooter.column.ColumnType

View File

@ -5,7 +5,7 @@ import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.PrefS
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.util.optInt

View File

@ -12,6 +12,9 @@ import jp.juggler.subwaytooter.column.*
import jp.juggler.subwaytooter.columnviewholder.TabletColumnViewHolder
import jp.juggler.subwaytooter.columnviewholder.scrollToTop2
import jp.juggler.subwaytooter.columnviewholder.showColumnSetting
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.table.AcctColor
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.util.*

View File

@ -6,8 +6,8 @@ import android.net.Uri
import android.os.Build
import androidx.appcompat.app.AlertDialog
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.PrefDevice
import jp.juggler.subwaytooter.PrefS
import jp.juggler.subwaytooter.pref.PrefDevice
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.action.conversationOtherInstance
import jp.juggler.subwaytooter.action.openActPostImpl

View File

@ -11,6 +11,7 @@ import jp.juggler.subwaytooter.api.entity.TootVisibility
import jp.juggler.subwaytooter.dialog.pickAccount
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.actpost.CompletionHelper
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.util.PostCompleteCallback
import jp.juggler.subwaytooter.util.PostImpl
import jp.juggler.util.hideKeyboard

View File

@ -8,6 +8,8 @@ import android.widget.LinearLayout
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.itemviewholder.ItemViewHolder
import jp.juggler.subwaytooter.pref.*
import jp.juggler.subwaytooter.pref.impl.StringPref
import jp.juggler.subwaytooter.span.MyClickableSpan
import jp.juggler.subwaytooter.util.CustomShare
import jp.juggler.subwaytooter.view.ListDivider

View File

@ -3,7 +3,7 @@ package jp.juggler.subwaytooter.actmain
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.view.MyViewPager

View File

@ -24,6 +24,7 @@ import jp.juggler.subwaytooter.action.*
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.column.ColumnType
import jp.juggler.subwaytooter.dialog.pickAccount
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.VersionString
import jp.juggler.subwaytooter.util.openBrowser

View File

@ -5,7 +5,7 @@ import android.net.Uri
import android.view.View
import androidx.appcompat.app.AlertDialog
import jp.juggler.subwaytooter.ActPost
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.Styler
import jp.juggler.subwaytooter.api.ApiTask

View File

@ -9,6 +9,7 @@ import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.actmain.onCompleteActPost
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.dialog.ActionsDialog
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.table.PostDraft
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.*

View File

@ -7,7 +7,7 @@ import android.text.style.ForegroundColorSpan
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.api.entity.*

View File

@ -3,6 +3,8 @@ package jp.juggler.subwaytooter.api
import android.content.Context
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.pref.PrefDevice
import jp.juggler.subwaytooter.pref.pref
import jp.juggler.subwaytooter.table.ClientInfo
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.*

View File

@ -5,7 +5,7 @@ import android.text.Spannable
import android.text.SpannableStringBuilder
import android.widget.TextView
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.MisskeyAccountDetailMap
import jp.juggler.subwaytooter.api.TootParser

View File

@ -1,7 +1,7 @@
package jp.juggler.subwaytooter.api.entity
import android.content.SharedPreferences
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.api.TootParser
import jp.juggler.util.*

View File

@ -1,7 +1,7 @@
package jp.juggler.subwaytooter.api.entity
import jp.juggler.subwaytooter.api.TootParser
import jp.juggler.subwaytooter.pref
import jp.juggler.subwaytooter.pref.pref
import jp.juggler.subwaytooter.util.DecodeOptions
import jp.juggler.util.JsonObject
import jp.juggler.util.filterNotEmpty

View File

@ -2,7 +2,7 @@ package jp.juggler.subwaytooter.api.entity
import android.os.SystemClock
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.api.TootApiClient
import jp.juggler.subwaytooter.api.TootApiResult
import jp.juggler.subwaytooter.api.TootParser

View File

@ -4,7 +4,7 @@ import android.text.Spannable
import android.text.SpannableStringBuilder
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.columnviewholder.ColumnViewHolder
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.span.NetworkEmojiSpan
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.DecodeOptions

View File

@ -6,7 +6,7 @@ import androidx.annotation.StringRes
import android.text.Spannable
import android.text.SpannableString
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.emoji.CustomEmoji

View File

@ -16,6 +16,8 @@ import jp.juggler.subwaytooter.api.entity.EntityId
import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.column.ColumnEncoder
import jp.juggler.subwaytooter.column.getBackgroundImageDir
import jp.juggler.subwaytooter.pref.*
import jp.juggler.subwaytooter.pref.impl.*
import jp.juggler.subwaytooter.table.*
import jp.juggler.util.*
import org.apache.commons.io.IOUtils

View File

@ -11,6 +11,8 @@ import androidx.annotation.StringRes
import androidx.appcompat.widget.AppCompatImageView
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.itemviewholder.AdditionalButtonsPosition
import jp.juggler.subwaytooter.pref.*
import jp.juggler.subwaytooter.pref.impl.*
import jp.juggler.subwaytooter.util.CustomShareTarget
import jp.juggler.subwaytooter.util.openBrowser
import jp.juggler.util.*

View File

@ -8,6 +8,7 @@ import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.columnviewholder.ColumnViewHolder
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.streaming.*
import jp.juggler.subwaytooter.table.*
import jp.juggler.subwaytooter.util.BucketList
@ -133,6 +134,8 @@ class Column(
internal var quickFilter = QUICK_FILTER_ALL
internal var showMediaDescription = true
@Volatile
internal var dontStreaming = false

View File

@ -18,6 +18,7 @@ object ColumnEncoder {
const val KEY_ACCOUNT_ROW_ID = "account_id"
const val KEY_TYPE = "type"
const val KEY_DONT_CLOSE = "dont_close"
const val KEY_SHOW_MEDIA_DESCRIPTION = "showMediaDescription"
private const val KEY_COLUMN_ID = "column_id"
private const val KEY_WITH_ATTACHMENT = "with_attachment"
@ -120,6 +121,7 @@ object ColumnEncoder {
dst[KEY_ANNOUNCEMENT_HIDE_TIME] = announcementHideTime
dst.putIfTrue(KEY_DONT_CLOSE, dontClose)
dst.putIfTrue(KEY_SHOW_MEDIA_DESCRIPTION, showMediaDescription)
dst.putIfTrue(KEY_WITH_ATTACHMENT, withAttachment)
dst.putIfTrue(KEY_WITH_HIGHLIGHT, withHighlight)
dst.putIfTrue(KEY_DONT_SHOW_BOOST, dontShowBoost)
@ -249,6 +251,7 @@ object ColumnEncoder {
fun decode(column: Column, src: JsonObject) {
column.run {
dontClose = src.optBoolean(KEY_DONT_CLOSE)
showMediaDescription = src.optBoolean(KEY_SHOW_MEDIA_DESCRIPTION,true)
withAttachment = src.optBoolean(KEY_WITH_ATTACHMENT)
withHighlight = src.optBoolean(KEY_WITH_HIGHLIGHT)
dontShowBoost = src.optBoolean(KEY_DONT_SHOW_BOOST)

View File

@ -7,6 +7,7 @@ import jp.juggler.subwaytooter.api.entity.EntityId
import jp.juggler.subwaytooter.api.entity.TimelineItem
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.columnviewholder.ColumnViewHolder
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.util.LogCategory
import jp.juggler.util.getAdaptiveRippleDrawable
import jp.juggler.util.notZero

View File

@ -8,6 +8,7 @@ import jp.juggler.subwaytooter.api.finder.*
import jp.juggler.subwaytooter.columnviewholder.getListItemOffset
import jp.juggler.subwaytooter.columnviewholder.setListItemTop
import jp.juggler.subwaytooter.notification.PollingWorker
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.util.*
import java.lang.StringBuilder

View File

@ -1,7 +1,7 @@
package jp.juggler.subwaytooter.column
import android.os.SystemClock
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.api.entity.*

View File

@ -6,6 +6,8 @@ import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.api.finder.*
import jp.juggler.subwaytooter.columnviewholder.setScrollPosition
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.util.ScrollPosition
import jp.juggler.util.*

View File

@ -21,6 +21,7 @@ import com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout
import com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayoutDirection
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.column.*
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.streaming.*
import jp.juggler.subwaytooter.table.AcctColor
import jp.juggler.subwaytooter.util.*
@ -108,6 +109,7 @@ class ColumnViewHolder(
lateinit var ivColumnBackgroundImage: ImageView
lateinit var llSearch: View
lateinit var cbDontCloseColumn: CheckBox
lateinit var cbShowMediaDescription: CheckBox
lateinit var cbRemoteOnly: CheckBox
lateinit var cbWithAttachment: CheckBox
lateinit var cbWithHighlight: CheckBox
@ -403,6 +405,7 @@ class ColumnViewHolder(
arrayOf(
cbDontAutoRefresh,
cbDontCloseColumn,
cbShowMediaDescription,
cbDontShowBoost,
cbDontShowFavourite,
cbDontShowFollow,
@ -810,8 +813,8 @@ class ColumnViewHolder(
text = context.getString(R.string.remote_only)
}.lparams(matchParent, wrapContent)
cbWithAttachment = checkBox {
text = context.getString(R.string.with_attachment)
cbShowMediaDescription = checkBox {
text = context.getString(R.string.show_media_description)
}.lparams(matchParent, wrapContent)
cbWithHighlight = checkBox {
@ -866,6 +869,10 @@ class ColumnViewHolder(
text = context.getString(R.string.hide_media_default)
}.lparams(matchParent, wrapContent)
cbWithAttachment = checkBox {
text = context.getString(R.string.with_attachment)
}.lparams(matchParent, wrapContent)
cbSystemNotificationNotRelated = checkBox {
text = context.getString(R.string.system_notification_not_related)
}.lparams(matchParent, wrapContent)

View File

@ -71,6 +71,12 @@ fun ColumnViewHolder.onCheckedChangedImpl(view: CompoundButton?, isChecked: Bool
activity.appState.saveColumnList()
}
cbShowMediaDescription->{
column.showMediaDescription = isChecked
activity.appState.saveColumnList()
column.startLoading()
}
cbWithAttachment -> {
column.withAttachment = isChecked
activity.appState.saveColumnList()

View File

@ -14,7 +14,7 @@ import com.google.android.flexbox.FlexWrap
import com.google.android.flexbox.FlexboxLayout
import com.google.android.flexbox.JustifyContent
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.emoji.UnicodeEmoji

View File

@ -4,8 +4,8 @@ import android.view.View
import android.widget.ImageView
import com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayoutDirection
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.PrefI
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.actmain.closePopup
import jp.juggler.subwaytooter.column.*
@ -151,6 +151,7 @@ fun ColumnViewHolder.onPageCreate(column: Column, pageIdx: Int, pageCount: Int)
extraInvalidatorList.clear()
cbDontCloseColumn.isCheckedNoAnime = column.dontClose
cbShowMediaDescription.isCheckedNoAnime = column.showMediaDescription
cbRemoteOnly.isCheckedNoAnime = column.remoteOnly
cbWithAttachment.isCheckedNoAnime = column.withAttachment
cbWithHighlight.isCheckedNoAnime = column.withHighlight

View File

@ -5,7 +5,7 @@ import android.graphics.Color
import android.view.View
import android.widget.ImageButton
import android.widget.TextView
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.column.*
import jp.juggler.util.applyAlphaMultiplier

View File

@ -17,6 +17,8 @@ import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.column.*
import jp.juggler.subwaytooter.dialog.DlgTextInput
import jp.juggler.subwaytooter.itemviewholder.DlgContextMenu
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.span.EmojiImageSpan
import jp.juggler.subwaytooter.span.LinkInfo
import jp.juggler.subwaytooter.span.MyClickableSpan

View File

@ -12,6 +12,8 @@ import java.lang.ref.WeakReference
import android.view.Gravity
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.api.entity.TootVisibility
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.pref.put
class DlgQuickTootMenu(
internal val activity: ActMain,

View File

@ -14,6 +14,9 @@ import com.astuetz.PagerSlidingTabStrip
import com.bumptech.glide.Glide
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.emoji.*
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.pref.put
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.view.HeaderGridView
import jp.juggler.subwaytooter.view.MyViewPager

View File

@ -2,7 +2,7 @@ package jp.juggler.subwaytooter.emoji
import androidx.annotation.DrawableRes
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.api.entity.Host
import jp.juggler.subwaytooter.api.entity.Mappable
import jp.juggler.util.JsonArray

View File

@ -18,6 +18,8 @@ import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.column.ColumnType
import jp.juggler.subwaytooter.dialog.DlgListMember
import jp.juggler.subwaytooter.dialog.DlgQRCode
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.span.MyClickableSpan
import jp.juggler.subwaytooter.table.FavMute
import jp.juggler.subwaytooter.table.SavedAccount

View File

@ -20,6 +20,8 @@ import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.columnviewholder.ItemListAdapter
import jp.juggler.subwaytooter.drawable.PreviewCardBorder
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.util.*
import jp.juggler.subwaytooter.view.*

View File

@ -4,12 +4,12 @@ import android.view.View
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.ActMediaViewer
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.action.*
import jp.juggler.subwaytooter.actmain.nextPosition
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.column.startGap
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.table.ContentWarning
import jp.juggler.subwaytooter.table.MediaShown
import jp.juggler.subwaytooter.util.openCustomTab
@ -48,10 +48,29 @@ fun ItemViewHolder.onClickImpl(v: View?) {
llReply -> clickReplyInfo(pos, accessInfo, column.type, statusReply, statusShowing)
llFollow -> clickFollowInfo(pos, accessInfo, followAccount) { whoRef ->
DlgContextMenu(this, column, whoRef, null, (item as? TootNotification), tvContent).show()
DlgContextMenu(
this,
column,
whoRef,
null,
(item as? TootNotification),
tvContent
).show()
}
btnFollow -> clickFollowInfo(pos, accessInfo, followAccount, forceMenu = true) { whoRef ->
DlgContextMenu(this, column, whoRef, null, (item as? TootNotification), tvContent).show()
btnFollow -> clickFollowInfo(
pos,
accessInfo,
followAccount,
forceMenu = true
) { whoRef ->
DlgContextMenu(
this,
column,
whoRef,
null,
(item as? TootNotification),
tvContent
).show()
}
btnGapHead -> column.startGap(item.cast(), isHead = true)
@ -59,11 +78,24 @@ fun ItemViewHolder.onClickImpl(v: View?) {
btnSearchTag, llTrendTag -> clickTag(pos, item)
btnListTL -> clickListTl(pos, accessInfo, item)
btnListMore -> clickListMoreButton(pos, accessInfo, item)
btnFollowRequestAccept -> clickFollowRequestAccept(accessInfo, followAccount, accept = true)
btnFollowRequestDeny -> clickFollowRequestAccept(accessInfo, followAccount, accept = false)
btnFollowRequestAccept -> clickFollowRequestAccept(
accessInfo,
followAccount,
accept = true
)
btnFollowRequestDeny -> clickFollowRequestAccept(
accessInfo,
followAccount,
accept = false
)
llFilter -> openFilterMenu(accessInfo, item.cast())
ivCardImage -> clickCardImage(pos, accessInfo, statusShowing?.card)
llConversationIcons -> clickConversation(pos, accessInfo, listAdapter, summary = item.cast())
llConversationIcons -> clickConversation(
pos,
accessInfo,
listAdapter,
summary = item.cast()
)
}
}
}
@ -82,8 +114,22 @@ fun ItemViewHolder.onLongClickImpl(v: View?): Boolean {
longClickBoostedInfo(boostAccount)
llReply ->
clickReplyInfo(pos, accessInfo, column.type, statusReply, statusShowing, longClick = true) { status ->
DlgContextMenu(this, column, status.accountRef, status, item.cast(), tvContent).show()
clickReplyInfo(
pos,
accessInfo,
column.type,
statusReply,
statusShowing,
longClick = true
) { status ->
DlgContextMenu(
this,
column,
status.accountRef,
status,
item.cast(),
tvContent
).show()
}
llFollow ->
@ -164,6 +210,7 @@ private fun ItemViewHolder.clickMedia(i: Int) {
PrefB.bpUseInternalMediaViewer(App1.pref) ->
ActMediaViewer.open(
activity,
column.showMediaDescription,
when (accessInfo.isMisskey) {
true -> ServiceType.MISSKEY
else -> ServiceType.MASTODON
@ -219,7 +266,12 @@ private fun ItemViewHolder.clickTag(pos: Int, item: TimelineItem?) {
when (item) {
is TootTag -> tagTimeline(pos, accessInfo, item.name)
is TootSearchGap -> column.startGap(item, isHead = true)
is TootConversationSummary -> clickConversation(pos, accessInfo, listAdapter, summary = item)
is TootConversationSummary -> clickConversation(
pos,
accessInfo,
listAdapter,
summary = item
)
is TootGap -> clickTootGap(column, item)
is TootDomainBlock -> clickDomainBlock(accessInfo, item)
is TootScheduled -> clickScheduledToot(accessInfo, item, column)

View File

@ -1,8 +1,8 @@
package jp.juggler.subwaytooter.itemviewholder
import android.view.View
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.PrefS
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.column.ColumnType

View File

@ -10,8 +10,8 @@ import com.google.android.flexbox.FlexWrap
import com.google.android.flexbox.FlexboxLayout
import com.google.android.flexbox.JustifyContent
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.PrefI
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.action.reactionAdd
import jp.juggler.subwaytooter.action.reactionFromAnotherAccount

View File

@ -20,6 +20,8 @@ import jp.juggler.subwaytooter.column.getAcctColor
import jp.juggler.subwaytooter.column.getContentColor
import jp.juggler.subwaytooter.columnviewholder.ItemListAdapter
import jp.juggler.subwaytooter.drawable.PreviewCardBorder
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.span.MyClickableSpan
import jp.juggler.subwaytooter.table.*
import jp.juggler.subwaytooter.util.Benchmark

View File

@ -2,7 +2,7 @@ package jp.juggler.subwaytooter.itemviewholder
import android.view.Gravity
import android.view.View
import jp.juggler.subwaytooter.PrefI
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.Styler
import jp.juggler.subwaytooter.actmain.addColumn

View File

@ -9,6 +9,8 @@ import jp.juggler.subwaytooter.actmain.checkAutoCW
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.column.ColumnType
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.table.ContentWarning
import jp.juggler.subwaytooter.table.MediaShown
import jp.juggler.subwaytooter.util.OpenSticker
@ -297,7 +299,7 @@ private fun ItemViewHolder.showAttachments(status: TootStatus) {
if (mediaAttachments.isEmpty()) null else mediaAttachments[0] as? TootAttachment
btnShowMedia.blurhash = m0?.blurhash
if (sb.isNotEmpty()) {
if (sb.isNotEmpty() && column.showMediaDescription) {
tvMediaDescription.visibility = View.VISIBLE
tvMediaDescription.text = sb
}

View File

@ -17,6 +17,8 @@ import jp.juggler.subwaytooter.actmain.nextPosition
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.column.getContentColor
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.table.UserRelation
import jp.juggler.subwaytooter.util.CustomShare

View File

@ -5,7 +5,7 @@ import android.text.Spanned
import android.text.style.RelativeSizeSpan
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.api.entity.Acct
import jp.juggler.subwaytooter.api.entity.EntityId
import jp.juggler.subwaytooter.api.entity.TootMention

View File

@ -19,6 +19,9 @@ import com.google.firebase.messaging.FirebaseMessaging
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.api.TootApiClient
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.pref.PrefDevice
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.pref.pref
import jp.juggler.subwaytooter.table.*
import jp.juggler.subwaytooter.util.*
import jp.juggler.util.*

View File

@ -9,7 +9,7 @@ import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import jp.juggler.subwaytooter.ActCallback
import jp.juggler.subwaytooter.EventReceiver
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.TootApiCallback
import jp.juggler.subwaytooter.api.TootApiClient

View File

@ -0,0 +1,350 @@
package jp.juggler.subwaytooter.pref
import jp.juggler.subwaytooter.pref.impl.BooleanPref
object PrefB {
// boolean
val bpDisableEmojiAnimation = BooleanPref(
"disable_emoji_animation",
false
)
// val bpDisableFastScroller = BooleanPref("disable_fast_scroller", true, 0) // R.id.swDisableFastScroller)
val bpDisableTabletMode = BooleanPref(
"disable_tablet_mode",
false
)
val bpDontConfirmBeforeCloseColumn = BooleanPref(
"DontConfirmBeforeCloseColumn",
false
)
val bpDontCropMediaThumb = BooleanPref(
"DontCropMediaThumb",
true
)
val bpDontDuplicationCheck = BooleanPref(
"dont_duplication_check",
false
)
val bpDontRefreshOnResume = BooleanPref(
"dont_refresh_on_resume",
false
)
val bpDontRound = BooleanPref(
"dont_round",
false
)
val bpDontScreenOff = BooleanPref(
"dont_screen_off",
false
)
val bpDontUseActionButtonWithQuickPostBar = BooleanPref(
"dont_use_action_button",
false
)
val bpDontUseStreaming = BooleanPref(
"dont_use_streaming",
false
)
val bpEnableGifAnimation = BooleanPref(
"enable_gif_animation",
false
)
val bpExitAppWhenCloseProtectedColumn = BooleanPref(
"ExitAppWhenCloseProtectedColumn",
false
)
val bpMentionFullAcct = BooleanPref(
"mention_full_acct",
false
)
val bpNotificationLED = BooleanPref(
"notification_led",
true
)
val bpNotificationSound = BooleanPref(
"notification_sound",
true
)
val bpNotificationVibration = BooleanPref(
"notification_vibration",
true
)
val bpPostButtonBarTop = BooleanPref(
"post_button_bar_at_top",
true
)
val bpPriorChrome = BooleanPref(
"prior_chrome",
true
)
val bpDontUseCustomTabs = BooleanPref(
"DontUseCustomTabs",
false
)
val bpPriorLocalURL = BooleanPref(
"prior_local_url",
false
)
val bpQuickPostBar = BooleanPref(
"quick_toot_bar",
false
)
val bpRelativeTimestamp = BooleanPref(
"relative_timestamp",
true
)
val bpShortAcctLocalUser = BooleanPref(
"short_acct_local_user",
true
)
val bpShowFollowButtonInButtonBar = BooleanPref(
"ShowFollowButtonInButtonBar",
false
)
val bpSimpleList = BooleanPref(
"simple_list",
true
)
val bpUseInternalMediaViewer = BooleanPref(
"use_internal_media_viewer",
true
)
val bpShowAppName = BooleanPref(
"show_app_name",
false
)
val bpShowLanguage = BooleanPref(
"ShowLanguage",
false
)
val bpForceGap = BooleanPref(
"force_gap",
false
)
val bpShareViewPool = BooleanPref(
"ShareViewPool",
true
)
val bpAllowColumnDuplication = BooleanPref(
"AllowColumnDuplication",
true
)
val bpAppendAttachmentUrlToContent = BooleanPref(
"AppendAttachmentUrlToContent",
false
)
val bpVerticalArrangeThumbnails = BooleanPref(
"VerticalArrangeThumbnails",
false
)
val bpDontShowPreviewCard = BooleanPref(
"DontShowPreviewCard",
false
)
val bpScrollTopFromColumnStrip = BooleanPref(
"ScrollTopFromColumnStrip",
false
)
val bpOpenSticker = BooleanPref(
"InstanceTicker", // 歴史的な理由でキー名が異なる
false
)
val bpLinksInContextMenu = BooleanPref(
"LinksInContextMenu",
false
)
val bpMoveNotificationsQuickFilter = BooleanPref(
"MoveNotificationsQuickFilter",
false
)
val bpShowAcctInSystemNotification = BooleanPref(
"ShowAcctInSystemNotification",
false
)
val bpShowLinkUnderline = BooleanPref(
"ShowLinkUnderline",
false
)
val bpShowSearchClear = BooleanPref(
"ShowSearchClear",
false
)
val bpDontRemoveDeletedToot = BooleanPref(
"DontRemoveDeletedToot",
false
)
val bpDontShowColumnBackgroundImage = BooleanPref(
"DontShowColumnBackgroundImage",
false
)
val bpCustomEmojiSeparatorZwsp = BooleanPref(
"CustomEmojiSeparatorZwsp",
false
)
val bpShowTranslateButton = BooleanPref(
"ShowTranslateButton",
false
)
val bpDirectoryLastActive = BooleanPref(
"DirectoryLastActive",
true
)
val bpDirectoryFollowers = BooleanPref(
"DirectoryFollowers",
true
)
val bpDirectoryTootCount = BooleanPref(
"DirectoryTootCount",
true
)
val bpDirectoryNote = BooleanPref(
"DirectoryNote",
true
)
val bpWarnHashtagAsciiAndNonAscii = BooleanPref(
"WarnHashtagAsciiAndNonAscii",
false
)
val bpEnablePixelfed = BooleanPref(
"EnablePixelfed",
false
)
val bpQuickTootOmitAccountSelection = BooleanPref(
"QuickTootOmitAccountSelection",
false
)
val bpSeparateReplyNotificationGroup = BooleanPref(
"SeparateReplyNotificationGroup",
false
)
val bpAlwaysExpandContextMenuItems = BooleanPref(
"AlwaysExpandContextMenuItems",
false
)
val bpShowBookmarkButton = BooleanPref(
"ShowBookmarkButton2",
true
)
val bpShowFilteredWord = BooleanPref(
"ShowFilteredWord",
false
)
val bpEnableDomainTimeline = BooleanPref(
"EnableDomainTimeline",
false
)
val bpDivideNotification = BooleanPref(
"DivideNotification",
false
)
val bpHideFollowCount = BooleanPref(
"HideFollowCount",
false
)
val bpEmojioneShortcode = BooleanPref(
"EmojioneShortcode",
true
)
val bpEmojiPickerCloseOnSelected = BooleanPref(
"EmojiPickerCloseOnSelected",
true
)
val bpCheckBetaVersion = BooleanPref(
"CheckBetaVersion",
false
)
val bpIgnoreTextInSharedMedia = BooleanPref(
"IgnoreTextInSharedMedia",
false
)
val bpEmojiPickerCategoryOther = BooleanPref(
"EmojiPickerCategoryOther",
false
)
val bpInAppUnicodeEmoji = BooleanPref(
"InAppUnicodeEmoji",
true
)
val bpKeepReactionSpace = BooleanPref(
"KeepReactionSpace",
false
)
val bpMultiWindowPost = BooleanPref(
"MultiWindowPost",
false
)
val bpManyWindowPost = BooleanPref(
"ManyWindowPost",
false
)
val bpMfmDecorationEnabled = BooleanPref(
"MfmDecorationEnabled",
true
)
val bpMfmDecorationShowUnsupportedMarkup = BooleanPref(
"MfmDecorationShowUnsupportedMarkup",
true
)
}

View File

@ -1,4 +1,4 @@
package jp.juggler.subwaytooter
package jp.juggler.subwaytooter.pref
import android.content.Context
import android.content.SharedPreferences

View File

@ -0,0 +1,29 @@
package jp.juggler.subwaytooter.pref
import android.content.Context
import android.content.SharedPreferences
import jp.juggler.subwaytooter.pref.impl.*
fun Context.pref(): SharedPreferences =
this.getSharedPreferences(this.packageName + "_preferences", Context.MODE_PRIVATE)
fun SharedPreferences.Editor.remove(item: BasePref<*>): SharedPreferences.Editor {
item.remove(this)
return this
}
fun SharedPreferences.Editor.put(item: BooleanPref, v: Boolean) =
this.apply { item.put(this, v) }
fun SharedPreferences.Editor.put(item: StringPref, v: String) =
this.apply { item.put(this, v) }
fun SharedPreferences.Editor.put(item: IntPref, v: Int) =
this.apply { item.put(this, v) }
fun SharedPreferences.Editor.put(item: LongPref, v: Long) =
this.apply { item.put(this, v) }
fun SharedPreferences.Editor.put(item: FloatPref, v: Float) =
this.apply { item.put(this, v) }

View File

@ -0,0 +1,16 @@
package jp.juggler.subwaytooter.pref
import jp.juggler.subwaytooter.pref.impl.FloatPref
object PrefF {
// float
val fpTimelineFontSize = FloatPref("timeline_font_size", Float.NaN)
val fpAcctFontSize = FloatPref("acct_font_size", Float.NaN)
val fpNotificationTlFontSize = FloatPref("notification_tl_font_size", Float.NaN)
val fpHeaderTextSize = FloatPref("HeaderTextSize", Float.NaN)
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
internal const val default_header_font_size = 14f
}

View File

@ -0,0 +1,116 @@
package jp.juggler.subwaytooter.pref
import android.graphics.Color
import jp.juggler.subwaytooter.itemviewholder.AdditionalButtonsPosition
import jp.juggler.subwaytooter.pref.impl.IntPref
object PrefI {
// int
val ipBackButtonAction = IntPref("back_button_action", 0)
@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
val ipUiTheme = IntPref("ui_theme", 0)
// val ipResizeImage = IntPref("resize_image", 4)
const val RC_SIMPLE = 0
const val RC_ACTUAL = 1
@Suppress("unused")
const val RC_NONE = 2
val ipRepliesCount = IntPref("RepliesCount", RC_SIMPLE)
val ipBoostsCount = IntPref("BoostsCount", RC_ACTUAL)
val ipFavouritesCount = IntPref("FavouritesCount", RC_ACTUAL)
val ipRefreshAfterToot = IntPref("refresh_after_toot", 0)
const val RAT_REFRESH_SCROLL = 0
@Suppress("unused")
const val RAT_REFRESH_DONT_SCROLL = 1
const val RAT_DONT_REFRESH = 2
@Suppress("unused")
const val VS_BY_ACCOUNT = 0
const val VS_MASTODON = 1
const val VS_MISSKEY = 2
val ipVisibilityStyle = IntPref("ipVisibilityStyle", VS_BY_ACCOUNT)
val ipAdditionalButtonsPosition =
IntPref("AdditionalButtonsPosition", AdditionalButtonsPosition.End.idx)
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)
val ipListDividerColor = IntPref("listDividerColor", 0)
val ipLastColumnPos = IntPref("last_column_pos", -1)
val ipBoostButtonJustify = IntPref("ipBoostButtonJustify", 0) // 0=左,1=中央,2=右
private const val JWCP_DEFAULT = 0
const val JWCP_START = 1
const val JWCP_END = 2
val ipJustifyWindowContentPortrait =
IntPref("JustifyWindowContentPortrait", JWCP_DEFAULT) // 0=default,1=start,2=end
const val GSP_HEAD = 0
private const val GSP_TAIL = 1
val ipGapHeadScrollPosition = IntPref("GapHeadScrollPosition", GSP_TAIL)
val ipGapTailScrollPosition = IntPref("GapTailScrollPosition", GSP_TAIL)
val ipLinkColor = IntPref("LinkColor", 0)
val ipSwitchOnColor = IntPref("SwitchOnColor", Color.BLACK or 0x0080ff)
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)
val ipButtonReactionedColor = IntPref("ButtonReactionedColor", 0)
val ipStatusBarColor = IntPref("StatusBarColor", 0)
val ipNavigationBarColor = IntPref("NavigationBarColor", 0)
val ipTootColorUnlisted = IntPref("ipTootColorUnlisted", 0)
val ipTootColorFollower = IntPref("ipTootColorFollower", 0)
val ipTootColorDirectUser = IntPref("ipTootColorDirectUser", 0)
val ipTootColorDirectMe = IntPref("ipTootColorDirectMe", 0)
val ipEventBgColorBoost = IntPref("EventBgColorBoost", 0)
val ipEventBgColorFavourite = IntPref("EventBgColorFavourite", 0)
val ipEventBgColorBookmark = IntPref("EventBgColorBookmark", 0)
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)
val ipEventBgColorStatus = IntPref("EventBgColorStatus", 0)
val ipEventBgColorGap = IntPref("EventBgColorGap", 0)
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)
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)
// val ipTrendTagCountShowing = IntPref("TrendTagCountShowing", 0)
// const val TTCS_WEEKLY = 0
// const val TTCS_DAILY = 1
}

View File

@ -0,0 +1,9 @@
package jp.juggler.subwaytooter.pref
import jp.juggler.subwaytooter.pref.impl.LongPref
object PrefL {
// long
val lpTabletTootDefaultAccount = LongPref("tablet_toot_default_account", -1L)
}

View File

@ -0,0 +1,52 @@
package jp.juggler.subwaytooter.pref
import jp.juggler.subwaytooter.pref.impl.StringPref
object PrefS {
// string
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")
val spCardDescriptionLength = StringPref("CardDescriptionLength", "64")
val spAvatarIconSize = StringPref("avatar_icon_size", "48")
val spNotificationTlIconSize = StringPref("notification_tl_icon_size", "24")
val spBoostButtonSize = StringPref("BoostButtonSize", "35")
val spReplyIconSize = StringPref("ReplyIconSize", "24")
val spHeaderIconSize = StringPref("HeaderIconSize", "24")
val spStripIconSize = StringPref("StripIconSize", "30")
// val spMediaSizeMax = StringPref("max_media_size", "8")
// val spMovieSizeMax = StringPref("max_movie_size", "40")
// val spMediaSizeMaxPixelfed = StringPref("MediaSizeMaxPixelfed", "15")
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", "")
val spRoundRatio = StringPref("round_ratio", "33")
val spBoostAlpha = StringPref("BoostAlpha", "60")
val spScreenBottomPadding = StringPref("ScreenBottomPadding", "8")
val spPullNotificationCheckInterval = StringPref("PullNotificationCheckInterval", "15")
val spUserAgent = StringPref("UserAgent", "")
val spMediaReadTimeout = StringPref("spMediaReadTimeout", "60")
val spAgreedPrivacyPolicyDigest = StringPref("spAgreedPrivacyPolicyDigest", "")
val spTimeZone = StringPref("TimeZone", "")
val spQuickTootMacro = StringPref("QuickTootMacro", "")
val spQuickTootVisibility = StringPref("QuickTootVisibility", "")
val spTranslateAppComponent = StringPref("TranslateAppComponent", "")
val spCustomShare1 = StringPref("CustomShare1", "")
val spCustomShare2 = StringPref("CustomShare2", "")
val spCustomShare3 = StringPref("CustomShare3", "")
// val spWebBrowser = StringPref("WebBrowser", "")
val spTimelineSpacing = StringPref("TimelineSpacing", "")
}

View File

@ -0,0 +1,46 @@
package jp.juggler.subwaytooter.pref.impl
import android.content.Context
import android.content.SharedPreferences
import jp.juggler.subwaytooter.pref.pref
@Suppress("EqualsOrHashCode")
abstract class BasePref<T>(val key: String, val defVal: T) {
companion object {
// キー名と設定項目のマップ。インポートやアプリ設定で使う
val allPref = HashMap<String, BasePref<*>>()
}
init {
when {
allPref[key] != null -> error("Preference key duplicate: $key")
else -> {
@Suppress("LeakingThis")
allPref[key] = this
}
}
}
abstract fun put(editor: SharedPreferences.Editor, v: T)
abstract operator fun invoke(pref: SharedPreferences): T
override fun equals(other: Any?) =
this === other
override fun hashCode(): Int = key.hashCode()
operator fun invoke(context: Context): T =
invoke(context.pref())
fun remove(e: SharedPreferences.Editor): SharedPreferences.Editor =
e.remove(key)
fun removeDefault(pref: SharedPreferences, e: SharedPreferences.Editor) =
if (pref.contains(key) && this.invoke(pref) == defVal) {
e.remove(key)
true
} else {
false
}
}

View File

@ -0,0 +1,14 @@
package jp.juggler.subwaytooter.pref.impl
import android.content.SharedPreferences
class BooleanPref(key: String, defVal: Boolean) : BasePref<Boolean>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): Boolean =
pref.getBoolean(key, defVal)
// put if value is not default, remove if value is same to default
override fun put(editor: SharedPreferences.Editor, v: Boolean) {
if (v == defVal) editor.remove(key) else editor.putBoolean(key, v)
}
}

View File

@ -0,0 +1,13 @@
package jp.juggler.subwaytooter.pref.impl
import android.content.SharedPreferences
class FloatPref(key: String, defVal: Float) : BasePref<Float>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): Float =
pref.getFloat(key, defVal)
override fun put(editor: SharedPreferences.Editor, v: Float) {
if (v == defVal) editor.remove(key) else editor.putFloat(key, v)
}
}

View File

@ -0,0 +1,13 @@
package jp.juggler.subwaytooter.pref.impl
import android.content.SharedPreferences
class IntPref(key: String, defVal: Int) : BasePref<Int>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): Int =
pref.getInt(key, defVal)
override fun put(editor: SharedPreferences.Editor, v: Int) {
if (v == defVal) editor.remove(key) else editor.putInt(key, v)
}
}

View File

@ -0,0 +1,13 @@
package jp.juggler.subwaytooter.pref.impl
import android.content.SharedPreferences
class LongPref(key: String, defVal: Long) : BasePref<Long>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): Long =
pref.getLong(key, defVal)
override fun put(editor: SharedPreferences.Editor, v: Long) {
if (v == defVal) editor.remove(key) else editor.putLong(key, v)
}
}

View File

@ -0,0 +1,20 @@
package jp.juggler.subwaytooter.pref.impl
import android.content.SharedPreferences
import jp.juggler.util.optInt
class StringPref(
key: String,
defVal: String,
val skipImport: Boolean = false,
) : BasePref<String>(key, defVal) {
override operator fun invoke(pref: SharedPreferences): String =
pref.getString(key, defVal) ?: defVal
override fun put(editor: SharedPreferences.Editor, v: String) {
if (v == defVal) editor.remove(key) else editor.putString(key, v)
}
fun toInt(pref: SharedPreferences) = invoke(pref).optInt() ?: defVal.toInt()
}

View File

@ -9,6 +9,8 @@ import jp.juggler.subwaytooter.api.entity.EntityId
import jp.juggler.subwaytooter.api.entity.ServiceType
import jp.juggler.subwaytooter.column.ColumnTask_Loading
import jp.juggler.subwaytooter.column.ColumnTask_Refresh
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.pref.put
import jp.juggler.util.*
import okhttp3.Request

View File

@ -8,7 +8,7 @@ import android.text.style.ReplacementSpan
import androidx.annotation.IntRange
import jp.juggler.apng.ApngFrames
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.util.LogCategory
import java.lang.ref.WeakReference

View File

@ -1,7 +1,7 @@
package jp.juggler.subwaytooter.streaming
import android.os.SystemClock
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.api.TootApiCallback
import jp.juggler.subwaytooter.api.TootApiClient
import jp.juggler.subwaytooter.api.TootApiResult

View File

@ -2,7 +2,7 @@ package jp.juggler.subwaytooter.streaming
import jp.juggler.subwaytooter.AppState
import jp.juggler.subwaytooter.column.Column
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.api.TootApiCallback
import jp.juggler.subwaytooter.api.TootApiClient
import jp.juggler.subwaytooter.api.entity.Acct

View File

@ -15,6 +15,8 @@ import jp.juggler.subwaytooter.action.userProfile
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.api.entity.TootStatus.Companion.findStatusIdFromUrl
import jp.juggler.subwaytooter.api.entity.TootTag.Companion.findHashtagFromUrl
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.pref.pref
import jp.juggler.subwaytooter.span.LinkInfo
import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.util.*

View File

@ -5,7 +5,7 @@ import android.graphics.PorterDuff
import android.graphics.drawable.Drawable
import androidx.core.content.ContextCompat
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefS
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.entity.TootStatus
import jp.juggler.subwaytooter.table.SavedAccount

View File

@ -7,12 +7,12 @@ import android.text.Spanned
import android.util.SparseBooleanArray
import androidx.annotation.DrawableRes
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.emoji.CustomEmoji
import jp.juggler.subwaytooter.emoji.EmojiMap
import jp.juggler.subwaytooter.emoji.UnicodeEmoji
import jp.juggler.subwaytooter.pref
import jp.juggler.subwaytooter.pref.pref
import jp.juggler.subwaytooter.span.EmojiImageSpan
import jp.juggler.subwaytooter.span.HighlightSpan
import jp.juggler.subwaytooter.span.NetworkEmojiSpan

View File

@ -7,7 +7,7 @@ import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.style.*
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.mfm.MisskeyMarkdownDecoder

View File

@ -4,7 +4,7 @@ import android.os.SystemClock
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.Styler
import jp.juggler.subwaytooter.api.*

View File

@ -5,6 +5,9 @@ import android.content.SharedPreferences
import androidx.annotation.RawRes
import androidx.appcompat.app.AlertDialog
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.pref.PrefS
import jp.juggler.subwaytooter.pref.pref
import jp.juggler.subwaytooter.pref.put
import jp.juggler.util.decodeUTF8
import jp.juggler.util.digestSHA256
import jp.juggler.util.encodeBase64Url

View File

@ -5,7 +5,7 @@ import android.content.Intent
import androidx.annotation.StringRes
import jp.juggler.subwaytooter.ActText
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.table.SavedAccount

View File

@ -23,7 +23,7 @@ import com.bumptech.glide.load.resource.gif.MyGifDrawable
import com.bumptech.glide.request.target.ImageViewTarget
import com.bumptech.glide.request.target.Target
import com.bumptech.glide.request.transition.Transition
import jp.juggler.subwaytooter.PrefB
import jp.juggler.subwaytooter.pref.PrefB
import jp.juggler.util.LogCategory
import jp.juggler.util.clipRange

View File

@ -17,7 +17,7 @@ import androidx.annotation.ColorInt
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SwitchCompat
import jp.juggler.subwaytooter.App1
import jp.juggler.subwaytooter.PrefI
import jp.juggler.subwaytooter.pref.PrefI
import jp.juggler.subwaytooter.R
import org.xmlpull.v1.XmlPullParser
import kotlin.math.pow

View File

@ -1099,4 +1099,5 @@
<string name="account_picker_mute">どのアカウントで %1$s をミュートしますか\?</string>
<string name="mfm_decoration_enabled">(Misskey)テキスト装飾を表示する</string>
<string name="mfm_show_unsupported_markup">(Misskey)未対応のマークアップを表示する</string>
<string name="show_media_description">添付メディアの説明文を表示する</string>
</resources>

View File

@ -1110,4 +1110,5 @@
<string name="many_window_post">Many window for post activity (experimental)</string>
<string name="mfm_decoration_enabled">(Misskey)Show text decorations</string>
<string name="mfm_show_unsupported_markup">(Misskey)Show unsupported markups</string>
<string name="show_media_description">Show media description</string>
</resources>

View File

@ -1,6 +1,6 @@
buildscript {
ext.jvm_target = "14"
ext.jvm_target = "11"
ext.min_sdk_version = 21
ext.target_sdk_version = 31

View File

@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion compile_sdk_version
@ -11,6 +12,7 @@ android {
defaultConfig {
targetSdkVersion target_sdk_version
minSdkVersion min_sdk_version
vectorDrawables.useSupportLibrary = true
}
@ -19,6 +21,18 @@ android {
}
resourcePrefix "cpv_"
kotlinOptions {
jvmTarget = jvm_target
useIR = true
freeCompilerArgs += [
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-Xopt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-Xopt-in=androidx.compose.animation.ExperimentalAnimationApi",
]
}
}
dependencies {

View File

@ -16,6 +16,7 @@ android {
versionCode 1
versionName "1.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
@ -25,6 +26,17 @@ android {
}
}
kotlinOptions {
jvmTarget = jvm_target
useIR = true
freeCompilerArgs += [
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-Xopt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-Xopt-in=androidx.compose.animation.ExperimentalAnimationApi",
]
}
}
dependencies {

View File

@ -18,7 +18,7 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {