From cfb48c07ffc528ce629026bc66c7adefd9630429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=8E=89=E4=B9=85?= Date: Wed, 17 Aug 2022 11:17:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=80=90=E5=85=89=E7=8E=AF=E5=8A=A9?= =?UTF-8?q?=E6=89=8BV5.13.0=E3=80=91=E8=AF=84=E8=AE=BA=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20IP=E5=B1=9E=E5=9C=B0=E5=B1=95=E7=A4=BA=20https://gi?= =?UTF-8?q?t.shanqu.cc/pm/halo/halo-app-issues/-/issues/2008?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/MessageDetailAdapter.java | 3 + .../com/gh/gamecenter/entity/CommentEntity.kt | 3 + .../gh/gamecenter/entity/ForumVideoEntity.kt | 5 +- .../entity/GamesCollectionDetailEntity.kt | 2 + .../com/gh/gamecenter/entity/MessageEntity.kt | 2 + .../gh/gamecenter/entity/PersonalEntity.kt | 97 +++++++++-------- .../com/gh/gamecenter/entity/RatingComment.kt | 78 +++++++------- .../gh/gamecenter/entity/RatingReplyEntity.kt | 3 + .../com/gh/gamecenter/entity/VideoEntity.kt | 3 + .../detail/GameCollectionDetailFragment.kt | 17 ++- .../gamedetail/desc/DescCommentsAdapter.kt | 8 +- .../rating/RatingCommentItemViewHolder.kt | 2 + .../gamedetail/rating/RatingReplyAdapter.kt | 6 +- .../newsdetail/NewsDetailAdapter.java | 4 +- .../personalhome/UserHomeFragment.kt | 54 +++++----- .../detail/ArticleDetailContentViewHolder.kt | 3 + .../qa/comment/StairsCommentViewHolder.kt | 33 +++--- .../qa/comment/base/BaseCommentAdapter.kt | 7 +- .../qa/entity/ArticleDetailEntity.kt | 3 +- .../qa/entity/QuestionsDetailEntity.kt | 3 +- .../gh/gamecenter/qa/entity/SourceEntity.kt | 10 ++ .../QuestionDetailContentViewHolder.kt | 3 + .../detail/desc/VideoDescTopViewHolder.kt | 6 +- .../video/detail/DetailPlayerView.kt | 14 +-- app/src/main/res/layout/comment_item.xml | 1 + app/src/main/res/layout/fragment_home.xml | 59 ++++++---- .../game_collection_detail_image_item.xml | 88 +++++++++------ .../game_collection_detail_video_item.xml | 102 ++++++++++-------- .../item_game_detail_rating_comment.xml | 14 ++- .../layout/layout_video_detail_surface.xml | 14 ++- .../main/res/layout/rating_comment_item.xml | 14 ++- app/src/main/res/layout/rating_reply_item.xml | 32 +++--- 32 files changed, 432 insertions(+), 261 deletions(-) create mode 100644 app/src/main/java/com/gh/gamecenter/qa/entity/SourceEntity.kt diff --git a/app/src/main/java/com/gh/gamecenter/adapter/MessageDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/MessageDetailAdapter.java index 20135677ed..34159b963b 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/MessageDetailAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/MessageDetailAdapter.java @@ -390,6 +390,9 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter { CommentUtils.setCommentUserView(mContext, holder, commentEntity); CommentUtils.setCommentTime(holder.commentTimeTv, commentEntity.getTime()); + if (commentEntity.getSource() != null && !commentEntity.getSource().getRegion().isEmpty()) { + holder.commentTimeTv.setText(holder.commentTimeTv.getText() + " · " + commentEntity.getSource().getRegion()); + } final CommentEntity finalCommentEntity = commentEntity; final boolean finalIsHotComment = isHotComment; diff --git a/app/src/main/java/com/gh/gamecenter/entity/CommentEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/CommentEntity.kt index d0b60ec451..7e5cfea132 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/CommentEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/CommentEntity.kt @@ -3,6 +3,7 @@ package com.gh.gamecenter.entity import android.os.Parcelable import com.gh.gamecenter.common.annotation.SyncPage import com.gh.gamecenter.common.syncpage.SyncFieldConstants +import com.gh.gamecenter.qa.entity.SourceEntity import com.google.gson.annotations.SerializedName import kotlinx.parcelize.Parcelize @@ -29,6 +30,7 @@ data class CommentEntity( var accept: Boolean = false,//是否采纳,问题评论用 var choiceness: Boolean = false,//是否已加精,问题评论用 var images: ArrayList? = arrayListOf(), + val source: SourceEntity? = null, // 楼层 var floor: Int = 0, @@ -56,6 +58,7 @@ data class CommentEntity( accept, choiceness, images, + source, floor, isExpand, subCommentList diff --git a/app/src/main/java/com/gh/gamecenter/entity/ForumVideoEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/ForumVideoEntity.kt index bd95b7fbb8..d3f27f0c8a 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/ForumVideoEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/ForumVideoEntity.kt @@ -2,6 +2,7 @@ package com.gh.gamecenter.entity import android.os.Parcelable import com.gh.gamecenter.qa.entity.Count +import com.gh.gamecenter.qa.entity.SourceEntity import com.google.gson.annotations.SerializedName import kotlinx.parcelize.IgnoredOnParcel import kotlinx.parcelize.Parcelize @@ -47,7 +48,9 @@ open class ForumVideoEntity( var choicenessStatus: String = "",// apply(申请), pass already(已精选) cancel not_yet(未精选) @IgnoredOnParcel var videoIsMuted: Boolean = false, //是否静音标记 - var duration: String = "" + var duration: String = "", + @SerializedName("_source") + val ipSource: SourceEntity? = null ) : Parcelable { fun getSimplifyChoicenessStatus(): String { diff --git a/app/src/main/java/com/gh/gamecenter/entity/GamesCollectionDetailEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/GamesCollectionDetailEntity.kt index a486527b67..087c6bd032 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/GamesCollectionDetailEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/GamesCollectionDetailEntity.kt @@ -2,6 +2,7 @@ package com.gh.gamecenter.entity import android.os.Parcelable import com.gh.gamecenter.qa.entity.Count +import com.gh.gamecenter.qa.entity.SourceEntity import com.gh.gamecenter.qa.entity.TimeEntity import com.google.gson.annotations.SerializedName import kotlinx.parcelize.Parcelize @@ -25,6 +26,7 @@ class GamesCollectionDetailEntity( var count: Count? = null, var user: UserEntity? = null, var me: MeEntity? = null, + val source: SourceEntity? = null ) : Parcelable { @Parcelize diff --git a/app/src/main/java/com/gh/gamecenter/entity/MessageEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/MessageEntity.kt index d47319ecd1..9e28ddc031 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/MessageEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/MessageEntity.kt @@ -2,6 +2,7 @@ package com.gh.gamecenter.entity import android.os.Parcel import android.os.Parcelable +import com.gh.gamecenter.qa.entity.SourceEntity import com.google.gson.annotations.SerializedName /** @@ -44,6 +45,7 @@ class MessageEntity { var activity: Activity = Activity() + val source: SourceEntity? = null class Article() : Parcelable { @SerializedName("_id") diff --git a/app/src/main/java/com/gh/gamecenter/entity/PersonalEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/PersonalEntity.kt index 4b2cf44135..c68e266815 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/PersonalEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/PersonalEntity.kt @@ -1,49 +1,52 @@ package com.gh.gamecenter.entity import android.os.Parcelable +import com.gh.gamecenter.qa.entity.SourceEntity import com.google.gson.annotations.SerializedName import kotlinx.parcelize.Parcelize @Parcelize data class PersonalEntity( - @SerializedName("_id") - val id: String = "", - var name: String = "", - var icon: String = "", - var introduce: String? = "", - @SerializedName("name_label") - var nameLabel: String? = "", - val count: Count = Count(), - val auth: Auth? = null, - val badge: Badge? = null, - val me: MeEntity = MeEntity(), - @SerializedName("icon_border_url") - var border: String = "", - @SerializedName("icon_border") - var iconBorder: AvatarBorderEntity? = null, - var background: BackgroundImageEntity? = null, - @SerializedName("last_visitor") - val lastVisitor: LastVisitor? = null, - @SerializedName("etiquette_exam") - val regulationTest: RegulationTest? = null + @SerializedName("_id") + val id: String = "", + var name: String = "", + var icon: String = "", + var introduce: String? = "", + @SerializedName("name_label") + var nameLabel: String? = "", + val count: Count = Count(), + val auth: Auth? = null, + val badge: Badge? = null, + val me: MeEntity = MeEntity(), + @SerializedName("icon_border_url") + var border: String = "", + @SerializedName("icon_border") + var iconBorder: AvatarBorderEntity? = null, + var background: BackgroundImageEntity? = null, + @SerializedName("last_visitor") + val lastVisitor: LastVisitor? = null, + @SerializedName("etiquette_exam") + val regulationTest: RegulationTest? = null, + val source: SourceEntity? = null ) : Parcelable { @Parcelize data class Count( - // 包括回答点赞和社区文章点赞 - val vote: Int? = 0, - var answer: Int = 0, - var question: Int = 0, - var fans: Int = 0, - val follower: Int = 0, - @SerializedName("community_article") - var communityArticle: Int = 0, - @SerializedName("game_comment") - val gameComment: Int = 0, - var video: Int = 0, - @SerializedName("game_list") - val gameList: Int = 0, - @SerializedName("today_visit") - val todayVisit: Int? = 0) : Parcelable { + // 包括回答点赞和社区文章点赞 + val vote: Int? = 0, + var answer: Int = 0, + var question: Int = 0, + var fans: Int = 0, + val follower: Int = 0, + @SerializedName("community_article") + var communityArticle: Int = 0, + @SerializedName("game_comment") + val gameComment: Int = 0, + var video: Int = 0, + @SerializedName("game_list") + val gameList: Int = 0, + @SerializedName("today_visit") + val todayVisit: Int? = 0 + ) : Parcelable { fun getTotalCount() = video + answer + question + communityArticle } @@ -52,25 +55,29 @@ data class PersonalEntity( // 礼仪测试 @Parcelize data class RegulationTest( - var status: String = "", - var rank: Int = 0) : Parcelable + var status: String = "", + var rank: Int = 0 +) : Parcelable // 最近访客 @Parcelize data class LastVisitor( - @SerializedName("_id") - var id: String = "", - var name: String = "", - var icon: String = "") : Parcelable + @SerializedName("_id") + var id: String = "", + var name: String = "", + var icon: String = "" +) : Parcelable // 徽章 @Parcelize data class Badge( - var name: String = "", - var icon: String = "", - var actions: List? = null) : Parcelable + var name: String = "", + var icon: String = "", + var actions: List? = null +) : Parcelable // 徽章领取条件 @Parcelize data class BadgeAction( - var text: String = "") : Parcelable + var text: String = "" +) : Parcelable diff --git a/app/src/main/java/com/gh/gamecenter/entity/RatingComment.kt b/app/src/main/java/com/gh/gamecenter/entity/RatingComment.kt index 6aa421f247..5239fa9b0e 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/RatingComment.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/RatingComment.kt @@ -2,42 +2,46 @@ package com.gh.gamecenter.entity import android.os.Parcelable import com.gh.gamecenter.common.annotation.Synchronize +import com.gh.gamecenter.qa.entity.SourceEntity import com.google.gson.annotations.SerializedName import kotlinx.parcelize.Parcelize @Parcelize -class RatingComment(@SerializedName("_id") - val id: String = "", - @Synchronize - var content: String = "", - val order: Int = 0, - @Synchronize - val me: MeEntity = MeEntity(), - @Synchronize - private var device: String = "", - @Synchronize - var time: Long = 0, - @Synchronize - var vote: Int = 0, - @Synchronize - var star: Int = 0, - @Synchronize - var reply: Int = 0, - val user: UserEntity = UserEntity(), - var isServiceComment: Boolean = false, - @SerializedName("attached") - var replyData: Reply? = null, - @Synchronize - @SerializedName("is_edit_content") - var isEditContent: Boolean? = null, - @SerializedName("game_version") - val gameVersion: String = "", - @SerializedName("is_jingxuan") - val isWonderful: Boolean = false, - val active: Boolean = true, - @Synchronize - var audit: Boolean = false, - var ignore: Boolean = false//此评分是否计入总分 +class RatingComment( + @SerializedName("_id") + val id: String = "", + @Synchronize + var content: String = "", + val order: Int = 0, + @Synchronize + val me: MeEntity = MeEntity(), + @Synchronize + private var device: String = "", + @Synchronize + var time: Long = 0, + @Synchronize + var vote: Int = 0, + @Synchronize + var star: Int = 0, + @Synchronize + var reply: Int = 0, + val user: UserEntity = UserEntity(), + var isServiceComment: Boolean = false, + @SerializedName("attached") + var replyData: Reply? = null, + @Synchronize + @SerializedName("is_edit_content") + var isEditContent: Boolean? = null, + @SerializedName("game_version") + val gameVersion: String = "", + @SerializedName("is_jingxuan") + val isWonderful: Boolean = false, + val active: Boolean = true, + @Synchronize + var audit: Boolean = false, + var ignore: Boolean = false,//此评分是否计入总分 + @SerializedName("_source") + val source: SourceEntity? = null ) : Parcelable { fun getDevice(): String { return device.trim() @@ -48,8 +52,10 @@ class RatingComment(@SerializedName("_id") } @Parcelize - class Reply(val user: UserEntity = UserEntity(), - val content: String = "", - @SerializedName("is_service") - var isService: Boolean = false) : Parcelable + class Reply( + val user: UserEntity = UserEntity(), + val content: String = "", + @SerializedName("is_service") + var isService: Boolean = false + ) : Parcelable } diff --git a/app/src/main/java/com/gh/gamecenter/entity/RatingReplyEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/RatingReplyEntity.kt index 6c64c840fb..12e483a121 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/RatingReplyEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/RatingReplyEntity.kt @@ -1,6 +1,7 @@ package com.gh.gamecenter.entity import android.os.Parcelable +import com.gh.gamecenter.qa.entity.SourceEntity import com.google.gson.annotations.SerializedName import kotlinx.parcelize.Parcelize @@ -16,6 +17,8 @@ class RatingReplyEntity( val weight: Int = 0, val parent: Parent? = null, var isHighlight: Boolean = false, + @SerializedName("_source") + val source: SourceEntity? = null ) : Parcelable { @Parcelize class Parent(val user: UserEntity) : Parcelable diff --git a/app/src/main/java/com/gh/gamecenter/entity/VideoEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/VideoEntity.kt index 259b06550a..9c1249ab90 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/VideoEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/VideoEntity.kt @@ -1,6 +1,7 @@ package com.gh.gamecenter.entity import android.os.Parcelable +import com.gh.gamecenter.qa.entity.SourceEntity import com.google.gson.annotations.SerializedName import kotlinx.parcelize.IgnoredOnParcel import kotlinx.parcelize.Parcelize @@ -54,6 +55,8 @@ open class VideoEntity( val tagActivityName: String = "", @SerializedName("tag_activity_id") var tagActivityId: String = "",//活动标签的id, 当 original=true + @SerializedName("_source") + val ipSource: SourceEntity? = null, //本地数据 @IgnoredOnParcel diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt index 5352a83b4b..11794b9716 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt @@ -381,8 +381,10 @@ class GameCollectionDetailFragment : imageItem.imageItemDesTv, videoItem.videoItemDesTv, toolbarUserContainer, - imageItem.imageItemUserContainer, - videoItem.videoItemUserContainer, + imageItem.userIcon, + imageItem.userInfo, + videoItem.userIcon, + videoItem.userInfo, toolbarFollowTv, imageItem.imageItemFollowTv, imageItem.imageItemFollowedTv, @@ -448,9 +450,12 @@ class GameCollectionDetailFragment : tagIv.goneIf(stamp.isEmpty()) imageItemDesTv.text = intro imageActivityLabelTv.goneIf(activityTags.isNullOrEmpty()) + ipRegionTv.goneIf(!(source != null && source.region.isNotEmpty())) + ipRegionTv.text = "IP属地:${source?.region}" if (!activityTags.isNullOrEmpty()) { imageActivityLabelTv.text = activityTags!![0].name - nameTv.layoutParams = (nameTv.layoutParams as ConstraintLayout.LayoutParams).apply { setMargins(16F.dip2px(), 0, 30F.dip2px(), 6F.dip2px()) } + nameTv.layoutParams = + (nameTv.layoutParams as ConstraintLayout.LayoutParams).apply { setMargins(16F.dip2px(), 0, 30F.dip2px(), 6F.dip2px()) } } when (stamp) { @@ -475,6 +480,8 @@ class GameCollectionDetailFragment : nameTv.text = title videoItemDesTv.text = intro videoActivityLabelTv.goneIf(activityTags.isNullOrEmpty()) + ipRegionTv.goneIf(!(source != null && source.region.isNotEmpty())) + ipRegionTv.text = "IP属地:${source?.region}" if (!activityTags.isNullOrEmpty()) { videoActivityLabelTv.text = activityTags!![0].name videoItemDesContainer.layoutParams = @@ -864,8 +871,8 @@ class GameCollectionDetailFragment : } R.id.toolbarUserContainer, - R.id.imageItemUserContainer, - R.id.videoItemUserContainer -> { + R.id.userIcon, + R.id.userInfo -> { DirectUtils.directToHomeActivity(requireContext(), mEntity?.user?.id, "", "游戏单详情-导航栏") } diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt index 67e3f84665..351c8044c7 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt @@ -89,6 +89,8 @@ class DescCommentsAdapter( tvBadgeName.visibility = View.GONE } + ipRegionTv.goneIf(!(commentData.source != null && commentData.source.region.isNotEmpty())) + ipRegionTv.text = " · ${commentData.source?.region}" when { commentData.isEditContent == null -> { time.setTextColor(ContextCompat.getColor(mContext, R.color.text_subtitleDesc)) @@ -131,7 +133,7 @@ class DescCommentsAdapter( userIcon.setOnClickListener { DirectUtils.directToHomeActivity(mContext, commentData.user.id, mEntrance, "游戏详情-玩家评论") MtaHelper.onEvent("游戏详情_新", "玩家评论_点击用户头像", mViewModel.game?.name) - NewLogUtils.logGameDetailCommentClick(mViewModel.game?.name ?: "", mViewModel.game?.id?:"","个人主页") + NewLogUtils.logGameDetailCommentClick(mViewModel.game?.name ?: "", mViewModel.game?.id ?: "", "个人主页") } userName.setOnClickListener { userIcon.performClick() @@ -148,7 +150,7 @@ class DescCommentsAdapter( val intent = RatingReplyActivity.getIntent(mContext, mViewModel.game!!, commentData, mEntrance, path) SyncDataBetweenPageHelper.startActivityForResult(mContext, intent, RATING_REPLY_REQUEST, position) MtaHelper.onEvent("游戏详情_新", "玩家评论_点击评论", mViewModel.game?.name) - NewLogUtils.logGameDetailCommentClick(mViewModel.game?.name ?: "", mViewModel.game?.id?:"","评论内容") + NewLogUtils.logGameDetailCommentClick(mViewModel.game?.name ?: "", mViewModel.game?.id ?: "", "评论内容") } content.setExpandCallback { MtaHelper.onEvent("游戏详情_新", "玩家评论_点击全文", mViewModel.game?.name) @@ -208,7 +210,7 @@ class DescCommentsAdapter( holder.itemView.setOnClickListener { EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_RATING)) MtaHelper.onEvent("游戏详情_新", "玩家评论_查看全部评论", gameName) - NewLogUtils.logGameDetailCommentClick(mViewModel.game?.name ?: "", mViewModel.game?.id?:"","查看全部评论") + NewLogUtils.logGameDetailCommentClick(mViewModel.game?.name ?: "", mViewModel.game?.id ?: "", "查看全部评论") } } } diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt index f641e6f3b2..964312811a 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt @@ -80,6 +80,8 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR replyContainer.goneIf(!(commentData.replyData != null && commentData.active)) replyMore.goneIf(commentData.reply <= 1) userIcon.display(commentData.user.border, commentData.user.icon, commentData.user.auth?.icon) + ipRegionTv.goneIf(!(commentData.source != null && commentData.source.region.isNotEmpty())) + ipRegionTv.text = " · ${commentData.source?.region}" when { commentData.isEditContent == null -> { time.setTextColor(ContextCompat.getColor(context, R.color.text_subtitleDesc)) diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt index ad39d1eea3..fa0d37b707 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt @@ -248,7 +248,11 @@ class RatingReplyAdapter( commentItem.setBackgroundColor(R.color.background_white.toColor(mContext)) line.setBackgroundColor(R.color.divider.toColor(mContext)) userNameBadge.goneIf(replyEntity.weight != 1) - time.text = NewsUtils.getFormattedTime(replyEntity.time) + time.text = if (replyEntity.source != null && replyEntity.source.region.isNotEmpty()) { + "${NewsUtils.getFormattedTime(replyEntity.time)} · ${replyEntity.source.region}" + } else { + NewsUtils.getFormattedTime(replyEntity.time) + } val voteDrawable = ContextCompat.getDrawable(mContext, R.drawable.comment_vote_selector) voteDrawable?.setBounds(0, 0, 20f.dip2px(), 20f.dip2px()) vote.setCompoundDrawables(voteDrawable, null, null, null) diff --git a/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java index 94ff0ec49c..1915a50ae7 100644 --- a/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java @@ -544,7 +544,9 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter { } NewsUtils.setNewsDetailTime(viewHolder.commentTimeTv, commentEntity.getTime()); - + if (commentEntity.getSource() != null && !commentEntity.getSource().getRegion().isEmpty()) { + viewHolder.commentTimeTv.setText(viewHolder.commentTimeTv.getText() + " · " + commentEntity.getSource().getRegion()); + } CommentUtils.setCommentUserView(mContext, viewHolder, commentEntity); diff --git a/app/src/main/java/com/gh/gamecenter/personalhome/UserHomeFragment.kt b/app/src/main/java/com/gh/gamecenter/personalhome/UserHomeFragment.kt index a20dc06167..c9e08f264f 100644 --- a/app/src/main/java/com/gh/gamecenter/personalhome/UserHomeFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/personalhome/UserHomeFragment.kt @@ -1,12 +1,10 @@ package com.gh.gamecenter.personalhome -import android.annotation.SuppressLint import android.graphics.Bitmap import android.graphics.drawable.BitmapDrawable import android.os.Build import android.os.Bundle import android.view.LayoutInflater -import android.view.MotionEvent import android.view.View import android.widget.CheckedTextView import android.widget.LinearLayout @@ -16,37 +14,42 @@ import androidx.constraintlayout.widget.ConstraintSet import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.lifecycle.Observer +import com.gh.common.databind.BindingAdapters +import com.gh.common.util.DialogUtils +import com.gh.common.util.DirectUtils +import com.gh.common.util.DirectUtils.directToBadgeWall +import com.gh.common.util.IntegralLogHelper +import com.gh.gamecenter.ImageViewerActivity +import com.gh.gamecenter.R +import com.gh.gamecenter.UserInfoActivity +import com.gh.gamecenter.UserInfoEditActivity import com.gh.gamecenter.common.base.adapter.FragmentAdapter import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout -import com.gh.gamecenter.common.constant.Constants -import com.gh.common.databind.BindingAdapters -import com.gh.common.util.* -import com.gh.common.util.DialogUtils -import com.gh.common.util.DirectUtils.directToBadgeWall -import com.gh.gamecenter.* -import com.gh.gamecenter.R +import com.gh.gamecenter.common.base.fragment.ToolbarFragment import com.gh.gamecenter.common.callback.BiCallback import com.gh.gamecenter.common.callback.ConfirmListener +import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.constant.EntranceConsts import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.utils.* import com.gh.gamecenter.databinding.FragmentHomeBinding -import com.gh.gamecenter.entity.* +import com.gh.gamecenter.entity.Badge +import com.gh.gamecenter.entity.MessageUnreadEntity +import com.gh.gamecenter.entity.PersonalEntity import com.gh.gamecenter.manager.UserManager import com.gh.gamecenter.message.MessageUnreadViewModel -import com.gh.gamecenter.common.base.fragment.ToolbarFragment import com.gh.gamecenter.personalhome.background.PersonalityBackgroundActivity import com.gh.gamecenter.personalhome.border.AvatarBorderActivity import com.gh.gamecenter.personalhome.fans.FansActivity import com.gh.gamecenter.personalhome.followers.FollowersActivity -import com.gh.gamecenter.personalhome.home.* +import com.gh.gamecenter.personalhome.home.UserHistoryFragment +import com.gh.gamecenter.personalhome.home.UserHistoryViewModel import com.gh.gamecenter.personalhome.home.game.UserGameFragment import com.gh.gamecenter.user.UserViewModel import com.google.android.material.appbar.AppBarLayout import com.google.android.material.appbar.AppBarLayout.OnOffsetChangedListener import com.halo.assistant.HaloApp import com.lightgame.utils.Utils -import io.reactivex.disposables.Disposable import kotlin.math.abs class UserHomeFragment : ToolbarFragment() { @@ -135,20 +138,17 @@ class UserHomeFragment : ToolbarFragment() { mHomeBinding?.badgeIcon?.setOnClickListener { DialogUtils.showViewBadgeDialog( requireContext(), - Badge(badge.name, badge.icon, badge.actions), - object : ConfirmListener { - override fun onConfirm() { - if (::mPersonalEntity.isInitialized) { - directToBadgeWall( - requireContext(), - mPersonalEntity.id, - mPersonalEntity.name, - mPersonalEntity.icon - ) - } - } + Badge(badge.name, badge.icon, badge.actions) + ) { + if (::mPersonalEntity.isInitialized) { + directToBadgeWall( + requireContext(), + mPersonalEntity.id, + mPersonalEntity.name, + mPersonalEntity.icon + ) } - ) + } } return@outside } @@ -431,6 +431,8 @@ class UserHomeFragment : ToolbarFragment() { userName.text = personalData.name authTv.text = personalData.auth?.text + ipRegionTv.goneIf(!(personalData.source != null && personalData.source.region.isNotEmpty())) + ipRegionTv.text = "IP属地:${personalData.source?.region}" userIntroduce.text = if (personalData.introduce.isNullOrBlank()) "这是一个很神秘的崽" else personalData.introduce todayVisitCount.text = if (personalData.count.todayVisit == null) "0" else personalData.count.todayVisit.toString() userFollowerCount.text = personalData.count.follower.toSimpleCount() diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailContentViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailContentViewHolder.kt index 9b1a978a7f..89758180a9 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailContentViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailContentViewHolder.kt @@ -163,6 +163,9 @@ class ArticleDetailContentViewHolder( NewsUtils.getFormattedTime(article.time.edit) ) } + if (article.source != null && article.source.region.isNotEmpty()) { + releaseTimeTv.text = "${releaseTimeTv.text} · ${article.source.region}" + } richEditor.visibility = View.VISIBLE article.community.let { entity -> gameName.text = entity.name diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentViewHolder.kt index 350b6cb3d9..b0897e09fd 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/StairsCommentViewHolder.kt @@ -165,6 +165,9 @@ class StairsCommentViewHolder( holder.binding.commentContent.text = commentEntity.content } CommentUtils.setCommentTime(holder.binding.commentTime, commentEntity.time) + if (commentEntity.source != null && commentEntity.source.region.isNotEmpty()) { + holder.binding.commentTime.text = "${holder.binding.commentTime.text} · ${commentEntity.source.region}" + } val key = when (mEntrance) { "(答案详情-评论列表)" -> "回答详情-评论管理" @@ -177,22 +180,20 @@ class StairsCommentViewHolder( } holder.binding.sdvUserBadge.setOnClickListener { v -> - DialogUtils.showViewBadgeDialog(binding.root.context, commentEntity.user.badge, object : ConfirmListener { - override fun onConfirm() { - MtaHelper.onEvent( - "进入徽章墙_用户记录", - key, - commentEntity.user.name + "(" + commentEntity.user.id + ")" - ) - MtaHelper.onEvent("徽章中心", "进入徽章中心", key) - DirectUtils.directToBadgeWall( - binding.root.context, - commentEntity.user.id, - commentEntity.user.name, - commentEntity.user.icon - ) - } - }) + DialogUtils.showViewBadgeDialog(binding.root.context, commentEntity.user.badge) { + MtaHelper.onEvent( + "进入徽章墙_用户记录", + key, + commentEntity.user.name + "(" + commentEntity.user.id + ")" + ) + MtaHelper.onEvent("徽章中心", "进入徽章中心", key) + DirectUtils.directToBadgeWall( + binding.root.context, + commentEntity.user.id, + commentEntity.user.name, + commentEntity.user.icon + ) + } } var isVote = holder.binding.commentLikeCount.currentTextColor == ContextCompat.getColor( diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentAdapter.kt index b29b982c18..68552d2922 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentAdapter.kt @@ -572,7 +572,12 @@ abstract class BaseCommentAdapter( binding.badgeTv.text = comment.user.badge?.name binding.topLabelIv.goneIf(!comment.isTop) binding.timeTv.setPadding(if (comment.isTop) 4f.dip2px() else 0, 0, 0, 0) - binding.timeTv.text = CommentUtils.getCommentTime(comment.time) + binding.timeTv.text = if (comment.source != null && comment.source.region.isNotEmpty()) { + "${CommentUtils.getCommentTime(comment.time)} · ${comment.source.region}" + } else { + CommentUtils.getCommentTime(comment.time) + } + binding.contentTv.goneIf(comment.content.isNullOrEmpty()) } diff --git a/app/src/main/java/com/gh/gamecenter/qa/entity/ArticleDetailEntity.kt b/app/src/main/java/com/gh/gamecenter/qa/entity/ArticleDetailEntity.kt index f604beca80..7e76b604ae 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/entity/ArticleDetailEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/entity/ArticleDetailEntity.kt @@ -41,7 +41,8 @@ data class ArticleDetailEntity( @SerializedName("choiceness_status") var choicenessStatus: String? = "",// 精选状态 apply(申请), pass already(已精选) cancel not_yet(未精选) var status: String? = "pass",//pass通过,fail未通过,pending审核中 - var original: String? = "" + var original: String? = "", + val source: SourceEntity? = null ) : Parcelable { fun getSimplifyChoicenessStatus(): String { diff --git a/app/src/main/java/com/gh/gamecenter/qa/entity/QuestionsDetailEntity.kt b/app/src/main/java/com/gh/gamecenter/qa/entity/QuestionsDetailEntity.kt index c5bf693da8..49757b0312 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/entity/QuestionsDetailEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/entity/QuestionsDetailEntity.kt @@ -53,7 +53,8 @@ data class QuestionsDetailEntity( @SerializedName("draft_id") var draftId: String = "", @SerializedName("images_info") - var imagesInfo: List = ArrayList() + var imagesInfo: List = ArrayList(), + val source: SourceEntity? = null ) : Parcelable { fun getFollowCount(): Int { diff --git a/app/src/main/java/com/gh/gamecenter/qa/entity/SourceEntity.kt b/app/src/main/java/com/gh/gamecenter/qa/entity/SourceEntity.kt new file mode 100644 index 0000000000..bf772815f3 --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/qa/entity/SourceEntity.kt @@ -0,0 +1,10 @@ +package com.gh.gamecenter.qa.entity + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class SourceEntity( + val ip: String = "", + val region: String = "", +) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/QuestionDetailContentViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/QuestionDetailContentViewHolder.kt index 2c1b65e314..6b65717e85 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/QuestionDetailContentViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/QuestionDetailContentViewHolder.kt @@ -154,6 +154,9 @@ class QuestionDetailContentViewHolder( NewsUtils.getFormattedTime(question.time.edit) ) } + if (question.source != null && question.source.region.isNotEmpty()) { + releaseTimeTv.text = "${releaseTimeTv.text} · ${question.source.region}" + } richEditor.visibility = View.VISIBLE question.community.let { entity -> gameName.text = entity.name diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt index 47b74f26ee..f6eeb3fdcf 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/desc/VideoDescTopViewHolder.kt @@ -36,7 +36,11 @@ class VideoDescTopViewHolder( binding.userNameTv.text = entity.user.name ImageUtils.display(binding.badgeIv, entity.user.badge?.icon) binding.badgeIv.goneIf(entity.user.badge == null) - binding.fansAndTimeTv.text = "${entity.user.count.fans}粉丝 · ${CommentUtils.getCommentTime(entity.time.upload)}" + binding.fansAndTimeTv.text = if (entity.ipSource != null && entity.ipSource.region.isNotEmpty()) { + "${entity.user.count.fans}粉丝 · ${CommentUtils.getCommentTime(entity.time.upload)} · ${entity.ipSource.region}" + } else { + "${entity.user.count.fans}粉丝 · ${CommentUtils.getCommentTime(entity.time.upload)}" + } binding.concernBtn.run { goneIf(entity.user.id == UserManager.getInstance().userId) text = if (entity.me.isFollower) "已关注" else "关注" diff --git a/app/src/main/java/com/gh/gamecenter/video/detail/DetailPlayerView.kt b/app/src/main/java/com/gh/gamecenter/video/detail/DetailPlayerView.kt index 5550c2a9c5..c8dbd5ac77 100644 --- a/app/src/main/java/com/gh/gamecenter/video/detail/DetailPlayerView.kt +++ b/app/src/main/java/com/gh/gamecenter/video/detail/DetailPlayerView.kt @@ -163,6 +163,8 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib mBinding.gameNameTv.text = mGameName mBinding.usernameTv.text = "@${videoEntity.user.name}" mBinding.videoTitleTv.text = videoEntity.title + mBinding.ipRegionTv.goneIf(!(videoEntity.ipSource != null && videoEntity.ipSource.region.isNotEmpty())) + mBinding.ipRegionTv.text = "IP属地:${videoEntity.ipSource?.region}" if (videoEntity.user.badge != null) { mBinding.sdvUserBadge.visibility = View.VISIBLE @@ -171,13 +173,11 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib mBinding.sdvUserBadge.visibility = View.GONE } mBinding.sdvUserBadge.setOnClickListener { - DialogUtils.showViewBadgeDialog(context, videoEntity.user.badge, object : ConfirmListener { - override fun onConfirm() { - MtaHelper.onEvent("进入徽章墙_用户记录", "视频详情", "${videoEntity.user.name}(${videoEntity.user.id})") - MtaHelper.onEvent("徽章中心", "进入徽章中心", "视频详情") - DirectUtils.directToBadgeWall(context, videoEntity.user.id, videoEntity.user.name, videoEntity.user.icon) - } - }) + DialogUtils.showViewBadgeDialog(context, videoEntity.user.badge) { + MtaHelper.onEvent("进入徽章墙_用户记录", "视频详情", "${videoEntity.user.name}(${videoEntity.user.id})") + MtaHelper.onEvent("徽章中心", "进入徽章中心", "视频详情") + DirectUtils.directToBadgeWall(context, videoEntity.user.id, videoEntity.user.name, videoEntity.user.icon) + } } if (videoEntity.me.isVoted && UserManager.getInstance().isLoggedIn) { diff --git a/app/src/main/res/layout/comment_item.xml b/app/src/main/res/layout/comment_item.xml index 4fe01e75d7..e38c7fad53 100644 --- a/app/src/main/res/layout/comment_item.xml +++ b/app/src/main/res/layout/comment_item.xml @@ -199,6 +199,7 @@ android:layout_height="wrap_content" android:layout_marginTop="8dp" android:layout_below="@+id/comment_content"> + + tools:visibility="visible" /> + app:layout_constraintTop_toBottomOf="@+id/regulation_and_badge_container"> - - - + + + + + + + + - + android:textSize="@dimen/secondary_size" + android:visibility="gone" + tools:text="IP属地:广东" + tools:visibility="visible" /> + app:layout_goneMarginBottom="32dp"> - + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> - + + + + + + app:layout_constraintBottom_toBottomOf="@+id/userIcon" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="@+id/userIcon" + tools:visibility="visible" /> + app:layout_constraintBottom_toBottomOf="@+id/userIcon" + app:layout_constraintLeft_toRightOf="@+id/userIcon" + app:layout_constraintTop_toTopOf="@+id/userIcon" /> \ No newline at end of file diff --git a/app/src/main/res/layout/game_collection_detail_video_item.xml b/app/src/main/res/layout/game_collection_detail_video_item.xml index d5bfee5d71..ec1c0390e3 100644 --- a/app/src/main/res/layout/game_collection_detail_video_item.xml +++ b/app/src/main/res/layout/game_collection_detail_video_item.xml @@ -9,24 +9,25 @@ + + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + android:paddingBottom="16dp"> + app:layout_constraintTop_toTopOf="parent" + tools:text="MOBA 手游集合,绝不氪金 5V5 公平对战" /> + app:layout_constraintTop_toTopOf="@+id/nameTv" + tools:src="@drawable/ic_official_big" /> - + app:layout_constraintTop_toBottomOf="@+id/videoItemDesContainer" + tools:layout_height="24dp" + tools:layout_width="24dp" /> - + + + + + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="@+id/userIcon" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="@+id/userIcon" + tools:visibility="visible" /> + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="@+id/userIcon" + app:layout_constraintLeft_toRightOf="@+id/userIcon" + app:layout_constraintTop_toTopOf="@+id/userIcon" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_game_detail_rating_comment.xml b/app/src/main/res/layout/item_game_detail_rating_comment.xml index 1bbd75a664..e24dd529da 100644 --- a/app/src/main/res/layout/item_game_detail_rating_comment.xml +++ b/app/src/main/res/layout/item_game_detail_rating_comment.xml @@ -125,11 +125,23 @@ android:layout_marginLeft="8dp" android:gravity="center" android:textColor="@color/text_subtitleDesc" - android:textSize="10sp" + android:textSize="@dimen/tag_text_size" app:layout_constraintBottom_toBottomOf="@+id/rating_start" app:layout_constraintLeft_toRightOf="@id/rating_start" app:layout_constraintTop_toTopOf="@+id/rating_start" /> + + + diff --git a/app/src/main/res/layout/rating_comment_item.xml b/app/src/main/res/layout/rating_comment_item.xml index bf2ddc90c4..7df738306b 100644 --- a/app/src/main/res/layout/rating_comment_item.xml +++ b/app/src/main/res/layout/rating_comment_item.xml @@ -129,11 +129,23 @@ android:layout_marginLeft="8dp" android:gravity="center" android:textColor="@color/text_subtitleDesc" - android:textSize="10sp" + android:textSize="@dimen/tag_text_size" app:layout_constraintBottom_toBottomOf="@+id/rating_start" app:layout_constraintLeft_toRightOf="@id/rating_start" app:layout_constraintTop_toTopOf="@+id/rating_start" /> + + app:layout_constraintTop_toTopOf="parent" /> - - - + +