アプリ設定に「ブーストボタンのアルファ値」を追加。明るいテーマのカラムヘッダ背景色のデフォルト値を白くした

This commit is contained in:
tateisu 2018-11-18 23:29:35 +09:00
parent 2b5d66ee95
commit 5432d10331
22 changed files with 239 additions and 205 deletions

View File

@ -134,6 +134,7 @@ class ActAppSetting : AppCompatActivity()
private lateinit var etMediaSizeMax : EditText private lateinit var etMediaSizeMax : EditText
private lateinit var etMovieSizeMax : EditText private lateinit var etMovieSizeMax : EditText
private lateinit var etRoundRatio : EditText private lateinit var etRoundRatio : EditText
private lateinit var etBoostAlpha : EditText
private lateinit var etMediaReadTimeout : EditText private lateinit var etMediaReadTimeout : EditText
@ -147,6 +148,7 @@ class ActAppSetting : AppCompatActivity()
private lateinit var tvTimelineFontSize : TextView private lateinit var tvTimelineFontSize : TextView
private lateinit var tvAcctFontSize : TextView private lateinit var tvAcctFontSize : TextView
private lateinit var etAvatarIconSize : EditText private lateinit var etAvatarIconSize : EditText
private lateinit var etPullNotificationCheckInterval : EditText private lateinit var etPullNotificationCheckInterval : EditText
private lateinit var etNotificationTlFontSize : EditText private lateinit var etNotificationTlFontSize : EditText
@ -332,6 +334,9 @@ class ActAppSetting : AppCompatActivity()
etRoundRatio = findViewById(R.id.etRoundRatio) etRoundRatio = findViewById(R.id.etRoundRatio)
etRoundRatio.addTextChangedListener(this) etRoundRatio.addTextChangedListener(this)
etBoostAlpha = findViewById(R.id.etBoostAlpha)
etBoostAlpha.addTextChangedListener(this)
etMediaReadTimeout= findViewById(R.id.etMediaReadTimeout) etMediaReadTimeout= findViewById(R.id.etMediaReadTimeout)
etMediaReadTimeout.addTextChangedListener(this) etMediaReadTimeout.addTextChangedListener(this)
@ -440,6 +445,7 @@ class ActAppSetting : AppCompatActivity()
etMediaSizeMax.setText(Pref.spMediaSizeMax(pref)) etMediaSizeMax.setText(Pref.spMediaSizeMax(pref))
etMovieSizeMax.setText(Pref.spMovieSizeMax(pref)) etMovieSizeMax.setText(Pref.spMovieSizeMax(pref))
etRoundRatio.setText(Pref.spRoundRatio(pref)) etRoundRatio.setText(Pref.spRoundRatio(pref))
etBoostAlpha.setText(Pref.spBoostAlpha(pref))
etMediaReadTimeout.setText(Pref.spMediaReadTimeout(pref)) etMediaReadTimeout.setText(Pref.spMediaReadTimeout(pref))
@ -521,6 +527,8 @@ class ActAppSetting : AppCompatActivity()
.put(Pref.spMovieSizeMax, etMovieSizeMax.text.toString().trim { it <= ' ' }) .put(Pref.spMovieSizeMax, etMovieSizeMax.text.toString().trim { it <= ' ' })
.put(Pref.spRoundRatio, etRoundRatio.text.toString().trim { it <= ' ' }) .put(Pref.spRoundRatio, etRoundRatio.text.toString().trim { it <= ' ' })
.put(Pref.spBoostAlpha, etBoostAlpha.text.toString().trim { it <= ' ' })
.put(Pref.spMediaReadTimeout, etMediaReadTimeout.text.toString().trim { it <= ' ' }) .put(Pref.spMediaReadTimeout, etMediaReadTimeout.text.toString().trim { it <= ' ' })
@ -849,8 +857,8 @@ class ActAppSetting : AppCompatActivity()
var c = footer_button_bg_color var c = footer_button_bg_color
if(c == 0) { if(c == 0) {
ivFooterToot.setBackgroundResource(R.drawable.btn_bg_ddd) ivFooterToot.setBackgroundResource(R.drawable.bg_button_cw)
ivFooterMenu.setBackgroundResource(R.drawable.btn_bg_ddd) ivFooterMenu.setBackgroundResource(R.drawable.bg_button_cw)
} else { } else {
val fg = if(footer_button_fg_color != 0) val fg = if(footer_button_fg_color != 0)
footer_button_fg_color footer_button_fg_color

View File

@ -23,6 +23,7 @@ import jp.juggler.subwaytooter.api.TootTask
import jp.juggler.subwaytooter.api.TootTaskRunner import jp.juggler.subwaytooter.api.TootTaskRunner
import jp.juggler.subwaytooter.util.* import jp.juggler.subwaytooter.util.*
import org.apache.commons.io.IOUtils import org.apache.commons.io.IOUtils
import org.jetbrains.anko.textColor
import java.io.File import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
@ -126,13 +127,13 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
} }
R.id.btnHeaderTextEdit -> { R.id.btnHeaderTextEdit -> {
builder = ColorPickerDialog.newBuilder() ColorPickerDialog.newBuilder()
.setDialogType(ColorPickerDialog.TYPE_CUSTOM) .setDialogType(ColorPickerDialog.TYPE_CUSTOM)
.setAllowPresets(true) .setAllowPresets(true)
.setShowAlphaSlider(false) .setShowAlphaSlider(false)
.setDialogId(COLOR_DIALOG_ID_HEADER_FOREGROUND) .setDialogId(COLOR_DIALOG_ID_HEADER_FOREGROUND)
if(column.header_fg_color != 0) builder.setColor(column.header_fg_color) .setColor(column.getHeaderNameColor(this))
builder.show(this) .show(this)
} }
R.id.btnHeaderTextReset -> { R.id.btnHeaderTextReset -> {
@ -387,43 +388,19 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
private fun show() { private fun show() {
try { try {
loading_busy = true loading_busy = true
var c = column.header_bg_color
if(c == 0) {
llColumnHeader.setBackgroundResource(R.drawable.btn_bg_ddd)
} else {
ViewCompat.setBackground(
llColumnHeader, Styler.getAdaptiveRippleDrawable(
c,
if(column.header_fg_color != 0)
column.header_fg_color
else
Styler.getAttributeColor(this, R.attr.colorRippleEffect)
)
)
}
c = column.header_fg_color column.setHeaderBackground(this,llColumnHeader)
if(c == 0) {
tvColumnName.setTextColor(
Styler.getAttributeColor(
this, var c = column.getHeaderNameColor(this)
android.R.attr.textColorPrimary tvColumnName.textColor = c
) Styler.setIconAttr(
) this,
Styler.setIconAttr( ivColumnHeader,
this, column.getIconAttrId(column.column_type),
ivColumnHeader, color = c
column.getIconAttrId(column.column_type) )
)
} else {
tvColumnName.setTextColor(c)
Styler.setIconAttr(
this,
ivColumnHeader,
column.getIconAttrId(column.column_type),
color = c
)
}
tvColumnName.text = column.getColumnName(false) tvColumnName.text = column.getColumnName(false)

View File

@ -1222,6 +1222,20 @@ class ActMain : AppCompatActivity()
Styler.round_ratio = clipRange(0f, 1f, round_ratio / 100f) * 0.5f Styler.round_ratio = clipRange(0f, 1f, round_ratio / 100f) * 0.5f
} }
run {
var boost_alpha :Float? = 0.8f
try{
val f = ( Pref.spBoostAlpha.toInt(pref).toFloat() +0.5f )/100f
boost_alpha = when{
f >= 1f -> null
f < 0f -> 0.66f
else-> f
}
} catch(ex : Throwable) {
log.trace(ex)
}
Styler.boost_alpha = boost_alpha
}
llEmpty = findViewById(R.id.llEmpty) llEmpty = findViewById(R.id.llEmpty)
@ -1415,28 +1429,11 @@ class ActMain : AppCompatActivity()
viewRoot.contentDescription = column.getColumnName(true) viewRoot.contentDescription = column.getColumnName(true)
// //
var c = column.header_bg_color column.setHeaderBackground(this,viewRoot)
if(c == 0) {
viewRoot.setBackgroundResource(R.drawable.btn_bg_ddd)
} else {
ViewCompat.setBackground(
viewRoot, Styler.getAdaptiveRippleDrawable(
c,
if(column.header_fg_color != 0)
column.header_fg_color
else
Styler.getAttributeColor(this, R.attr.colorRippleEffect)
)
)
}
c = column.header_fg_color
if(c == 0) { var c = column.getHeaderNameColor(this)
Styler.setIconAttr(this, ivIcon, column.getIconAttrId(column.column_type)) Styler.setIconAttr(this, ivIcon, column.getIconAttrId(column.column_type), c)
} else {
Styler.setIconAttr(this, ivIcon, column.getIconAttrId(column.column_type), c)
}
// //
val ac = AcctColor.load(column.access_info.acct) val ac = AcctColor.load(column.access_info.acct)
@ -2265,9 +2262,9 @@ class ActMain : AppCompatActivity()
val footer_tab_indicator_color = Pref.ipFooterTabIndicatorColor(pref) val footer_tab_indicator_color = Pref.ipFooterTabIndicatorColor(pref)
var c = footer_button_bg_color var c = footer_button_bg_color
if(c == 0) { if(c == 0) {
btnMenu.setBackgroundResource(R.drawable.btn_bg_ddd) btnMenu.setBackgroundResource(R.drawable.bg_button_cw)
btnToot.setBackgroundResource(R.drawable.btn_bg_ddd) btnToot.setBackgroundResource(R.drawable.bg_button_cw)
btnQuickToot.setBackgroundResource(R.drawable.btn_bg_ddd) btnQuickToot.setBackgroundResource(R.drawable.bg_button_cw)
} else { } else {
val fg = if(footer_button_fg_color != 0) val fg = if(footer_button_fg_color != 0)
footer_button_fg_color footer_button_fg_color

View File

@ -6,8 +6,10 @@ import android.net.Uri
import android.os.AsyncTask import android.os.AsyncTask
import android.os.Environment import android.os.Environment
import android.os.SystemClock import android.os.SystemClock
import android.support.v4.view.ViewCompat
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.view.Gravity import android.view.Gravity
import android.view.View
import jp.juggler.subwaytooter.api.* import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.api.entity.* import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.table.* import jp.juggler.subwaytooter.table.*
@ -1926,11 +1928,12 @@ class Column(
// 初回の取得 // 初回の取得
val result = when { val result = when {
isMisskey -> { isMisskey -> {
if( initialUntilDate ){ if(initialUntilDate) {
params.put("untilDate",System.currentTimeMillis() + ( 86400000L * 365)) params.put("untilDate", System.currentTimeMillis() + (86400000L * 365))
} }
client.request(path_base, params.toPostRequestBuilder()) client.request(path_base, params.toPostRequestBuilder())
} }
aroundMin -> client.request("$path_base&min_id=$status_id") aroundMin -> client.request("$path_base&min_id=$status_id")
aroundMax -> client.request("$path_base&max_id=$status_id") aroundMax -> client.request("$path_base&max_id=$status_id")
else -> client.request(path_base) else -> client.request(path_base)
@ -2830,7 +2833,7 @@ class Column(
, misskeyParams = makeMisskeyTimelineParameter(parser) , misskeyParams = makeMisskeyTimelineParameter(parser)
.put("tag", hashtag) .put("tag", hashtag)
.put("limit", MISSKEY_HASHTAG_LIMIT) .put("limit", MISSKEY_HASHTAG_LIMIT)
) )
} else { } else {
getStatuses(client, makeHashtagUrl(hashtag)) getStatuses(client, makeHashtagUrl(hashtag))
@ -6831,6 +6834,39 @@ class Column(
Styler.getAttributeColor(activity, R.attr.colorTimeSmall) Styler.getAttributeColor(activity, R.attr.colorTimeSmall)
} }
fun getHeaderPageNumberColor(activity : AppCompatActivity) : Int {
val c = header_fg_color
return when {
c != 0 -> c
else -> Styler.getAttributeColor(
activity,
R.attr.colorColumnHeaderPageNumber
)
}
}
fun getHeaderNameColor(activity : AppCompatActivity) : Int {
val c = header_fg_color
return when {
c != 0 -> c
else -> Styler.getAttributeColor(
activity,
R.attr.colorColumnHeaderName
)
}
}
fun setHeaderBackground(activity : AppCompatActivity, view : View) {
val c = header_bg_color
if(c == 0) {
view.setBackgroundResource(R.drawable.bg_column_header)
} else {
ViewCompat.setBackground(
view, Styler.getAdaptiveRippleDrawable(c, getHeaderNameColor(activity))
)
}
}
// fun findListIndexByTimelineId(orderId : EntityId) : Int? { // fun findListIndexByTimelineId(orderId : EntityId) : Int? {
// list_data.forEachIndexed { i, v -> // list_data.forEachIndexed { i, v ->
// if(v.getOrderId() == orderId) return i // if(v.getOrderId() == orderId) return i

View File

@ -657,66 +657,29 @@ class ColumnViewHolder(
fun showColumnColor() { fun showColumnColor() {
val column = this.column val column = this.column
if(column == null || column.is_dispose.get()) return if(column == null || column.is_dispose.get()) return
// カラムヘッダ背景
column.setHeaderBackground(activity,llColumnHeader)
// カラムヘッダ文字色(A)
var c = column.getHeaderNameColor(activity)
tvColumnName.textColor =c
Styler.setIconAttr(
activity,
ivColumnIcon,
column.getIconAttrId(column.column_type),
c
)
Styler.setIconAttr(activity, btnColumnSetting, R.attr.ic_tune, c)
Styler.setIconAttr(activity, btnColumnReload, R.attr.btn_refresh, c)
Styler.setIconAttr(activity, btnColumnClose, R.attr.btn_close, c)
var c = column.header_bg_color // カラムヘッダ文字色(B)
if(c == 0) { c = column.getHeaderPageNumberColor(activity)
llColumnHeader.setBackgroundResource(R.drawable.btn_bg_ddd) tvColumnIndex.textColor =c
} else { tvColumnStatus.textColor =c
ViewCompat.setBackground(
llColumnHeader,
Styler.getAdaptiveRippleDrawable(
c,
if(column.header_fg_color != 0)
column.header_fg_color
else
Styler.getAttributeColor(activity, R.attr.colorRippleEffect)
)
)
}
c = column.header_fg_color
if(c == 0) {
tvColumnIndex.setTextColor(
Styler.getAttributeColor(
activity,
R.attr.colorColumnHeaderPageNumber
)
)
tvColumnStatus.setTextColor(
Styler.getAttributeColor(
activity,
R.attr.colorColumnHeaderPageNumber
)
)
tvColumnName.setTextColor(
Styler.getAttributeColor(
activity,
android.R.attr.textColorPrimary
)
)
Styler.setIconAttr(
activity,
ivColumnIcon,
column.getIconAttrId(column.column_type)
)
Styler.setIconAttr(activity, btnColumnSetting, R.attr.ic_tune)
Styler.setIconAttr(activity, btnColumnReload, R.attr.btn_refresh)
Styler.setIconAttr(activity, btnColumnClose, R.attr.btn_close)
} else {
tvColumnIndex.setTextColor(c)
tvColumnStatus.setTextColor(c)
tvColumnName.setTextColor(c)
Styler.setIconAttr(
activity,
ivColumnIcon,
column.getIconAttrId(column.column_type),
c
)
Styler.setIconAttr(activity, btnColumnSetting, R.attr.ic_tune, c)
Styler.setIconAttr(activity, btnColumnReload, R.attr.btn_refresh, c)
Styler.setIconAttr(activity, btnColumnClose, R.attr.btn_close, c)
}
// カラム内部の背景色
c = column.column_bg_color c = column.column_bg_color
if(c == 0) { if(c == 0) {
ViewCompat.setBackground(flColumnBackground, null) ViewCompat.setBackground(flColumnBackground, null)
@ -724,15 +687,17 @@ class ColumnViewHolder(
flColumnBackground.setBackgroundColor(c) flColumnBackground.setBackgroundColor(c)
} }
// カラム内部の背景画像
ivColumnBackgroundImage.alpha = column.column_bg_image_alpha ivColumnBackgroundImage.alpha = column.column_bg_image_alpha
loadBackgroundImage(ivColumnBackgroundImage, column.column_bg_image) loadBackgroundImage(ivColumnBackgroundImage, column.column_bg_image)
// エラー表示
tvLoading.textColor = column.getContentColor(activity) tvLoading.textColor = column.getContentColor(activity)
status_adapter?.findHeaderViewHolder(listView)?.showColor() status_adapter?.findHeaderViewHolder(listView)?.showColor()
} }
private fun closeBitmaps() { private fun closeBitmaps() {
try { try {
ivColumnBackgroundImage.visibility = View.GONE ivColumnBackgroundImage.visibility = View.GONE

View File

@ -217,7 +217,7 @@ internal class ItemViewHolder(
llTrendTag.setOnLongClickListener(this) llTrendTag.setOnLongClickListener(this)
llFilter.setOnClickListener(this) llFilter.setOnClickListener(this)
var f :Float var f : Float
f = activity.timeline_font_size_sp f = activity.timeline_font_size_sp
if(! f.isNaN()) { if(! f.isNaN()) {
@ -253,7 +253,7 @@ internal class ItemViewHolder(
tvAcct.textSize = f tvAcct.textSize = f
tvTime.textSize = f tvTime.textSize = f
tvTrendTagDesc.textSize = f tvTrendTagDesc.textSize = f
tvFilterDetail.textSize =f tvFilterDetail.textSize = f
} }
var s = activity.avatarIconSize var s = activity.avatarIconSize
@ -261,7 +261,7 @@ internal class ItemViewHolder(
ivThumbnail.layoutParams.width = s ivThumbnail.layoutParams.width = s
ivFollow.layoutParams.width = s ivFollow.layoutParams.width = s
ivBoosted.layoutParams.width = s ivBoosted.layoutParams.width = s
s = activity.notificationTlIconSize s = activity.notificationTlIconSize
ivBoosted.layoutParams.height = s ivBoosted.layoutParams.height = s
@ -423,12 +423,12 @@ internal class ItemViewHolder(
(llCardOuter.background as? PreviewCardBorder)?.let { (llCardOuter.background as? PreviewCardBorder)?.let {
val rgb = c and 0xffffff val rgb = c and 0xffffff
val alpha = max(1, c ushr (24+1)) // 本来の値の半分にする val alpha = max(1, c ushr (24 + 1)) // 本来の値の半分にする
it.color = rgb or ( alpha shl 24) it.color = rgb or (alpha shl 24)
} }
c = column.getAcctColor(activity) c = column.getAcctColor(activity)
log.d("acct_color %x",c) log.d("acct_color %x", c)
this.acct_color = c this.acct_color = c
tvBoostedTime.setTextColor(c) tvBoostedTime.setTextColor(c)
tvTime.setTextColor(c) tvTime.setTextColor(c)
@ -628,13 +628,13 @@ internal class ItemViewHolder(
val reblog = item.reblog val reblog = item.reblog
when { when {
reblog == null -> showStatusOrReply(item) reblog == null -> showStatusOrReply(item)
! item.hasAnyContent() -> { ! item.hasAnyContent() -> {
// 通常のブースト。引用なしブースト。 // 通常のブースト。引用なしブースト。
// ブースト表示は通知イベントと被るのでしない // ブースト表示は通知イベントと被るのでしない
showStatusOrReply(reblog) showStatusOrReply(reblog)
} }
else -> { else -> {
// 引用Renote // 引用Renote
showReply( showReply(
@ -714,13 +714,13 @@ internal class ItemViewHolder(
TootNotification.TYPE_MENTION, TootNotification.TYPE_MENTION,
TootNotification.TYPE_REPLY -> { TootNotification.TYPE_REPLY -> {
if(! bSimpleList && ! access_info.isMisskey) { if(! bSimpleList && ! access_info.isMisskey) {
if(n_account != null){ if(n_account != null) {
if( n_status?.in_reply_to_id != null if(n_status?.in_reply_to_id != null
||n_status?.reply != null || n_status?.reply != null
){ ) {
// トゥート内部に「~への返信」を表示するので、 // トゥート内部に「~への返信」を表示するので、
// 通知イベントの「~からの返信」は表示しない // 通知イベントの「~からの返信」は表示しない
}else{ } else {
// 返信ではなくメンションの場合は「~からの返信」を表示する // 返信ではなくメンションの場合は「~からの返信」を表示する
showBoost( showBoost(
n_accountRef, n_accountRef,
@ -743,7 +743,7 @@ internal class ItemViewHolder(
n.time_created_at, n.time_created_at,
R.attr.ic_question, R.attr.ic_question,
R.string.display_name_reaction_by R.string.display_name_reaction_by
,reactionDrawableId = reaction?.btnDrawableId , reactionDrawableId = reaction?.btnDrawableId
) )
if(n_status != null) { if(n_status != null) {
showNotificationStatus(n_status) showNotificationStatus(n_status)
@ -864,8 +864,9 @@ internal class ItemViewHolder(
Styler.setIconAttr( Styler.setIconAttr(
activity, activity,
ivReply, ivReply,
iconAttrId, iconAttrId,
color = content_color color = content_color,
alphaMultiplier = Styler.boost_alpha
) )
tvReply.text = text tvReply.text = text
@ -895,11 +896,11 @@ internal class ItemViewHolder(
llReply.visibility = View.VISIBLE llReply.visibility = View.VISIBLE
val name = if(accountId == replyStatus.account.id) { val name = if(accountId == replyStatus.account.id) {
AcctColor.getNicknameWithColor( access_info.getFullAcct(replyStatus.account)) AcctColor.getNicknameWithColor(access_info.getFullAcct(replyStatus.account))
} else { } else {
val m = replyStatus.mentions?.find { it.id == accountId } val m = replyStatus.mentions?.find { it.id == accountId }
if(m != null) { if(m != null) {
AcctColor.getNicknameWithColor( access_info.getFullAcct(m.acct)) AcctColor.getNicknameWithColor(access_info.getFullAcct(m.acct))
} else { } else {
SpannableString("ID(${accountId})") SpannableString("ID(${accountId})")
} }
@ -939,7 +940,8 @@ internal class ItemViewHolder(
activity, activity,
ivBoosted, ivBoosted,
icon_attr_id, icon_attr_id,
color = content_color color = content_color,
alphaMultiplier = Styler.boost_alpha
) )
} }
@ -968,7 +970,15 @@ internal class ItemViewHolder(
setAcct(tvFollowerAcct, access_info.getFullAcct(who), who.acct) setAcct(tvFollowerAcct, access_info.getFullAcct(who), who.acct)
val relation = UserRelation.load(access_info.db_id, who.id) val relation = UserRelation.load(access_info.db_id, who.id)
Styler.setFollowIcon(activity, btnFollow, ivFollowedBy, relation, who,content_color) Styler.setFollowIcon(
activity,
btnFollow,
ivFollowedBy,
relation,
who,
content_color,
alphaMultiplier = Styler.boost_alpha
)
if(column.column_type == Column.TYPE_FOLLOW_REQUESTS) { if(column.column_type == Column.TYPE_FOLLOW_REQUESTS) {
llFollowRequest.visibility = View.VISIBLE llFollowRequest.visibility = View.VISIBLE
@ -1147,7 +1157,8 @@ internal class ItemViewHolder(
activity, activity,
btnHideMedia, btnHideMedia,
R.attr.btn_close, R.attr.btn_close,
color = content_color color = content_color,
alphaMultiplier = Styler.boost_alpha
) )
} }
@ -1903,8 +1914,6 @@ internal class ItemViewHolder(
// c != null && c > 0 // c != null && c > 0
// } ?: return // } ?: return
val density = activity.resources.displayMetrics.density val density = activity.resources.displayMetrics.density
val buttonHeight = ActMain.boostButtonSize val buttonHeight = ActMain.boostButtonSize
@ -1947,7 +1956,8 @@ internal class ItemViewHolder(
activity, activity,
b, b,
R.drawable.ic_add, R.drawable.ic_add,
color = content_color color = content_color,
alphaMultiplier = Styler.boost_alpha
) )
box.addView(b) box.addView(b)
@ -2404,7 +2414,7 @@ internal class ItemViewHolder(
btnContentWarning = button { btnContentWarning = button {
background = background =
ContextCompat.getDrawable(context, R.drawable.btn_bg_ddd) ContextCompat.getDrawable(context, R.drawable.bg_button_cw)
minWidthCompat = dip(40) minWidthCompat = dip(40)
padding = dip(4) padding = dip(4)
//tools:text="見る" //tools:text="見る"

View File

@ -411,6 +411,8 @@ object Pref {
val spMspUserToken = StringPref("mastodon_search_portal_user_token", "") val spMspUserToken = StringPref("mastodon_search_portal_user_token", "")
val spEmojiPickerRecent = StringPref("emoji_picker_recent", "") val spEmojiPickerRecent = StringPref("emoji_picker_recent", "")
val spRoundRatio = StringPref("round_ratio", "33") val spRoundRatio = StringPref("round_ratio", "33")
val spBoostAlpha = StringPref("BoostAlpha", "60")
val spPullNotificationCheckInterval = StringPref("PullNotificationCheckInterval", "15") val spPullNotificationCheckInterval = StringPref("PullNotificationCheckInterval", "15")
val spUserAgent = StringPref("UserAgent", "") val spUserAgent = StringPref("UserAgent", "")

View File

@ -21,6 +21,7 @@ import jp.juggler.subwaytooter.api.entity.TootVisibility
import jp.juggler.subwaytooter.table.SavedAccount import jp.juggler.subwaytooter.table.SavedAccount
import jp.juggler.subwaytooter.table.UserRelation import jp.juggler.subwaytooter.table.UserRelation
import jp.juggler.subwaytooter.util.LogCategory import jp.juggler.subwaytooter.util.LogCategory
import jp.juggler.subwaytooter.util.applyAlphaMultiplier
import jp.juggler.subwaytooter.util.startMargin import jp.juggler.subwaytooter.util.startMargin
import jp.juggler.subwaytooter.view.CountImageButton import jp.juggler.subwaytooter.view.CountImageButton
import org.jetbrains.anko.* import org.jetbrains.anko.*
@ -92,13 +93,15 @@ internal class StatusButtons(
activity, activity,
btnConversation, btnConversation,
R.drawable.ic_conversation_dark, R.drawable.ic_conversation_dark,
color = color_normal color = color_normal,
alphaMultiplier = Styler.boost_alpha
) )
Styler.setIconDrawableId( Styler.setIconDrawableId(
activity, activity,
btnMore, btnMore,
R.drawable.btn_more_dark, R.drawable.btn_more_dark,
color = color_normal color = color_normal,
alphaMultiplier = Styler.boost_alpha
) )
// val a = (((color_normal ushr 24)/255f) * 0.7f) // val a = (((color_normal ushr 24)/255f) * 0.7f)
@ -198,7 +201,8 @@ internal class StatusButtons(
ivFollowedBy2, ivFollowedBy2,
relation, relation,
account, account,
color_normal color_normal,
alphaMultiplier = Styler.boost_alpha
) )
relation relation
} }
@ -213,10 +217,10 @@ internal class StatusButtons(
count : String, count : String,
contentDescription : String contentDescription : String
) { ) {
val d = Styler.createColoredDrawable(activity,drawableId,color) val d = Styler.createColoredDrawable(activity,drawableId,color,alphaMultiplier = Styler.boost_alpha)
b.setImageDrawable(d) b.setImageDrawable(d)
b.setPaddingAndText(holder.paddingH, holder.paddingV, count, 14f, holder.compoundPaddingDp) b.setPaddingAndText(holder.paddingH, holder.paddingV, count, 14f, holder.compoundPaddingDp)
b.setTextColor(color) b.setTextColor(color.applyAlphaMultiplier(Styler.boost_alpha))
b.contentDescription = contentDescription + count b.contentDescription = contentDescription + count
b.isEnabled = enabled b.isEnabled = enabled
} }

View File

@ -18,6 +18,7 @@ import jp.juggler.subwaytooter.api.entity.TootAccount
import jp.juggler.subwaytooter.api.entity.TootVisibility import jp.juggler.subwaytooter.api.entity.TootVisibility
import jp.juggler.subwaytooter.span.EmojiImageSpan import jp.juggler.subwaytooter.span.EmojiImageSpan
import jp.juggler.subwaytooter.table.UserRelation import jp.juggler.subwaytooter.table.UserRelation
import jp.juggler.subwaytooter.util.clipRange
import java.util.* import java.util.*
object Styler { object Styler {
@ -58,13 +59,20 @@ object Styler {
) )
} }
fun createColoredDrawable( fun createColoredDrawable(
context : Context, context : Context,
drawableId : Int, drawableId : Int,
color : Int color : Int,
alphaMultiplier: Float? = null
) : Drawable { ) : Drawable {
val rgb = (color and 0xffffff) or Color.BLACK val rgb = (color and 0xffffff) or Color.BLACK
val alpha = (color ushr 24) val alpha = if( alphaMultiplier ==null ){
(color ushr 24)
}else{
clipRange(0,255,((color ushr 24).toFloat() * alphaMultiplier +0.5f ).toInt())
}
// 色指定が他のアイコンに影響しないようにする // 色指定が他のアイコンに影響しないようにする
// カラーフィルターとアルファ値を設定する // カラーフィルターとアルファ値を設定する
@ -79,13 +87,14 @@ object Styler {
context : Context, context : Context,
imageView : ImageView, imageView : ImageView,
drawableId : Int, drawableId : Int,
color : Int? = null color : Int? = null,
alphaMultiplier: Float? = null
) { ) {
if(color == null) { if(color == null) {
// ImageViewにアイコンを設定する。デフォルトの色 // ImageViewにアイコンを設定する。デフォルトの色
imageView.setImageDrawable(ContextCompat.getDrawable(context, drawableId)) imageView.setImageDrawable(ContextCompat.getDrawable(context, drawableId))
} else { } else {
imageView.setImageDrawable(createColoredDrawable(context, drawableId, color)) imageView.setImageDrawable(createColoredDrawable(context, drawableId, color,alphaMultiplier))
} }
} }
@ -93,9 +102,10 @@ object Styler {
context : Context, context : Context,
imageView : ImageView, imageView : ImageView,
iconAttrId : Int, iconAttrId : Int,
color : Int? = null color : Int? = null,
alphaMultiplier: Float? = null
) { ) {
setIconDrawableId(context, imageView, getAttributeResourceId(context, iconAttrId), color) setIconDrawableId(context, imageView, getAttributeResourceId(context, iconAttrId), color,alphaMultiplier)
} }
fun getVisibilityIconAttr(isMisskeyData : Boolean, visibility : TootVisibility) : Int { fun getVisibilityIconAttr(isMisskeyData : Boolean, visibility : TootVisibility) : Int {
@ -214,6 +224,7 @@ object Styler {
, relation : UserRelation , relation : UserRelation
, who : TootAccount , who : TootAccount
, defaultColor : Int , defaultColor : Int
,alphaMultiplier : Float? = null
) { ) {
fun colorError() = Styler.getAttributeColor(context, R.attr.colorRegexFilterError) fun colorError() = Styler.getAttributeColor(context, R.attr.colorRegexFilterError)
@ -224,17 +235,17 @@ object Styler {
relation.blocked_by -> { relation.blocked_by -> {
ivDot.visibility = View.VISIBLE ivDot.visibility = View.VISIBLE
setIconDrawableId(context, ivDot, R.drawable.ic_blocked_by, color = colorError()) setIconDrawableId(context, ivDot, R.drawable.ic_blocked_by, color = colorError(),alphaMultiplier = alphaMultiplier)
} }
relation.requested_by -> { relation.requested_by -> {
ivDot.visibility = View.VISIBLE ivDot.visibility = View.VISIBLE
setIconDrawableId(context, ivDot, R.drawable.ic_requested_by, color = colorError()) setIconDrawableId(context, ivDot, R.drawable.ic_requested_by, color = colorError(),alphaMultiplier = alphaMultiplier)
} }
relation.followed_by -> { relation.followed_by -> {
ivDot.visibility = View.VISIBLE ivDot.visibility = View.VISIBLE
setIconAttr(context, ivDot, R.attr.ic_followed_by, color = colorAccent()) setIconAttr(context, ivDot, R.attr.ic_followed_by, color = colorAccent(),alphaMultiplier = alphaMultiplier)
// 被フォローリクエスト状態の時に followed_by が 真と偽の両方がありえるようなので // 被フォローリクエスト状態の時に followed_by が 真と偽の両方がありえるようなので
// Relationshipだけを見ても被フォローリクエスト状態は分からないっぽい // Relationshipだけを見ても被フォローリクエスト状態は分からないっぽい
// 仕方ないので馬鹿正直に「 followed_byが真ならバッジをつける」しかできない // 仕方ないので馬鹿正直に「 followed_byが真ならバッジをつける」しかできない
@ -283,7 +294,7 @@ object Styler {
} }
} }
setIconAttr(context, ibFollow, icon_attr, color = color) setIconAttr(context, ibFollow, icon_attr, color = color,alphaMultiplier = alphaMultiplier)
ibFollow.contentDescription = contentDescription ibFollow.contentDescription = contentDescription
} }
@ -350,6 +361,7 @@ object Styler {
// ActMainの初期化時に更新される // ActMainの初期化時に更新される
var round_ratio : Float = 0.33f * 0.5f var round_ratio : Float = 0.33f * 0.5f
var boost_alpha : Float? = null
fun calcIconRound(wh : Int) = wh.toFloat() * round_ratio fun calcIconRound(wh : Int) = wh.toFloat() * round_ratio

View File

@ -155,7 +155,14 @@ internal class ViewHolderHeaderProfile(
btnStatusCount.textColor = contentColor btnStatusCount.textColor = contentColor
btnFollowing.textColor = contentColor btnFollowing.textColor = contentColor
btnFollowers.textColor = contentColor btnFollowers.textColor = contentColor
Styler.setIconDrawableId(activity, btnMore, R.drawable.btn_more, color = contentColor)
Styler.setIconDrawableId(
activity,
btnMore,
R.drawable.btn_more,
color = contentColor,
alphaMultiplier = Styler.boost_alpha
)
val acctColor = column.getAcctColor(activity) val acctColor = column.getAcctColor(activity)
tvCreated.textColor = acctColor tvCreated.textColor = acctColor
@ -293,8 +300,6 @@ internal class ViewHolderHeaderProfile(
emojiMapProfile = who.profile_emojis emojiMapProfile = who.profile_emojis
) )
val nameTypeface = ActMain.timeline_font_bold val nameTypeface = ActMain.timeline_font_bold
val valueTypeface = ActMain.timeline_font val valueTypeface = ActMain.timeline_font

View File

@ -1068,3 +1068,13 @@ fun Matcher.groupOrNull( g:Int):String? =
null null
} }
// colorARGB.applyAlphaMultiplier(0.5f) でalpha値が半分になったARGB値を得る
fun Int.applyAlphaMultiplier(alphaMultiplier: Float? = null):Int{
return if( alphaMultiplier ==null ){
this
}else{
val rgb = (this and 0xffffff)
val alpha = clipRange(0,255,((this ushr 24).toFloat() * alphaMultiplier +0.5f ).toInt())
return rgb or (alpha shl 24)
}
}

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="?attr/colorRippleEffect" />
</shape>
</item>
<item android:state_selected="true">
<shape android:shape="rectangle">
<solid android:color="?attr/colorButtonSelected" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="?attr/colorButtonSelected" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="?attr/color_column_header" />
</shape>
</item>
</selector>

View File

@ -1181,7 +1181,7 @@
android:id="@+id/ivFooterMenu" android:id="@+id/ivFooterMenu"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/btn_bg_ddd" android:background="@drawable/bg_button_cw"
android:importantForAccessibility="no" android:importantForAccessibility="no"
app:srcCompat="?attr/ic_hamburger" app:srcCompat="?attr/ic_hamburger"
/> />
@ -1239,7 +1239,7 @@
android:id="@+id/ivFooterToot" android:id="@+id/ivFooterToot"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/btn_bg_ddd" android:background="@drawable/bg_button_cw"
android:contentDescription="@string/toot" android:contentDescription="@string/toot"
app:srcCompat="?attr/ic_edit" app:srcCompat="?attr/ic_edit"
/> />
@ -1583,6 +1583,23 @@
<View style="@style/setting_divider"/> <View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:labelFor="@+id/etBoostAlpha"
android:text="@string/boost_button_alpha"
/>
<LinearLayout style="@style/setting_row_form">
<EditText
android:id="@+id/etBoostAlpha"
style="@style/setting_horizontal_stretch"
android:gravity="center"
android:inputType="numberDecimal"
/>
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView <TextView
style="@style/setting_row_label" style="@style/setting_row_label"
android:labelFor="@+id/etAvatarIconSize" android:labelFor="@+id/etAvatarIconSize"

View File

@ -65,7 +65,7 @@
android:id="@+id/btnMenu" android:id="@+id/btnMenu"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/btn_bg_ddd" android:background="@drawable/bg_button_cw"
android:contentDescription="@string/menu" android:contentDescription="@string/menu"
app:srcCompat="?attr/ic_hamburger" app:srcCompat="?attr/ic_hamburger"
/> />
@ -109,7 +109,7 @@
android:id="@+id/btnToot" android:id="@+id/btnToot"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/btn_bg_ddd" android:background="@drawable/bg_button_cw"
android:contentDescription="@string/toot" android:contentDescription="@string/toot"
app:srcCompat="?attr/ic_edit" app:srcCompat="?attr/ic_edit"
/> />
@ -140,7 +140,7 @@
android:id="@+id/btnQuickToot" android:id="@+id/btnQuickToot"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/btn_bg_ddd" android:background="@drawable/bg_button_cw"
android:contentDescription="@string/post" android:contentDescription="@string/post"
app:srcCompat="?attr/btn_post" app:srcCompat="?attr/btn_post"
/> />

View File

@ -5,7 +5,7 @@
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/btn_bg_ddd" android:background="@drawable/bg_column_header"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
> >

View File

@ -18,7 +18,7 @@
android:id="@+id/llColumnHeader" android:id="@+id/llColumnHeader"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/btn_bg_ddd" android:background="@drawable/bg_column_header"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:paddingEnd="12dp" android:paddingEnd="12dp"

View File

@ -793,5 +793,6 @@
<string name="conversation_to">送り先:</string> <string name="conversation_to">送り先:</string>
<string name="make_quote_renote">引用Renoteにする</string> <string name="make_quote_renote">引用Renoteにする</string>
<string name="mute_application_confirm">アプリ \"%1$s\" はミュートされます。よろしいですか?</string> <string name="mute_application_confirm">アプリ \"%1$s\" はミュートされます。よろしいですか?</string>
<string name="boost_button_alpha">ブーストボタンのアルファ不透明度(単位:%。アプリの再起動が必要。本文テキスト色のアルファ値の影響も受けます)</string>
</resources> </resources>

View File

@ -7,6 +7,10 @@
<!-- カラムヘッダ背景色、および一部ボタンの背景色 --> <!-- カラムヘッダ背景色、および一部ボタンの背景色 -->
<attr name="color_column_header" format="color"/> <attr name="color_column_header" format="color"/>
<!-- CWボタンなどの背景色 -->
<attr name="colorButtonBg" format="color"/>
<!-- イメージボタンの図柄の色 0xff000000 --> <!-- イメージボタンの図柄の色 0xff000000 -->
<attr name="colorImageButton" format="color"/> <attr name="colorImageButton" format="color"/>
@ -56,6 +60,9 @@
<!-- カラムヘッダページ番号の文字色 #888 --> <!-- カラムヘッダページ番号の文字色 #888 -->
<attr name="colorColumnHeaderPageNumber" format="color"/> <attr name="colorColumnHeaderPageNumber" format="color"/>
<!-- カラムヘッダのカラム名の文字色 -->
<attr name="colorColumnHeaderName" format="color"/>
<!-- カラム設定の背景色 #ccc --> <!-- カラム設定の背景色 #ccc -->
<attr name="colorColumnSettingBackground" format="color"/> <attr name="colorColumnSettingBackground" format="color"/>

View File

@ -4,6 +4,7 @@
<color name="Light_colorColumnListItemText">#80000000</color> <color name="Light_colorColumnListItemText">#80000000</color>
<color name="Light_colorTimeSmall">#ff666666</color> <color name="Light_colorTimeSmall">#ff666666</color>
<color name="Light_colorContentText">#ff333333</color> <color name="Light_colorContentText">#ff333333</color>
<color name="Light_colorColumnHeaderName">#616161</color>
<color name="Light_colorColumnHeaderAcct">#80000000</color> <color name="Light_colorColumnHeaderAcct">#80000000</color>
<color name="Light_colorColumnHeaderPageNumber">#80000000</color> <color name="Light_colorColumnHeaderPageNumber">#80000000</color>
@ -23,10 +24,12 @@
<color name="Light_colorSearchFormBackground">#bee6ff</color> <color name="Light_colorSearchFormBackground">#bee6ff</color>
<color name="Light_colorPrimary">#cccccc</color> <color name="Light_colorPrimary">#cccccc</color>
<color name="Light_color_column_header">#cccccc</color> <color name="Light_color_column_header">#fff</color>
<color name="Light_colorButtonBg">#cccccc</color>
<color name="Light_colorReplyBackground">#cccccc</color> <color name="Light_colorReplyBackground">#cccccc</color>
<color name="Light_colorPostFormBackground">#eee</color> <color name="Light_colorPostFormBackground">#eee</color>
<color name="Light_colorProfileBackgroundMask">#C0FFFFFF</color> <color name="Light_colorProfileBackgroundMask">#C0FFFFFF</color>
@ -55,7 +58,7 @@
<color name="Dark_colorColumnHeaderAcct">#66FFFFFF</color> <color name="Dark_colorColumnHeaderAcct">#66FFFFFF</color>
<color name="Dark_colorColumnHeaderPageNumber">#66FFFFFF</color> <color name="Dark_colorColumnHeaderPageNumber">#66FFFFFF</color>
<color name="Dark_colorSettingDivider">#66FFFFFF</color><!-- ダイアログ背景が#424242なので、それより明るくないといけない --> <color name="Dark_colorSettingDivider">#66FFFFFF</color><!-- ダイアログ背景が#424242なので、それより明るくないといけない -->
<color name="Dark_colorColumnHeaderName">#e4e4e4</color>
<color name="Dark_colorImageButton">#ccFFFFFF</color> <color name="Dark_colorImageButton">#ccFFFFFF</color>
@ -72,6 +75,7 @@
<color name="Dark_colorPrimary">#333</color> <color name="Dark_colorPrimary">#333</color>
<color name="Dark_color_column_header">#333</color> <color name="Dark_color_column_header">#333</color>
<color name="Dark_colorButtonBg">#333</color>
<color name="Dark_colorReplyBackground">#333</color> <color name="Dark_colorReplyBackground">#333</color>
<color name="Dark_colorPostFormBackground">#222</color> <color name="Dark_colorPostFormBackground">#222</color>

View File

@ -812,5 +812,6 @@
<string name="conversation_to">To:</string> <string name="conversation_to">To:</string>
<string name="make_quote_renote">Use \"Quoted Renote\"</string> <string name="make_quote_renote">Use \"Quoted Renote\"</string>
<string name="mute_application_confirm">Application \"%1$s\" will be muted. Are you sure ?</string> <string name="mute_application_confirm">Application \"%1$s\" will be muted. Are you sure ?</string>
<string name="boost_button_alpha">Boost button alpha opacity (Unit:%. app restart required. also affected of content text alpha.)</string>
</resources> </resources>

View File

@ -43,6 +43,8 @@
<item name="colorRegexFilterError">@color/Light_colorRegexFilterError</item> <item name="colorRegexFilterError">@color/Light_colorRegexFilterError</item>
<item name="colorPostFormBackground">@color/Light_colorPostFormBackground</item> <item name="colorPostFormBackground">@color/Light_colorPostFormBackground</item>
<item name="colorColumnStripBackground">@color/Light_colorColumnStripBackground</item> <item name="colorColumnStripBackground">@color/Light_colorColumnStripBackground</item>
<item name="colorColumnHeaderName">@color/Light_colorColumnHeaderName</item>
<item name="colorButtonBg">@color/Light_colorButtonBg</item>
<item name="btn_attachment">@drawable/btn_attachment</item> <item name="btn_attachment">@drawable/btn_attachment</item>
<item name="btn_boost">@drawable/btn_boost</item> <item name="btn_boost">@drawable/btn_boost</item>
@ -167,6 +169,8 @@
<item name="colorRegexFilterError">@color/Dark_colorRegexFilterError</item> <item name="colorRegexFilterError">@color/Dark_colorRegexFilterError</item>
<item name="colorPostFormBackground">@color/Dark_colorPostFormBackground</item> <item name="colorPostFormBackground">@color/Dark_colorPostFormBackground</item>
<item name="colorColumnStripBackground">@color/Dark_colorColumnStripBackground</item> <item name="colorColumnStripBackground">@color/Dark_colorColumnStripBackground</item>
<item name="colorColumnHeaderName">@color/Dark_colorColumnHeaderName</item>
<item name="colorButtonBg">@color/Dark_colorButtonBg</item>
<item name="btn_attachment">@drawable/btn_attachment_dark</item> <item name="btn_attachment">@drawable/btn_attachment_dark</item>
<item name="btn_boost">@drawable/btn_boost_dark</item> <item name="btn_boost">@drawable/btn_boost_dark</item>