mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-27 09:11:23 +01:00
リファクタ
This commit is contained in:
parent
6787de833b
commit
daf493463c
@ -431,7 +431,7 @@ class ActAppSettingChild : AppCompatActivity()
|
||||
etBoostButtonSize = findViewById(R.id.etBoostButtonSize)
|
||||
etReplyIconSize = findViewById(R.id.etReplyIconSize)
|
||||
etHeaderIconSize = findViewById(R.id.etHeaderIconSize)
|
||||
etStripIconSize= findViewById(R.id.etStripIconSize)
|
||||
etStripIconSize = findViewById(R.id.etStripIconSize)
|
||||
tvTimelineFontUrl = findViewById(R.id.tvTimelineFontUrl)
|
||||
tvTimelineFontBoldUrl = findViewById(R.id.tvTimelineFontBoldUrl)
|
||||
|
||||
@ -974,8 +974,11 @@ class ActAppSettingChild : AppCompatActivity()
|
||||
}
|
||||
|
||||
override fun onColorSelected(dialogId : Int, @ColorInt colorSelected : Int) {
|
||||
|
||||
val colorOpaque = colorSelected or Color.BLACK
|
||||
val colorAlpha = if(colorSelected == 0) 0x01000000 else colorSelected
|
||||
|
||||
val colorAlpha = colorSelected.notZero() ?: 0x01000000
|
||||
|
||||
when(dialogId) {
|
||||
|
||||
COLOR_DIALOG_ID_FOOTER_BUTTON_BG -> {
|
||||
@ -1077,8 +1080,8 @@ class ActAppSettingChild : AppCompatActivity()
|
||||
|
||||
var c = footer_button_bg_color
|
||||
if(c == 0) {
|
||||
ivFooterToot !!.setBackgroundResource(R.drawable.bg_button_cw)
|
||||
ivFooterMenu !!.setBackgroundResource(R.drawable.bg_button_cw)
|
||||
ivFooterToot?.setBackgroundResource(R.drawable.bg_button_cw)
|
||||
ivFooterMenu?.setBackgroundResource(R.drawable.bg_button_cw)
|
||||
} else {
|
||||
val fg = if(footer_button_fg_color != 0)
|
||||
footer_button_fg_color
|
||||
@ -1088,33 +1091,29 @@ class ActAppSettingChild : AppCompatActivity()
|
||||
ViewCompat.setBackground(ivFooterMenu !!, getAdaptiveRippleDrawable(c, fg))
|
||||
}
|
||||
|
||||
c = footer_button_fg_color
|
||||
if(c == 0) c= getAttributeColor(this,R.attr.colorVectorDrawable)
|
||||
ivFooterToot?.setImageResource(R.drawable.ic_edit)
|
||||
ivFooterToot?.imageTintList = ColorStateList.valueOf(c)
|
||||
ivFooterMenu?.setImageResource(R.drawable.ic_hamburger)
|
||||
ivFooterMenu?.imageTintList = ColorStateList.valueOf(c)
|
||||
|
||||
c = footer_tab_bg_color
|
||||
if(c == 0) {
|
||||
llFooterBG !!.setBackgroundColor(
|
||||
getAttributeColor(
|
||||
this,
|
||||
R.attr.colorColumnStripBackground
|
||||
)
|
||||
)
|
||||
} else {
|
||||
llFooterBG !!.setBackgroundColor(c)
|
||||
}
|
||||
val csl = ColorStateList.valueOf(
|
||||
footer_button_fg_color.notZero()
|
||||
?: getAttributeColor(this, R.attr.colorVectorDrawable)
|
||||
)
|
||||
ivFooterToot?.imageTintList = csl
|
||||
ivFooterMenu?.imageTintList = csl
|
||||
|
||||
c = footer_tab_divider_color
|
||||
if(c == 0) c= getAttributeColor(this, R.attr.colorImageButton)
|
||||
vFooterDivider1 ?.setBackgroundColor(c)
|
||||
vFooterDivider2 ?.setBackgroundColor(c)
|
||||
llFooterBG?.setBackgroundColor(
|
||||
footer_tab_bg_color.notZero()
|
||||
?: getAttributeColor(this, R.attr.colorColumnStripBackground)
|
||||
)
|
||||
|
||||
c = footer_tab_indicator_color
|
||||
if(c == 0) c = getAttributeColor(this, R.attr.colorAccent)
|
||||
vIndicator ?.setBackgroundColor(c)
|
||||
c = footer_tab_divider_color.notZero() ?: getAttributeColor(this, R.attr.colorImageButton)
|
||||
vFooterDivider1?.setBackgroundColor(c)
|
||||
vFooterDivider2?.setBackgroundColor(c)
|
||||
|
||||
vIndicator?.setBackgroundColor(
|
||||
footer_tab_indicator_color.notZero()
|
||||
?: getAttributeColor(this, R.attr.colorAccent)
|
||||
)
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s : CharSequence, start : Int, count : Int, after : Int) {
|
||||
|
@ -212,11 +212,11 @@ class ActColumnCustomize : AppCompatActivity(), View.OnClickListener, ColorPicke
|
||||
colorSelected
|
||||
|
||||
COLOR_DIALOG_ID_ACCT_TEXT -> {
|
||||
column.acct_color = if(colorSelected == 0) 1 else colorSelected
|
||||
column.acct_color = colorSelected.notZero() ?: 1
|
||||
}
|
||||
|
||||
COLOR_DIALOG_ID_CONTENT_TEXT -> {
|
||||
column.content_color = if(colorSelected == 0) 1 else colorSelected
|
||||
column.content_color = colorSelected.notZero() ?: 1
|
||||
}
|
||||
}
|
||||
show()
|
||||
|
@ -2,6 +2,7 @@ package jp.juggler.subwaytooter
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.media.RingtoneManager
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
@ -13,10 +14,8 @@ import android.widget.TextView
|
||||
import com.jrummyapps.android.colorpicker.ColorPickerDialog
|
||||
import com.jrummyapps.android.colorpicker.ColorPickerDialogListener
|
||||
import jp.juggler.subwaytooter.table.HighlightWord
|
||||
import jp.juggler.util.LogCategory
|
||||
import jp.juggler.util.getAttributeColor
|
||||
import jp.juggler.util.mayUri
|
||||
import jp.juggler.util.toJsonObject
|
||||
import jp.juggler.util.*
|
||||
import org.jetbrains.anko.textColor
|
||||
import org.json.JSONException
|
||||
|
||||
class ActHighlightWordEdit
|
||||
@ -125,20 +124,10 @@ class ActHighlightWordEdit
|
||||
swSound.isChecked = item.sound_type != HighlightWord.SOUND_TYPE_NONE
|
||||
|
||||
tvName.text = item.name
|
||||
tvName.setBackgroundColor(item.color_bg) // may 0
|
||||
tvName.textColor = item.color_fg.notZero()
|
||||
?: getAttributeColor(this, android.R.attr.textColorPrimary)
|
||||
|
||||
var c = item.color_bg
|
||||
if(c == 0) {
|
||||
tvName.setBackgroundColor(0)
|
||||
} else {
|
||||
tvName.setBackgroundColor(c)
|
||||
}
|
||||
|
||||
c = item.color_fg
|
||||
if(c == 0) {
|
||||
tvName.setTextColor(getAttributeColor(this, android.R.attr.textColorPrimary))
|
||||
} else {
|
||||
tvName.setTextColor(c)
|
||||
}
|
||||
} finally {
|
||||
bBusy = false
|
||||
}
|
||||
@ -205,8 +194,8 @@ class ActHighlightWordEdit
|
||||
|
||||
override fun onColorSelected(dialogId : Int, color : Int) {
|
||||
when(dialogId) {
|
||||
COLOR_DIALOG_ID_TEXT -> item.color_fg = - 0x1000000 or color
|
||||
COLOR_DIALOG_ID_BACKGROUND -> item.color_bg = if(color == 0) 0x01000000 else color
|
||||
COLOR_DIALOG_ID_TEXT -> item.color_fg = color or Color.BLACK
|
||||
COLOR_DIALOG_ID_BACKGROUND -> item.color_bg = color.notZero() ?: 0x01000000
|
||||
}
|
||||
showSampleText()
|
||||
}
|
||||
|
@ -153,27 +153,13 @@ class ActHighlightWordList : AppCompatActivity(), View.OnClickListener {
|
||||
itemView.tag = item // itemView は親クラスのメンバ変数
|
||||
tvName.text = item.name
|
||||
|
||||
var c = item.color_bg
|
||||
if(c == 0) {
|
||||
tvName.setBackgroundColor(0)
|
||||
} else {
|
||||
tvName.setBackgroundColor(c)
|
||||
}
|
||||
tvName.setBackgroundColor(item.color_bg)
|
||||
tvName.setTextColor(
|
||||
item.color_fg.notZero()
|
||||
?:getAttributeColor(this@ActHighlightWordList,android.R.attr.textColorPrimary)
|
||||
)
|
||||
|
||||
c = item.color_fg
|
||||
if(c == 0) {
|
||||
tvName.setTextColor(
|
||||
getAttributeColor(
|
||||
this@ActHighlightWordList,
|
||||
android.R.attr.textColorPrimary
|
||||
)
|
||||
)
|
||||
} else {
|
||||
tvName.setTextColor(c)
|
||||
}
|
||||
|
||||
btnSound.visibility =
|
||||
if(item.sound_type == HighlightWord.SOUND_TYPE_NONE) View.GONE else View.VISIBLE
|
||||
vg(btnSound,item.sound_type != HighlightWord.SOUND_TYPE_NONE)
|
||||
btnSound.setOnClickListener(this)
|
||||
btnSound.tag = item
|
||||
}
|
||||
|
@ -2423,23 +2423,21 @@ class ActMain : AppCompatActivity()
|
||||
ViewCompat.setBackground(btnQuickToot, getAdaptiveRippleDrawable(c, fg))
|
||||
}
|
||||
|
||||
c = footer_button_fg_color
|
||||
if(c == 0) c= getAttributeColor(this,R.attr.colorVectorDrawable)
|
||||
var csl = ColorStateList.valueOf(c)
|
||||
val csl = ColorStateList.valueOf(
|
||||
footer_button_fg_color.notZero()
|
||||
?: getAttributeColor(this,R.attr.colorVectorDrawable)
|
||||
)
|
||||
btnToot.imageTintList = csl
|
||||
btnMenu.imageTintList = csl
|
||||
btnQuickToot.imageTintList = csl
|
||||
// setIconDrawableId(this, btnToot, R.drawable.ic_edit, c)
|
||||
// setIconDrawableId(this, btnMenu, R.drawable.ic_hamburger, c)
|
||||
// setIconDrawableId(this, btnQuickToot, R.drawable.ic_send, c)
|
||||
|
||||
c = footer_tab_bg_color
|
||||
if(c == 0) c = getAttributeColor(this, R.attr.colorColumnStripBackground)
|
||||
c = footer_tab_bg_color.notZero()
|
||||
?: getAttributeColor(this, R.attr.colorColumnStripBackground)
|
||||
svColumnStrip.setBackgroundColor(c)
|
||||
llQuickTootBar.setBackgroundColor(c)
|
||||
|
||||
c = footer_tab_divider_color
|
||||
if(c == 0) c = getAttributeColor(this, R.attr.colorImageButton)
|
||||
c = footer_tab_divider_color.notZero()
|
||||
?: getAttributeColor(this, R.attr.colorImageButton)
|
||||
vFooterDivider1.setBackgroundColor(c)
|
||||
vFooterDivider2.setBackgroundColor(c)
|
||||
|
||||
|
@ -20,6 +20,7 @@ import jp.juggler.subwaytooter.table.AcctColor
|
||||
import jp.juggler.util.getAttributeColor
|
||||
import jp.juggler.util.hideKeyboard
|
||||
import jp.juggler.util.mayUri
|
||||
import jp.juggler.util.notZero
|
||||
|
||||
class ActNickname : AppCompatActivity(), View.OnClickListener, ColorPickerDialogListener {
|
||||
|
||||
@ -173,14 +174,8 @@ class ActNickname : AppCompatActivity(), View.OnClickListener, ColorPickerDialog
|
||||
private fun show() {
|
||||
val s = etNickname.text.toString().trim { it <= ' ' }
|
||||
tvPreview.text = if(s.isNotEmpty()) s else acct
|
||||
var c : Int
|
||||
|
||||
c = color_fg
|
||||
if(c == 0) c = getAttributeColor(this, R.attr.colorTimeSmall)
|
||||
tvPreview.setTextColor(c)
|
||||
|
||||
c = color_bg
|
||||
tvPreview.setBackgroundColor(c)
|
||||
tvPreview.setTextColor(color_fg.notZero() ?: getAttributeColor(this, R.attr.colorTimeSmall))
|
||||
tvPreview.setBackgroundColor(color_bg)
|
||||
}
|
||||
|
||||
override fun onClick(v : View) {
|
||||
@ -251,7 +246,7 @@ class ActNickname : AppCompatActivity(), View.OnClickListener, ColorPickerDialog
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, R.string.notification_sound)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, false)
|
||||
notification_sound_uri.mayUri()?.let{
|
||||
notification_sound_uri.mayUri()?.let {
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, it)
|
||||
}
|
||||
|
||||
|
@ -496,31 +496,24 @@ class Column(
|
||||
private var defaultColorContentText = 0
|
||||
|
||||
fun reloadDefaultColor(activity : AppCompatActivity, pref : SharedPreferences) {
|
||||
var c : Int
|
||||
|
||||
//
|
||||
c = Pref.ipCcdHeaderBg(pref)
|
||||
if(c == 0) c = getAttributeColor(activity, R.attr.color_column_header)
|
||||
defaultColorHeaderBg = c
|
||||
//
|
||||
c = Pref.ipCcdHeaderFg(pref)
|
||||
if(c == 0) c = getAttributeColor(activity, R.attr.colorColumnHeaderName)
|
||||
defaultColorHeaderName = c
|
||||
//
|
||||
c = Pref.ipCcdHeaderFg(pref)
|
||||
if(c == 0) c = getAttributeColor(activity, R.attr.colorColumnHeaderPageNumber)
|
||||
defaultColorHeaderPageNumber = c
|
||||
//
|
||||
c = Pref.ipCcdContentBg(pref)
|
||||
defaultColorContentBg = c
|
||||
//
|
||||
c = Pref.ipCcdContentAcct(pref)
|
||||
if(c == 0) c = getAttributeColor(activity, R.attr.colorTimeSmall)
|
||||
defaultColorContentAcct = c
|
||||
//
|
||||
c = Pref.ipCcdContentText(pref)
|
||||
if(c == 0) c = getAttributeColor(activity, R.attr.colorContentText)
|
||||
defaultColorContentText = c
|
||||
|
||||
defaultColorHeaderBg = Pref.ipCcdHeaderBg(pref)?.notZero()
|
||||
?: getAttributeColor(activity, R.attr.color_column_header)
|
||||
|
||||
defaultColorHeaderName = Pref.ipCcdHeaderFg(pref).notZero()
|
||||
?: getAttributeColor(activity, R.attr.colorColumnHeaderName)
|
||||
|
||||
defaultColorHeaderPageNumber = Pref.ipCcdHeaderFg(pref).notZero()
|
||||
?: getAttributeColor(activity, R.attr.colorColumnHeaderPageNumber)
|
||||
|
||||
defaultColorContentBg = Pref.ipCcdContentBg(pref)
|
||||
// may zero
|
||||
|
||||
defaultColorContentAcct = Pref.ipCcdContentAcct(pref).notZero()
|
||||
?: getAttributeColor(activity, R.attr.colorTimeSmall)
|
||||
|
||||
defaultColorContentText = Pref.ipCcdContentText(pref).notZero()
|
||||
?: getAttributeColor(activity, R.attr.colorContentText)
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -771,9 +771,10 @@ class ColumnViewHolder(
|
||||
tvColumnStatus.textColor = c
|
||||
|
||||
// カラム内部の背景色
|
||||
c = column.column_bg_color
|
||||
if(c == 0) c = Column.defaultColorContentBg
|
||||
flColumnBackground.setBackgroundColor(c)
|
||||
flColumnBackground.setBackgroundColor(
|
||||
column.column_bg_color.notZero()
|
||||
?: Column.defaultColorContentBg
|
||||
)
|
||||
|
||||
// カラム内部の背景画像
|
||||
ivColumnBackgroundImage.alpha = column.column_bg_image_alpha
|
||||
@ -1140,23 +1141,13 @@ class ColumnViewHolder(
|
||||
else
|
||||
acct
|
||||
|
||||
var c : Int
|
||||
|
||||
c = ac.color_fg
|
||||
tvColumnContext.setTextColor(
|
||||
when {
|
||||
c != 0 -> c
|
||||
// column.header_fg_color != 0 -> column.header_fg_color
|
||||
else -> getAttributeColor(activity, R.attr.colorTimeSmall)
|
||||
}
|
||||
ac.color_fg.notZero()
|
||||
?: getAttributeColor(activity, R.attr.colorTimeSmall)
|
||||
)
|
||||
|
||||
c = ac.color_bg
|
||||
if(c == 0) {
|
||||
ViewCompat.setBackground(tvColumnContext, null)
|
||||
} else {
|
||||
tvColumnContext.setBackgroundColor(c)
|
||||
}
|
||||
tvColumnContext.setBackgroundColor(ac.color_bg)
|
||||
tvColumnContext.setPaddingRelative(activity.acct_pad_lr, 0, activity.acct_pad_lr, 0)
|
||||
|
||||
tvColumnName.text = column.getColumnName(false)
|
||||
@ -1504,7 +1495,7 @@ class ColumnViewHolder(
|
||||
|
||||
val colorFg = getAttributeColor(activity, R.attr.colorContentText)
|
||||
val colorBgSelected = colorFg.applyAlphaMultiplier(0.25f)
|
||||
val colorFgList = ColorStateList.valueOf(colorFg)
|
||||
val colorFgList = ColorStateList.valueOf(colorFg)
|
||||
showQuickFilterButton = { btn, iconId, selected ->
|
||||
ViewCompat.setBackground(
|
||||
btn,
|
||||
@ -1519,6 +1510,7 @@ class ColumnViewHolder(
|
||||
)
|
||||
when(btn) {
|
||||
is TextView -> btn.textColor = colorFg
|
||||
|
||||
is ImageButton -> {
|
||||
btn.setImageResource(iconId)
|
||||
btn.imageTintList = colorFgList
|
||||
@ -1528,7 +1520,7 @@ class ColumnViewHolder(
|
||||
} else {
|
||||
val colorBg = column.getHeaderBackgroundColor()
|
||||
val colorFg = column.getHeaderNameColor()
|
||||
val colorFgList = ColorStateList.valueOf(colorFg)
|
||||
val colorFgList = ColorStateList.valueOf(colorFg)
|
||||
val colorBgSelected = Color.rgb(
|
||||
(Color.red(colorBg) * 3 + Color.red(colorFg)) / 4,
|
||||
(Color.green(colorBg) * 3 + Color.green(colorFg)) / 4,
|
||||
@ -1547,7 +1539,8 @@ class ColumnViewHolder(
|
||||
)
|
||||
when(btn) {
|
||||
is TextView -> btn.textColor = colorFg
|
||||
is ImageButton ->{
|
||||
|
||||
is ImageButton -> {
|
||||
btn.setImageResource(iconId)
|
||||
btn.imageTintList = colorFgList
|
||||
}
|
||||
|
@ -23,10 +23,7 @@ import jp.juggler.subwaytooter.util.startMargin
|
||||
import jp.juggler.subwaytooter.view.MyLinkMovementMethod
|
||||
import jp.juggler.subwaytooter.view.MyNetworkImageView
|
||||
import jp.juggler.subwaytooter.view.MyTextView
|
||||
import jp.juggler.util.getAttributeColor
|
||||
import jp.juggler.util.intoStringResource
|
||||
import jp.juggler.util.setIconDrawableId
|
||||
import jp.juggler.util.vg
|
||||
import jp.juggler.util.*
|
||||
import org.jetbrains.anko.textColor
|
||||
|
||||
internal class ViewHolderHeaderProfile(
|
||||
@ -80,7 +77,7 @@ internal class ViewHolderHeaderProfile(
|
||||
btnFollowers = viewRoot.findViewById(R.id.btnFollowers)
|
||||
btnStatusCount = viewRoot.findViewById(R.id.btnStatusCount)
|
||||
tvNote = viewRoot.findViewById(R.id.tvNote)
|
||||
tvMisskeyExtra= viewRoot.findViewById(R.id.tvMisskeyExtra)
|
||||
tvMisskeyExtra = viewRoot.findViewById(R.id.tvMisskeyExtra)
|
||||
btnMore = viewRoot.findViewById(R.id.btnMore)
|
||||
btnFollow = viewRoot.findViewById(R.id.btnFollow)
|
||||
ivFollowedBy = viewRoot.findViewById(R.id.ivFollowedBy)
|
||||
@ -122,13 +119,12 @@ internal class ViewHolderHeaderProfile(
|
||||
}
|
||||
|
||||
override fun showColor() {
|
||||
var c = column.column_bg_color
|
||||
c = if(c == 0) {
|
||||
getAttributeColor(activity, R.attr.colorProfileBackgroundMask)
|
||||
} else {
|
||||
- 0x40000000 or (0x00ffffff and c)
|
||||
}
|
||||
llProfile.setBackgroundColor(c)
|
||||
llProfile.setBackgroundColor(
|
||||
when(val c = column.column_bg_color) {
|
||||
0 -> getAttributeColor(activity, R.attr.colorProfileBackgroundMask)
|
||||
else -> - 0x40000000 or (0x00ffffff and c)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private var contentColor = 0
|
||||
@ -203,7 +199,7 @@ internal class ViewHolderHeaderProfile(
|
||||
name_invalidator.register(null)
|
||||
|
||||
tvNote.text = ""
|
||||
tvMisskeyExtra.text=""
|
||||
tvMisskeyExtra.text = ""
|
||||
note_invalidator.register(null)
|
||||
|
||||
btnStatusCount.text = activity.getString(R.string.statuses) + "\n" + "?"
|
||||
@ -235,7 +231,7 @@ internal class ViewHolderHeaderProfile(
|
||||
tvRemoteProfileWarning.visibility =
|
||||
if(column.access_info.isRemoteUser(who)) View.VISIBLE else View.GONE
|
||||
|
||||
fun SpannableStringBuilder.appendSpan(text:String,span:Any){
|
||||
fun SpannableStringBuilder.appendSpan(text : String, span : Any) {
|
||||
val start = length
|
||||
append(text)
|
||||
setSpan(
|
||||
@ -246,54 +242,54 @@ internal class ViewHolderHeaderProfile(
|
||||
)
|
||||
}
|
||||
|
||||
tvAcct.text = SpannableStringBuilder().apply{
|
||||
|
||||
tvAcct.text = SpannableStringBuilder().apply {
|
||||
|
||||
append("@")
|
||||
|
||||
|
||||
append(access_info.getFullAcct(who))
|
||||
|
||||
|
||||
if(whoDetail?.locked ?: who.locked) {
|
||||
append(" ")
|
||||
val info = EmojiMap201709.sShortNameToImageId["lock"]
|
||||
if(info != null) {
|
||||
appendSpan("locked", EmojiImageSpan(activity, info.image_id))
|
||||
}else {
|
||||
} else {
|
||||
append("locked")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(who.bot) {
|
||||
append(" ")
|
||||
val info = EmojiMap201709.sShortNameToImageId["robot_face"]
|
||||
if(info != null) {
|
||||
appendSpan("bot", EmojiImageSpan(activity, info.image_id))
|
||||
}else {
|
||||
} else {
|
||||
append("bot")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val note = whoRef.decoded_note
|
||||
tvNote.text = note
|
||||
note_invalidator.register(note)
|
||||
|
||||
tvMisskeyExtra.text=SpannableStringBuilder().apply{
|
||||
tvMisskeyExtra.text = SpannableStringBuilder().apply {
|
||||
var s = whoDetail?.location
|
||||
if( s?.isNotEmpty() == true){
|
||||
if(s?.isNotEmpty() == true) {
|
||||
if(isNotEmpty()) append('\n')
|
||||
appendSpan(
|
||||
activity.getString(R.string.location),
|
||||
EmojiImageSpan(
|
||||
activity,
|
||||
R.drawable.ic_location,
|
||||
useColorShader = true
|
||||
))
|
||||
activity,
|
||||
R.drawable.ic_location,
|
||||
useColorShader = true
|
||||
)
|
||||
)
|
||||
append(' ')
|
||||
append(s)
|
||||
}
|
||||
s = whoDetail?.birthday
|
||||
if( s?.isNotEmpty() == true){
|
||||
if(s?.isNotEmpty() == true) {
|
||||
if(isNotEmpty()) append('\n')
|
||||
appendSpan(
|
||||
activity.getString(R.string.birthday),
|
||||
@ -301,12 +297,13 @@ internal class ViewHolderHeaderProfile(
|
||||
activity,
|
||||
R.drawable.ic_cake,
|
||||
useColorShader = true
|
||||
))
|
||||
)
|
||||
)
|
||||
append(' ')
|
||||
append(s)
|
||||
}
|
||||
}
|
||||
vg(tvMisskeyExtra,tvMisskeyExtra.text.isNotEmpty())
|
||||
vg(tvMisskeyExtra, tvMisskeyExtra.text.isNotEmpty())
|
||||
|
||||
btnStatusCount.text = activity.getString(R.string.statuses) + "\n" +
|
||||
(whoDetail?.statuses_count ?: who.statuses_count)
|
||||
@ -316,7 +313,15 @@ internal class ViewHolderHeaderProfile(
|
||||
(whoDetail?.followers_count ?: who.followers_count)
|
||||
|
||||
val relation = UserRelation.load(access_info.db_id, who.id)
|
||||
Styler.setFollowIcon(activity, btnFollow, ivFollowedBy, relation, who, contentColor ,alphaMultiplier = Styler.boost_alpha)
|
||||
Styler.setFollowIcon(
|
||||
activity,
|
||||
btnFollow,
|
||||
ivFollowedBy,
|
||||
relation,
|
||||
who,
|
||||
contentColor,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
|
||||
showMoved(who, who.movedRef)
|
||||
|
||||
@ -333,7 +338,7 @@ internal class ViewHolderHeaderProfile(
|
||||
short = true,
|
||||
emojiMapProfile = who.profile_emojis
|
||||
)
|
||||
|
||||
|
||||
// valueはMisskeyならMFM、MastodonならHTML
|
||||
val valueDecodeOptions = DecodeOptions(
|
||||
context = activity,
|
||||
@ -438,7 +443,15 @@ internal class ViewHolderHeaderProfile(
|
||||
setAcct(tvMovedAcct, access_info.getFullAcct(moved), moved.acct)
|
||||
|
||||
val relation = UserRelation.load(access_info.db_id, moved.id)
|
||||
Styler.setFollowIcon(activity, btnMoved, ivMovedBy, relation, moved, contentColor,alphaMultiplier = Styler.boost_alpha)
|
||||
Styler.setFollowIcon(
|
||||
activity,
|
||||
btnMoved,
|
||||
ivMovedBy,
|
||||
relation,
|
||||
moved,
|
||||
contentColor,
|
||||
alphaMultiplier = Styler.boost_alpha
|
||||
)
|
||||
}
|
||||
|
||||
private fun setAcct(tv : TextView, acctLong : String, acctShort : String) {
|
||||
@ -487,20 +500,20 @@ internal class ViewHolderHeaderProfile(
|
||||
}
|
||||
|
||||
R.id.btnMore -> whoRef?.let { whoRef ->
|
||||
DlgContextMenu(activity, column, whoRef, null, null,null).show()
|
||||
DlgContextMenu(activity, column, whoRef, null, null, null).show()
|
||||
}
|
||||
|
||||
R.id.btnFollow -> whoRef?.let { whoRef ->
|
||||
DlgContextMenu(activity, column, whoRef, null, null,null).show()
|
||||
DlgContextMenu(activity, column, whoRef, null, null, null).show()
|
||||
}
|
||||
|
||||
R.id.btnMoved -> movedRef?.let { movedRef ->
|
||||
DlgContextMenu(activity, column, movedRef, null, null,null).show()
|
||||
DlgContextMenu(activity, column, movedRef, null, null, null).show()
|
||||
}
|
||||
|
||||
R.id.llMoved -> movedRef?.let { movedRef ->
|
||||
if(access_info.isPseudo) {
|
||||
DlgContextMenu(activity, column, movedRef, null, null,null).show()
|
||||
DlgContextMenu(activity, column, movedRef, null, null, null).show()
|
||||
} else {
|
||||
Action_User.profileLocal(
|
||||
activity,
|
||||
|
@ -6,7 +6,10 @@ package jp.juggler.util
|
||||
fun <T : Comparable<T>> clipRange(min : T, max : T, src : T) =
|
||||
if(src < min) min else if(src > max) max else src
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// zero to null
|
||||
|
||||
fun Int.notZero() :Int? = if(this!=0) this else null
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// long
|
||||
|
Loading…
x
Reference in New Issue
Block a user