Skip to content

Commit

Permalink
tootsearchカラムで「~への返信」を押した時の挙動を改善
Browse files Browse the repository at this point in the history
  • Loading branch information
tateisu committed Sep 23, 2019
1 parent d999fa0 commit 9e2d2af
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.kt
Expand Up @@ -735,13 +735,13 @@ internal class ItemViewHolder(
}

in_reply_to_id != null && in_reply_to_account_id != null -> {
showReply(in_reply_to_account_id,item)
showReply(in_reply_to_account_id, item)
if(colorBgArg == 0) colorBg = Pref.ipEventBgColorMention(activity.pref)
}
}
showStatus(item, colorBg)
}

private fun showMessageHolder(item : TootMessageHolder) {
tvMessageHolder.visibility = View.VISIBLE
tvMessageHolder.text = item.text
Expand Down Expand Up @@ -1008,14 +1008,14 @@ internal class ItemViewHolder(
}

private fun showSearchTag(tag : TootTag) {
if( tag.history?.isNotEmpty() == true ){
if(tag.history?.isNotEmpty() == true) {
llTrendTag.visibility = View.VISIBLE
tvTrendTagName.text = "#${tag.name}"
tvTrendTagDesc.text =
activity.getString(R.string.people_talking, tag.accountDaily, tag.accountWeekly)
tvTrendTagCount.text = "${tag.countDaily}(${tag.countWeekly})"
cvTagHistory.setHistory(tag.history)
}else{
} else {
llSearchTag.visibility = View.VISIBLE
btnSearchTag.text = "#" + tag.name

Expand Down Expand Up @@ -1073,16 +1073,17 @@ internal class ItemViewHolder(

private fun showReply(
accountId : EntityId,
replyStatus : TootStatus
reply : TootStatus
) {
val iconId = R.drawable.ic_reply
status_reply = reply


llReply.visibility = View.VISIBLE

val name = if(accountId == replyStatus.account.id) {
AcctColor.getNicknameWithColor(access_info.getFullAcct(replyStatus.account))
val name = if(accountId == reply.account.id) {
AcctColor.getNicknameWithColor(access_info.getFullAcct(reply.account))
} else {
val m = replyStatus.mentions?.find { it.id == accountId }
val m = reply.mentions?.find { it.id == accountId }
if(m != null) {
AcctColor.getNicknameWithColor(access_info.getFullAcct(m.acct))
} else {
Expand All @@ -1091,12 +1092,7 @@ internal class ItemViewHolder(
}

val text = name.intoStringResource(activity, R.string.reply_to)

// val who = reply.account
// showStatusTime(activity, tvReplyTime, who, time = reply.time_created_at)
// setAcct(tvReplyAcct, access_info.getFullAcct(who), who.acct)

showReply(iconId, text)
showReply(R.drawable.ic_reply, text)
}

private fun showBoost(
Expand Down Expand Up @@ -1155,8 +1151,7 @@ internal class ItemViewHolder(

setAcct(tvFollowerAcct, access_info.getFullAcct(who), who.acct)

who.setAccountExtra(tvLastStatusAt,access_info)

who.setAccountExtra(tvLastStatusAt, access_info)

val relation = UserRelation.load(access_info.db_id, who.id)
Styler.setFollowIcon(
Expand Down Expand Up @@ -2575,10 +2570,10 @@ internal class ItemViewHolder(

TootPollsType.FriendsNico -> {
val remain = enquete.time_start + TootPolls.ENQUETE_EXPIRE - now
remain > 0L && !enquete.ownVoted
remain > 0L && ! enquete.ownVoted
}

TootPollsType.Misskey -> !enquete.ownVoted
TootPollsType.Misskey -> ! enquete.ownVoted
}

items.forEachIndexed { index, choice ->
Expand Down Expand Up @@ -2608,10 +2603,10 @@ internal class ItemViewHolder(
val sb = SpannableStringBuilder()
.append(item.decoded_text)

if( enquete.ownVoted ) {
if(enquete.ownVoted) {
sb.append(" / ")
sb.append(activity.getString(R.string.vote_count_text, item.votes))
if( item.isVoted ) sb.append(' ').append(0x2713.toChar())
if(item.isVoted) sb.append(' ').append(0x2713.toChar())
}
sb
}
Expand All @@ -2633,7 +2628,7 @@ internal class ItemViewHolder(
else -> activity.getString(R.string.vote_count_text, v)
}
)
if( item.isVoted ) sb.append(' ').append(0x2713.toChar())
if(item.isVoted) sb.append(' ').append(0x2713.toChar())
}
sb
}
Expand Down

0 comments on commit 9e2d2af

Please sign in to comment.