「アプリ設定/見た目/一部の通知の本文アルファ値」を追加
This commit is contained in:
parent
349c3b8b9e
commit
82f7ec7f26
|
@ -75,6 +75,7 @@ class ActMain : AppCompatActivity(),
|
|||
var screenBottomPadding = 0
|
||||
var timelineFont: Typeface = Typeface.DEFAULT
|
||||
var timeline_font_bold: Typeface = Typeface.DEFAULT_BOLD
|
||||
var eventFadeAlpha = 1f
|
||||
}
|
||||
|
||||
// アプリ設定のキャッシュ
|
||||
|
|
|
@ -75,6 +75,12 @@ fun ActMain.reloadIconSize() {
|
|||
ActMain.headerIconSize = parseIconSize(PrefS.spHeaderIconSize)
|
||||
ActMain.stripIconSize = parseIconSize(PrefS.spStripIconSize)
|
||||
ActMain.screenBottomPadding = parseIconSize(PrefS.spScreenBottomPadding, minDp = 0f)
|
||||
|
||||
ActMain.eventFadeAlpha = PrefS.spEventTextAlpha()
|
||||
.toFloatOrNull()
|
||||
?.takeIf{ it.isFinite()}
|
||||
?.clip(0f,1f)
|
||||
?: 1f
|
||||
}
|
||||
|
||||
// initUIから呼ばれる
|
||||
|
|
|
@ -787,6 +787,8 @@ val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_sett
|
|||
sw(PrefB.bpUseTwemoji, R.string.use_twemoji_emoji)
|
||||
|
||||
sw(PrefB.bpKeepReactionSpace, R.string.keep_reaction_space)
|
||||
|
||||
text(PrefS.spEventTextAlpha, R.string.event_text_alpha, InputTypeEx.numberDecimal)
|
||||
}
|
||||
|
||||
section(R.string.color) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package jp.juggler.subwaytooter.itemviewholder
|
||||
|
||||
import android.view.View
|
||||
import jp.juggler.subwaytooter.ActMain
|
||||
import jp.juggler.subwaytooter.R
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus
|
||||
import jp.juggler.subwaytooter.column.ColumnType
|
||||
|
@ -45,7 +46,7 @@ private fun addLinkAndCaption(
|
|||
}
|
||||
}
|
||||
|
||||
fun ItemViewHolder.showPreviewCard(status: TootStatus) {
|
||||
fun ItemViewHolder.showPreviewCard(status: TootStatus, fadeText: Boolean) {
|
||||
|
||||
if (PrefB.bpDontShowPreviewCard(activity.pref)) return
|
||||
|
||||
|
@ -73,6 +74,12 @@ fun ItemViewHolder.showPreviewCard(status: TootStatus) {
|
|||
tvCardText.visibility = View.VISIBLE
|
||||
tvCardText.text = text
|
||||
bShowOuter = true
|
||||
|
||||
val fadeAlpha = ActMain.eventFadeAlpha
|
||||
if (fadeAlpha < 1f) {
|
||||
val a = if (fadeText) fadeAlpha else 1f
|
||||
tvCardText.alpha = a
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package jp.juggler.subwaytooter.itemviewholder
|
|||
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import jp.juggler.subwaytooter.pref.PrefI
|
||||
import jp.juggler.subwaytooter.R
|
||||
import jp.juggler.subwaytooter.Styler
|
||||
import jp.juggler.subwaytooter.actmain.addColumn
|
||||
|
@ -12,6 +11,7 @@ import jp.juggler.subwaytooter.api.entity.TootNotification
|
|||
import jp.juggler.subwaytooter.api.entity.TootReaction
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus
|
||||
import jp.juggler.subwaytooter.column.ColumnType
|
||||
import jp.juggler.subwaytooter.pref.PrefI
|
||||
import jp.juggler.util.notZero
|
||||
import org.jetbrains.anko.backgroundColor
|
||||
|
||||
|
@ -68,29 +68,53 @@ fun ItemViewHolder.showNotification(n: TootNotification) {
|
|||
}
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationFollow(n: TootNotification, nAccountRef: TootAccountRef?) {
|
||||
private fun ItemViewHolder.showNotificationFollow(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?
|
||||
) {
|
||||
val colorBg = PrefI.ipEventBgColorFollow(activity.pref)
|
||||
colorBg.notZero()?.let { viewRoot.backgroundColor = it }
|
||||
nAccountRef?.let {
|
||||
showBoost(it, n.time_created_at, R.drawable.ic_follow_plus, R.string.display_name_followed_by)
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_follow_plus,
|
||||
R.string.display_name_followed_by
|
||||
)
|
||||
showAccount(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationUnfollow(n: TootNotification, nAccountRef: TootAccountRef?) {
|
||||
private fun ItemViewHolder.showNotificationUnfollow(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?
|
||||
) {
|
||||
val colorBg = PrefI.ipEventBgColorUnfollow(activity.pref)
|
||||
colorBg.notZero()?.let { viewRoot.backgroundColor = it }
|
||||
nAccountRef?.let {
|
||||
showBoost(it, n.time_created_at, R.drawable.ic_follow_cross, R.string.display_name_unfollowed_by)
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_follow_cross,
|
||||
R.string.display_name_unfollowed_by
|
||||
)
|
||||
showAccount(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationFollowRequest(n: TootNotification, nAccountRef: TootAccountRef?) {
|
||||
private fun ItemViewHolder.showNotificationFollowRequest(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?
|
||||
) {
|
||||
val colorBg = PrefI.ipEventBgColorFollowRequest(activity.pref)
|
||||
colorBg.notZero()?.let { viewRoot.backgroundColor = it }
|
||||
nAccountRef?.let {
|
||||
showBoost(it, n.time_created_at, R.drawable.ic_follow_wait, R.string.display_name_follow_request_by)
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_follow_wait,
|
||||
R.string.display_name_follow_request_by
|
||||
)
|
||||
showAccount(it)
|
||||
}
|
||||
boostedAction = {
|
||||
|
@ -98,16 +122,28 @@ private fun ItemViewHolder.showNotificationFollowRequest(n: TootNotification, nA
|
|||
}
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationFollowRequestAccepted(n: TootNotification, nAccountRef: TootAccountRef?) {
|
||||
private fun ItemViewHolder.showNotificationFollowRequestAccepted(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?
|
||||
) {
|
||||
val colorBg = PrefI.ipEventBgColorFollow(activity.pref)
|
||||
colorBg.notZero()?.let { viewRoot.backgroundColor = it }
|
||||
nAccountRef?.let {
|
||||
showBoost(it, n.time_created_at, R.drawable.ic_follow_plus, R.string.display_name_follow_request_accepted_by)
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_follow_plus,
|
||||
R.string.display_name_follow_request_accepted_by
|
||||
)
|
||||
showAccount(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationPost(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
private fun ItemViewHolder.showNotificationPost(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
val colorBg = PrefI.ipEventBgColorStatus(activity.pref)
|
||||
val iconId = when (nStatus) {
|
||||
null -> R.drawable.ic_question
|
||||
|
@ -117,7 +153,11 @@ private fun ItemViewHolder.showNotificationPost(n: TootNotification, nAccountRef
|
|||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationReaction(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
private fun ItemViewHolder.showNotificationReaction(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
val colorBg = PrefI.ipEventBgColorReaction(activity.pref)
|
||||
nAccountRef?.let {
|
||||
showBoost(
|
||||
|
@ -131,16 +171,24 @@ private fun ItemViewHolder.showNotificationReaction(n: TootNotification, nAccoun
|
|||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationFavourite(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
private fun ItemViewHolder.showNotificationFavourite(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
nAccountRef?.let {
|
||||
val iconId = if (accessInfo.isNicoru(it.get())) R.drawable.ic_nicoru else R.drawable.ic_star
|
||||
showBoost(it, n.time_created_at, iconId, R.string.display_name_favourited_by)
|
||||
}
|
||||
val colorBg = PrefI.ipEventBgColorFavourite(activity.pref)
|
||||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
nStatus?.let { showNotificationStatus(it, colorBg, fadeText = true) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationReblog(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
private fun ItemViewHolder.showNotificationReblog(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
nAccountRef?.let {
|
||||
showBoost(
|
||||
it,
|
||||
|
@ -152,19 +200,33 @@ private fun ItemViewHolder.showNotificationReblog(n: TootNotification, nAccountR
|
|||
)
|
||||
}
|
||||
val colorBg = PrefI.ipEventBgColorBoost(activity.pref)
|
||||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
nStatus?.let { showNotificationStatus(it, colorBg, fadeText = true) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationRenote(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
private fun ItemViewHolder.showNotificationRenote(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
// 引用のないreblog
|
||||
nAccountRef?.let {
|
||||
showBoost(it, n.time_created_at, R.drawable.ic_repeat, R.string.display_name_boosted_by, boostStatus = nStatus)
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_repeat,
|
||||
R.string.display_name_boosted_by,
|
||||
boostStatus = nStatus
|
||||
)
|
||||
}
|
||||
val colorBg = PrefI.ipEventBgColorBoost(activity.pref)
|
||||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationMention(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
private fun ItemViewHolder.showNotificationMention(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
// メンション通知に「~~からの返信」を表示するカラムなのかどうか
|
||||
fun willShowReplyInfo(status: TootStatus?): Boolean = when {
|
||||
// メンションではなく返信の場合、トゥート内部に「~への返信」を表示するので
|
||||
|
@ -176,34 +238,85 @@ private fun ItemViewHolder.showNotificationMention(n: TootNotification, nAccount
|
|||
}
|
||||
|
||||
if (willShowReplyInfo(nStatus)) {
|
||||
nAccountRef?.let { showBoost(it, n.time_created_at, R.drawable.ic_reply, R.string.display_name_mentioned_by) }
|
||||
nAccountRef?.let {
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_reply,
|
||||
R.string.display_name_mentioned_by
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val colorBg = PrefI.ipEventBgColorMention(activity.pref)
|
||||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationQuote(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
nAccountRef?.let { showBoost(it, n.time_created_at, R.drawable.ic_repeat, R.string.display_name_quoted_by) }
|
||||
private fun ItemViewHolder.showNotificationQuote(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
nAccountRef?.let {
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_repeat,
|
||||
R.string.display_name_quoted_by
|
||||
)
|
||||
}
|
||||
|
||||
val colorBg = PrefI.ipEventBgColorQuote(activity.pref)
|
||||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationVote(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
nAccountRef?.let { showBoost(it, n.time_created_at, R.drawable.ic_vote, R.string.display_name_voted_by) }
|
||||
private fun ItemViewHolder.showNotificationVote(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
nAccountRef?.let {
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_vote,
|
||||
R.string.display_name_voted_by
|
||||
)
|
||||
}
|
||||
val colorBg = PrefI.ipEventBgColorVote(activity.pref)
|
||||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationPoll(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
nAccountRef?.let { showBoost(it, n.time_created_at, R.drawable.ic_vote, R.string.end_of_polling_from) }
|
||||
private fun ItemViewHolder.showNotificationPoll(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
nAccountRef?.let {
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_vote,
|
||||
R.string.end_of_polling_from
|
||||
)
|
||||
}
|
||||
val colorBg = 0
|
||||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationUnknown(n: TootNotification, nAccountRef: TootAccountRef?, nStatus: TootStatus?) {
|
||||
nAccountRef?.let { showBoost(it, n.time_created_at, R.drawable.ic_question, R.string.unknown_notification_from) }
|
||||
private fun ItemViewHolder.showNotificationUnknown(
|
||||
n: TootNotification,
|
||||
nAccountRef: TootAccountRef?,
|
||||
nStatus: TootStatus?
|
||||
) {
|
||||
nAccountRef?.let {
|
||||
showBoost(
|
||||
it,
|
||||
n.time_created_at,
|
||||
R.drawable.ic_question,
|
||||
R.string.unknown_notification_from
|
||||
)
|
||||
}
|
||||
val colorBg = 0
|
||||
nStatus?.let { showNotificationStatus(it, colorBg) }
|
||||
|
||||
|
@ -212,21 +325,25 @@ private fun ItemViewHolder.showNotificationUnknown(n: TootNotification, nAccount
|
|||
tvMessageHolder.gravity = Gravity.CENTER
|
||||
}
|
||||
|
||||
private fun ItemViewHolder.showNotificationStatus(item: TootStatus, colorBgDefault: Int) {
|
||||
private fun ItemViewHolder.showNotificationStatus(
|
||||
item: TootStatus,
|
||||
colorBgDefault: Int,
|
||||
fadeText: Boolean = false
|
||||
) {
|
||||
val reblog = item.reblog
|
||||
when {
|
||||
reblog == null -> showStatusOrReply(item, colorBgDefault)
|
||||
reblog == null -> showStatusOrReply(item, colorBgDefault, fadeText = fadeText)
|
||||
|
||||
item.isQuoteToot -> {
|
||||
// 引用Renote
|
||||
showReply(reblog, R.drawable.ic_repeat, R.string.quote_to)
|
||||
showStatus(item, PrefI.ipEventBgColorQuote(activity.pref))
|
||||
showStatus(item, PrefI.ipEventBgColorQuote(activity.pref), fadeText = fadeText)
|
||||
}
|
||||
|
||||
else -> {
|
||||
// 通常のブースト。引用なしブースト。
|
||||
// ブースト表示は通知イベントと被るのでしない
|
||||
showStatusOrReply(reblog, PrefI.ipEventBgColorBoost(activity.pref))
|
||||
showStatusOrReply(reblog, PrefI.ipEventBgColorBoost(activity.pref), fadeText = fadeText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.text.Spannable
|
|||
import android.text.SpannableStringBuilder
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import jp.juggler.subwaytooter.ActMain
|
||||
import jp.juggler.subwaytooter.R
|
||||
import jp.juggler.subwaytooter.Styler
|
||||
import jp.juggler.subwaytooter.actmain.checkAutoCW
|
||||
|
@ -20,7 +21,11 @@ import jp.juggler.util.*
|
|||
import org.jetbrains.anko.backgroundColor
|
||||
import org.jetbrains.anko.textColor
|
||||
|
||||
fun ItemViewHolder.showStatusOrReply(item: TootStatus, colorBgArg: Int = 0) {
|
||||
fun ItemViewHolder.showStatusOrReply(
|
||||
item: TootStatus,
|
||||
colorBgArg: Int = 0,
|
||||
fadeText: Boolean = false
|
||||
) {
|
||||
var colorBg = colorBgArg
|
||||
val reply = item.reply
|
||||
val inReplyToId = item.in_reply_to_id
|
||||
|
@ -36,10 +41,14 @@ fun ItemViewHolder.showStatusOrReply(item: TootStatus, colorBgArg: Int = 0) {
|
|||
if (colorBgArg == 0) colorBg = PrefI.ipEventBgColorMention(activity.pref)
|
||||
}
|
||||
}
|
||||
showStatus(item, colorBg)
|
||||
showStatus(item, colorBg, fadeText = fadeText)
|
||||
}
|
||||
|
||||
fun ItemViewHolder.showStatus(status: TootStatus, colorBg: Int = 0) {
|
||||
fun ItemViewHolder.showStatus(
|
||||
status: TootStatus,
|
||||
colorBg: Int = 0,
|
||||
fadeText: Boolean = false
|
||||
) {
|
||||
|
||||
val filteredWord = status.filteredWord
|
||||
if (filteredWord != null) {
|
||||
|
@ -115,6 +124,15 @@ fun ItemViewHolder.showStatus(status: TootStatus, colorBg: Int = 0) {
|
|||
// tvTags.setText( status.decoded_tags );
|
||||
// }
|
||||
|
||||
val fadeAlpha = ActMain.eventFadeAlpha
|
||||
if (fadeAlpha < 1f) {
|
||||
val a = if (fadeText) fadeAlpha else 1f
|
||||
tvMentions.alpha = a
|
||||
tvContentWarning.alpha = a
|
||||
tvContent.alpha = a
|
||||
tvApplication.alpha = a
|
||||
}
|
||||
|
||||
if (status.decoded_mentions.isEmpty()) {
|
||||
tvMentions.visibility = View.GONE
|
||||
} else {
|
||||
|
@ -129,7 +147,7 @@ fun ItemViewHolder.showStatus(status: TootStatus, colorBg: Int = 0) {
|
|||
val r = status.auto_cw
|
||||
tvContent.minLines = r?.originalLineCount ?: -1
|
||||
|
||||
showPreviewCard(status)
|
||||
showPreviewCard(status, fadeText = fadeText)
|
||||
showSpoilerTextAndContent(status)
|
||||
showAttachments(status)
|
||||
makeReactionsView(status)
|
||||
|
|
|
@ -49,4 +49,6 @@ object PrefS {
|
|||
// val spWebBrowser = StringPref("WebBrowser", "")
|
||||
|
||||
val spTimelineSpacing = StringPref("TimelineSpacing", "")
|
||||
|
||||
val spEventTextAlpha = StringPref("EventTextAlpha", "")
|
||||
}
|
|
@ -1107,4 +1107,5 @@
|
|||
<string name="url_parse_failed">URLの指定が変です</string>
|
||||
<string name="url_of_user_or_status">ユーザや投稿のURL</string>
|
||||
<string name="unbookmark">ブックマーク解除</string>
|
||||
<string name="event_text_alpha">一部の通知の本文アルファ値(0.0~1.0, デフォルト:1)</string>
|
||||
</resources>
|
||||
|
|
|
@ -1118,4 +1118,5 @@
|
|||
<string name="url_of_user_or_status">URL of user or status</string>
|
||||
<string name="url_parse_failed">parse error.</string>
|
||||
<string name="unbookmark">Unbookmark</string>
|
||||
<string name="event_text_alpha">Text alpha value for some notifications (0.0~1.0, default:1)</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue