feat: IP 属地显示
This commit is contained in:
parent
3bbc9f79c8
commit
24084fa9a6
|
|
@ -22,7 +22,6 @@ import com.huanchengfly.tieba.post.fragments.MenuDialogFragment
|
||||||
import com.huanchengfly.tieba.post.models.ReplyInfoBean
|
import com.huanchengfly.tieba.post.models.ReplyInfoBean
|
||||||
import com.huanchengfly.tieba.post.plugins.PluginManager
|
import com.huanchengfly.tieba.post.plugins.PluginManager
|
||||||
import com.huanchengfly.tieba.post.utils.*
|
import com.huanchengfly.tieba.post.utils.*
|
||||||
import com.huanchengfly.tieba.post.utils.NavigationHelper
|
|
||||||
import com.huanchengfly.tieba.post.utils.TiebaUtil.reportPost
|
import com.huanchengfly.tieba.post.utils.TiebaUtil.reportPost
|
||||||
import com.huanchengfly.tieba.post.widgets.MyLinearLayout
|
import com.huanchengfly.tieba.post.widgets.MyLinearLayout
|
||||||
|
|
||||||
|
|
@ -164,7 +163,8 @@ class ThreadMainPostAdapter(
|
||||||
R.id.thread_list_item_user_time,
|
R.id.thread_list_item_user_time,
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.tip_thread_item_thread,
|
R.string.tip_thread_item_thread,
|
||||||
DateTimeUtils.getRelativeTimeString(context, threadBean.createTime!!)
|
DateTimeUtils.getRelativeTimeString(context, threadBean.createTime!!),
|
||||||
|
user.ipAddress
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
holder.setText(R.id.thread_list_item_content_title, title)
|
holder.setText(R.id.thread_list_item_content_title, title)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ import com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class ThreadReplyAdapter(context: Context) : BaseSingleTypeDelegateAdapter<PostListItemBean>(context, LinearLayoutHelper()) {
|
class ThreadReplyAdapter(context: Context) : BaseSingleTypeDelegateAdapter<PostListItemBean>(context, LinearLayoutHelper()) {
|
||||||
private var userInfoBeanMap: MutableMap<String?, ThreadContentBean.UserInfoBean?> = HashMap()
|
private var userInfoBeanMap: MutableMap<String?, ThreadContentBean.UserInfoBean?> = HashMap()
|
||||||
|
|
@ -418,27 +417,60 @@ class ThreadReplyAdapter(context: Context) : BaseSingleTypeDelegateAdapter<PostL
|
||||||
}
|
}
|
||||||
viewHolder.setText(R.id.thread_list_item_user_name, if (userInfoBean == null) item.authorId else StringUtil.getUsernameString(context, userInfoBean.name, userInfoBean.nameShow))
|
viewHolder.setText(R.id.thread_list_item_user_name, if (userInfoBean == null) item.authorId else StringUtil.getUsernameString(context, userInfoBean.name, userInfoBean.nameShow))
|
||||||
if (userInfoBean != null) {
|
if (userInfoBean != null) {
|
||||||
val levelId = if (userInfoBean.levelId == null || TextUtils.isEmpty(userInfoBean.levelId)) "?" else userInfoBean.levelId
|
val levelId =
|
||||||
ThemeUtil.setChipThemeByLevel(levelId,
|
if (userInfoBean.levelId == null || TextUtils.isEmpty(userInfoBean.levelId)) "?" else userInfoBean.levelId
|
||||||
|
ThemeUtil.setChipThemeByLevel(
|
||||||
|
levelId,
|
||||||
viewHolder.getView(R.id.thread_list_item_user_status),
|
viewHolder.getView(R.id.thread_list_item_user_status),
|
||||||
viewHolder.getView(R.id.thread_list_item_user_level),
|
viewHolder.getView(R.id.thread_list_item_user_level),
|
||||||
viewHolder.getView(R.id.thread_list_item_user_lz_tip))
|
viewHolder.getView(R.id.thread_list_item_user_lz_tip)
|
||||||
|
)
|
||||||
viewHolder.setText(R.id.thread_list_item_user_level, levelId)
|
viewHolder.setText(R.id.thread_list_item_user_level, levelId)
|
||||||
viewHolder.setOnClickListener(R.id.thread_list_item_user_avatar) { view: View? -> NavigationHelper.toUserSpaceWithAnim(context, userInfoBean.id, StringUtil.getAvatarUrl(userInfoBean.portrait), view) }
|
viewHolder.setOnClickListener(R.id.thread_list_item_user_avatar) { view: View? ->
|
||||||
ImageUtil.load(viewHolder.getView(R.id.thread_list_item_user_avatar), ImageUtil.LOAD_TYPE_AVATAR, userInfoBean.portrait)
|
NavigationHelper.toUserSpaceWithAnim(
|
||||||
|
context,
|
||||||
|
userInfoBean.id,
|
||||||
|
StringUtil.getAvatarUrl(userInfoBean.portrait),
|
||||||
|
view
|
||||||
|
)
|
||||||
|
}
|
||||||
|
ImageUtil.load(
|
||||||
|
viewHolder.getView(R.id.thread_list_item_user_avatar),
|
||||||
|
ImageUtil.LOAD_TYPE_AVATAR,
|
||||||
|
userInfoBean.portrait
|
||||||
|
)
|
||||||
}
|
}
|
||||||
initContentView(viewHolder, item)
|
initContentView(viewHolder, item)
|
||||||
viewHolder.setText(R.id.thread_list_item_user_time, context.getString(R.string.tip_thread_item, item.floor, getRelativeTimeString(context, item.time!!)))
|
viewHolder.setText(
|
||||||
|
R.id.thread_list_item_user_time,
|
||||||
|
context.getString(
|
||||||
|
R.string.tip_thread_item,
|
||||||
|
item.floor,
|
||||||
|
getRelativeTimeString(context, item.time!!),
|
||||||
|
userInfoBean?.ipAddress
|
||||||
|
)
|
||||||
|
)
|
||||||
initFloorView(viewHolder, item)
|
initFloorView(viewHolder, item)
|
||||||
if (isPureRead) {
|
if (isPureRead) {
|
||||||
viewHolder.getView<View>(R.id.thread_list_item_content).setPadding(DisplayUtil.dp2px(context, 4f), 0, DisplayUtil.dp2px(context, 4f), 0)
|
viewHolder.getView<View>(R.id.thread_list_item_content)
|
||||||
|
.setPadding(DisplayUtil.dp2px(context, 4f), 0, DisplayUtil.dp2px(context, 4f), 0)
|
||||||
viewHolder.setVisibility(R.id.thread_list_item_user, View.GONE)
|
viewHolder.setVisibility(R.id.thread_list_item_user, View.GONE)
|
||||||
viewHolder.setVisibility(R.id.thread_list_item_content_floor_card, View.GONE)
|
viewHolder.setVisibility(R.id.thread_list_item_content_floor_card, View.GONE)
|
||||||
} else {
|
} else {
|
||||||
if (viewHolder.getView<View>(R.id.thread_list_item_content).layoutDirection == View.LAYOUT_DIRECTION_LTR) {
|
if (viewHolder.getView<View>(R.id.thread_list_item_content).layoutDirection == View.LAYOUT_DIRECTION_LTR) {
|
||||||
viewHolder.getView<View>(R.id.thread_list_item_content).setPadding(DisplayUtil.dp2px(context, 38f), 0, DisplayUtil.dp2px(context, 4f), 0)
|
viewHolder.getView<View>(R.id.thread_list_item_content).setPadding(
|
||||||
|
DisplayUtil.dp2px(context, 38f),
|
||||||
|
0,
|
||||||
|
DisplayUtil.dp2px(context, 4f),
|
||||||
|
0
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
viewHolder.getView<View>(R.id.thread_list_item_content).setPadding(DisplayUtil.dp2px(context, 4f), 0, DisplayUtil.dp2px(context, 38f), 0)
|
viewHolder.getView<View>(R.id.thread_list_item_content).setPadding(
|
||||||
|
DisplayUtil.dp2px(context, 4f),
|
||||||
|
0,
|
||||||
|
DisplayUtil.dp2px(context, 38f),
|
||||||
|
0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
viewHolder.setVisibility(R.id.thread_list_item_user, View.VISIBLE)
|
viewHolder.setVisibility(R.id.thread_list_item_user, View.VISIBLE)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,14 @@ class ThreadContentBean : BaseBean() {
|
||||||
@SerializedName("is_like")
|
@SerializedName("is_like")
|
||||||
val isLike: String? = null
|
val isLike: String? = null
|
||||||
|
|
||||||
@SerializedName("is_manager")
|
@SerializedName("is_bawu")
|
||||||
val isManager: String? = null
|
val isBawu: String? = null
|
||||||
|
|
||||||
|
@SerializedName("bawu_type")
|
||||||
|
val bawuType: String? = null
|
||||||
|
|
||||||
|
@SerializedName("ip_address")
|
||||||
|
val ipAddress: String? = null
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ object RetrofitTiebaApi {
|
||||||
createAPI<OfficialTiebaApi>("http://c.tieba.baidu.com/",
|
createAPI<OfficialTiebaApi>("http://c.tieba.baidu.com/",
|
||||||
defaultCommonHeaderInterceptor,
|
defaultCommonHeaderInterceptor,
|
||||||
CommonHeaderInterceptor(
|
CommonHeaderInterceptor(
|
||||||
Header.USER_AGENT to { "bdtb for Android 9.9.8.32" },
|
Header.USER_AGENT to { "bdtb for Android 12.25.1.0" },
|
||||||
Header.CUID to { UIDUtil.getNewCUID() },
|
Header.CUID to { UIDUtil.getNewCUID() },
|
||||||
Header.CUID_GALAXY2 to { UIDUtil.getFinalCUID() },
|
Header.CUID_GALAXY2 to { UIDUtil.getFinalCUID() },
|
||||||
Header.CUID_GID to { "" }
|
Header.CUID_GID to { "" }
|
||||||
|
|
@ -107,7 +107,7 @@ object RetrofitTiebaApi {
|
||||||
Param.CUID_GALAXY2 to { UIDUtil.getFinalCUID() },
|
Param.CUID_GALAXY2 to { UIDUtil.getFinalCUID() },
|
||||||
Param.CUID_GID to { "" },
|
Param.CUID_GID to { "" },
|
||||||
Param.FROM to { "tieba" },
|
Param.FROM to { "tieba" },
|
||||||
Param.CLIENT_VERSION to { "9.9.8.32" }
|
Param.CLIENT_VERSION to { "12.25.1.0" }
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,10 @@ object DateTimeUtils {
|
||||||
}
|
}
|
||||||
val currentCalendar = Calendar.getInstance()
|
val currentCalendar = Calendar.getInstance()
|
||||||
return if (currentCalendar.after(calendar)) {
|
return if (currentCalendar.after(calendar)) {
|
||||||
if (calendar.get(Calendar.YEAR) == currentCalendar.get(Calendar.YEAR) && calendar.get(
|
if (calendar.get(Calendar.YEAR) == currentCalendar.get(Calendar.YEAR)) {
|
||||||
Calendar.MONTH
|
if (calendar.get(Calendar.DAY_OF_MONTH) == currentCalendar.get(Calendar.DAY_OF_MONTH) &&
|
||||||
) == currentCalendar.get(Calendar.MONTH)
|
calendar.get(Calendar.MONTH) == currentCalendar.get(Calendar.MONTH)
|
||||||
) {
|
) {
|
||||||
if (calendar.get(Calendar.DAY_OF_MONTH) == currentCalendar.get(Calendar.DAY_OF_MONTH)) {
|
|
||||||
if (calendar.get(Calendar.HOUR_OF_DAY) == currentCalendar.get(Calendar.HOUR_OF_DAY)) {
|
if (calendar.get(Calendar.HOUR_OF_DAY) == currentCalendar.get(Calendar.HOUR_OF_DAY)) {
|
||||||
if (calendar.get(Calendar.MINUTE) == currentCalendar.get(Calendar.MINUTE)) {
|
if (calendar.get(Calendar.MINUTE) == currentCalendar.get(Calendar.MINUTE)) {
|
||||||
context.getString(
|
context.getString(
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@
|
||||||
<string name="menu_save_photo">保存图片</string>
|
<string name="menu_save_photo">保存图片</string>
|
||||||
<string name="toast_play_failed">播放失败</string>
|
<string name="toast_play_failed">播放失败</string>
|
||||||
<string name="toast_cannot_view">抱歉,当前暂时无法浏览本吧</string>
|
<string name="toast_cannot_view">抱歉,当前暂时无法浏览本吧</string>
|
||||||
<string name="tip_thread_item">第 %1$s 楼 · %2$s</string>
|
<string name="tip_thread_item">第 %1$s 楼 %2$s 来自%3$s</string>
|
||||||
<string name="tip_floor_more_count">查看更多回复(%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_title">发现新版本 %1$s(%2$s)</string>
|
||||||
<string name="update_tip_header">更新 · %1$s</string>
|
<string name="update_tip_header">更新 · %1$s</string>
|
||||||
|
|
@ -409,7 +409,7 @@
|
||||||
<string name="text_badge_history_forum">贴吧</string>
|
<string name="text_badge_history_forum">贴吧</string>
|
||||||
<string name="title_history_thread">贴子记录</string>
|
<string name="title_history_thread">贴子记录</string>
|
||||||
<string name="title_history_forum">经过贴吧</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 来自%2$s</string>
|
||||||
<string name="title_all_reply">全部</string>
|
<string name="title_all_reply">全部</string>
|
||||||
<string name="title_thread_header">回复 %1$s</string>
|
<string name="title_thread_header">回复 %1$s</string>
|
||||||
<string name="btn_agree_post">%1$s 赞</string>
|
<string name="btn_agree_post">%1$s 赞</string>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue