アプリ設定に「カラム色のデフォルト」を追加。createColoredDrawable の最適化

This commit is contained in:
tateisu 2018-11-20 07:46:14 +09:00
parent 54cdecbd01
commit d7b17a8d8a
17 changed files with 871 additions and 305 deletions

View File

@ -30,6 +30,7 @@ import jp.juggler.subwaytooter.util.handleGetContentResult
import jp.juggler.subwaytooter.util.intentOpenDocument
import jp.juggler.subwaytooter.util.showToast
import org.apache.commons.io.IOUtils
import org.jetbrains.anko.textColor
import java.io.File
import java.io.FileOutputStream
import java.io.OutputStreamWriter
@ -67,8 +68,14 @@ class ActAppSetting : AppCompatActivity()
internal const val COLOR_DIALOG_ID_TOOT_BG_UNLISTED = 7
internal const val COLOR_DIALOG_ID_TOOT_BG_FOLLOWER = 8
internal const val COLOR_DIALOG_ID_TOOT_BG_DIRECT_USER = 9
internal const val COLOR_DIALOG_ID_TOOT_BG_DIRECT_ME = 10
internal const val COLOR_DIALOG_ID_LINK = 11
internal const val COLOR_DIALOG_ID_TOOT_BG_DIRECT_ME = 10
internal const val COLOR_DIALOG_ID_LINK = 11
internal const val COLOR_DIALOG_ID_COLUMN_HEADER_BG = 12
internal const val COLOR_DIALOG_ID_COLUMN_HEADER_FG = 13
internal const val COLOR_DIALOG_ID_COLUMN_BG = 14
internal const val COLOR_DIALOG_ID_COLUMN_ACCT = 15
internal const val COLOR_DIALOG_ID_COLUMN_TEXT = 16
internal const val REQUEST_CODE_TIMELINE_FONT = 1
internal const val REQUEST_CODE_TIMELINE_FONT_BOLD = 2
@ -117,6 +124,12 @@ class ActAppSetting : AppCompatActivity()
private var toot_color_direct_me : Int = 0
private var link_color : Int = 0
private var color_column_header_bg : Int = 0
private var color_column_header_fg : Int = 0
private var color_column_bg : Int = 0
private var color_column_acct : Int = 0
private var color_column_text : Int = 0
private lateinit var ivFooterToot : ImageView
private lateinit var ivFooterMenu : ImageView
private lateinit var llFooterBG : View
@ -137,7 +150,6 @@ class ActAppSetting : AppCompatActivity()
private lateinit var etBoostAlpha : EditText
private lateinit var etMediaReadTimeout : EditText
private lateinit var tvTimelineFontUrl : TextView
private var timeline_font : String? = null
private lateinit var tvTimelineFontBoldUrl : TextView
@ -154,11 +166,18 @@ class ActAppSetting : AppCompatActivity()
private lateinit var etNotificationTlFontSize : EditText
private lateinit var tvNotificationTlFontSize : TextView
private lateinit var etNotificationTlIconSize : EditText
private lateinit var etBoostButtonSize : EditText
private lateinit var tvUserAgentError : TextView
private lateinit var llColumnHeader : View
private lateinit var ivColumnHeader : ImageView
private lateinit var tvColumnName : TextView
private lateinit var flColumnBackground : View
private lateinit var tvSampleAcct : TextView
private lateinit var tvSampleContent : TextView
private var load_busy : Boolean = false
override fun onPause() {
@ -171,7 +190,7 @@ class ActAppSetting : AppCompatActivity()
try {
PollingWorker.scheduleJob(this, PollingWorker.JOB_POLLING)
} catch(ex : Throwable) {
log.trace(ex,"PollingWorker.scheduleJob failed.")
log.trace(ex, "PollingWorker.scheduleJob failed.")
}
}
@ -222,13 +241,13 @@ class ActAppSetting : AppCompatActivity()
, getString(R.string.replies_count_none)
)
spVisibilityStyle= initSpinner(
spVisibilityStyle = initSpinner(
R.id.spVisibilityStyle
, getString(R.string.visibility_style_by_account)
, getString(R.string.mastodon)
, getString(R.string.misskey)
)
spBoostButtonJustify= initSpinner(
spBoostButtonJustify = initSpinner(
R.id.spBoostButtonJustify
, getString(R.string.start)
, getString(R.string.center)
@ -263,39 +282,51 @@ class ActAppSetting : AppCompatActivity()
}
findViewById<View>(R.id.btnFooterBackgroundEdit).setOnClickListener(this)
findViewById<View>(R.id.btnFooterBackgroundReset).setOnClickListener(this)
findViewById<View>(R.id.btnFooterForegroundColorEdit).setOnClickListener(this)
findViewById<View>(R.id.btnFooterForegroundColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnTabBackgroundColorEdit).setOnClickListener(this)
findViewById<View>(R.id.btnTabBackgroundColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnTabDividerColorEdit).setOnClickListener(this)
findViewById<View>(R.id.btnTabDividerColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnTabIndicatorColorEdit).setOnClickListener(this)
findViewById<View>(R.id.btnTabIndicatorColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnListDividerColorEdit).setOnClickListener(this)
findViewById<View>(R.id.btnListDividerColorReset).setOnClickListener(this)
intArrayOf(
R.id.btnFooterBackgroundEdit
, R.id.btnFooterBackgroundReset
, R.id.btnFooterForegroundColorEdit
, R.id.btnFooterForegroundColorReset
, R.id.btnTabBackgroundColorEdit
, R.id.btnTabBackgroundColorReset
, R.id.btnTabDividerColorEdit
, R.id.btnTabDividerColorReset
, R.id.btnTabIndicatorColorEdit
, R.id.btnTabIndicatorColorReset
, R.id.btnListDividerColorEdit
, R.id.btnListDividerColorReset
, R.id.btnBackgroundColorUnlistedEdit
, R.id.btnBackgroundColorUnlistedReset
, R.id.btnBackgroundColorFollowerEdit
, R.id.btnBackgroundColorFollowerReset
, R.id.btnBackgroundColorDirectWithUserEdit
, R.id.btnBackgroundColorDirectWithUserReset
, R.id.btnBackgroundColorDirectNoUserEdit
, R.id.btnBackgroundColorDirectNoUserReset
, R.id.btnLinkColorEdit
, R.id.btnLinkColorReset
, R.id.btnTimelineFontEdit
, R.id.btnTimelineFontReset
, R.id.btnTimelineFontBoldEdit
, R.id.btnTimelineFontBoldReset
, R.id.btnSettingExport
, R.id.btnSettingImport
, R.id.btnCustomStreamListenerEdit
, R.id.btnCustomStreamListenerReset
, R.id.btnCcdHeaderBackgroundEdit
, R.id.btnCcdHeaderBackgroundReset
, R.id.btnCcdHeaderForegroundEdit
, R.id.btnCcdHeaderForegroundReset
, R.id.btnCcdContentBackgroundEdit
, R.id.btnCcdContentBackgroundReset
, R.id.btnCcdContentAcctEdit
, R.id.btnCcdContentAcctReset
, R.id.btnCcdContentTextEdit
, R.id.btnCcdContentTextReset
).forEach {
findViewById<View>(it).setOnClickListener(this)
}
findViewById<View>(R.id.btnBackgroundColorUnlistedEdit).setOnClickListener(this)
findViewById<View>(R.id.btnBackgroundColorUnlistedReset).setOnClickListener(this)
findViewById<View>(R.id.btnBackgroundColorFollowerEdit).setOnClickListener(this)
findViewById<View>(R.id.btnBackgroundColorFollowerReset).setOnClickListener(this)
findViewById<View>(R.id.btnBackgroundColorDirectWithUserEdit).setOnClickListener(this)
findViewById<View>(R.id.btnBackgroundColorDirectWithUserReset).setOnClickListener(this)
findViewById<View>(R.id.btnBackgroundColorDirectNoUserEdit).setOnClickListener(this)
findViewById<View>(R.id.btnBackgroundColorDirectNoUserReset).setOnClickListener(this)
findViewById<View>(R.id.btnLinkColorEdit).setOnClickListener(this)
findViewById<View>(R.id.btnLinkColorReset).setOnClickListener(this)
findViewById<View>(R.id.btnTimelineFontEdit).setOnClickListener(this)
findViewById<View>(R.id.btnTimelineFontReset).setOnClickListener(this)
findViewById<View>(R.id.btnTimelineFontBoldEdit).setOnClickListener(this)
findViewById<View>(R.id.btnTimelineFontBoldReset).setOnClickListener(this)
findViewById<View>(R.id.btnSettingExport).setOnClickListener(this)
findViewById<View>(R.id.btnSettingImport).setOnClickListener(this)
findViewById<View>(R.id.btnCustomStreamListenerEdit).setOnClickListener(this)
findViewById<View>(R.id.btnCustomStreamListenerReset).setOnClickListener(this)
ivFooterToot = findViewById(R.id.ivFooterToot)
ivFooterMenu = findViewById(R.id.ivFooterMenu)
@ -321,14 +352,14 @@ class ActAppSetting : AppCompatActivity()
etAutoCWLines = findViewById(R.id.etAutoCWLines)
etAutoCWLines.addTextChangedListener(this)
etCardDescriptionLength = findViewById(R.id.etCardDescriptionLength)
etCardDescriptionLength.addTextChangedListener(this)
etMediaSizeMax = findViewById(R.id.etMediaSizeMax)
etMediaSizeMax.addTextChangedListener(this)
etMovieSizeMax= findViewById(R.id.etMovieSizeMax)
etMovieSizeMax = findViewById(R.id.etMovieSizeMax)
etMovieSizeMax.addTextChangedListener(this)
etRoundRatio = findViewById(R.id.etRoundRatio)
@ -337,7 +368,7 @@ class ActAppSetting : AppCompatActivity()
etBoostAlpha = findViewById(R.id.etBoostAlpha)
etBoostAlpha.addTextChangedListener(this)
etMediaReadTimeout= findViewById(R.id.etMediaReadTimeout)
etMediaReadTimeout = findViewById(R.id.etMediaReadTimeout)
etMediaReadTimeout.addTextChangedListener(this)
tvTimelineFontSize = findViewById(R.id.tvTimelineFontSize)
@ -382,6 +413,14 @@ class ActAppSetting : AppCompatActivity()
tvUserAgentError = findViewById(R.id.tvUserAgentError)
llColumnHeader = findViewById(R.id.llColumnHeader)
ivColumnHeader = findViewById(R.id.ivColumnHeader)
tvColumnName = findViewById(R.id.tvColumnName)
flColumnBackground = findViewById(R.id.flColumnBackground)
tvSampleAcct = findViewById(R.id.tvSampleAcct)
tvSampleContent = findViewById(R.id.tvSampleContent)
}
private fun initSpinner(@IdRes viewId : Int, vararg captions : String) : Spinner {
@ -430,6 +469,12 @@ class ActAppSetting : AppCompatActivity()
toot_color_direct_me = Pref.ipTootColorDirectMe(pref)
link_color = Pref.ipLinkColor(pref)
color_column_header_bg = Pref.ipCcdHeaderBg(pref)
color_column_header_fg = Pref.ipCcdHeaderFg(pref)
color_column_bg = Pref.ipCcdContentBg(pref)
color_column_acct = Pref.ipCcdContentAcct(pref)
color_column_text = Pref.ipCcdContentText(pref)
etColumnWidth.setText(Pref.spColumnWidth(pref))
etMediaThumbHeight.setText(Pref.spMediaThumbHeight(pref))
etClientName.setText(Pref.spClientName(pref))
@ -473,6 +518,8 @@ class ActAppSetting : AppCompatActivity()
)
showUserAgentError()
showColumnSample()
showColumnHeaderSample()
}
private fun saveUIToData() {
@ -512,7 +559,9 @@ class ActAppSetting : AppCompatActivity()
etUserAgent.text.toString().replace(reLinefeed, " ").trim { it <= ' ' })
.put(Pref.spQuoteNameFormat, etQuoteNameFormat.text.toString()) // not trimmed
.put(Pref.spAutoCWLines, etAutoCWLines.text.toString().trim { it <= ' ' })
.put(Pref.spCardDescriptionLength, etCardDescriptionLength.text.toString().trim { it <= ' ' })
.put(
Pref.spCardDescriptionLength,
etCardDescriptionLength.text.toString().trim { it <= ' ' })
.put(Pref.spAvatarIconSize, etAvatarIconSize.text.toString().trim { it <= ' ' })
.put(
Pref.spNotificationTlIconSize,
@ -525,12 +574,11 @@ class ActAppSetting : AppCompatActivity()
etPullNotificationCheckInterval.text.toString().trim { it <= ' ' })
.put(Pref.spMediaSizeMax, etMediaSizeMax.text.toString().trim { it <= ' ' })
.put(Pref.spMovieSizeMax, etMovieSizeMax.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.spTimelineFont, timeline_font ?: "")
.put(Pref.spTimelineFontBold, timeline_font_bold ?: "")
@ -548,7 +596,7 @@ class ActAppSetting : AppCompatActivity()
.put(Pref.ipFooterTabDividerColor, footer_tab_divider_color)
.put(Pref.ipFooterTabIndicatorColor, footer_tab_indicator_color)
.put(Pref.ipListDividerColor, list_divider_color)
.put(Pref.ipTootColorUnlisted, toot_color_unlisted)
.put(Pref.ipTootColorFollower, toot_color_follower)
.put(Pref.ipTootColorDirectUser, toot_color_direct_user)
@ -556,9 +604,16 @@ class ActAppSetting : AppCompatActivity()
.put(Pref.ipLinkColor, link_color)
.put(Pref.ipCcdHeaderBg, color_column_header_bg)
.put(Pref.ipCcdHeaderFg, color_column_header_fg)
.put(Pref.ipCcdContentBg, color_column_bg)
.put(Pref.ipCcdContentAcct, color_column_acct)
.put(Pref.ipCcdContentText, color_column_text)
.apply()
showUserAgentError()
}
private fun showUserAgentError() {
@ -569,6 +624,53 @@ class ActAppSetting : AppCompatActivity()
}
}
private fun showColumnHeaderSample() {
val header_bg = when {
color_column_header_bg != 0 -> color_column_header_bg
else -> Styler.getAttributeColor(this, R.attr.color_column_header)
}
val header_fg = when {
color_column_header_fg != 0 -> color_column_header_fg
else -> Styler.getAttributeColor(this, R.attr.colorColumnHeaderName)
}
ViewCompat.setBackground(
llColumnHeader,
Styler.getAdaptiveRippleDrawable(header_bg, header_fg)
)
tvColumnName.textColor = header_fg
Styler.setIconAttr(
this,
ivColumnHeader,
R.attr.btn_federate_tl,
color = header_fg
)
}
private fun showColumnSample() {
var c = when {
color_column_bg != 0 -> color_column_bg
else -> 0
}
flColumnBackground.setBackgroundColor(c)
c = when {
color_column_acct != 0 -> color_column_acct
else -> Styler.getAttributeColor(this, R.attr.colorTimeSmall)
}
tvSampleAcct.setTextColor(c)
c = when {
color_column_text != 0 -> color_column_text
else -> Styler.getAttributeColor(this, R.attr.colorContentText)
}
tvSampleContent.setTextColor(c)
}
override fun onCheckedChanged(buttonView : CompoundButton, isChecked : Boolean) {
saveUIToData()
}
@ -649,46 +751,50 @@ class ActAppSetting : AppCompatActivity()
true
)
R.id.btnListDividerColorReset -> {
list_divider_color = 0
saveUIToData()
}
R.id.btnBackgroundColorUnlistedEdit -> openColorPicker(
COLOR_DIALOG_ID_TOOT_BG_UNLISTED,
toot_color_unlisted,
true
)
R.id.btnBackgroundColorUnlistedReset -> {
toot_color_unlisted = 0
saveUIToData()
}
R.id.btnBackgroundColorFollowerEdit -> openColorPicker(
COLOR_DIALOG_ID_TOOT_BG_FOLLOWER,
toot_color_follower,
true
)
R.id.btnBackgroundColorFollowerReset -> {
toot_color_follower = 0
saveUIToData()
}
R.id.btnBackgroundColorDirectWithUserEdit -> openColorPicker(
COLOR_DIALOG_ID_TOOT_BG_DIRECT_USER,
toot_color_direct_user,
true
)
R.id.btnBackgroundColorDirectWithUserReset -> {
toot_color_direct_user = 0
saveUIToData()
}
R.id.btnBackgroundColorDirectNoUserEdit -> openColorPicker(
COLOR_DIALOG_ID_TOOT_BG_DIRECT_ME,
toot_color_direct_me,
true
)
R.id.btnListDividerColorReset -> {
list_divider_color = 0
saveUIToData()
}
R.id.btnBackgroundColorUnlistedReset -> {
toot_color_unlisted = 0
saveUIToData()
}
R.id.btnBackgroundColorFollowerReset -> {
toot_color_follower = 0
saveUIToData()
}
R.id.btnBackgroundColorDirectWithUserReset -> {
toot_color_direct_user = 0
saveUIToData()
}
R.id.btnBackgroundColorDirectNoUserReset -> {
toot_color_direct_me = 0
saveUIToData()
@ -699,11 +805,72 @@ class ActAppSetting : AppCompatActivity()
link_color,
true
)
R.id.btnLinkColorReset -> {
link_color = 0
saveUIToData()
}
R.id.btnCcdHeaderBackgroundEdit -> openColorPicker(
COLOR_DIALOG_ID_COLUMN_HEADER_BG,
color_column_header_bg,
false
)
R.id.btnCcdHeaderBackgroundReset -> {
color_column_header_bg = 0
saveUIToData()
showColumnHeaderSample()
}
R.id.btnCcdHeaderForegroundEdit -> openColorPicker(
COLOR_DIALOG_ID_COLUMN_HEADER_FG,
color_column_header_fg,
false
)
R.id.btnCcdHeaderForegroundReset -> {
color_column_header_fg = 0
saveUIToData()
showColumnHeaderSample()
}
R.id.btnCcdContentBackgroundEdit -> openColorPicker(
COLOR_DIALOG_ID_COLUMN_BG,
color_column_bg,
false
)
R.id.btnCcdContentBackgroundReset -> {
color_column_bg = 0
saveUIToData()
showColumnSample()
}
R.id.btnCcdContentAcctEdit -> openColorPicker(
COLOR_DIALOG_ID_COLUMN_ACCT,
color_column_acct,
true
)
R.id.btnCcdContentAcctReset -> {
color_column_acct = 0
saveUIToData()
showColumnSample()
}
R.id.btnCcdContentTextEdit -> openColorPicker(
COLOR_DIALOG_ID_COLUMN_TEXT,
color_column_text,
true
)
R.id.btnCcdContentTextReset -> {
color_column_text = 0
saveUIToData()
showColumnSample()
}
R.id.btnTimelineFontReset -> {
timeline_font = ""
saveUIToData()
@ -751,7 +918,7 @@ class ActAppSetting : AppCompatActivity()
override fun onActivityResult(requestCode : Int, resultCode : Int, data : Intent?) {
if(resultCode == RESULT_OK && data != null && requestCode == REQUEST_CODE_TIMELINE_FONT) {
data.handleGetContentResult(contentResolver).firstOrNull()?.first?.let{ uri->
data.handleGetContentResult(contentResolver).firstOrNull()?.first?.let { uri ->
val file = saveTimelineFont(uri, "TimelineFont")
if(file != null) {
timeline_font = file.absolutePath
@ -760,7 +927,7 @@ class ActAppSetting : AppCompatActivity()
}
}
} else if(resultCode == RESULT_OK && data != null && requestCode == REQUEST_CODE_TIMELINE_FONT_BOLD) {
data.handleGetContentResult(contentResolver).firstOrNull()?.first?.let{ uri->
data.handleGetContentResult(contentResolver).firstOrNull()?.first?.let { uri ->
val file = saveTimelineFont(uri, "TimelineFontBold")
if(file != null) {
timeline_font_bold = file.absolutePath
@ -769,7 +936,7 @@ class ActAppSetting : AppCompatActivity()
}
}
} else if(resultCode == RESULT_OK && data != null && requestCode == REQUEST_CODE_APP_DATA_IMPORT) {
data.handleGetContentResult(contentResolver).firstOrNull()?.first?.let{ uri->
data.handleGetContentResult(contentResolver).firstOrNull()?.first?.let { uri ->
contentResolver.takePersistableUriPermission(
uri,
Intent.FLAG_GRANT_READ_URI_PERMISSION
@ -791,63 +958,99 @@ class ActAppSetting : AppCompatActivity()
}
override fun onColorSelected(dialogId : Int, @ColorInt colorSelected : Int) {
val colorOpaque = colorFF000000 or colorSelected
val colorAlpha = if(colorSelected == 0) 0x01000000 else colorSelected
when(dialogId) {
COLOR_DIALOG_ID_FOOTER_BUTTON_BG -> {
footer_button_bg_color = colorFF000000 or colorSelected
footer_button_bg_color = colorOpaque
saveUIToData()
showFooterColor()
}
COLOR_DIALOG_ID_FOOTER_BUTTON_FG -> {
footer_button_fg_color = colorFF000000 or colorSelected
footer_button_fg_color = colorOpaque
saveUIToData()
showFooterColor()
}
COLOR_DIALOG_ID_FOOTER_TAB_BG -> {
footer_tab_bg_color = colorFF000000 or colorSelected
footer_tab_bg_color = colorOpaque
saveUIToData()
showFooterColor()
}
COLOR_DIALOG_ID_FOOTER_TAB_DIVIDER -> {
footer_tab_divider_color = colorFF000000 or colorSelected
footer_tab_divider_color = colorOpaque
saveUIToData()
showFooterColor()
}
COLOR_DIALOG_ID_FOOTER_TAB_INDICATOR -> {
footer_tab_indicator_color = if(colorSelected == 0) 0x01000000 else colorSelected
footer_tab_indicator_color = colorAlpha
saveUIToData()
showFooterColor()
}
COLOR_DIALOG_ID_LIST_DIVIDER -> {
list_divider_color = if(colorSelected == 0) 0x01000000 else colorSelected
list_divider_color = colorAlpha
saveUIToData()
}
COLOR_DIALOG_ID_TOOT_BG_UNLISTED -> {
toot_color_unlisted = if(colorSelected == 0) 0x01000000 else colorSelected
toot_color_unlisted = colorAlpha
saveUIToData()
}
COLOR_DIALOG_ID_TOOT_BG_FOLLOWER -> {
toot_color_follower = if(colorSelected == 0) 0x01000000 else colorSelected
toot_color_follower = colorAlpha
saveUIToData()
}
COLOR_DIALOG_ID_TOOT_BG_DIRECT_USER -> {
toot_color_direct_user= if(colorSelected == 0) 0x01000000 else colorSelected
toot_color_direct_user = colorAlpha
saveUIToData()
}
COLOR_DIALOG_ID_TOOT_BG_DIRECT_ME -> {
toot_color_direct_me = if(colorSelected == 0) 0x01000000 else colorSelected
toot_color_direct_me = colorAlpha
saveUIToData()
}
COLOR_DIALOG_ID_LINK ->{
link_color = if(colorSelected == 0) 0x01000000 else colorSelected
COLOR_DIALOG_ID_LINK -> {
link_color = colorAlpha
saveUIToData()
}
COLOR_DIALOG_ID_COLUMN_HEADER_BG -> {
color_column_header_bg = colorOpaque
saveUIToData()
showColumnHeaderSample()
}
COLOR_DIALOG_ID_COLUMN_HEADER_FG -> {
color_column_header_fg = colorOpaque
saveUIToData()
showColumnHeaderSample()
}
COLOR_DIALOG_ID_COLUMN_BG -> {
color_column_bg = colorOpaque
saveUIToData()
showColumnSample()
}
COLOR_DIALOG_ID_COLUMN_ACCT -> {
color_column_acct = colorAlpha
saveUIToData()
showColumnSample()
}
COLOR_DIALOG_ID_COLUMN_TEXT -> {
color_column_text = colorAlpha
saveUIToData()
showColumnSample()
}
}
}
@ -873,8 +1076,8 @@ class ActAppSetting : AppCompatActivity()
Styler.setIconAttr(this, ivFooterToot, R.attr.ic_edit)
Styler.setIconAttr(this, ivFooterMenu, R.attr.ic_hamburger)
} else {
Styler.setIconAttr(this, ivFooterToot, R.attr.ic_edit,color=c)
Styler.setIconAttr(this, ivFooterMenu, R.attr.ic_hamburger,color=c)
Styler.setIconAttr(this, ivFooterToot, R.attr.ic_edit, color = c)
Styler.setIconAttr(this, ivFooterMenu, R.attr.ic_hamburger, color = c)
}
c = footer_tab_bg_color
@ -1072,7 +1275,7 @@ class ActAppSetting : AppCompatActivity()
)
// ZipOutputStreamオブジェクトの作成
ZipOutputStream(FileOutputStream(file)).use{ zipStream->
ZipOutputStream(FileOutputStream(file)).use { zipStream ->
// アプリデータjson
zipStream.putNextEntry(ZipEntry("AppData.json"))
@ -1080,17 +1283,21 @@ class ActAppSetting : AppCompatActivity()
val jw = JsonWriter(OutputStreamWriter(zipStream, "UTF-8"))
AppDataExporter.encodeAppData(this@ActAppSetting, jw)
jw.flush()
}finally{
} finally {
zipStream.closeEntry()
}
// カラム背景画像
val appState = App1.getAppState(this@ActAppSetting)
for(column in appState.column_list) {
AppDataExporter.saveBackgroundImage(this@ActAppSetting,zipStream,column)
AppDataExporter.saveBackgroundImage(
this@ActAppSetting,
zipStream,
column
)
}
}
return file
} catch(ex : Throwable) {
log.trace(ex)

View File

@ -119,7 +119,7 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
.setAllowPresets(true)
.setShowAlphaSlider(false)
.setDialogId(COLOR_DIALOG_ID_HEADER_BACKGROUND)
.setColor(column.getHeaderBackgroundColor(this))
.setColor(column.getHeaderBackgroundColor())
.show(this)
}
@ -134,7 +134,7 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
.setAllowPresets(true)
.setShowAlphaSlider(false)
.setDialogId(COLOR_DIALOG_ID_HEADER_FOREGROUND)
.setColor(column.getHeaderNameColor(this))
.setColor(column.getHeaderNameColor())
.show(this)
}
@ -164,7 +164,7 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
.setAllowPresets(true)
.setShowAlphaSlider(true)
.setDialogId(COLOR_DIALOG_ID_ACCT_TEXT)
.setColor(column.getAcctColor(this))
.setColor(column.getAcctColor())
.show(this)
}
@ -179,7 +179,7 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
.setAllowPresets(true)
.setShowAlphaSlider(true)
.setDialogId(COLOR_DIALOG_ID_CONTENT_TEXT)
.setColor(column.getContentColor(this))
.setColor(column.getContentColor())
.show(this)
}
@ -391,11 +391,9 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
try {
loading_busy = true
column.setHeaderBackground(this,llColumnHeader)
column.setHeaderBackground(llColumnHeader)
var c = column.getHeaderNameColor(this)
val c = column.getHeaderNameColor()
tvColumnName.textColor = c
Styler.setIconAttr(
this,
@ -430,8 +428,8 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
loadImage(ivColumnBackground, column.column_bg_image)
tvSampleAcct.setTextColor( column.getAcctColor(this))
tvSampleContent.setTextColor(column.getContentColor(this))
tvSampleAcct.setTextColor( column.getAcctColor())
tvSampleContent.setTextColor(column.getContentColor())
} finally {
loading_busy = false

View File

@ -200,7 +200,7 @@ class ActMain : AppCompatActivity()
///////////////////////////////////////////////////////////////////////////////////////////////
internal val link_click_listener : MyClickableSpanClickCallback = { viewClicked, span ->
private val link_click_listener : MyClickableSpanClickCallback = { viewClicked, span ->
var view = viewClicked
var column : Column? = null
@ -437,6 +437,7 @@ class ActMain : AppCompatActivity()
super.onNewIntent(intent)
log.w("onNewIntent: isResumed = isResumed")
}
override fun onSaveInstanceState(outState : Bundle?) {
log.d("onSaveInstanceState")
super.onSaveInstanceState(outState)
@ -637,9 +638,9 @@ class ActMain : AppCompatActivity()
private fun handleSentIntent(intent : Intent) {
sent_intent2 = intent
// Galaxy S8+ で STのSSを取った後に出るポップアップからそのまま共有でSTを選ぶと何も起きない問題への対策
handler.post{
handler.post {
AccountPicker.pick(
this,
bAllowPseudo = false,
@ -775,6 +776,11 @@ class ActMain : AppCompatActivity()
override fun onActivityResult(requestCode : Int, resultCode : Int, data : Intent?) {
log.d("onActivityResult")
if(requestCode == REQUEST_CODE_APP_SETTING) {
Column.reloadDefaultColor(this,pref)
}
if(resultCode == Activity.RESULT_OK) {
if(requestCode == REQUEST_CODE_COLUMN_LIST) {
if(data != null) {
@ -1159,6 +1165,8 @@ class ActMain : AppCompatActivity()
MyClickableSpan.defaultLinkColor = Pref.ipLinkColor(pref)
Column.reloadDefaultColor(this,pref)
var sv = Pref.spTimelineFont(pref)
if(sv.isNotEmpty()) {
try {
@ -1223,13 +1231,13 @@ class ActMain : AppCompatActivity()
}
run {
var boost_alpha :Float? = 0.8f
try{
val f = ( Pref.spBoostAlpha.toInt(pref).toFloat() +0.5f )/100f
boost_alpha = when{
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
else -> f
}
} catch(ex : Throwable) {
log.trace(ex)
@ -1429,11 +1437,14 @@ class ActMain : AppCompatActivity()
viewRoot.contentDescription = column.getColumnName(true)
//
column.setHeaderBackground(this,viewRoot)
column.setHeaderBackground( viewRoot)
var c = column.getHeaderNameColor(this)
Styler.setIconAttr(this, ivIcon, column.getIconAttrId(column.column_type), c)
Styler.setIconAttr(
this,
ivIcon,
column.getIconAttrId(column.column_type),
column.getHeaderNameColor()
)
//
val ac = AcctColor.load(column.access_info.acct)
@ -2260,16 +2271,17 @@ class ActMain : AppCompatActivity()
val footer_tab_bg_color = Pref.ipFooterTabBgColor(pref)
val footer_tab_divider_color = Pref.ipFooterTabDividerColor(pref)
val footer_tab_indicator_color = Pref.ipFooterTabIndicatorColor(pref)
var c = footer_button_bg_color
if(c == 0) {
btnMenu.setBackgroundResource(R.drawable.bg_button_cw)
btnToot.setBackgroundResource(R.drawable.bg_button_cw)
btnQuickToot.setBackgroundResource(R.drawable.bg_button_cw)
} else {
val fg = if(footer_button_fg_color != 0)
footer_button_fg_color
else
Styler.getAttributeColor(this, R.attr.colorRippleEffect)
val fg = when {
footer_button_fg_color != 0 -> footer_button_fg_color
else -> Styler.getAttributeColor(this, R.attr.colorRippleEffect)
}
ViewCompat.setBackground(btnToot, Styler.getAdaptiveRippleDrawable(c, fg))
ViewCompat.setBackground(btnMenu, Styler.getAdaptiveRippleDrawable(c, fg))
ViewCompat.setBackground(btnQuickToot, Styler.getAdaptiveRippleDrawable(c, fg))
@ -2287,47 +2299,14 @@ class ActMain : AppCompatActivity()
}
c = footer_tab_bg_color
if(c == 0) {
svColumnStrip.setBackgroundColor(
Styler.getAttributeColor(
this,
R.attr.colorColumnStripBackground
)
)
llQuickTootBar.setBackgroundColor(
Styler.getAttributeColor(
this,
R.attr.colorColumnStripBackground
)
)
} else {
svColumnStrip.setBackgroundColor(c)
svColumnStrip.setBackgroundColor(
Styler.getAttributeColor(
this,
R.attr.colorColumnStripBackground
)
)
}
if(c == 0) c = Styler.getAttributeColor(this, R.attr.colorColumnStripBackground)
svColumnStrip.setBackgroundColor(c)
llQuickTootBar.setBackgroundColor(c)
c = footer_tab_divider_color
if(c == 0) {
vFooterDivider1.setBackgroundColor(
Styler.getAttributeColor(
this,
R.attr.colorImageButton
)
)
vFooterDivider2.setBackgroundColor(
Styler.getAttributeColor(
this,
R.attr.colorImageButton
)
)
} else {
vFooterDivider1.setBackgroundColor(c)
vFooterDivider2.setBackgroundColor(c)
}
if(c == 0) c = Styler.getAttributeColor(this, R.attr.colorImageButton)
vFooterDivider1.setBackgroundColor(c)
vFooterDivider2.setBackgroundColor(c)
llColumnStrip.indicatorColor = footer_tab_indicator_color
}

View File

@ -2,6 +2,7 @@ package jp.juggler.subwaytooter
import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import android.net.Uri
import android.os.AsyncTask
import android.os.Environment
@ -468,6 +469,42 @@ class Column(
log.i("backgroundDir: ${backgroundDir} exists=${backgroundDir.exists()}")
return backgroundDir
}
private var defaultColorHeaderBg = 0
private var defaultColorHeaderName = 0
private var defaultColorHeaderPageNumber = 0
private var defaultColorContentBg = 0
private var defaultColorContentAcct = 0
private var defaultColorContentText = 0
fun reloadDefaultColor(activity : AppCompatActivity, pref : SharedPreferences) {
var c : Int
//
c = Pref.ipCcdHeaderBg(pref)
if(c == 0) c = Styler.getAttributeColor(activity, R.attr.color_column_header)
defaultColorHeaderBg = c
//
c = Pref.ipCcdHeaderFg(pref)
if(c == 0) c = Styler.getAttributeColor(activity, R.attr.colorColumnHeaderName)
defaultColorHeaderName = c
//
c = Pref.ipCcdHeaderFg(pref)
if(c == 0) c = Styler.getAttributeColor(activity, R.attr.colorColumnHeaderPageNumber)
defaultColorHeaderPageNumber = c
//
c = Pref.ipCcdContentBg(pref)
defaultColorContentBg = c
//
c = Pref.ipCcdContentAcct(pref)
if(c == 0) c = Styler.getAttributeColor(activity, R.attr.colorTimeSmall)
defaultColorContentAcct = c
//
c = Pref.ipCcdContentText(pref)
if(c == 0) c = Styler.getAttributeColor(activity, R.attr.colorContentText)
defaultColorContentText = c
}
}
private var callback_ref : WeakReference<Callback>? = null
@ -6822,53 +6859,41 @@ class Column(
}
}
fun getContentColor(activity : AppCompatActivity) : Int = if(content_color != 0) {
content_color
} else {
Styler.getAttributeColor(activity, R.attr.colorContentText)
fun getContentColor() : Int = when {
content_color != 0 -> content_color
else -> defaultColorContentText
}
fun getAcctColor(activity : AppCompatActivity) : Int = if(acct_color != 0) {
acct_color
} else {
Styler.getAttributeColor(activity, R.attr.colorTimeSmall)
fun getAcctColor() : Int = when {
acct_color != 0 -> acct_color
else -> defaultColorContentAcct
}
fun getHeaderPageNumberColor(activity : AppCompatActivity) : Int {
val c = header_fg_color
return when {
c != 0 -> c
else -> Styler.getAttributeColor(activity,R.attr.colorColumnHeaderPageNumber)
}
fun getHeaderPageNumberColor() = when {
header_fg_color != 0 -> header_fg_color
else -> defaultColorHeaderPageNumber
}
fun getHeaderNameColor(activity : AppCompatActivity) : Int {
val c = header_fg_color
return when {
c != 0 -> c
else -> Styler.getAttributeColor(activity,R.attr.colorColumnHeaderName)
}
fun getHeaderNameColor() = when {
header_fg_color != 0 -> header_fg_color
else -> defaultColorHeaderName
}
fun getHeaderBackgroundColor(activity : AppCompatActivity) : Int {
val c = header_bg_color
return when {
c != 0 -> c
else -> Styler.getAttributeColor(activity,R.attr.color_column_header)
}
fun getHeaderBackgroundColor() = when {
header_bg_color != 0 -> header_bg_color
else -> defaultColorHeaderBg
}
fun setHeaderBackground(activity : AppCompatActivity, view : View) {
fun setHeaderBackground( view : View) {
ViewCompat.setBackground(
view,
Styler.getAdaptiveRippleDrawable(
getHeaderBackgroundColor(activity),
getHeaderNameColor(activity)
getHeaderBackgroundColor(),
getHeaderNameColor()
)
)
}
// fun findListIndexByTimelineId(orderId : EntityId) : Int? {
// list_data.forEachIndexed { i, v ->
// if(v.getOrderId() == orderId) return i

View File

@ -659,10 +659,10 @@ class ColumnViewHolder(
if(column == null || column.is_dispose.get()) return
// カラムヘッダ背景
column.setHeaderBackground(activity,llColumnHeader)
column.setHeaderBackground(llColumnHeader)
// カラムヘッダ文字色(A)
var c = column.getHeaderNameColor(activity)
var c = column.getHeaderNameColor()
tvColumnName.textColor =c
Styler.setIconAttr(
activity,
@ -675,7 +675,7 @@ class ColumnViewHolder(
Styler.setIconAttr(activity, btnColumnClose, R.attr.btn_close, c)
// カラムヘッダ文字色(B)
c = column.getHeaderPageNumberColor(activity)
c = column.getHeaderPageNumberColor()
tvColumnIndex.textColor =c
tvColumnStatus.textColor =c
@ -692,7 +692,7 @@ class ColumnViewHolder(
loadBackgroundImage(ivColumnBackgroundImage, column.column_bg_image)
// エラー表示
tvLoading.textColor = column.getContentColor(activity)
tvLoading.textColor = column.getContentColor()
status_adapter?.findHeaderViewHolder(listView)?.showColor()
}

View File

@ -399,7 +399,7 @@ internal class ItemViewHolder(
removeExtraView()
var c : Int
c = column.getContentColor(activity)
c = column.getContentColor()
this.content_color = c
tvBoosted.setTextColor(c)
@ -427,7 +427,7 @@ internal class ItemViewHolder(
it.color = rgb or (alpha shl 24)
}
c = column.getAcctColor(activity)
c = column.getAcctColor()
log.d("acct_color %x", c)
this.acct_color = c
tvBoostedTime.setTextColor(c)

View File

@ -387,6 +387,12 @@ object Pref {
val ipTootColorDirectUser = IntPref("ipTootColorDirectUser", 0)
val ipTootColorDirectMe = IntPref("ipTootColorDirectMe", 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 ipTrendTagCountShowing = IntPref("TrendTagCountShowing", 0)
// const val TTCS_WEEKLY = 0
// const val TTCS_DAILY = 1

View File

@ -57,7 +57,7 @@ internal class StatusButtons(
private val ivFollowedBy2 = holder.ivFollowedBy2
private val btnMore = holder.btnMore
private val color_normal = column.getContentColor(activity)
private val color_normal = column.getContentColor()
private val color_accent : Int
get() = Styler.getAttributeColor(activity, R.attr.colorImageButtonAccent)

View File

@ -3,13 +3,17 @@ package jp.juggler.subwaytooter
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.ColorFilter
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.graphics.drawable.*
import android.graphics.drawable.shapes.RectShape
import android.os.Build
import android.os.SystemClock
import android.support.v4.content.ContextCompat
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.util.SparseArray
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
@ -59,40 +63,136 @@ object Styler {
)
}
/////////////////////////////////////////////////////////
private class ColorFilterCacheValue(
val filter : ColorFilter,
var lastUsed : Long
)
private val colorFilterCache = SparseArray<ColorFilterCacheValue>()
private var colorFilterCacheLastSweep = 0L
private fun createColorFilter(rgb : Int) : ColorFilter? {
synchronized(colorFilterCache) {
val now = SystemClock.elapsedRealtime()
val cacheValue = colorFilterCache[rgb]
if(cacheValue != null) {
cacheValue.lastUsed = now
return cacheValue.filter
}
val size = colorFilterCache.size()
if(now - colorFilterCacheLastSweep >= 10000L && size >= 64) {
colorFilterCacheLastSweep = now
for(i in size - 1 downTo 0) {
val v = colorFilterCache.valueAt(i)
if(now - v.lastUsed >= 10000L) {
colorFilterCache.removeAt(i)
}
}
}
val f = PorterDuffColorFilter(rgb, PorterDuff.Mode.SRC_ATOP)
colorFilterCache.put(rgb, ColorFilterCacheValue(f, now))
return f
}
}
/////////////////////////////////////////////////////////
private class ColoredDrawableCacheKey(
val drawableId : Int,
val rgb : Int,
val alpha : Int
) {
override fun equals(other : Any?) : Boolean {
return this === other || (
other is ColoredDrawableCacheKey
&& drawableId == other.drawableId
&& rgb == other.rgb
&& alpha == other.alpha
)
}
override fun hashCode() : Int {
return drawableId xor (rgb or (alpha shl 24))
}
}
private class ColoredDrawableCacheValue(
val drawable : Drawable,
var lastUsed : Long
)
private val coloredDrawableCache = HashMap<ColoredDrawableCacheKey, ColoredDrawableCacheValue>()
private var coloredDrawableCacheLastSweep = 0L
fun createColoredDrawable(
context : Context,
drawableId : Int,
color : Int,
alphaMultiplier: Float? = null
alphaMultiplier : Float? = null
) : Drawable {
val rgb = (color and 0xffffff) or Color.BLACK
val alpha = if( alphaMultiplier ==null ){
val alpha = if(alphaMultiplier == null) {
(color ushr 24)
}else{
clipRange(0,255,((color ushr 24).toFloat() * alphaMultiplier +0.5f ).toInt())
} else {
clipRange(0, 255, ((color ushr 24).toFloat() * alphaMultiplier + 0.5f).toInt())
}
// 色指定が他のアイコンに影響しないようにする
// カラーフィルターとアルファ値を設定する
val d = ContextCompat.getDrawable(context, drawableId) !!.mutate()
d.setColorFilter(rgb, PorterDuff.Mode.SRC_ATOP)
d.alpha = alpha
return d
val cacheKey = ColoredDrawableCacheKey(drawableId, rgb, alpha)
synchronized(coloredDrawableCache) {
val now = SystemClock.elapsedRealtime()
val cacheValue = coloredDrawableCache[cacheKey]
if(cacheValue != null) {
cacheValue.lastUsed = now
return cacheValue.drawable
}
if(now - coloredDrawableCacheLastSweep >= 10000L && coloredDrawableCache.size >= 64) {
coloredDrawableCacheLastSweep = now
val it = coloredDrawableCache.entries.iterator()
while(it.hasNext()) {
val (_, v) = it.next()
if(now - v.lastUsed >= 10000L) {
it.remove()
}
}
}
// 色指定が他のアイコンに影響しないようにする
// カラーフィルターとアルファ値を設定する
val d = ContextCompat.getDrawable(context, drawableId) !!.mutate()
d.colorFilter = createColorFilter(rgb)
d.alpha = alpha
coloredDrawableCache[cacheKey] = ColoredDrawableCacheValue(d, now)
return d
}
}
//////////////////////////////////////////////////////////////////
fun setIconDrawableId(
context : Context,
imageView : ImageView,
drawableId : Int,
color : Int? = null,
alphaMultiplier: Float? = null
alphaMultiplier : Float? = null
) {
if(color == null) {
// ImageViewにアイコンを設定する。デフォルトの色
imageView.setImageDrawable(ContextCompat.getDrawable(context, drawableId))
} else {
imageView.setImageDrawable(createColoredDrawable(context, drawableId, color,alphaMultiplier))
imageView.setImageDrawable(
createColoredDrawable(
context,
drawableId,
color,
alphaMultiplier
)
)
}
}
@ -101,9 +201,15 @@ object Styler {
imageView : ImageView,
iconAttrId : Int,
color : Int? = null,
alphaMultiplier: Float? = null
alphaMultiplier : Float? = null
) {
setIconDrawableId(context, imageView, getAttributeResourceId(context, iconAttrId), color,alphaMultiplier)
setIconDrawableId(
context,
imageView,
getAttributeResourceId(context, iconAttrId),
color,
alphaMultiplier
)
}
fun getVisibilityIconAttr(isMisskeyData : Boolean, visibility : TootVisibility) : Int {
@ -222,7 +328,7 @@ object Styler {
, relation : UserRelation
, who : TootAccount
, defaultColor : Int
,alphaMultiplier : Float? = null
, alphaMultiplier : Float? = null
) {
fun colorError() = Styler.getAttributeColor(context, R.attr.colorRegexFilterError)
@ -233,17 +339,35 @@ object Styler {
relation.blocked_by -> {
ivDot.visibility = View.VISIBLE
setIconDrawableId(context, ivDot, R.drawable.ic_blocked_by, color = colorError(),alphaMultiplier = alphaMultiplier)
setIconDrawableId(
context,
ivDot,
R.drawable.ic_blocked_by,
color = colorError(),
alphaMultiplier = alphaMultiplier
)
}
relation.requested_by -> {
ivDot.visibility = View.VISIBLE
setIconDrawableId(context, ivDot, R.drawable.ic_requested_by, color = colorError(),alphaMultiplier = alphaMultiplier)
setIconDrawableId(
context,
ivDot,
R.drawable.ic_requested_by,
color = colorError(),
alphaMultiplier = alphaMultiplier
)
}
relation.followed_by -> {
ivDot.visibility = View.VISIBLE
setIconAttr(context, ivDot, R.attr.ic_followed_by, color = colorAccent(),alphaMultiplier = alphaMultiplier)
setIconAttr(
context,
ivDot,
R.attr.ic_followed_by,
color = colorAccent(),
alphaMultiplier = alphaMultiplier
)
// 被フォローリクエスト状態の時に followed_by が 真と偽の両方がありえるようなので
// Relationshipだけを見ても被フォローリクエスト状態は分からないっぽい
// 仕方ないので馬鹿正直に「 followed_byが真ならバッジをつける」しかできない
@ -292,7 +416,7 @@ object Styler {
}
}
setIconAttr(context, ibFollow, icon_attr, color = color,alphaMultiplier = alphaMultiplier)
setIconAttr(context, ibFollow, icon_attr, color = color, alphaMultiplier = alphaMultiplier)
ibFollow.contentDescription = contentDescription
}

View File

@ -144,7 +144,7 @@ internal class ViewHolderHeaderProfile(
tvCreated.textSize = f
}
val contentColor = column.getContentColor(activity)
val contentColor = column.getContentColor()
this.contentColor = contentColor
tvMoved.textColor = contentColor
@ -164,7 +164,7 @@ internal class ViewHolderHeaderProfile(
alphaMultiplier = Styler.boost_alpha
)
val acctColor = column.getAcctColor(activity)
val acctColor = column.getAcctColor()
tvCreated.textColor = acctColor
tvMovedAcct.textColor = acctColor
@ -407,11 +407,7 @@ internal class ViewHolderHeaderProfile(
else -> acctLong
}
val acct_color = when {
column.acct_color != 0 -> column.acct_color
else -> Styler.getAttributeColor(activity, R.attr.colorTimeSmall)
}
tv.setTextColor(if(AcctColor.hasColorForeground(ac)) ac.color_fg else acct_color)
tv.setTextColor(if(AcctColor.hasColorForeground(ac)) ac.color_fg else column.getAcctColor() )
if(AcctColor.hasColorBackground(ac)) {
tv.setBackgroundColor(ac.color_bg)

View File

@ -30,7 +30,7 @@ internal class ViewHolderHeaderSearch(
val sv = DecodeOptions(activity, access_info,decodeEmoji = true).decodeHTML( html)
tvSearchDesc.text = sv
tvSearchDesc.textColor = column.getContentColor(activity)
tvSearchDesc.textColor = column.getContentColor()
}
override fun onViewRecycled() {

View File

@ -924,7 +924,6 @@
/>
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView
@ -1020,11 +1019,18 @@
</LinearLayout>
<!-- #################################################### -->
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/background_color_unlisted"
android:text="@string/toot_background_color"
/>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/unlisted_visibility"
/>
<LinearLayout style="@style/setting_row_form">
@ -1047,11 +1053,9 @@
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/background_color_follower"
style="@style/setting_row_label_indent1"
android:text="@string/followers_visibility"
/>
<LinearLayout style="@style/setting_row_form">
@ -1074,11 +1078,10 @@
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/background_color_direct_with_user"
style="@style/setting_row_label_indent1"
android:text="@string/direct_with_user_visibility"
/>
<LinearLayout style="@style/setting_row_form">
@ -1101,11 +1104,9 @@
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/background_color_direct_no_user"
style="@style/setting_row_label_indent1"
android:text="@string/direct_only_me_visibility"
/>
<LinearLayout style="@style/setting_row_form">
@ -1128,6 +1129,8 @@
</LinearLayout>
<!-- ######################################################## -->
<View style="@style/setting_divider"/>
<TextView
@ -1155,6 +1158,221 @@
</LinearLayout>
<!-- カラム色のデフォルト ########################################################## -->
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/column_color_default"
/>
<LinearLayout style="@style/setting_row_form">
<LinearLayout
android:id="@+id/llColumnHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="3dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="3dp"
>
<ImageView
android:id="@+id/ivColumnHeader"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="4dp"
android:importantForAccessibility="no"
tools:src="?attr/btn_federate_tl"
/>
<TextView
android:id="@+id/tvColumnName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/federate_timeline"
/>
</LinearLayout>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/header_background_color"
/>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnCcdHeaderBackgroundEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnCcdHeaderBackgroundReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false"
/>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/header_foreground_color"
/>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnCcdHeaderForegroundEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnCcdHeaderForegroundReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false"
/>
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<FrameLayout
android:id="@+id/flColumnBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="start"
android:maxLines="1"
android:textColor="?attr/colorTimeSmall"
android:textSize="12sp"
android:text="@string/acct_sample"
android:id="@+id/tvSampleAcct"
/>
<jp.juggler.subwaytooter.view.MyTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:lineSpacingMultiplier="1.1"
android:textColor="?attr/colorContentText"
android:gravity="start"
android:text="@string/content_sample"
android:id="@+id/tvSampleContent"
/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/content_background_color"
/>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnCcdContentBackgroundEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnCcdContentBackgroundReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false"
/>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/content_acct_color"
/>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnCcdContentAcctEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnCcdContentAcctReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false"
/>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/content_text_color"
/>
<LinearLayout style="@style/setting_row_form">
<Button
android:id="@+id/btnCcdContentTextEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnCcdContentTextReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:textAllCaps="false"
/>
</LinearLayout>
<!-- ########################################################## -->
<View style="@style/setting_divider"/>
<TextView
@ -1255,13 +1473,10 @@
</FrameLayout>
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/button_background_color"
/>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/button_background_color"
/>
<LinearLayout style="@style/setting_row_form">
@ -1283,14 +1498,10 @@
</LinearLayout>
<LinearLayout style="@style/setting_row_form"
>
<TextView
style="@style/setting_row_label"
android:text="@string/button_foreground_color"
/>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/button_foreground_color"
/>
<LinearLayout style="@style/setting_row_form">
@ -1312,13 +1523,10 @@
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/tab_background_color"
/>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/quick_toot_bar_background_color"
/>
<LinearLayout style="@style/setting_row_form">
@ -1340,13 +1548,10 @@
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/tab_divider_color"
/>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/tab_divider_color"
/>
<LinearLayout style="@style/setting_row_form">
@ -1368,13 +1573,10 @@
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
android:text="@string/tab_indicator_color"
/>
</LinearLayout>
<TextView
style="@style/setting_row_label_indent1"
android:text="@string/tab_indicator_color"
/>
<LinearLayout style="@style/setting_row_form">
@ -1396,6 +1598,8 @@
</LinearLayout>
<!-- ################################################################## -->
<View style="@style/setting_divider"/>
<TextView
@ -1409,7 +1613,6 @@
android:id="@+id/tvTimelineFontUrl"
style="@style/setting_horizontal_stretch"
/>
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
@ -1432,6 +1635,8 @@
</LinearLayout>
<!-- ################################################################## -->
<View style="@style/setting_divider"/>
<TextView
@ -1590,6 +1795,7 @@
/>
<LinearLayout style="@style/setting_row_form">
<EditText
android:id="@+id/etBoostAlpha"
style="@style/setting_horizontal_stretch"
@ -1716,8 +1922,8 @@
<TextView
style="@style/setting_row_label"
android:text="@string/timeout_for_embed_media_viewer"
android:labelFor="@+id/etMediaReadTimeout"
android:text="@string/timeout_for_embed_media_viewer"
/>
<LinearLayout style="@style/setting_row_form">

View File

@ -62,13 +62,10 @@
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
style="@style/setting_row_label_indent1"
android:text="@string/background_color"
/>
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
@ -89,13 +86,10 @@
</LinearLayout>
<LinearLayout style="@style/setting_row_form">
<TextView
style="@style/setting_row_label"
style="@style/setting_row_label_indent1"
android:text="@string/foreground_color"
/>
</LinearLayout>
<LinearLayout style="@style/setting_row_form">

View File

@ -779,10 +779,6 @@
<string name="reply_to">Reply to %1$s</string>
<string name="deleted_at">deleted at %1$s</string>
<string name="already_reactioned">already reactioned.</string>
<string name="background_color_unlisted">Toot background color of \'Unlisted\' visibility</string>
<string name="background_color_follower">Toot background color of \'follower\' visibility</string>
<string name="background_color_direct_with_user">Toot background color of \'Direct to users\' visibility</string>
<string name="background_color_direct_no_user">Toot background color of \'Direct only me\' visibility</string>
<string name="already_voted">Already voted.</string>
<string name="endorse_set">Endorse in your profile</string>

View File

@ -72,10 +72,6 @@
<string name="back_button_action">戻るボタンの動作</string>
<string name="back_to_column_list">戻るボタンでカラム一覧を開く</string>
<string name="background_color">背景色</string>
<string name="background_color_direct_no_user">トゥート背景色 \'ダイレクト(自分のみ)\'</string>
<string name="background_color_direct_with_user">トゥート背景色 \'ダイレクト(対象ユーザあり)\'</string>
<string name="background_color_follower">トゥート背景色 \'フォロワーのみ\'</string>
<string name="background_color_unlisted">トゥート背景色 \'未収載\'</string>
<string name="background_image">背景画像</string>
<string name="background_image_alpha">背景画像のアルファ値</string>
<string name="behavior">挙動</string>
@ -795,4 +791,17 @@
<string name="mute_application_confirm">アプリ \"%1$s\" はミュートされます。よろしいですか?</string>
<string name="boost_button_alpha">ブーストボタンのアルファ不透明度(単位:%。アプリの再起動が必要。本文テキスト色のアルファ値の影響も受けます)</string>
<string name="toot_background_color">トゥート背景色</string>
<string name="unlisted_visibility">\'未収載\' 公開範囲</string>
<string name="followers_visibility">\'フォロワーのみ\' 公開範囲</string>
<string name="direct_with_user_visibility">\'誰かへのDM\' 公開範囲</string>
<string name="direct_only_me_visibility">\'自分へのDM\' 公開範囲</string>
<string name="column_color_default">カラムの色の既定値(アプリ再起動が必要)</string>
<string name="header_background_color">ヘッダーの背景色</string>
<string name="header_foreground_color">ヘッダーのアイコンや文字の色</string>
<string name="content_background_color">内容の背景色</string>
<string name="content_acct_color">内容のAcctの文字色</string>
<string name="content_text_color">内容の本文の文字色</string>
<string name="quick_toot_bar_background_color">簡易投稿入力の背景色</string>
</resources>

View File

@ -767,10 +767,10 @@
<string name="reply_to">Reply to %1$s</string>
<string name="deleted_at">deleted at %1$s</string>
<string name="already_reactioned">already reactioned.</string>
<string name="background_color_unlisted">Toot background color of \'Unlisted\' visibility</string>
<string name="background_color_follower">Toot background color of \'follower\' visibility</string>
<string name="background_color_direct_with_user">Toot background color of \'Direct to users\' visibility</string>
<string name="background_color_direct_no_user">Toot background color of \'Direct only me\' visibility</string>
<string name="unlisted_visibility">\'Unlisted\' visibility</string>
<string name="followers_visibility">\'Followers\' visibility</string>
<string name="direct_with_user_visibility">\'Direct to users\' visibility</string>
<string name="direct_only_me_visibility">\'Direct only me\' visibility</string>
<string name="already_voted">Already voted.</string>
<string name="endorse_set">Endorse in your profile</string>
@ -813,5 +813,13 @@
<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="boost_button_alpha">Boost button alpha opacity (Unit:%. app restart required. also affected of content text alpha.)</string>
<string name="toot_background_color">Toot background color</string>
<string name="column_color_default">Column color default(app restart required)</string>
<string name="header_background_color">Header background color</string>
<string name="header_foreground_color">Header foreground color</string>
<string name="content_background_color">Content background color</string>
<string name="content_acct_color">Content acct color</string>
<string name="content_text_color">Content text color</string>
<string name="quick_toot_bar_background_color">Quick toot bar background color</string>
</resources>

View File

@ -261,19 +261,6 @@
</style>
<style name="setting_row_label">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingLeft">12dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:paddingStart" tools:ignore="NewApi">12dp</item>
<item name="android:paddingEnd" tools:ignore="NewApi">0dp</item>
<item name="android:textSize">14sp</item>
</style>
<style name="setting_row_form">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
@ -288,6 +275,37 @@
</style>
<style name="setting_row_label">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingLeft">12dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:paddingStart" tools:ignore="NewApi">12dp</item>
<item name="android:paddingEnd" tools:ignore="NewApi">0dp</item>
<item name="android:textSize">14sp</item>
</style>
<style name="setting_row_label_indent1">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">horizontal</item>
<item name="android:layout_marginTop">3dp</item>
<item name="android:baselineAligned">true</item>
<item name="android:paddingLeft">48dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:paddingStart" tools:ignore="NewApi">48dp</item>
<item name="android:paddingEnd" tools:ignore="NewApi">0dp</item>
<item name="android:textSize">14sp</item>
</style>
<style name="setting_row_form_fields" parent="setting_row_form">
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">0dp</item>