pref: 优化 IP 属地显示

This commit is contained in:
HuanCheng65 2022-06-24 07:30:28 +08:00
parent 9af7abe934
commit b94d638928
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
3 changed files with 22 additions and 12 deletions

View File

@ -200,13 +200,18 @@ class ThreadMainPostAdapter(
ImageUtil.LOAD_TYPE_AVATAR,
user.portrait
)
holder.setText(
R.id.thread_list_item_user_time,
var timeText =
context.getString(
R.string.tip_thread_item_thread,
DateTimeUtils.getRelativeTimeString(context, threadBean.createTime!!),
user.ipAddress
DateTimeUtils.getRelativeTimeString(context, threadBean.createTime!!)
)
if (user.ipAddress?.isNotEmpty() == true) {
timeText += " "
timeText += context.getString(R.string.text_ip_location, user.ipAddress)
}
holder.setText(
R.id.thread_list_item_user_time,
timeText
)
holder.setText(R.id.thread_list_item_content_title, title)
if (threadPostBean != null) {

View File

@ -610,14 +610,18 @@ class ThreadReplyAdapter(context: Context) :
)
}
initContentView(viewHolder, item)
var timeText = context.getString(
R.string.tip_thread_item,
item.floor,
getRelativeTimeString(context, item.time!!)
)
if (userInfoBean?.ipAddress?.isNotEmpty() == true) {
timeText += " "
timeText += context.getString(R.string.text_ip_location, userInfoBean.ipAddress)
}
viewHolder.setText(
R.id.thread_list_item_user_time,
context.getString(
R.string.tip_thread_item,
item.floor,
getRelativeTimeString(context, item.time!!),
userInfoBean?.ipAddress
)
timeText
)
initFloorView(viewHolder, item)
if (isPureRead) {

View File

@ -172,7 +172,8 @@
<string name="menu_save_photo">保存图片</string>
<string name="toast_play_failed">播放失败</string>
<string name="toast_cannot_view">抱歉,当前暂时无法浏览本吧</string>
<string name="tip_thread_item">第 %1$s 楼 %2$s 来自%3$s</string>
<string name="tip_thread_item">第 %1$s 楼 %2$s</string>
<string name="text_ip_location">来自%1$s</string>
<string name="tip_floor_more_count">查看更多回复(%1$s)</string>
<string name="update_tip_title">发现新版本 %1$s(%2$s)</string>
<string name="update_tip_header">更新 · %1$s</string>
@ -409,7 +410,7 @@
<string name="text_badge_history_forum">贴吧</string>
<string name="title_history_thread">贴子记录</string>
<string name="title_history_forum">经过贴吧</string>
<string name="tip_thread_item_thread">%1$s 来自%2$s</string>
<string name="tip_thread_item_thread">%1$s</string>
<string name="title_all_reply">全部</string>
<string name="title_thread_header">回复 %1$s</string>
<string name="btn_agree_post">%1$s 赞</string>