2018-01-04 19:52:25 +01:00
|
|
|
package jp.juggler.subwaytooter
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.graphics.Typeface
|
2018-01-17 18:39:16 +01:00
|
|
|
import android.os.SystemClock
|
2018-01-14 22:47:42 +01:00
|
|
|
import android.support.v4.content.ContextCompat
|
2018-01-04 19:52:25 +01:00
|
|
|
import android.support.v4.view.ViewCompat
|
|
|
|
import android.support.v7.app.AlertDialog
|
2018-08-04 20:07:55 +02:00
|
|
|
import android.support.v7.widget.RecyclerView
|
2018-01-04 19:52:25 +01:00
|
|
|
import android.text.Spannable
|
|
|
|
import android.text.SpannableStringBuilder
|
|
|
|
import android.text.Spanned
|
2018-01-14 22:47:42 +01:00
|
|
|
import android.text.TextUtils
|
|
|
|
import android.view.Gravity
|
2018-01-04 19:52:25 +01:00
|
|
|
import android.view.View
|
2018-01-14 22:47:42 +01:00
|
|
|
import android.view.ViewGroup
|
|
|
|
import android.widget.*
|
2018-07-07 07:15:16 +02:00
|
|
|
import jp.juggler.subwaytooter.action.*
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
import java.util.ArrayList
|
|
|
|
|
|
|
|
import jp.juggler.subwaytooter.api.TootApiClient
|
|
|
|
import jp.juggler.subwaytooter.api.TootApiResult
|
|
|
|
import jp.juggler.subwaytooter.api.TootTask
|
|
|
|
import jp.juggler.subwaytooter.api.TootTaskRunner
|
|
|
|
import jp.juggler.subwaytooter.api.entity.*
|
|
|
|
import jp.juggler.subwaytooter.dialog.ActionsDialog
|
|
|
|
import jp.juggler.subwaytooter.dialog.DlgConfirm
|
|
|
|
import jp.juggler.subwaytooter.table.AcctColor
|
|
|
|
import jp.juggler.subwaytooter.table.ContentWarning
|
|
|
|
import jp.juggler.subwaytooter.table.MediaShown
|
|
|
|
import jp.juggler.subwaytooter.table.SavedAccount
|
|
|
|
import jp.juggler.subwaytooter.table.UserRelation
|
|
|
|
import jp.juggler.subwaytooter.span.EmojiImageSpan
|
2018-01-14 22:47:42 +01:00
|
|
|
import jp.juggler.subwaytooter.util.*
|
2018-01-04 19:52:25 +01:00
|
|
|
import jp.juggler.subwaytooter.view.*
|
|
|
|
import okhttp3.Request
|
|
|
|
import okhttp3.RequestBody
|
2018-01-14 22:47:42 +01:00
|
|
|
import org.jetbrains.anko.*
|
2018-01-04 19:52:25 +01:00
|
|
|
import org.json.JSONObject
|
|
|
|
|
|
|
|
internal class ItemViewHolder(
|
2018-01-17 18:39:16 +01:00
|
|
|
val activity : ActMain
|
2018-01-04 19:52:25 +01:00
|
|
|
) : View.OnClickListener, View.OnLongClickListener {
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
private val log = LogCategory("ItemViewHolder")
|
2018-08-04 20:07:55 +02:00
|
|
|
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
val viewRoot : View
|
|
|
|
|
|
|
|
private var bSimpleList : Boolean = false
|
2018-01-21 13:46:36 +01:00
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
lateinit var column : Column
|
2018-01-21 13:46:36 +01:00
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
private lateinit var list_adapter : ItemListAdapter
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llBoosted : View
|
|
|
|
private lateinit var ivBoosted : ImageView
|
|
|
|
private lateinit var tvBoosted : TextView
|
|
|
|
private lateinit var tvBoostedAcct : TextView
|
|
|
|
private lateinit var tvBoostedTime : TextView
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llFollow : View
|
|
|
|
private lateinit var ivFollow : MyNetworkImageView
|
|
|
|
private lateinit var tvFollowerName : TextView
|
|
|
|
private lateinit var tvFollowerAcct : TextView
|
|
|
|
private lateinit var btnFollow : ImageButton
|
|
|
|
private lateinit var ivFollowedBy : ImageView
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llStatus : View
|
|
|
|
private lateinit var ivThumbnail : MyNetworkImageView
|
|
|
|
private lateinit var tvName : TextView
|
|
|
|
private lateinit var tvTime : TextView
|
|
|
|
private lateinit var tvAcct : TextView
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llContentWarning : View
|
|
|
|
private lateinit var tvContentWarning : MyTextView
|
|
|
|
private lateinit var btnContentWarning : Button
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llContents : View
|
|
|
|
private lateinit var tvMentions : MyTextView
|
|
|
|
private lateinit var tvContent : MyTextView
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var flMedia : View
|
2018-01-21 13:46:36 +01:00
|
|
|
private lateinit var llMedia : View
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var btnShowMedia : TextView
|
|
|
|
private lateinit var ivMedia1 : MyNetworkImageView
|
|
|
|
private lateinit var ivMedia2 : MyNetworkImageView
|
|
|
|
private lateinit var ivMedia3 : MyNetworkImageView
|
|
|
|
private lateinit var ivMedia4 : MyNetworkImageView
|
|
|
|
private lateinit var btnHideMedia : View
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llButtonBar : View
|
|
|
|
private lateinit var btnConversation : ImageButton
|
2018-08-16 10:02:55 +02:00
|
|
|
private lateinit var btnReply : Button
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var btnBoost : Button
|
|
|
|
private lateinit var btnFavourite : Button
|
|
|
|
private lateinit var llFollow2 : View
|
|
|
|
private lateinit var btnFollow2 : ImageButton
|
|
|
|
private lateinit var ivFollowedBy2 : ImageView
|
|
|
|
private lateinit var btnMore : ImageButton
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llSearchTag : View
|
|
|
|
private lateinit var btnSearchTag : Button
|
2018-05-30 07:18:45 +02:00
|
|
|
private lateinit var llTrendTag : View
|
|
|
|
private lateinit var tvTrendTagName : TextView
|
|
|
|
private lateinit var tvTrendTagDesc : TextView
|
|
|
|
private lateinit var tvTrendTagCount : TextView
|
|
|
|
private lateinit var cvTrendTagHistory : TrendTagHistoryView
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llList : View
|
|
|
|
private lateinit var btnListTL : Button
|
|
|
|
private lateinit var btnListMore : ImageButton
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-04-17 18:29:50 +02:00
|
|
|
private lateinit var llFollowRequest : View
|
|
|
|
private lateinit var btnFollowRequestAccept : View
|
|
|
|
private lateinit var btnFollowRequestDeny : View
|
|
|
|
|
2018-07-07 07:15:16 +02:00
|
|
|
private lateinit var llFilter : View
|
|
|
|
private lateinit var tvFilterPhrase : TextView
|
|
|
|
private lateinit var tvFilterDetail : TextView
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var llExtra : LinearLayout
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private lateinit var tvApplication : TextView
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-05-24 18:33:09 +02:00
|
|
|
private lateinit var tvMessageHolder : TextView
|
2018-01-17 18:39:16 +01:00
|
|
|
private lateinit var access_info : SavedAccount
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
private var buttons_for_status : StatusButtons? = null
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-20 07:51:14 +01:00
|
|
|
private var item : TimelineItem? = null
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-18 22:22:27 +01:00
|
|
|
private var status_showing : TootStatus? = null
|
2018-05-08 10:25:02 +02:00
|
|
|
private var status_account : TootAccountRef? = null
|
|
|
|
private var boost_account : TootAccountRef? = null
|
|
|
|
private var follow_account : TootAccountRef? = null
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-21 13:46:36 +01:00
|
|
|
private var boost_time : Long = 0L
|
2018-01-20 07:51:14 +01:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
private val content_color_default : Int
|
|
|
|
private var acct_color : Int = 0
|
|
|
|
|
|
|
|
private val boost_invalidator : NetworkEmojiInvalidator
|
|
|
|
private val follow_invalidator : NetworkEmojiInvalidator
|
|
|
|
private val name_invalidator : NetworkEmojiInvalidator
|
|
|
|
private val content_invalidator : NetworkEmojiInvalidator
|
|
|
|
private val spoiler_invalidator : NetworkEmojiInvalidator
|
|
|
|
private val extra_invalidator_list = ArrayList<NetworkEmojiInvalidator>()
|
|
|
|
|
|
|
|
init {
|
2018-01-14 22:47:42 +01:00
|
|
|
this.viewRoot = inflate(activity.UI {})
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
btnListTL.setOnClickListener(this)
|
|
|
|
btnListMore.setOnClickListener(this)
|
|
|
|
|
|
|
|
btnSearchTag.setOnClickListener(this)
|
2018-01-10 16:47:35 +01:00
|
|
|
btnSearchTag.setOnLongClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
btnContentWarning.setOnClickListener(this)
|
|
|
|
btnShowMedia.setOnClickListener(this)
|
|
|
|
ivMedia1.setOnClickListener(this)
|
|
|
|
ivMedia2.setOnClickListener(this)
|
|
|
|
ivMedia3.setOnClickListener(this)
|
|
|
|
ivMedia4.setOnClickListener(this)
|
|
|
|
btnFollow.setOnClickListener(this)
|
|
|
|
btnFollow.setOnLongClickListener(this)
|
|
|
|
|
|
|
|
ivThumbnail.setOnClickListener(this)
|
|
|
|
// ここを個別タップにすると邪魔すぎる tvName.setOnClickListener( this );
|
|
|
|
llBoosted.setOnClickListener(this)
|
|
|
|
llBoosted.setOnLongClickListener(this)
|
|
|
|
llFollow.setOnClickListener(this)
|
|
|
|
llFollow.setOnLongClickListener(this)
|
|
|
|
btnFollow.setOnClickListener(this)
|
|
|
|
|
2018-04-17 18:29:50 +02:00
|
|
|
btnFollowRequestAccept.setOnClickListener(this)
|
|
|
|
btnFollowRequestDeny.setOnClickListener(this)
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
// ロングタップ
|
|
|
|
ivThumbnail.setOnLongClickListener(this)
|
|
|
|
|
|
|
|
//
|
2018-01-10 16:47:35 +01:00
|
|
|
tvContent.movementMethod = MyLinkMovementMethod
|
|
|
|
tvMentions.movementMethod = MyLinkMovementMethod
|
|
|
|
tvContentWarning.movementMethod = MyLinkMovementMethod
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
btnHideMedia.setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-05-30 07:18:45 +02:00
|
|
|
llTrendTag.setOnClickListener(this)
|
|
|
|
llTrendTag.setOnLongClickListener(this)
|
2018-08-04 20:07:55 +02:00
|
|
|
llFilter.setOnClickListener(this)
|
2018-03-21 16:39:10 +01:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
this.content_color_default = tvContent.textColors.defaultColor
|
|
|
|
|
|
|
|
if(! activity.timeline_font_size_sp.isNaN()) {
|
|
|
|
tvFollowerName.textSize = activity.timeline_font_size_sp
|
|
|
|
tvName.textSize = activity.timeline_font_size_sp
|
|
|
|
tvMentions.textSize = activity.timeline_font_size_sp
|
|
|
|
tvContentWarning.textSize = activity.timeline_font_size_sp
|
|
|
|
tvContent.textSize = activity.timeline_font_size_sp
|
|
|
|
btnShowMedia.textSize = activity.timeline_font_size_sp
|
2018-01-14 22:47:42 +01:00
|
|
|
tvApplication.textSize = activity.timeline_font_size_sp
|
2018-05-20 00:31:59 +02:00
|
|
|
tvMessageHolder.textSize = activity.timeline_font_size_sp
|
2018-01-04 19:52:25 +01:00
|
|
|
btnListTL.textSize = activity.timeline_font_size_sp
|
2018-05-30 07:18:45 +02:00
|
|
|
tvTrendTagName.textSize = activity.timeline_font_size_sp
|
|
|
|
tvTrendTagCount.textSize = activity.timeline_font_size_sp
|
2018-07-07 07:15:16 +02:00
|
|
|
tvFilterPhrase.textSize = activity.timeline_font_size_sp
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
2018-08-04 20:07:55 +02:00
|
|
|
if(! activity.notification_tl_font_size_sp.isNaN()) {
|
2018-06-24 03:12:45 +02:00
|
|
|
tvBoosted.textSize = activity.notification_tl_font_size_sp
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
if(! activity.acct_font_size_sp.isNaN()) {
|
|
|
|
tvBoostedAcct.textSize = activity.acct_font_size_sp
|
|
|
|
tvBoostedTime.textSize = activity.acct_font_size_sp
|
|
|
|
tvFollowerAcct.textSize = activity.acct_font_size_sp
|
|
|
|
tvAcct.textSize = activity.acct_font_size_sp
|
|
|
|
tvTime.textSize = activity.acct_font_size_sp
|
2018-05-30 07:18:45 +02:00
|
|
|
tvTrendTagDesc.textSize = activity.acct_font_size_sp
|
2018-07-07 07:15:16 +02:00
|
|
|
tvFilterDetail.textSize = activity.acct_font_size_sp
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ivThumbnail.layoutParams.height = activity.avatarIconSize
|
2018-01-18 08:53:32 +01:00
|
|
|
ivThumbnail.layoutParams.width = activity.avatarIconSize
|
|
|
|
ivFollow.layoutParams.width = activity.avatarIconSize
|
|
|
|
ivBoosted.layoutParams.width = activity.avatarIconSize
|
2018-06-24 03:12:45 +02:00
|
|
|
ivBoosted.layoutParams.height = activity.notificationTlIconSize
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
this.content_invalidator = NetworkEmojiInvalidator(activity.handler, tvContent)
|
|
|
|
this.spoiler_invalidator = NetworkEmojiInvalidator(activity.handler, tvContentWarning)
|
|
|
|
this.boost_invalidator = NetworkEmojiInvalidator(activity.handler, tvBoosted)
|
|
|
|
this.follow_invalidator = NetworkEmojiInvalidator(activity.handler, tvFollowerName)
|
|
|
|
this.name_invalidator = NetworkEmojiInvalidator(activity.handler, tvName)
|
|
|
|
}
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
fun onViewRecycled() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-01-21 13:46:36 +01:00
|
|
|
fun bind(
|
|
|
|
list_adapter : ItemListAdapter,
|
|
|
|
column : Column,
|
|
|
|
bSimpleList : Boolean,
|
|
|
|
item : TimelineItem
|
|
|
|
) {
|
2018-08-15 15:27:04 +02:00
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
this.list_adapter = list_adapter
|
|
|
|
this.column = column
|
|
|
|
this.bSimpleList = bSimpleList
|
|
|
|
|
|
|
|
this.access_info = column.access_info
|
|
|
|
|
|
|
|
if(activity.timeline_font != null || activity.timeline_font_bold != null) {
|
2018-07-07 07:15:16 +02:00
|
|
|
val font_bold = activity.timeline_font_bold ?: activity.timeline_font
|
2018-08-04 20:07:55 +02:00
|
|
|
val font_normal = activity.timeline_font ?: activity.timeline_font_bold
|
2018-01-21 13:46:36 +01:00
|
|
|
viewRoot.scan { v ->
|
2018-01-17 18:39:16 +01:00
|
|
|
try {
|
|
|
|
if(v is Button) {
|
|
|
|
// ボタンは太字なので触らない
|
|
|
|
} else if(v is TextView) {
|
|
|
|
val typeface = when {
|
2018-05-30 07:18:45 +02:00
|
|
|
v === tvName ||
|
|
|
|
v === tvFollowerName ||
|
|
|
|
v === tvBoosted ||
|
|
|
|
v === tvTrendTagCount ||
|
2018-07-07 07:15:16 +02:00
|
|
|
v === tvTrendTagName ||
|
|
|
|
v === tvFilterPhrase -> font_bold
|
2018-08-04 20:07:55 +02:00
|
|
|
else -> font_normal
|
2018-01-17 18:39:16 +01:00
|
|
|
}
|
|
|
|
if(typeface != null) v.typeface = typeface
|
|
|
|
}
|
|
|
|
} catch(ex : Throwable) {
|
|
|
|
log.trace(ex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tvName.typeface = Typeface.DEFAULT_BOLD
|
|
|
|
tvFollowerName.typeface = Typeface.DEFAULT_BOLD
|
|
|
|
tvBoosted.typeface = Typeface.DEFAULT_BOLD
|
2018-07-07 07:15:16 +02:00
|
|
|
tvTrendTagCount.typeface = Typeface.DEFAULT_BOLD
|
2018-01-17 18:39:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(bSimpleList) {
|
|
|
|
|
|
|
|
viewRoot.setOnTouchListener { _, ev ->
|
|
|
|
// ポップアップを閉じた時にクリックでリストを触ったことになってしまう不具合の回避
|
|
|
|
val now = SystemClock.elapsedRealtime()
|
|
|
|
// ポップアップを閉じた直後はタッチダウンを無視する
|
|
|
|
if(now - StatusButtonsPopup.last_popup_close >= 30L) {
|
|
|
|
false
|
|
|
|
} else {
|
|
|
|
val action = ev.action
|
|
|
|
log.d("onTouchEvent action=$action")
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
viewRoot.setOnClickListener { viewClicked ->
|
|
|
|
activity.closeListItemPopup()
|
2018-01-18 22:22:27 +01:00
|
|
|
status_showing?.let { status ->
|
2018-01-17 18:39:16 +01:00
|
|
|
val popup = StatusButtonsPopup(activity, column, bSimpleList)
|
|
|
|
activity.listItemPopup = popup
|
|
|
|
popup.show(
|
|
|
|
list_adapter.columnVh.listView,
|
|
|
|
viewClicked,
|
|
|
|
status,
|
|
|
|
item as? TootNotification
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
llButtonBar.visibility = View.GONE
|
|
|
|
this.buttons_for_status = null
|
|
|
|
} else {
|
|
|
|
viewRoot.isClickable = false
|
|
|
|
llButtonBar.visibility = View.VISIBLE
|
|
|
|
this.buttons_for_status = StatusButtons(
|
|
|
|
activity,
|
|
|
|
column,
|
|
|
|
false,
|
|
|
|
|
|
|
|
btnConversation = btnConversation,
|
|
|
|
btnReply = btnReply,
|
|
|
|
btnBoost = btnBoost,
|
|
|
|
btnFavourite = btnFavourite,
|
|
|
|
llFollow2 = llFollow2,
|
|
|
|
btnFollow2 = btnFollow2,
|
|
|
|
ivFollowedBy2 = ivFollowedBy2,
|
|
|
|
btnMore = btnMore
|
|
|
|
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-01-18 22:22:27 +01:00
|
|
|
this.status_showing = null
|
2018-01-04 19:52:25 +01:00
|
|
|
this.status_account = null
|
|
|
|
this.boost_account = null
|
|
|
|
this.follow_account = null
|
2018-01-20 07:51:14 +01:00
|
|
|
this.boost_time = 0L
|
2018-08-20 07:10:56 +02:00
|
|
|
this.viewRoot.setBackgroundColor(0)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
llBoosted.visibility = View.GONE
|
|
|
|
llFollow.visibility = View.GONE
|
|
|
|
llStatus.visibility = View.GONE
|
|
|
|
llSearchTag.visibility = View.GONE
|
|
|
|
llList.visibility = View.GONE
|
2018-04-17 18:29:50 +02:00
|
|
|
llFollowRequest.visibility = View.GONE
|
2018-01-04 19:52:25 +01:00
|
|
|
llExtra.removeAllViews()
|
2018-05-20 00:31:59 +02:00
|
|
|
tvMessageHolder.visibility = View.GONE
|
2018-05-30 07:18:45 +02:00
|
|
|
llTrendTag.visibility = View.GONE
|
2018-07-07 07:15:16 +02:00
|
|
|
llFilter.visibility = View.GONE
|
2018-01-21 13:46:36 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
var c : Int
|
2018-01-10 16:47:35 +01:00
|
|
|
c = if(column.content_color != 0) column.content_color else content_color_default
|
|
|
|
tvBoosted.setTextColor(c)
|
|
|
|
tvFollowerName.setTextColor(c)
|
|
|
|
tvName.setTextColor(c)
|
|
|
|
tvMentions.setTextColor(c)
|
|
|
|
tvContentWarning.setTextColor(c)
|
|
|
|
tvContent.setTextColor(c)
|
|
|
|
//NSFWは文字色固定 btnShowMedia.setTextColor( c );
|
2018-01-14 22:47:42 +01:00
|
|
|
tvApplication.setTextColor(c)
|
2018-05-20 00:31:59 +02:00
|
|
|
tvMessageHolder.setTextColor(c)
|
2018-05-30 07:18:45 +02:00
|
|
|
tvTrendTagName.setTextColor(c)
|
|
|
|
tvTrendTagCount.setTextColor(c)
|
|
|
|
cvTrendTagHistory.setColor(c)
|
2018-07-07 07:15:16 +02:00
|
|
|
tvFilterPhrase.setTextColor(c)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
c = if(column.acct_color != 0) column.acct_color else Styler.getAttributeColor(
|
|
|
|
activity,
|
|
|
|
R.attr.colorTimeSmall
|
|
|
|
)
|
2018-01-14 22:47:42 +01:00
|
|
|
this.acct_color = c
|
|
|
|
tvBoostedTime.setTextColor(c)
|
|
|
|
tvTime.setTextColor(c)
|
2018-05-30 07:18:45 +02:00
|
|
|
tvTrendTagDesc.setTextColor(c)
|
2018-01-14 22:47:42 +01:00
|
|
|
// tvBoostedAcct.setTextColor( c );
|
|
|
|
// tvFollowerAcct.setTextColor( c );
|
|
|
|
// tvAcct.setTextColor( c );
|
2018-07-07 07:15:16 +02:00
|
|
|
tvFilterPhrase.setTextColor(c)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
this.item = item
|
|
|
|
when(item) {
|
|
|
|
is TootStatus -> {
|
|
|
|
val reblog = item.reblog
|
|
|
|
if(reblog != null) {
|
|
|
|
showBoost(
|
2018-05-08 10:25:02 +02:00
|
|
|
item.accountRef,
|
2018-01-21 13:46:36 +01:00
|
|
|
item.time_created_at,
|
|
|
|
R.attr.btn_boost,
|
2018-05-24 18:33:09 +02:00
|
|
|
R.string.display_name_boosted_by
|
2018-01-04 19:52:25 +01:00
|
|
|
)
|
|
|
|
showStatus(activity, reblog)
|
|
|
|
} else {
|
|
|
|
showStatus(activity, item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-20 00:31:59 +02:00
|
|
|
is TootAccountRef -> showAccount(item)
|
|
|
|
|
|
|
|
is TootNotification -> showNotification(item)
|
2018-05-24 18:33:09 +02:00
|
|
|
|
2018-05-20 00:31:59 +02:00
|
|
|
is TootGap -> showGap()
|
|
|
|
is TootDomainBlock -> showDomainBlock(item)
|
|
|
|
is TootList -> showList(item)
|
|
|
|
|
|
|
|
is TootMessageHolder -> showMessageHolder(item)
|
2018-05-30 07:18:45 +02:00
|
|
|
|
|
|
|
// TootTrendTag の後に TootTagを判定すること
|
|
|
|
is TootTrendTag -> showTrendTag(item)
|
|
|
|
is TootTag -> showSearchTag(item)
|
2018-05-20 00:31:59 +02:00
|
|
|
|
2018-07-07 07:15:16 +02:00
|
|
|
is TootFilter -> showFilter(item)
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
else -> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-30 07:18:45 +02:00
|
|
|
private fun showTrendTag(item : TootTrendTag) {
|
|
|
|
llTrendTag.visibility = View.VISIBLE
|
|
|
|
tvTrendTagName.text = "#${item.name}"
|
2018-08-04 20:07:55 +02:00
|
|
|
tvTrendTagDesc.text =
|
|
|
|
activity.getString(R.string.people_talking, item.accountDaily, item.accountWeekly)
|
2018-05-30 21:50:07 +02:00
|
|
|
tvTrendTagCount.text = "${item.countDaily}(${item.countWeekly})"
|
2018-05-30 07:18:45 +02:00
|
|
|
cvTrendTagHistory.setHistory(item.history)
|
|
|
|
}
|
|
|
|
|
2018-05-20 00:31:59 +02:00
|
|
|
private fun showMessageHolder(item : TootMessageHolder) {
|
|
|
|
tvMessageHolder.visibility = View.VISIBLE
|
|
|
|
tvMessageHolder.text = item.text
|
|
|
|
tvMessageHolder.gravity = item.gravity
|
|
|
|
}
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
private fun showNotification(n : TootNotification) {
|
|
|
|
val n_status = n.status
|
2018-05-08 10:25:02 +02:00
|
|
|
val n_accountRef = n.accountRef
|
2018-05-18 19:08:46 +02:00
|
|
|
val n_account = n_accountRef?.get()
|
2018-01-04 19:52:25 +01:00
|
|
|
when(n.type) {
|
|
|
|
TootNotification.TYPE_FAVOURITE -> {
|
|
|
|
if(n_account != null) showBoost(
|
2018-05-08 10:25:02 +02:00
|
|
|
n_accountRef,
|
2018-01-21 13:46:36 +01:00
|
|
|
n.time_created_at,
|
|
|
|
if(access_info.isNicoru(n_account)) R.attr.ic_nicoru else R.attr.btn_favourite,
|
2018-05-24 18:33:09 +02:00
|
|
|
R.string.display_name_favourited_by
|
2018-01-04 19:52:25 +01:00
|
|
|
)
|
|
|
|
if(n_status != null) showStatus(activity, n_status)
|
|
|
|
}
|
|
|
|
|
|
|
|
TootNotification.TYPE_REBLOG -> {
|
|
|
|
if(n_account != null) showBoost(
|
2018-05-08 10:25:02 +02:00
|
|
|
n_accountRef,
|
2018-01-21 13:46:36 +01:00
|
|
|
n.time_created_at,
|
|
|
|
R.attr.btn_boost,
|
2018-05-24 18:33:09 +02:00
|
|
|
R.string.display_name_boosted_by
|
2018-01-04 19:52:25 +01:00
|
|
|
)
|
|
|
|
if(n_status != null) showStatus(activity, n_status)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TootNotification.TYPE_FOLLOW -> {
|
|
|
|
if(n_account != null) {
|
|
|
|
showBoost(
|
2018-05-08 10:25:02 +02:00
|
|
|
n_accountRef,
|
2018-01-21 13:46:36 +01:00
|
|
|
n.time_created_at,
|
|
|
|
R.attr.ic_follow_plus,
|
2018-05-24 18:33:09 +02:00
|
|
|
R.string.display_name_followed_by
|
2018-01-04 19:52:25 +01:00
|
|
|
)
|
2018-05-08 10:25:02 +02:00
|
|
|
showAccount(n_accountRef)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TootNotification.TYPE_MENTION -> {
|
|
|
|
if(! bSimpleList) {
|
|
|
|
if(n_account != null) showBoost(
|
2018-05-08 10:25:02 +02:00
|
|
|
n_accountRef,
|
2018-01-21 13:46:36 +01:00
|
|
|
n.time_created_at,
|
|
|
|
R.attr.btn_reply,
|
2018-05-24 18:33:09 +02:00
|
|
|
R.string.display_name_replied_by
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
if(n_status != null) showStatus(activity, n_status)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else -> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun showList(list : TootList) {
|
|
|
|
llList.visibility = View.VISIBLE
|
|
|
|
btnListTL.text = list.title
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun showDomainBlock(domain_block : TootDomainBlock) {
|
|
|
|
llSearchTag.visibility = View.VISIBLE
|
|
|
|
btnSearchTag.text = domain_block.domain
|
|
|
|
}
|
|
|
|
|
2018-08-04 20:07:55 +02:00
|
|
|
private fun showFilter(filter : TootFilter) {
|
2018-07-07 07:15:16 +02:00
|
|
|
llFilter.visibility = View.VISIBLE
|
|
|
|
tvFilterPhrase.text = filter.phrase
|
2018-08-04 20:07:55 +02:00
|
|
|
|
2018-07-07 07:15:16 +02:00
|
|
|
val sb = StringBuffer()
|
2018-07-08 19:00:47 +02:00
|
|
|
//
|
2018-08-04 20:07:55 +02:00
|
|
|
sb.append(activity.getString(R.string.filter_context))
|
2018-07-07 07:15:16 +02:00
|
|
|
.append(": ")
|
|
|
|
.append(filter.getContextNames(activity).joinToString("/"))
|
2018-07-08 19:00:47 +02:00
|
|
|
//
|
2018-07-10 08:44:34 +02:00
|
|
|
val flags = ArrayList<String>()
|
2018-08-04 20:07:55 +02:00
|
|
|
if(filter.irreversible) flags.add(activity.getString(R.string.filter_irreversible))
|
|
|
|
if(filter.whole_word) flags.add(activity.getString(R.string.filter_word_match))
|
|
|
|
if(flags.isNotEmpty()) {
|
2018-07-10 08:44:34 +02:00
|
|
|
sb.append('\n')
|
2018-08-04 20:07:55 +02:00
|
|
|
.append(flags.joinToString(", "))
|
2018-07-10 08:44:34 +02:00
|
|
|
}
|
|
|
|
//
|
2018-08-04 20:07:55 +02:00
|
|
|
if(filter.time_expires_at != 0L) {
|
2018-07-08 19:00:47 +02:00
|
|
|
sb.append('\n')
|
2018-07-07 07:15:16 +02:00
|
|
|
.append(activity.getString(R.string.filter_expires_at))
|
|
|
|
.append(": ")
|
2018-08-04 20:07:55 +02:00
|
|
|
.append(TootStatus.formatTime(activity, filter.time_expires_at, false))
|
2018-07-07 07:15:16 +02:00
|
|
|
}
|
2018-08-04 20:07:55 +02:00
|
|
|
|
2018-07-07 07:15:16 +02:00
|
|
|
tvFilterDetail.text = sb.toString()
|
|
|
|
}
|
|
|
|
|
2018-01-20 07:51:14 +01:00
|
|
|
private fun showSearchTag(tag : TootTag) {
|
2018-01-04 19:52:25 +01:00
|
|
|
llSearchTag.visibility = View.VISIBLE
|
2018-01-20 07:51:14 +01:00
|
|
|
btnSearchTag.text = "#" + tag.name
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private fun showGap() {
|
|
|
|
llSearchTag.visibility = View.VISIBLE
|
|
|
|
btnSearchTag.text = activity.getString(R.string.read_gap)
|
|
|
|
}
|
|
|
|
|
2018-05-08 10:55:08 +02:00
|
|
|
private fun showBoost(
|
|
|
|
whoRef : TootAccountRef,
|
|
|
|
time : Long,
|
|
|
|
icon_attr_id : Int,
|
2018-05-24 18:33:09 +02:00
|
|
|
string_id : Int
|
2018-05-08 10:55:08 +02:00
|
|
|
) {
|
2018-05-08 10:25:02 +02:00
|
|
|
boost_account = whoRef
|
2018-05-18 19:08:46 +02:00
|
|
|
val who = whoRef.get()
|
2018-05-24 18:33:09 +02:00
|
|
|
|
|
|
|
val text : Spannable = if(string_id == R.string.display_name_followed_by) {
|
|
|
|
// フォローの場合 decoded_display_name が2箇所で表示に使われるのを避ける必要がある
|
|
|
|
who.decodeDisplayName(activity)
|
|
|
|
} else {
|
|
|
|
// それ以外の場合は decoded_display_name を再利用して構わない
|
|
|
|
whoRef.decoded_display_name
|
|
|
|
}.intoStringResource(activity, string_id)
|
|
|
|
|
2018-01-20 07:51:14 +01:00
|
|
|
boost_time = time
|
2018-01-04 19:52:25 +01:00
|
|
|
llBoosted.visibility = View.VISIBLE
|
|
|
|
ivBoosted.setImageResource(Styler.getAttributeResourceId(activity, icon_attr_id))
|
2018-04-05 20:04:45 +02:00
|
|
|
showStatusTime(activity, tvBoostedTime, who, time = time)
|
2018-01-04 19:52:25 +01:00
|
|
|
tvBoosted.text = text
|
|
|
|
boost_invalidator.register(text)
|
|
|
|
setAcct(tvBoostedAcct, access_info.getFullAcct(who), who.acct)
|
|
|
|
}
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
private fun showAccount(whoRef : TootAccountRef) {
|
|
|
|
follow_account = whoRef
|
2018-05-18 19:08:46 +02:00
|
|
|
val who = whoRef.get()
|
2018-01-04 19:52:25 +01:00
|
|
|
llFollow.visibility = View.VISIBLE
|
2018-01-21 13:46:36 +01:00
|
|
|
ivFollow.setImageUrl(
|
|
|
|
activity.pref,
|
|
|
|
Styler.calcIconRound(ivFollow.layoutParams),
|
|
|
|
access_info.supplyBaseUrl(who.avatar_static)
|
|
|
|
)
|
2018-05-08 10:25:02 +02:00
|
|
|
tvFollowerName.text = whoRef.decoded_display_name
|
|
|
|
follow_invalidator.register(whoRef.decoded_display_name)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
setAcct(tvFollowerAcct, access_info.getFullAcct(who), who.acct)
|
|
|
|
|
|
|
|
val relation = UserRelation.load(access_info.db_id, who.id)
|
|
|
|
Styler.setFollowIcon(activity, btnFollow, ivFollowedBy, relation, who)
|
2018-04-17 18:29:50 +02:00
|
|
|
|
|
|
|
if(column.column_type == Column.TYPE_FOLLOW_REQUESTS) {
|
|
|
|
llFollowRequest.visibility = View.VISIBLE
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private fun showStatus(activity : ActMain, status : TootStatus) {
|
2018-08-04 20:07:55 +02:00
|
|
|
|
|
|
|
if(status.filtered) {
|
2018-07-06 17:22:22 +02:00
|
|
|
showMessageHolder(TootMessageHolder(activity.getString(R.string.filtered)))
|
|
|
|
return
|
|
|
|
}
|
2018-08-04 20:07:55 +02:00
|
|
|
|
2018-01-18 22:22:27 +01:00
|
|
|
this.status_showing = status
|
2018-01-04 19:52:25 +01:00
|
|
|
llStatus.visibility = View.VISIBLE
|
|
|
|
|
2018-08-20 07:10:56 +02:00
|
|
|
if( status.conversation_main) {
|
|
|
|
this.viewRoot.setBackgroundColor( (Styler.getAttributeColor(activity,R.attr.colorImageButtonAccent) and 0xffffff ) or 0x20000000)
|
|
|
|
}
|
|
|
|
|
2018-04-05 20:04:45 +02:00
|
|
|
showStatusTime(activity, tvTime, who = status.account, status = status)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
val whoRef = status.accountRef
|
2018-05-18 19:08:46 +02:00
|
|
|
val who = whoRef.get()
|
2018-05-08 10:25:02 +02:00
|
|
|
this.status_account = whoRef
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
setAcct(tvAcct, access_info.getFullAcct(who), who.acct)
|
|
|
|
|
|
|
|
// if(who == null) {
|
|
|
|
// tvName.text = "?"
|
|
|
|
// name_invalidator.register(null)
|
|
|
|
// ivThumbnail.setImageUrl(activity.pref, 16f, null, null)
|
|
|
|
// } else {
|
2018-05-08 10:25:02 +02:00
|
|
|
tvName.text = whoRef.decoded_display_name
|
|
|
|
name_invalidator.register(whoRef.decoded_display_name)
|
2018-01-04 19:52:25 +01:00
|
|
|
ivThumbnail.setImageUrl(
|
2018-01-17 18:39:16 +01:00
|
|
|
activity.pref,
|
2018-01-18 08:53:32 +01:00
|
|
|
Styler.calcIconRound(ivThumbnail.layoutParams),
|
2018-01-17 18:39:16 +01:00
|
|
|
access_info.supplyBaseUrl(who.avatar_static),
|
|
|
|
access_info.supplyBaseUrl(who.avatar)
|
2018-01-04 19:52:25 +01:00
|
|
|
)
|
|
|
|
// }
|
|
|
|
|
|
|
|
var content = status.decoded_content
|
|
|
|
llExtra.removeAllViews()
|
|
|
|
for(invalidator in extra_invalidator_list) {
|
|
|
|
invalidator.register(null)
|
|
|
|
}
|
|
|
|
extra_invalidator_list.clear()
|
|
|
|
|
|
|
|
// ニコフレのアンケートの表示
|
|
|
|
val enquete = status.enquete
|
|
|
|
if(enquete != null && NicoEnquete.TYPE_ENQUETE == enquete.type) {
|
2018-06-23 04:43:18 +02:00
|
|
|
val question = enquete.decoded_question
|
2018-01-04 19:52:25 +01:00
|
|
|
val items = enquete.items
|
|
|
|
|
|
|
|
if(question.isNotBlank()) content = question
|
|
|
|
if(items != null) {
|
|
|
|
val now = System.currentTimeMillis()
|
|
|
|
var n = 0
|
|
|
|
for(item in items) {
|
2018-06-23 04:43:18 +02:00
|
|
|
makeEnqueteChoiceView(enquete, now, n ++, item.decoded_text)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
makeEnqueteTimerView(enquete)
|
|
|
|
}
|
|
|
|
|
|
|
|
// カードの表示(会話ビューのみ)
|
|
|
|
val card = status.card
|
|
|
|
if(card != null) {
|
|
|
|
makeCardView(activity, llExtra, card)
|
|
|
|
}
|
|
|
|
|
|
|
|
// if( status.decoded_tags == null ){
|
|
|
|
// tvTags.setVisibility( View.GONE );
|
|
|
|
// }else{
|
|
|
|
// tvTags.setVisibility( View.VISIBLE );
|
|
|
|
// tvTags.setText( status.decoded_tags );
|
|
|
|
// }
|
|
|
|
|
|
|
|
if(status.decoded_mentions.isEmpty()) {
|
|
|
|
tvMentions.visibility = View.GONE
|
|
|
|
} else {
|
|
|
|
tvMentions.visibility = View.VISIBLE
|
|
|
|
tvMentions.text = status.decoded_mentions
|
|
|
|
}
|
|
|
|
|
|
|
|
tvContent.text = content
|
|
|
|
content_invalidator.register(content)
|
|
|
|
|
|
|
|
activity.checkAutoCW(status, content)
|
|
|
|
val r = status.auto_cw
|
|
|
|
|
|
|
|
tvContent.minLines = r?.originalLineCount ?: - 1
|
|
|
|
|
|
|
|
val decoded_spoiler_text = status.decoded_spoiler_text
|
|
|
|
when {
|
|
|
|
decoded_spoiler_text.isNotEmpty() -> {
|
|
|
|
// 元データに含まれるContent Warning を使う
|
|
|
|
llContentWarning.visibility = View.VISIBLE
|
|
|
|
tvContentWarning.text = status.decoded_spoiler_text
|
|
|
|
spoiler_invalidator.register(status.decoded_spoiler_text)
|
|
|
|
val cw_shown = ContentWarning.isShown(status, false)
|
|
|
|
showContent(cw_shown)
|
|
|
|
}
|
|
|
|
|
|
|
|
r?.decoded_spoiler_text != null -> {
|
|
|
|
// 自動CW
|
|
|
|
llContentWarning.visibility = View.VISIBLE
|
|
|
|
tvContentWarning.text = r.decoded_spoiler_text
|
|
|
|
spoiler_invalidator.register(r.decoded_spoiler_text)
|
|
|
|
val cw_shown = ContentWarning.isShown(status, false)
|
|
|
|
showContent(cw_shown)
|
|
|
|
}
|
|
|
|
|
|
|
|
else -> {
|
|
|
|
// CWしない
|
|
|
|
llContentWarning.visibility = View.GONE
|
|
|
|
llContents.visibility = View.VISIBLE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val media_attachments = status.media_attachments
|
|
|
|
if(media_attachments == null || media_attachments.isEmpty()) {
|
|
|
|
flMedia.visibility = View.GONE
|
2018-01-18 22:22:27 +01:00
|
|
|
llMedia.visibility = View.GONE
|
|
|
|
btnShowMedia.visibility = View.GONE
|
2018-01-04 19:52:25 +01:00
|
|
|
} else {
|
|
|
|
flMedia.visibility = View.VISIBLE
|
|
|
|
|
|
|
|
// hide sensitive media
|
|
|
|
val default_shown = when {
|
|
|
|
column.hide_media_default -> false
|
|
|
|
access_info.dont_hide_nsfw -> true
|
|
|
|
else -> ! status.sensitive
|
|
|
|
}
|
|
|
|
val is_shown = MediaShown.isShown(status, default_shown)
|
2018-01-21 13:46:36 +01:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
btnShowMedia.visibility = if(! is_shown) View.VISIBLE else View.GONE
|
2018-01-18 22:22:27 +01:00
|
|
|
llMedia.visibility = if(! is_shown) View.GONE else View.VISIBLE
|
|
|
|
setMedia(ivMedia1, status, media_attachments, 0)
|
|
|
|
setMedia(ivMedia2, status, media_attachments, 1)
|
|
|
|
setMedia(ivMedia3, status, media_attachments, 2)
|
|
|
|
setMedia(ivMedia4, status, media_attachments, 3)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
buttons_for_status?.bind(status, (item as? TootNotification))
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
val application = status.application
|
2018-01-17 02:16:26 +01:00
|
|
|
if(application != null
|
2018-01-17 18:39:16 +01:00
|
|
|
&& (column.column_type == Column.TYPE_CONVERSATION || Pref.bpShowAppName(activity.pref))
|
2018-01-17 02:16:26 +01:00
|
|
|
) {
|
|
|
|
tvApplication.visibility = View.VISIBLE
|
2018-01-17 18:39:16 +01:00
|
|
|
tvApplication.text =
|
|
|
|
activity.getString(R.string.application_is, application.name ?: "")
|
|
|
|
} else {
|
2018-01-17 02:16:26 +01:00
|
|
|
tvApplication.visibility = View.GONE
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-05 20:04:45 +02:00
|
|
|
private fun showStatusTime(
|
|
|
|
activity : ActMain,
|
|
|
|
tv : TextView,
|
|
|
|
@Suppress("UNUSED_PARAMETER") who : TootAccount,
|
|
|
|
status : TootStatus? = null,
|
|
|
|
time : Long? = null
|
|
|
|
) {
|
2018-01-04 19:52:25 +01:00
|
|
|
val sb = SpannableStringBuilder()
|
|
|
|
|
2018-04-05 20:04:45 +02:00
|
|
|
// if(access_info.getFullAcct(who) == "unarist@mstdn.maud.io") {
|
|
|
|
// // if(sb.isNotEmpty()) sb.append(' ')
|
|
|
|
//
|
|
|
|
// val start = sb.length
|
|
|
|
// sb.append("unarist")
|
|
|
|
// val end = sb.length
|
|
|
|
// val icon_id = R.drawable.unarist
|
|
|
|
// sb.setSpan(
|
|
|
|
// EmojiImageSpan(activity, icon_id),
|
|
|
|
// start,
|
|
|
|
// end,
|
|
|
|
// Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
|
// )
|
|
|
|
// }
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-04-05 20:04:45 +02:00
|
|
|
if(status != null) {
|
2018-05-08 10:55:08 +02:00
|
|
|
|
2018-05-10 00:25:44 +02:00
|
|
|
// botマーク
|
2018-05-08 10:55:08 +02:00
|
|
|
if(status.account.bot) {
|
2018-05-10 00:25:44 +02:00
|
|
|
if(sb.isNotEmpty()) sb.append('\u200B')
|
2018-05-08 10:55:08 +02:00
|
|
|
|
2018-05-10 00:25:44 +02:00
|
|
|
sb.appendColorShadeIcon(activity, R.drawable.ic_bot, "bot")
|
|
|
|
|
2018-05-24 18:33:09 +02:00
|
|
|
// val start = sb.length
|
|
|
|
// sb.append("bot")
|
|
|
|
// val end = sb.length
|
|
|
|
// val info = EmojiMap201709.sShortNameToImageId["robot_face"]
|
|
|
|
// if(info != null) {
|
|
|
|
// sb.setSpan(
|
|
|
|
// EmojiImageSpan(activity, info.image_id),
|
|
|
|
// start,
|
|
|
|
// end,
|
|
|
|
// Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
|
// )
|
|
|
|
// }
|
2018-05-08 10:55:08 +02:00
|
|
|
}
|
|
|
|
|
2018-05-10 00:25:44 +02:00
|
|
|
// NSFWマーク
|
2018-04-05 20:04:45 +02:00
|
|
|
if(status.hasMedia() && status.sensitive) {
|
2018-05-10 00:25:44 +02:00
|
|
|
if(sb.isNotEmpty()) sb.append('\u200B')
|
2018-04-05 20:04:45 +02:00
|
|
|
|
|
|
|
val start = sb.length
|
|
|
|
sb.append("NSFW")
|
|
|
|
val end = sb.length
|
|
|
|
val icon_id = Styler.getAttributeResourceId(activity, R.attr.ic_eye_off)
|
|
|
|
sb.setSpan(
|
|
|
|
EmojiImageSpan(activity, icon_id),
|
|
|
|
start,
|
|
|
|
end,
|
|
|
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-05-10 00:25:44 +02:00
|
|
|
// visibility
|
2018-04-05 20:04:45 +02:00
|
|
|
val visIconAttrId = Styler.getVisibilityIconAttr(status.visibility)
|
|
|
|
if(R.attr.ic_public != visIconAttrId) {
|
2018-05-10 00:25:44 +02:00
|
|
|
if(sb.isNotEmpty()) sb.append('\u200B')
|
2018-04-05 20:04:45 +02:00
|
|
|
val start = sb.length
|
|
|
|
sb.append(status.visibility)
|
|
|
|
val end = sb.length
|
|
|
|
val iconResId = Styler.getAttributeResourceId(activity, visIconAttrId)
|
|
|
|
sb.setSpan(
|
|
|
|
EmojiImageSpan(activity, iconResId),
|
|
|
|
start,
|
|
|
|
end,
|
|
|
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
|
)
|
|
|
|
}
|
2018-05-24 18:33:09 +02:00
|
|
|
|
2018-05-10 00:25:44 +02:00
|
|
|
// pinned
|
2018-04-05 20:04:45 +02:00
|
|
|
if(status.pinned) {
|
2018-05-10 00:25:44 +02:00
|
|
|
if(sb.isNotEmpty()) sb.append('\u200B')
|
|
|
|
sb.appendColorShadeIcon(activity, R.drawable.ic_pin, "pinned")
|
|
|
|
|
2018-05-24 18:33:09 +02:00
|
|
|
// val start = sb.length
|
|
|
|
// sb.append("pinned")
|
|
|
|
// val end = sb.length
|
|
|
|
// val icon_id = Styler.getAttributeResourceId(activity, R.attr.ic_pin)
|
|
|
|
// sb.setSpan(
|
|
|
|
// EmojiImageSpan(activity, icon_id),
|
|
|
|
// start,
|
|
|
|
// end,
|
|
|
|
// Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
|
|
// )
|
2018-04-05 20:04:45 +02:00
|
|
|
}
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(sb.isNotEmpty()) sb.append(' ')
|
2018-01-17 18:39:16 +01:00
|
|
|
sb.append(
|
2018-04-05 20:04:45 +02:00
|
|
|
when {
|
|
|
|
time != null -> TootStatus.formatTime(
|
|
|
|
activity,
|
|
|
|
time,
|
|
|
|
column.column_type != Column.TYPE_CONVERSATION
|
|
|
|
)
|
|
|
|
status != null -> TootStatus.formatTime(
|
|
|
|
activity,
|
|
|
|
status.time_created_at,
|
|
|
|
column.column_type != Column.TYPE_CONVERSATION
|
|
|
|
)
|
|
|
|
else -> "?"
|
|
|
|
}
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
2018-04-05 20:04:45 +02:00
|
|
|
|
|
|
|
tv.text = sb
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
2018-01-21 17:47:13 +01:00
|
|
|
// fun updateRelativeTime() {
|
|
|
|
// val boost_time = this.boost_time
|
|
|
|
// if(boost_time != 0L) {
|
|
|
|
// tvBoostedTime.text = TootStatus.formatTime(tvBoostedTime.context, boost_time, true)
|
|
|
|
// }
|
|
|
|
// val status_showing = this.status_showing
|
|
|
|
// if(status_showing != null) {
|
|
|
|
// showStatusTime(activity, status_showing)
|
|
|
|
// }
|
|
|
|
// }
|
2018-01-20 07:51:14 +01:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
private fun setAcct(tv : TextView, acctLong : String, acctShort : String?) {
|
|
|
|
|
|
|
|
val ac = AcctColor.load(acctLong)
|
|
|
|
tv.text = when {
|
|
|
|
AcctColor.hasNickname(ac) -> ac.nickname
|
2018-01-18 19:09:36 +01:00
|
|
|
Pref.bpShortAcctLocalUser(App1.pref) -> "@" + (acctShort ?: "?")
|
2018-01-04 19:52:25 +01:00
|
|
|
else -> acctLong
|
|
|
|
}
|
|
|
|
tv.setTextColor(if(AcctColor.hasColorForeground(ac)) ac.color_fg else this.acct_color)
|
|
|
|
|
|
|
|
if(AcctColor.hasColorBackground(ac)) {
|
|
|
|
tv.setBackgroundColor(ac.color_bg)
|
|
|
|
} else {
|
|
|
|
ViewCompat.setBackground(tv, null)
|
|
|
|
}
|
|
|
|
tv.setPaddingRelative(activity.acct_pad_lr, 0, activity.acct_pad_lr, 0)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun showContent(shown : Boolean) {
|
|
|
|
llContents.visibility = if(shown) View.VISIBLE else View.GONE
|
|
|
|
btnContentWarning.setText(if(shown) R.string.hide else R.string.show)
|
2018-01-18 22:22:27 +01:00
|
|
|
status_showing?.let { status ->
|
2018-01-04 19:52:25 +01:00
|
|
|
val r = status.auto_cw
|
|
|
|
tvContent.minLines = r?.originalLineCount ?: - 1
|
|
|
|
if(r?.decoded_spoiler_text != null) {
|
|
|
|
// 自動CWの場合はContentWarningのテキストを切り替える
|
2018-01-17 18:39:16 +01:00
|
|
|
tvContentWarning.text =
|
|
|
|
if(shown) activity.getString(R.string.auto_cw_prefix) else r.decoded_spoiler_text
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
private fun setMedia(
|
|
|
|
iv : MyNetworkImageView,
|
|
|
|
status : TootStatus,
|
|
|
|
media_attachments : ArrayList<TootAttachmentLike>,
|
|
|
|
idx : Int
|
|
|
|
) {
|
2018-01-04 19:52:25 +01:00
|
|
|
val ta = if(idx < media_attachments.size) media_attachments[idx] else null
|
|
|
|
if(ta != null) {
|
|
|
|
val url = ta.urlForThumbnail
|
|
|
|
if(url != null && url.isNotEmpty()) {
|
|
|
|
iv.visibility = View.VISIBLE
|
2018-03-09 20:54:03 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
iv.setFocusPoint(ta.focusX, ta.focusY)
|
2018-03-09 20:54:03 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
if(Pref.bpDontCropMediaThumb(App1.pref)) {
|
2018-03-09 20:54:03 +01:00
|
|
|
iv.scaleType = ImageView.ScaleType.FIT_CENTER
|
2018-03-21 16:39:10 +01:00
|
|
|
} else {
|
2018-03-09 20:54:03 +01:00
|
|
|
iv.setScaleTypeForMedia()
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
val mediaType = ta.type
|
|
|
|
when(mediaType) {
|
|
|
|
TootAttachmentLike.TYPE_VIDEO -> iv.setMediaType(R.drawable.media_type_video)
|
|
|
|
TootAttachmentLike.TYPE_GIFV -> iv.setMediaType(R.drawable.media_type_gifv)
|
|
|
|
TootAttachmentLike.TYPE_UNKNOWN -> iv.setMediaType(R.drawable.media_type_unknown)
|
|
|
|
else -> iv.setMediaType(0)
|
|
|
|
}
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
iv.setImageUrl(
|
|
|
|
activity.pref,
|
|
|
|
0f,
|
|
|
|
access_info.supplyBaseUrl(url),
|
|
|
|
access_info.supplyBaseUrl(url)
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
val description = ta.description
|
|
|
|
if(description != null && description.isNotEmpty()) {
|
2018-01-17 18:39:16 +01:00
|
|
|
val lp = LinearLayout.LayoutParams(
|
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
lp.topMargin = (0.5f + llExtra.resources.displayMetrics.density * 3f).toInt()
|
|
|
|
val tv = MyTextView(activity)
|
|
|
|
tv.layoutParams = lp
|
|
|
|
//
|
2018-01-10 16:47:35 +01:00
|
|
|
tv.movementMethod = MyLinkMovementMethod
|
2018-01-04 19:52:25 +01:00
|
|
|
if(! activity.timeline_font_size_sp.isNaN()) {
|
|
|
|
tv.textSize = activity.timeline_font_size_sp
|
|
|
|
}
|
2018-01-17 18:39:16 +01:00
|
|
|
val c =
|
|
|
|
if(column.content_color != 0) column.content_color else content_color_default
|
2018-01-04 19:52:25 +01:00
|
|
|
tv.setTextColor(c)
|
|
|
|
|
|
|
|
//
|
2018-01-17 18:39:16 +01:00
|
|
|
val desc =
|
|
|
|
activity.getString(R.string.media_description, idx + 1, ta.description)
|
2018-01-11 10:31:25 +01:00
|
|
|
tv.text = DecodeOptions(
|
2018-01-21 17:47:13 +01:00
|
|
|
activity,
|
2018-01-11 10:31:25 +01:00
|
|
|
emojiMapCustom = status.custom_emojis,
|
|
|
|
emojiMapProfile = status.profile_emojis
|
2018-01-21 17:47:13 +01:00
|
|
|
).decodeEmoji(desc)
|
2018-01-04 19:52:25 +01:00
|
|
|
llExtra.addView(tv)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
iv.visibility = View.GONE
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onClick(v : View) {
|
|
|
|
|
|
|
|
val pos = activity.nextPosition(column)
|
|
|
|
val item = this.item
|
|
|
|
val notification = (item as? TootNotification)
|
2018-01-14 22:47:42 +01:00
|
|
|
when(v) {
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-18 22:22:27 +01:00
|
|
|
btnHideMedia -> status_showing?.let { status ->
|
2018-01-04 19:52:25 +01:00
|
|
|
MediaShown.save(status, false)
|
|
|
|
btnShowMedia.visibility = View.VISIBLE
|
2018-01-18 22:22:27 +01:00
|
|
|
llMedia.visibility = View.GONE
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
2018-01-18 22:22:27 +01:00
|
|
|
btnShowMedia -> status_showing?.let { status ->
|
2018-01-04 19:52:25 +01:00
|
|
|
MediaShown.save(status, true)
|
|
|
|
btnShowMedia.visibility = View.GONE
|
2018-01-18 22:22:27 +01:00
|
|
|
llMedia.visibility = View.VISIBLE
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
ivMedia1 -> clickMedia(0)
|
|
|
|
ivMedia2 -> clickMedia(1)
|
|
|
|
ivMedia3 -> clickMedia(2)
|
|
|
|
ivMedia4 -> clickMedia(3)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-18 22:22:27 +01:00
|
|
|
btnContentWarning -> status_showing?.let { status ->
|
2018-01-04 19:52:25 +01:00
|
|
|
val new_shown = llContents.visibility == View.GONE
|
|
|
|
ContentWarning.save(status, new_shown)
|
2018-01-20 07:51:14 +01:00
|
|
|
|
|
|
|
// 1個だけ開閉するのではなく、例えば通知TLにある複数の要素をまとめて開閉するなどある
|
2018-01-21 13:46:36 +01:00
|
|
|
list_adapter.notifyChange(reason = "ContentWarning onClick", reset = true)
|
2018-01-20 07:51:14 +01:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
ivThumbnail -> status_account?.let { whoRef ->
|
2018-08-18 12:58:14 +02:00
|
|
|
when {
|
|
|
|
access_info.isMisskey -> Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
|
|
|
access_info.isPseudo -> DlgContextMenu(activity, column, whoRef, null, notification).show()
|
|
|
|
else -> Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
llBoosted -> boost_account?.let { whoRef ->
|
2018-01-04 19:52:25 +01:00
|
|
|
if(access_info.isPseudo) {
|
2018-05-08 10:25:02 +02:00
|
|
|
DlgContextMenu(activity, column, whoRef, null, notification).show()
|
2018-01-04 19:52:25 +01:00
|
|
|
} else {
|
2018-05-18 19:08:46 +02:00
|
|
|
Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
llFollow -> follow_account?.let { whoRef ->
|
2018-01-04 19:52:25 +01:00
|
|
|
if(access_info.isPseudo) {
|
2018-05-08 10:25:02 +02:00
|
|
|
DlgContextMenu(activity, column, whoRef, null, notification).show()
|
2018-01-04 19:52:25 +01:00
|
|
|
} else {
|
2018-05-18 19:08:46 +02:00
|
|
|
Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
btnFollow -> follow_account?.let { who ->
|
2018-01-04 19:52:25 +01:00
|
|
|
DlgContextMenu(activity, column, who, null, notification).show()
|
|
|
|
}
|
|
|
|
|
2018-05-30 07:18:45 +02:00
|
|
|
btnSearchTag, llTrendTag -> when(item) {
|
2018-08-18 12:58:14 +02:00
|
|
|
is TootGap -> column.startGap(item)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
is TootDomainBlock -> {
|
|
|
|
val domain = item.domain
|
|
|
|
AlertDialog.Builder(activity)
|
|
|
|
.setMessage(activity.getString(R.string.confirm_unblock_domain, domain))
|
|
|
|
.setNegativeButton(R.string.cancel, null)
|
2018-01-17 18:39:16 +01:00
|
|
|
.setPositiveButton(R.string.ok) { _, _ ->
|
|
|
|
Action_Instance.blockDomain(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
domain,
|
|
|
|
false
|
|
|
|
)
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
.show()
|
|
|
|
}
|
|
|
|
|
2018-01-20 07:51:14 +01:00
|
|
|
is TootTag -> {
|
2018-01-17 18:39:16 +01:00
|
|
|
Action_HashTag.timeline(
|
|
|
|
activity,
|
|
|
|
activity.nextPosition(column),
|
|
|
|
access_info,
|
2018-01-20 07:51:14 +01:00
|
|
|
item.name // #を含まない
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
btnListTL -> if(item is TootList) {
|
2018-01-04 19:52:25 +01:00
|
|
|
activity.addColumn(pos, access_info, Column.TYPE_LIST_TL, item.id)
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
btnListMore -> if(item is TootList) {
|
2018-01-04 19:52:25 +01:00
|
|
|
ActionsDialog()
|
|
|
|
.addAction(activity.getString(R.string.list_timeline)) {
|
|
|
|
activity.addColumn(pos, access_info, Column.TYPE_LIST_TL, item.id)
|
|
|
|
}
|
|
|
|
.addAction(activity.getString(R.string.list_member)) {
|
2018-03-21 16:39:10 +01:00
|
|
|
activity.addColumn(
|
|
|
|
false,
|
|
|
|
pos,
|
|
|
|
access_info,
|
|
|
|
Column.TYPE_LIST_MEMBER,
|
|
|
|
item.id
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
2018-03-21 16:39:10 +01:00
|
|
|
.addAction(activity.getString(R.string.rename)) {
|
2018-02-04 18:55:42 +01:00
|
|
|
Action_List.rename(activity, access_info, item)
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
.addAction(activity.getString(R.string.delete)) {
|
|
|
|
DlgConfirm.openSimple(
|
|
|
|
activity
|
|
|
|
, activity.getString(R.string.list_delete_confirm, item.title)
|
|
|
|
) {
|
2018-08-18 12:58:14 +02:00
|
|
|
Action_List.delete(activity, access_info, item.id.toLong())
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.show(activity, item.title)
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
btnFollowRequestAccept -> follow_account?.let { whoRef ->
|
2018-05-18 19:08:46 +02:00
|
|
|
val who = whoRef.get()
|
2018-05-08 10:55:08 +02:00
|
|
|
DlgConfirm.openSimple(
|
|
|
|
activity,
|
|
|
|
activity.getString(
|
|
|
|
R.string.follow_accept_confirm,
|
|
|
|
AcctColor.getNickname(access_info.getFullAcct(who))
|
|
|
|
)
|
|
|
|
) {
|
2018-05-08 10:25:02 +02:00
|
|
|
Action_Follow.authorizeFollowRequest(activity, access_info, whoRef, true)
|
2018-04-17 18:29:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
btnFollowRequestDeny -> follow_account?.let { whoRef ->
|
2018-05-18 19:08:46 +02:00
|
|
|
val who = whoRef.get()
|
2018-05-08 10:55:08 +02:00
|
|
|
DlgConfirm.openSimple(
|
|
|
|
activity,
|
|
|
|
activity.getString(
|
|
|
|
R.string.follow_deny_confirm,
|
|
|
|
AcctColor.getNickname(access_info.getFullAcct(who))
|
|
|
|
)
|
|
|
|
) {
|
2018-05-08 10:25:02 +02:00
|
|
|
Action_Follow.authorizeFollowRequest(activity, access_info, whoRef, false)
|
2018-04-17 18:29:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-04 20:07:55 +02:00
|
|
|
llFilter -> if(item is TootFilter) {
|
2018-07-07 07:15:16 +02:00
|
|
|
openFilterMenu(item)
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
else -> when(v.id) {
|
2018-01-18 22:22:27 +01:00
|
|
|
R.id.ivCardThumbnail -> status_showing?.card?.url?.let { url ->
|
2018-01-14 22:47:42 +01:00
|
|
|
if(url.isNotEmpty()) App1.openCustomTab(activity, url)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onLongClick(v : View) : Boolean {
|
|
|
|
|
|
|
|
val notification = (item as? TootNotification)
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
when(v) {
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
ivThumbnail -> {
|
2018-01-17 18:39:16 +01:00
|
|
|
status_account?.let { who ->
|
|
|
|
DlgContextMenu(
|
|
|
|
activity,
|
|
|
|
column,
|
|
|
|
who,
|
|
|
|
null,
|
|
|
|
notification
|
|
|
|
).show()
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
llBoosted -> {
|
2018-01-17 18:39:16 +01:00
|
|
|
boost_account?.let { who ->
|
|
|
|
DlgContextMenu(
|
|
|
|
activity,
|
|
|
|
column,
|
|
|
|
who,
|
|
|
|
null,
|
|
|
|
notification
|
|
|
|
).show()
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
llFollow -> {
|
2018-05-08 10:25:02 +02:00
|
|
|
follow_account?.let { whoRef ->
|
2018-01-17 18:39:16 +01:00
|
|
|
DlgContextMenu(
|
|
|
|
activity,
|
|
|
|
column,
|
2018-05-08 10:25:02 +02:00
|
|
|
whoRef,
|
2018-01-17 18:39:16 +01:00
|
|
|
null,
|
|
|
|
notification
|
|
|
|
).show()
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
btnFollow -> {
|
2018-05-08 10:25:02 +02:00
|
|
|
follow_account?.let { whoRef ->
|
2018-01-17 18:39:16 +01:00
|
|
|
Action_Follow.followFromAnotherAccount(
|
|
|
|
activity,
|
|
|
|
activity.nextPosition(column),
|
|
|
|
access_info,
|
2018-05-18 19:08:46 +02:00
|
|
|
whoRef.get()
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
return true
|
|
|
|
}
|
2018-01-10 16:47:35 +01:00
|
|
|
|
2018-05-30 07:18:45 +02:00
|
|
|
btnSearchTag, llTrendTag -> {
|
2018-01-10 16:47:35 +01:00
|
|
|
val item = this.item
|
|
|
|
when(item) {
|
2018-01-14 22:47:42 +01:00
|
|
|
// is TootGap -> column.startGap(item)
|
|
|
|
//
|
|
|
|
// is TootDomainBlock -> {
|
|
|
|
// val domain = item.domain
|
|
|
|
// AlertDialog.Builder(activity)
|
|
|
|
// .setMessage(activity.getString(R.string.confirm_unblock_domain, domain))
|
|
|
|
// .setNegativeButton(R.string.cancel, null)
|
|
|
|
// .setPositiveButton(R.string.ok) { _, _ -> Action_Instance.blockDomain(activity, access_info, domain, false) }
|
|
|
|
// .show()
|
|
|
|
// }
|
2018-01-10 16:47:35 +01:00
|
|
|
|
2018-01-20 07:51:14 +01:00
|
|
|
is TootTag -> {
|
2018-01-10 16:47:35 +01:00
|
|
|
// search_tag は#を含まない
|
2018-01-21 13:46:36 +01:00
|
|
|
val tagEncoded = item.name.encodePercent()
|
2018-01-10 16:47:35 +01:00
|
|
|
val host = access_info.host
|
|
|
|
val url = "https://$host/tags/$tagEncoded"
|
|
|
|
Action_HashTag.timelineOtherInstance(
|
2018-01-14 22:47:42 +01:00
|
|
|
activity = activity,
|
|
|
|
pos = activity.nextPosition(column),
|
|
|
|
url = url,
|
|
|
|
host = host,
|
2018-01-20 07:51:14 +01:00
|
|
|
tag_without_sharp = item.name
|
2018-01-10 16:47:35 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun clickMedia(i : Int) {
|
2018-01-18 22:22:27 +01:00
|
|
|
val status = status_showing ?: return
|
2018-01-04 19:52:25 +01:00
|
|
|
try {
|
|
|
|
val media_attachments = status.media_attachments ?: return
|
|
|
|
val item = if(i < media_attachments.size) media_attachments[i] else return
|
|
|
|
when(item) {
|
|
|
|
is TootAttachmentMSP -> {
|
|
|
|
// マストドン検索ポータルのデータではmedia_attachmentsが簡略化されている
|
|
|
|
// 会話の流れを表示する
|
2018-01-17 18:39:16 +01:00
|
|
|
Action_Toot.conversationOtherInstance(
|
|
|
|
activity,
|
|
|
|
activity.nextPosition(column),
|
2018-01-18 22:22:27 +01:00
|
|
|
status_showing
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
is TootAttachment -> {
|
2018-01-17 02:16:26 +01:00
|
|
|
if(Pref.bpUseInternalMediaViewer(App1.pref)) {
|
2018-01-04 19:52:25 +01:00
|
|
|
// 内蔵メディアビューア
|
2018-08-18 12:58:14 +02:00
|
|
|
val serviceType = when(access_info.isMisskey){
|
|
|
|
true -> ServiceType.MISSKEY
|
|
|
|
else -> ServiceType.MASTODON
|
|
|
|
}
|
|
|
|
ActMediaViewer.open(activity, serviceType, media_attachments, i)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
} else {
|
|
|
|
// ブラウザで開く
|
|
|
|
App1.openCustomTab(activity, item)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch(ex : Throwable) {
|
|
|
|
log.trace(ex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun makeCardView(activity : ActMain, llExtra : LinearLayout, card : TootCard) {
|
2018-01-17 18:39:16 +01:00
|
|
|
var lp = LinearLayout.LayoutParams(
|
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
lp.topMargin = (0.5f + llExtra.resources.displayMetrics.density * 3f).toInt()
|
|
|
|
val tv = MyTextView(activity)
|
|
|
|
tv.layoutParams = lp
|
|
|
|
//
|
2018-01-10 16:47:35 +01:00
|
|
|
tv.movementMethod = MyLinkMovementMethod
|
2018-01-04 19:52:25 +01:00
|
|
|
if(! activity.timeline_font_size_sp.isNaN()) {
|
|
|
|
tv.textSize = activity.timeline_font_size_sp
|
|
|
|
}
|
|
|
|
val c = if(column.content_color != 0) column.content_color else content_color_default
|
|
|
|
tv.setTextColor(c)
|
|
|
|
|
|
|
|
val sb = StringBuilder()
|
|
|
|
addLinkAndCaption(sb, activity.getString(R.string.card_header_card), card.url, card.title)
|
2018-01-17 18:39:16 +01:00
|
|
|
addLinkAndCaption(
|
|
|
|
sb,
|
|
|
|
activity.getString(R.string.card_header_author),
|
|
|
|
card.author_url,
|
|
|
|
card.author_name
|
|
|
|
)
|
|
|
|
addLinkAndCaption(
|
|
|
|
sb,
|
|
|
|
activity.getString(R.string.card_header_provider),
|
|
|
|
card.provider_url,
|
|
|
|
card.provider_name
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
val description = card.description
|
2018-01-14 22:47:42 +01:00
|
|
|
if(description != null && description.isNotEmpty()) {
|
2018-01-04 19:52:25 +01:00
|
|
|
if(sb.isNotEmpty()) sb.append("<br>")
|
|
|
|
sb.append(HTMLDecoder.encodeEntity(description))
|
|
|
|
}
|
|
|
|
val html = sb.toString()
|
|
|
|
//
|
2018-01-21 17:47:13 +01:00
|
|
|
tv.text = DecodeOptions(activity, access_info).decodeHTML(html)
|
2018-01-04 19:52:25 +01:00
|
|
|
llExtra.addView(tv)
|
|
|
|
|
|
|
|
val image = card.image
|
2018-01-14 22:47:42 +01:00
|
|
|
if(image != null && image.isNotEmpty()) {
|
2018-01-17 18:39:16 +01:00
|
|
|
lp = LinearLayout.LayoutParams(
|
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
|
activity.app_state.media_thumb_height
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
lp.topMargin = (0.5f + llExtra.resources.displayMetrics.density * 3f).toInt()
|
|
|
|
val iv = MyNetworkImageView(activity)
|
|
|
|
iv.layoutParams = lp
|
|
|
|
//
|
|
|
|
iv.id = R.id.ivCardThumbnail
|
|
|
|
iv.setOnClickListener(this)
|
2018-01-17 18:39:16 +01:00
|
|
|
iv.scaleType =
|
2018-01-18 19:09:36 +01:00
|
|
|
if(Pref.bpDontCropMediaThumb(App1.pref)) ImageView.ScaleType.FIT_CENTER else ImageView.ScaleType.CENTER_CROP
|
2018-01-17 18:39:16 +01:00
|
|
|
iv.setImageUrl(
|
|
|
|
activity.pref,
|
|
|
|
0f,
|
|
|
|
access_info.supplyBaseUrl(image),
|
|
|
|
access_info.supplyBaseUrl(image)
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
llExtra.addView(iv)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
private fun addLinkAndCaption(
|
|
|
|
sb : StringBuilder,
|
|
|
|
header : String,
|
|
|
|
url : String?,
|
|
|
|
caption : String?
|
|
|
|
) {
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
if(url.isNullOrEmpty() && caption.isNullOrEmpty()) return
|
|
|
|
|
|
|
|
if(sb.isNotEmpty()) sb.append("<br>")
|
|
|
|
|
|
|
|
sb.append(HTMLDecoder.encodeEntity(header)).append(": ")
|
|
|
|
|
|
|
|
if(url != null && url.isNotEmpty()) {
|
|
|
|
sb.append("<a href=\"").append(HTMLDecoder.encodeEntity(url)).append("\">")
|
|
|
|
}
|
2018-01-17 18:39:16 +01:00
|
|
|
sb.append(
|
|
|
|
HTMLDecoder.encodeEntity(
|
|
|
|
when {
|
|
|
|
caption != null && caption.isNotEmpty() -> caption
|
|
|
|
url != null && url.isNotEmpty() -> url
|
|
|
|
else -> "???"
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
if(url != null && url.isNotEmpty()) {
|
|
|
|
sb.append("</a>")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun makeEnqueteChoiceView(
|
|
|
|
enquete : NicoEnquete,
|
|
|
|
now : Long,
|
|
|
|
i : Int,
|
|
|
|
item : Spannable
|
|
|
|
) {
|
|
|
|
|
|
|
|
val remain = enquete.time_start + NicoEnquete.ENQUETE_EXPIRE - now
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
val lp = LinearLayout.LayoutParams(
|
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
if(i == 0)
|
|
|
|
lp.topMargin = (0.5f + llExtra.resources.displayMetrics.density * 3f).toInt()
|
|
|
|
val b = Button(activity)
|
|
|
|
b.layoutParams = lp
|
|
|
|
b.setAllCaps(false)
|
|
|
|
b.text = item
|
|
|
|
val invalidator = NetworkEmojiInvalidator(activity.handler, b)
|
|
|
|
extra_invalidator_list.add(invalidator)
|
|
|
|
invalidator.register(item)
|
|
|
|
if(remain <= 0) {
|
|
|
|
b.isEnabled = false
|
|
|
|
} else {
|
|
|
|
val accessInfo = this@ItemViewHolder.access_info
|
|
|
|
b.setOnClickListener { view ->
|
|
|
|
val context = view.context ?: return@setOnClickListener
|
|
|
|
onClickEnqueteChoice(enquete, context, accessInfo, i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
llExtra.addView(b)
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun makeEnqueteTimerView(enquete : NicoEnquete) {
|
|
|
|
val density = llExtra.resources.displayMetrics.density
|
|
|
|
val height = (0.5f + 6 * density).toInt()
|
|
|
|
val view = EnqueteTimerView(activity)
|
2018-01-17 18:39:16 +01:00
|
|
|
view.layoutParams =
|
|
|
|
LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height)
|
2018-01-04 19:52:25 +01:00
|
|
|
view.setParams(enquete.time_start, NicoEnquete.ENQUETE_EXPIRE)
|
|
|
|
llExtra.addView(view)
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun onClickEnqueteChoice(
|
|
|
|
enquete : NicoEnquete,
|
|
|
|
context : Context,
|
|
|
|
accessInfo : SavedAccount,
|
|
|
|
idx : Int
|
|
|
|
) {
|
|
|
|
val now = System.currentTimeMillis()
|
|
|
|
val remain = enquete.time_start + NicoEnquete.ENQUETE_EXPIRE - now
|
|
|
|
if(remain <= 0) {
|
2018-01-21 13:46:36 +01:00
|
|
|
showToast(context, false, R.string.enquete_was_end)
|
2018-01-04 19:52:25 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
TootTaskRunner(context).run(accessInfo, object : TootTask {
|
|
|
|
override fun background(client : TootApiClient) : TootApiResult? {
|
|
|
|
val form = JSONObject()
|
|
|
|
try {
|
|
|
|
form.put("item_index", Integer.toString(idx))
|
|
|
|
} catch(ex : Throwable) {
|
2018-01-14 22:47:42 +01:00
|
|
|
log.e(ex, "json encode failed.")
|
2018-01-04 19:52:25 +01:00
|
|
|
ex.printStackTrace()
|
|
|
|
}
|
|
|
|
|
|
|
|
val request_builder = Request.Builder()
|
|
|
|
.post(RequestBody.create(TootApiClient.MEDIA_TYPE_JSON, form.toString()))
|
|
|
|
|
|
|
|
return client.request("/api/v1/votes/" + enquete.status_id, request_builder)
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun handleResult(result : TootApiResult?) {
|
|
|
|
result ?: return // cancelled.
|
|
|
|
|
|
|
|
val data = result.jsonObject
|
|
|
|
if(data != null) {
|
2018-01-21 13:46:36 +01:00
|
|
|
val message = data.parseString("message") ?: "?"
|
2018-01-04 19:52:25 +01:00
|
|
|
val valid = data.optBoolean("valid")
|
|
|
|
if(valid) {
|
2018-01-21 13:46:36 +01:00
|
|
|
showToast(context, false, R.string.enquete_voted)
|
2018-01-04 19:52:25 +01:00
|
|
|
} else {
|
2018-01-21 13:46:36 +01:00
|
|
|
showToast(context, true, R.string.enquete_vote_failed, message)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
} else {
|
2018-01-21 13:46:36 +01:00
|
|
|
showToast(context, true, result.error)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-07-07 07:15:16 +02:00
|
|
|
private fun openFilterMenu(item : TootFilter) {
|
|
|
|
val ad = ActionsDialog()
|
2018-08-04 20:07:55 +02:00
|
|
|
ad.addAction(activity.getString(R.string.edit)) {
|
|
|
|
ActKeywordFilter.open(activity, access_info, item.id)
|
2018-07-07 07:15:16 +02:00
|
|
|
}
|
2018-08-04 20:07:55 +02:00
|
|
|
ad.addAction(activity.getString(R.string.delete)) {
|
|
|
|
Action_Filter.delete(activity, access_info, item)
|
2018-07-07 07:15:16 +02:00
|
|
|
}
|
2018-08-04 20:07:55 +02:00
|
|
|
ad.show(activity, activity.getString(R.string.filter_of, item.phrase))
|
2018-07-07 07:15:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
private fun inflate(ui : AnkoContext<Context>) = with(ui) {
|
|
|
|
verticalLayout {
|
|
|
|
// トップレベルのViewGroupのlparamsはイニシャライザ内部に置くしかないみたい
|
2018-08-04 20:07:55 +02:00
|
|
|
layoutParams = RecyclerView.LayoutParams(matchParent, wrapContent)
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
|
|
|
|
topPadding = dip(3)
|
|
|
|
bottomPadding = dip(3)
|
|
|
|
descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
|
|
|
|
|
|
|
|
llBoosted = linearLayout {
|
|
|
|
lparams(matchParent, wrapContent) {
|
|
|
|
bottomMargin = dip(6)
|
|
|
|
}
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
|
|
ivBoosted = imageView {
|
|
|
|
scaleType = ImageView.ScaleType.FIT_END
|
|
|
|
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
|
|
|
|
}.lparams(dip(48), dip(32)) {
|
|
|
|
endMargin = dip(4)
|
|
|
|
}
|
|
|
|
|
|
|
|
verticalLayout {
|
|
|
|
lparams(dip(0), wrapContent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
linearLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
tvBoostedAcct = textView {
|
|
|
|
ellipsize = TextUtils.TruncateAt.END
|
|
|
|
gravity = Gravity.END
|
|
|
|
maxLines = 1
|
|
|
|
textColor = Styler.getAttributeColor(context, R.attr.colorTimeSmall)
|
|
|
|
textSize = 12f // textSize の単位はSP
|
|
|
|
// tools:text ="who@hoge"
|
|
|
|
}.lparams(dip(0), wrapContent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
tvBoostedTime = textView {
|
|
|
|
|
|
|
|
startPadding = dip(2)
|
|
|
|
|
|
|
|
gravity = Gravity.END
|
|
|
|
textColor = Styler.getAttributeColor(context, R.attr.colorTimeSmall)
|
|
|
|
textSize = 12f // textSize の単位はSP
|
|
|
|
// tools:ignore="RtlSymmetry"
|
|
|
|
// tools:text="2017-04-16 09:37:14"
|
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tvBoosted = textView {
|
|
|
|
// tools:text = "~にブーストされました"
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
llFollow = linearLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
|
|
ivFollow = myNetworkImageView {
|
|
|
|
contentDescription = context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.FIT_END
|
|
|
|
}.lparams(dip(48), dip(40)) {
|
|
|
|
endMargin = dip(4)
|
|
|
|
}
|
|
|
|
|
|
|
|
verticalLayout {
|
|
|
|
|
|
|
|
lparams(dip(0), wrapContent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
tvFollowerName = textView {
|
|
|
|
// tools:text="Follower Name"
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
tvFollowerAcct = textView {
|
|
|
|
setPaddingStartEnd(dip(4), dip(4))
|
|
|
|
textColor = Styler.getAttributeColor(context, R.attr.colorTimeSmall)
|
|
|
|
textSize = 12f // SP
|
|
|
|
// tools:text="aaaaaaaaaaaaaaaa"
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
}
|
|
|
|
|
|
|
|
frameLayout {
|
|
|
|
lparams(dip(40), dip(40)) {
|
|
|
|
startMargin = dip(4)
|
|
|
|
}
|
|
|
|
|
|
|
|
btnFollow = imageButton {
|
2018-01-17 18:39:16 +01:00
|
|
|
background =
|
|
|
|
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
2018-01-14 22:47:42 +01:00
|
|
|
contentDescription = context.getString(R.string.follow)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER
|
|
|
|
// tools:src="?attr/ic_follow_plus"
|
|
|
|
}.lparams(matchParent, matchParent)
|
|
|
|
|
|
|
|
ivFollowedBy = imageView {
|
|
|
|
scaleType = ImageView.ScaleType.CENTER
|
|
|
|
// tools:src="?attr/ic_followed_by"
|
|
|
|
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
|
|
|
|
}.lparams(matchParent, matchParent)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
llStatus = verticalLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
linearLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
tvAcct = textView {
|
|
|
|
ellipsize = TextUtils.TruncateAt.END
|
|
|
|
gravity = Gravity.END
|
|
|
|
maxLines = 1
|
|
|
|
textColor = Styler.getAttributeColor(context, R.attr.colorTimeSmall)
|
|
|
|
textSize = 12f // SP
|
|
|
|
// tools:text="who@hoge"
|
|
|
|
}.lparams(dip(0), wrapContent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
tvTime = textView {
|
|
|
|
gravity = Gravity.END
|
|
|
|
startPadding = dip(2)
|
|
|
|
textColor = Styler.getAttributeColor(context, R.attr.colorTimeSmall)
|
|
|
|
textSize = 12f // SP
|
|
|
|
// tools:ignore="RtlSymmetry"
|
|
|
|
// tools:text="2017-04-16 09:37:14"
|
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
linearLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
ivThumbnail = myNetworkImageView {
|
2018-01-17 18:39:16 +01:00
|
|
|
background =
|
|
|
|
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
2018-01-14 22:47:42 +01:00
|
|
|
contentDescription = context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
}.lparams(dip(48), dip(48)) {
|
|
|
|
topMargin = dip(4)
|
|
|
|
endMargin = dip(4)
|
|
|
|
}
|
|
|
|
|
|
|
|
verticalLayout {
|
|
|
|
lparams(dip(0), wrapContent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
tvName = textView {
|
|
|
|
|
|
|
|
// tools:text="Displayname"
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
llContentWarning = linearLayout {
|
|
|
|
lparams(matchParent, wrapContent) {
|
|
|
|
topMargin = dip(3)
|
|
|
|
isBaselineAligned = false
|
|
|
|
}
|
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
|
|
btnContentWarning = button {
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
background =
|
|
|
|
ContextCompat.getDrawable(context, R.drawable.btn_bg_ddd)
|
2018-01-14 22:47:42 +01:00
|
|
|
minWidthCompat = dip(40)
|
|
|
|
padding = dip(4)
|
|
|
|
//tools:text="見る"
|
|
|
|
}.lparams(wrapContent, dip(40)) {
|
|
|
|
endMargin = dip(8)
|
|
|
|
}
|
|
|
|
|
|
|
|
verticalLayout {
|
|
|
|
lparams(dip(0), wrapContent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
tvMentions = myTextView {
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
tvContentWarning = myTextView {
|
|
|
|
}.lparams(matchParent, wrapContent) {
|
|
|
|
topMargin = dip(3)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
llContents = verticalLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
tvContent = myTextView {
|
|
|
|
setLineSpacing(lineSpacingExtra, 1.1f)
|
|
|
|
// tools:text="Contents\nContents"
|
|
|
|
}.lparams(matchParent, wrapContent) {
|
|
|
|
topMargin = dip(3)
|
|
|
|
}
|
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
val actMain = activity as? ActMain
|
|
|
|
val thumbnailHeight = actMain?.app_state?.media_thumb_height ?: dip(64)
|
2018-04-05 20:04:45 +02:00
|
|
|
val verticalArrangeThumbnails = Pref.bpVerticalArrangeThumbnails(
|
|
|
|
actMain?.pref ?: Pref.pref(context)
|
|
|
|
)
|
2018-03-21 16:39:10 +01:00
|
|
|
|
2018-04-05 20:04:45 +02:00
|
|
|
flMedia = if(verticalArrangeThumbnails) {
|
2018-03-21 16:39:10 +01:00
|
|
|
frameLayout {
|
2018-04-05 20:04:45 +02:00
|
|
|
lparams(matchParent, wrapContent) {
|
2018-03-21 16:39:10 +01:00
|
|
|
topMargin = dip(3)
|
|
|
|
}
|
|
|
|
llMedia = verticalLayout {
|
|
|
|
lparams(matchParent, matchParent)
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
btnHideMedia = imageButton {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.btn_bg_transparent
|
|
|
|
)
|
|
|
|
contentDescription = "@string/hide"
|
|
|
|
imageResource =
|
|
|
|
Styler.getAttributeResourceId(
|
|
|
|
context,
|
|
|
|
R.attr.btn_close
|
|
|
|
)
|
2018-04-05 20:04:45 +02:00
|
|
|
}.lparams(dip(32), dip(32)) {
|
2018-03-21 16:39:10 +01:00
|
|
|
gravity = Gravity.END
|
|
|
|
}
|
2018-03-06 23:28:41 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
ivMedia1 = myNetworkImageView {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.bg_thumbnail
|
|
|
|
)
|
|
|
|
contentDescription =
|
|
|
|
context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
|
|
|
|
}.lparams(matchParent, thumbnailHeight) {
|
|
|
|
topMargin = dip(3)
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
ivMedia2 = myNetworkImageView {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.bg_thumbnail
|
|
|
|
)
|
|
|
|
contentDescription =
|
|
|
|
context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
|
|
|
|
}.lparams(matchParent, thumbnailHeight) {
|
|
|
|
topMargin = dip(3)
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
ivMedia3 = myNetworkImageView {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.bg_thumbnail
|
|
|
|
)
|
|
|
|
contentDescription =
|
|
|
|
context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
|
|
|
|
}.lparams(matchParent, thumbnailHeight) {
|
|
|
|
topMargin = dip(3)
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
ivMedia4 = myNetworkImageView {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.bg_thumbnail
|
|
|
|
)
|
|
|
|
contentDescription =
|
|
|
|
context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
|
|
|
|
}.lparams(matchParent, thumbnailHeight) {
|
|
|
|
topMargin = dip(3)
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
btnShowMedia = textView {
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
backgroundColor = Styler.getAttributeColor(
|
2018-01-17 18:39:16 +01:00
|
|
|
context,
|
2018-03-21 16:39:10 +01:00
|
|
|
R.attr.colorShowMediaBackground
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
2018-03-21 16:39:10 +01:00
|
|
|
gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
|
|
|
text = context.getString(R.string.tap_to_show)
|
|
|
|
textColor =
|
2018-04-05 20:04:45 +02:00
|
|
|
Styler.getAttributeColor(
|
|
|
|
context,
|
|
|
|
R.attr.colorShowMediaText
|
|
|
|
)
|
|
|
|
endPadding = dip(4)
|
2018-03-21 16:39:10 +01:00
|
|
|
minHeightCompat = dip(32)
|
|
|
|
}.lparams(matchParent, matchParent)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
frameLayout {
|
|
|
|
lparams(matchParent, thumbnailHeight) {
|
|
|
|
topMargin = dip(3)
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
2018-03-21 16:39:10 +01:00
|
|
|
llMedia = linearLayout {
|
|
|
|
lparams(matchParent, matchParent)
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
ivMedia1 = myNetworkImageView {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.bg_thumbnail
|
|
|
|
)
|
|
|
|
contentDescription =
|
|
|
|
context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
|
|
|
|
}.lparams(0, matchParent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
ivMedia2 = myNetworkImageView {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.bg_thumbnail
|
|
|
|
)
|
|
|
|
contentDescription =
|
|
|
|
context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
|
|
|
|
}.lparams(0, matchParent) {
|
|
|
|
startMargin = dip(8)
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
ivMedia3 = myNetworkImageView {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.bg_thumbnail
|
|
|
|
)
|
|
|
|
contentDescription =
|
|
|
|
context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
|
|
|
|
}.lparams(0, matchParent) {
|
|
|
|
startMargin = dip(8)
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
ivMedia4 = myNetworkImageView {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.bg_thumbnail
|
|
|
|
)
|
|
|
|
contentDescription =
|
|
|
|
context.getString(R.string.thumbnail)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER_CROP
|
|
|
|
|
|
|
|
}.lparams(0, matchParent) {
|
|
|
|
startMargin = dip(8)
|
|
|
|
weight = 1f
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
btnHideMedia = imageButton {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.btn_bg_transparent
|
|
|
|
)
|
|
|
|
contentDescription = "@string/hide"
|
|
|
|
imageResource =
|
|
|
|
Styler.getAttributeResourceId(
|
|
|
|
context,
|
|
|
|
R.attr.btn_close
|
|
|
|
)
|
|
|
|
}.lparams(dip(32), matchParent) {
|
|
|
|
startMargin = dip(8)
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
btnShowMedia = textView {
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
backgroundColor = Styler.getAttributeColor(
|
2018-01-17 18:39:16 +01:00
|
|
|
context,
|
2018-03-21 16:39:10 +01:00
|
|
|
R.attr.colorShowMediaBackground
|
2018-01-17 18:39:16 +01:00
|
|
|
)
|
2018-03-21 16:39:10 +01:00
|
|
|
gravity = Gravity.CENTER
|
|
|
|
text = context.getString(R.string.tap_to_show)
|
|
|
|
textColor =
|
2018-04-05 20:04:45 +02:00
|
|
|
Styler.getAttributeColor(
|
|
|
|
context,
|
|
|
|
R.attr.colorShowMediaText
|
|
|
|
)
|
2018-03-21 16:39:10 +01:00
|
|
|
|
|
|
|
}.lparams(matchParent, matchParent)
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-05 20:04:45 +02:00
|
|
|
|
2018-03-21 16:39:10 +01:00
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
|
|
|
|
llExtra = verticalLayout {
|
|
|
|
lparams(matchParent, wrapContent) {
|
|
|
|
topMargin = dip(0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// button bar
|
|
|
|
llButtonBar = linearLayout {
|
|
|
|
lparams(wrapContent, dip(40)) {
|
|
|
|
topMargin = dip(3)
|
|
|
|
}
|
|
|
|
|
2018-08-16 10:02:55 +02:00
|
|
|
val marginBetween = dip(2)
|
|
|
|
val compoundPadding= dip(0.5f)
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
btnConversation = imageButton {
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.btn_bg_transparent
|
|
|
|
)
|
2018-01-14 22:47:42 +01:00
|
|
|
contentDescription = context.getString(R.string.conversation_view)
|
|
|
|
minimumWidth = dip(40)
|
2018-01-17 18:39:16 +01:00
|
|
|
imageResource =
|
|
|
|
Styler.getAttributeResourceId(context, R.attr.ic_conversation)
|
2018-01-14 22:47:42 +01:00
|
|
|
}.lparams(wrapContent, matchParent)
|
|
|
|
|
2018-08-16 10:02:55 +02:00
|
|
|
btnReply = button {
|
2018-01-14 22:47:42 +01:00
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.btn_bg_transparent
|
|
|
|
)
|
2018-08-16 10:02:55 +02:00
|
|
|
compoundDrawablePadding = compoundPadding
|
|
|
|
minWidthCompat = dip(48)
|
|
|
|
setPaddingStartEnd(dip(4), dip(4))
|
|
|
|
// imageResource = Styler.getAttributeResourceId(context, R.attr.btn_reply)
|
2018-01-14 22:47:42 +01:00
|
|
|
}.lparams(wrapContent, matchParent) {
|
2018-08-16 10:02:55 +02:00
|
|
|
startMargin = marginBetween
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
btnBoost = button {
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.btn_bg_transparent
|
|
|
|
)
|
2018-08-16 10:02:55 +02:00
|
|
|
compoundDrawablePadding = compoundPadding
|
2018-01-14 22:47:42 +01:00
|
|
|
|
|
|
|
minWidthCompat = dip(48)
|
|
|
|
setPaddingStartEnd(dip(4), dip(4))
|
|
|
|
}.lparams(wrapContent, matchParent) {
|
2018-08-16 10:02:55 +02:00
|
|
|
startMargin = marginBetween
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
btnFavourite = button {
|
2018-01-17 18:39:16 +01:00
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.btn_bg_transparent
|
|
|
|
)
|
2018-08-16 10:02:55 +02:00
|
|
|
compoundDrawablePadding = compoundPadding
|
2018-01-14 22:47:42 +01:00
|
|
|
minWidthCompat = dip(48)
|
|
|
|
setPaddingStartEnd(dip(4), dip(4))
|
|
|
|
|
|
|
|
}.lparams(wrapContent, matchParent) {
|
2018-08-16 10:02:55 +02:00
|
|
|
startMargin = marginBetween
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
llFollow2 = frameLayout {
|
|
|
|
lparams(dip(40), dip(40)) {
|
2018-08-16 10:02:55 +02:00
|
|
|
startMargin = marginBetween
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
btnFollow2 = imageButton {
|
|
|
|
|
2018-01-17 18:39:16 +01:00
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.btn_bg_transparent
|
|
|
|
)
|
2018-01-14 22:47:42 +01:00
|
|
|
contentDescription = context.getString(R.string.follow)
|
|
|
|
scaleType = ImageView.ScaleType.CENTER
|
|
|
|
// tools:src="?attr/ic_follow_plus"
|
|
|
|
minimumWidth = dip(40)
|
|
|
|
|
|
|
|
}.lparams(matchParent, matchParent)
|
|
|
|
|
|
|
|
ivFollowedBy2 = imageView {
|
|
|
|
|
|
|
|
scaleType = ImageView.ScaleType.CENTER
|
2018-01-17 18:39:16 +01:00
|
|
|
imageResource = Styler.getAttributeResourceId(
|
|
|
|
context,
|
|
|
|
R.attr.ic_followed_by
|
|
|
|
)
|
2018-01-14 22:47:42 +01:00
|
|
|
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
|
|
|
|
}.lparams(matchParent, matchParent)
|
|
|
|
}
|
|
|
|
|
|
|
|
btnMore = imageButton {
|
2018-01-17 18:39:16 +01:00
|
|
|
background = ContextCompat.getDrawable(
|
|
|
|
context,
|
|
|
|
R.drawable.btn_bg_transparent
|
|
|
|
)
|
2018-01-14 22:47:42 +01:00
|
|
|
contentDescription = context.getString(R.string.more)
|
2018-01-17 18:39:16 +01:00
|
|
|
imageResource =
|
|
|
|
Styler.getAttributeResourceId(context, R.attr.btn_more)
|
2018-01-14 22:47:42 +01:00
|
|
|
minimumWidth = dip(40)
|
|
|
|
}.lparams(wrapContent, matchParent) {
|
2018-08-16 10:02:55 +02:00
|
|
|
startMargin = marginBetween
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tvApplication = textView {
|
|
|
|
gravity = Gravity.END
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
llSearchTag = linearLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
btnSearchTag = button {
|
|
|
|
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
|
|
|
allCaps = false
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
}
|
|
|
|
|
2018-05-30 07:18:45 +02:00
|
|
|
llTrendTag = linearLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
|
|
|
|
|
|
|
verticalLayout {
|
|
|
|
lparams(0, wrapContent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
tvTrendTagName = textView {
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
tvTrendTagDesc = textView {
|
|
|
|
textColor = Styler.getAttributeColor(context, R.attr.colorTimeSmall)
|
|
|
|
textSize = 12f // SP
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
}
|
|
|
|
tvTrendTagCount = textView {
|
|
|
|
|
|
|
|
}.lparams(wrapContent, wrapContent) {
|
|
|
|
startMargin = dip(6)
|
|
|
|
endMargin = dip(6)
|
|
|
|
}
|
|
|
|
|
|
|
|
cvTrendTagHistory = trendTagHistoryView {
|
|
|
|
|
|
|
|
}.lparams(dip(64), dip(32))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-01-14 22:47:42 +01:00
|
|
|
llList = linearLayout {
|
|
|
|
lparams(matchParent, wrapContent)
|
|
|
|
|
|
|
|
btnListTL = button {
|
|
|
|
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
|
|
|
allCaps = false
|
|
|
|
}.lparams(0, wrapContent) {
|
|
|
|
weight = 1f
|
|
|
|
}
|
|
|
|
|
|
|
|
btnListMore = imageButton {
|
|
|
|
|
|
|
|
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
|
|
|
imageResource = Styler.getAttributeResourceId(context, R.attr.btn_more)
|
|
|
|
contentDescription = context.getString(R.string.more)
|
|
|
|
}.lparams(dip(40), dip(40)) {
|
|
|
|
startMargin = dip(4)
|
|
|
|
}
|
|
|
|
}
|
2018-04-17 18:29:50 +02:00
|
|
|
|
2018-05-24 18:33:09 +02:00
|
|
|
tvMessageHolder = textView {
|
|
|
|
padding = dip(4)
|
2018-05-20 00:31:59 +02:00
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
|
2018-04-17 18:29:50 +02:00
|
|
|
llFollowRequest = linearLayout {
|
|
|
|
lparams(matchParent, wrapContent) {
|
|
|
|
topMargin = dip(6)
|
|
|
|
}
|
|
|
|
gravity = Gravity.END
|
|
|
|
|
|
|
|
btnFollowRequestAccept = imageButton {
|
|
|
|
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
|
|
|
contentDescription = context.getString(R.string.follow_accept)
|
|
|
|
imageResource = Styler.getAttributeResourceId(context, R.attr.ic_check)
|
2018-05-08 10:55:08 +02:00
|
|
|
setPadding(0, 0, 0, 0)
|
|
|
|
}.lparams(dip(48f), dip(32f))
|
2018-04-17 18:29:50 +02:00
|
|
|
|
|
|
|
btnFollowRequestDeny = imageButton {
|
|
|
|
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
|
|
|
|
contentDescription = context.getString(R.string.follow_deny)
|
|
|
|
imageResource = Styler.getAttributeResourceId(context, R.attr.btn_close)
|
2018-05-08 10:55:08 +02:00
|
|
|
setPadding(0, 0, 0, 0)
|
|
|
|
}.lparams(dip(48f), dip(32f)) {
|
2018-04-17 18:29:50 +02:00
|
|
|
startMargin = dip(4)
|
|
|
|
}
|
|
|
|
}
|
2018-07-07 07:15:16 +02:00
|
|
|
|
|
|
|
llFilter = verticalLayout {
|
|
|
|
lparams(matchParent, wrapContent) {
|
|
|
|
}
|
|
|
|
minimumHeight = dip(40)
|
2018-08-04 20:07:55 +02:00
|
|
|
|
|
|
|
tvFilterPhrase = textView {
|
2018-07-07 07:15:16 +02:00
|
|
|
typeface = Typeface.DEFAULT_BOLD
|
|
|
|
}.lparams(matchParent, wrapContent)
|
2018-08-04 20:07:55 +02:00
|
|
|
|
|
|
|
tvFilterDetail = textView {
|
2018-07-07 07:15:16 +02:00
|
|
|
textColor = Styler.getAttributeColor(context, R.attr.colorTimeSmall)
|
|
|
|
textSize = 12f // SP
|
|
|
|
}.lparams(matchParent, wrapContent)
|
|
|
|
}
|
2018-01-14 22:47:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|