From e7428f6bb9d63c5b81b96b9ba316ccade9754f43 Mon Sep 17 00:00:00 2001 From: tateisu Date: Sun, 6 Jan 2019 17:35:22 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=83=A0=E3=83=8D=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E3=83=A1=E3=83=87=E3=82=A3=E3=82=A2=E3=82=BF=E3=82=A4?= =?UTF-8?q?=E3=83=97=E8=A1=A8=E7=A4=BA=E3=81=AB=E5=8F=A4=E3=81=84=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=82=BF=E3=81=AE=E5=86=85=E5=AE=B9=E3=81=8C=E6=AE=8B?= =?UTF-8?q?=E3=82=8B=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82=E3=82=8B=E3=83=90?= =?UTF-8?q?=E3=82=B0=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jp/juggler/subwaytooter/ItemViewHolder.kt | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.kt b/app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.kt index c2e36866..f423e3c9 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.kt +++ b/app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.kt @@ -1464,15 +1464,13 @@ internal class ItemViewHolder( } else -> { - when(ta.type) { - TootAttachmentLike.TYPE_VIDEO -> { - iv.setMediaType(R.drawable.media_type_video) + iv.setMediaType( + when(ta.type) { + TootAttachmentLike.TYPE_VIDEO -> R.drawable.media_type_video + TootAttachmentLike.TYPE_GIFV -> R.drawable.media_type_gifv + else -> 0 } - - TootAttachmentLike.TYPE_GIFV -> { - iv.setMediaType(R.drawable.media_type_gifv) - } - } + ) iv.setDefaultImageResId(0) iv.setImageUrl( activity.pref, @@ -1559,7 +1557,7 @@ internal class ItemViewHolder( ivThumbnail -> status_account?.let { whoRef -> when { - access_info.isNA ->DlgContextMenu( + access_info.isNA -> DlgContextMenu( activity, column, whoRef, @@ -1993,9 +1991,9 @@ internal class ItemViewHolder( } - private fun makeReactionsView(status:TootStatus ) { + private fun makeReactionsView(status : TootStatus) { if(! access_info.isMisskey) return - + val reactionsCount = status.reactionCounts val density = activity.density @@ -2033,13 +2031,14 @@ internal class ItemViewHolder( ) val hasMyReaction = status.myReaction?.isNotEmpty() == true - b.contentDescription = activity.getString(if(hasMyReaction) R.string.reaction_remove else R.string.reaction_add ) + b.contentDescription = + activity.getString(if(hasMyReaction) R.string.reaction_remove else R.string.reaction_add) b.scaleType = ImageView.ScaleType.FIT_CENTER b.padding = paddingV b.setOnClickListener { - if( hasMyReaction ){ + if(hasMyReaction) { removeReaction(status, false) - }else{ + } else { addReaction(status, null) } } @@ -2190,9 +2189,9 @@ internal class ItemViewHolder( if(access_info.isPseudo || ! access_info.isMisskey) return - if(!confirmed) { + if(! confirmed) { AlertDialog.Builder(activity) - .setMessage(activity.getString(R.string.reaction_remove_confirm,reaction)) + .setMessage(activity.getString(R.string.reaction_remove_confirm, reaction)) .setNegativeButton(R.string.cancel, null) .setPositiveButton(R.string.ok) { _, _ -> removeReaction(status, confirmed = true) @@ -2211,7 +2210,6 @@ internal class ItemViewHolder( .put("noteId", status.id.toString()) .toPostRequestBuilder() ) - override fun handleResult(result : TootApiResult?) { result ?: return @@ -2223,14 +2221,18 @@ internal class ItemViewHolder( } if((result.response?.code() ?: - 1) in 200 until 300) { - if(status.decreaseReaction(reaction,true,"removeReaction" )) { + if(status.decreaseReaction(reaction, true, "removeReaction")) { // 1個だけ描画更新するのではなく、TLにある複数の要素をまとめて更新する - list_adapter.notifyChange(reason = "removeReaction complete", reset = true) + list_adapter.notifyChange( + reason = "removeReaction complete", + reset = true + ) } } } }) } + private fun makeEnqueteChoiceView( enquete : NicoEnquete, now : Long,