diff --git a/app/src/main/java/com/gh/common/util/DialogUtils.java b/app/src/main/java/com/gh/common/util/DialogUtils.java index d6ea14e30a..5f9f7e358c 100644 --- a/app/src/main/java/com/gh/common/util/DialogUtils.java +++ b/app/src/main/java/com/gh/common/util/DialogUtils.java @@ -1477,8 +1477,9 @@ public class DialogUtils { View confirmBtn = contentView.findViewById(R.id.confirm); View linkTv = contentView.findViewById(R.id.link); + Context finalContext = context; linkTv.setOnClickListener(v -> { - // TODO 跳转资讯文章 + DirectUtils.directToArticle(finalContext, "5f4477be25e07e19be4e2a22", "(礼仪测试弹窗)"); }); cancelBtn.setOnClickListener(v -> { diff --git a/app/src/main/java/com/gh/common/util/EntranceUtils.java b/app/src/main/java/com/gh/common/util/EntranceUtils.java index cbfca1ebcf..f29806671c 100644 --- a/app/src/main/java/com/gh/common/util/EntranceUtils.java +++ b/app/src/main/java/com/gh/common/util/EntranceUtils.java @@ -166,6 +166,7 @@ public class EntranceUtils { public static final String KEY_COMMUNITY_ARTICLE_ID = "communityArticleId"; public static final String KEY_ARTICLE_COMMENT_ID = "articleCommentId"; public static final String KEY_SHOW_ARTICLE_COMMENT = "showArticleComment"; + public static final String KEY_SCROLL_TO_COMMENT_AREA = "scroll_to_comment_area"; public static final String KEY_RATING_STAR_COUNT = "ratingStarCount"; public static final String KEY_QUESTION_MODERATOR_PATCH = "questionModeratorPatch"; public static final String KEY_SKIP_GAME_COMMENT = "skipGameComment"; diff --git a/app/src/main/java/com/gh/gamecenter/entity/CommunityEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/CommunityEntity.kt index 0033aa4117..7158d242d9 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/CommunityEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/CommunityEntity.kt @@ -13,8 +13,8 @@ data class CommunityEntity( @SerializedName("icon", alternate = ["ori_icon"]) var icon: String? = "", @SerializedName("icon_subscript") - var iconSubscript: String? = null -) : Parcelable { + var iconSubscript: String? = null, + var game: SimpleGame? = null) : Parcelable { constructor(id: String = "", name: String = "") : this(id, name, "choiceness") companion object { diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/ForumArticleAskItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/forum/home/ForumArticleAskItemViewHolder.kt index 0bd4793c1b..9d0cd84638 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/ForumArticleAskItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/ForumArticleAskItemViewHolder.kt @@ -7,10 +7,11 @@ import com.gh.base.BaseActivity import com.gh.common.util.* import com.gh.gamecenter.R import com.gh.gamecenter.databinding.CommunityAnswerItemBinding +import com.gh.gamecenter.entity.CommunityEntity import com.gh.gamecenter.manager.UserManager import com.gh.gamecenter.qa.answer.BaseAnswerOrArticleItemViewHolder import com.gh.gamecenter.qa.answer.edit.AnswerEditActivity -import com.gh.gamecenter.qa.comment.CommentActivity +import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity import com.gh.gamecenter.qa.entity.AnswerEntity import com.gh.gamecenter.qa.entity.ArticleEntity import com.gh.gamecenter.qa.entity.QuestionsDetailEntity @@ -85,10 +86,10 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B if (entity.type == "community_article") { val communityId = if (entity.articleCommunityId.isNotEmpty()) entity.articleCommunityId else UserManager.getInstance().community.id - val intent = CommentActivity.getArticleCommentIntent(itemView.context, - entity.id!!, - entity.commentCount, - entity.commentCount == 0, communityId) + val intent = ArticleDetailActivity.getCommentIntent(itemView.context, + CommunityEntity(communityId, entity.communityName ?: ""), + entity.id ?: "", + entrance, "") itemView.context.startActivity(intent) MtaHelper.onEvent(getEventId(entrance), getKey(entrance), "评论图标") } else { diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailViewModel.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailViewModel.kt index f5af93b590..47cec6ab37 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailViewModel.kt @@ -149,6 +149,7 @@ class GameDetailViewModel(application: Application, || RegionSettingHelper.shouldThisGameDisplayMirrorInfo(game?.id ?: ""))) { val finalItemList: ArrayList = arrayListOf() val mirrorCustomColumnList = data.mirrorData?.customColumnList ?: arrayListOf() + mirrorCustomColumnList.sortByDescending { it.order } for (item in data.detailEntity) { // 去掉所有自定义栏目并把镜像相应权重的自定义栏目放到相应的位置 if (item.type == DetailEntity.Type.CUSTOM_COLUMN.value) { diff --git a/app/src/main/java/com/gh/gamecenter/message/MessageItemViewHolder.java b/app/src/main/java/com/gh/gamecenter/message/MessageItemViewHolder.java index 11460e1708..6291887205 100644 --- a/app/src/main/java/com/gh/gamecenter/message/MessageItemViewHolder.java +++ b/app/src/main/java/com/gh/gamecenter/message/MessageItemViewHolder.java @@ -5,6 +5,9 @@ import android.content.Intent; import android.view.View; import android.widget.RelativeLayout; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentActivity; + import com.gh.base.BaseActivity; import com.gh.base.BaseRecyclerViewHolder; import com.gh.base.OnListClickListener; @@ -29,6 +32,7 @@ import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity; import com.gh.gamecenter.manager.UserManager; import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity; import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity; +import com.gh.gamecenter.qa.article.detail.comment.ArticleDetailCommentActivity; import com.gh.gamecenter.qa.entity.Questions; import com.gh.gamecenter.qa.follow.AskFollowMoreDialog; import com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity; @@ -40,8 +44,6 @@ import com.lightgame.utils.Utils; import java.util.ArrayList; import java.util.List; -import androidx.annotation.Nullable; -import androidx.fragment.app.FragmentActivity; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; import retrofit2.HttpException; @@ -209,7 +211,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "community_article_vote": - mBinding.messageCommand.setText("赞同你的文章"); + mBinding.messageCommand.setText("赞同你的帖子"); mBinding.messageContent.setVisibility(View.GONE); mBinding.messageOriginalTitle.setText(messageEntity.getArticle().getTitle()); mBinding.messageArticleIcon.setVisibility(View.GONE); @@ -520,12 +522,17 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder } break; case "community_article_comment_vote": + community = new CommunityEntity(entity.getArticle().getCommunityId(), ""); + if (view.getId() == R.id.message_original || view.getId() == R.id.message_item) { + context.startActivity(ArticleDetailCommentActivity.Companion.getIntent(context, entity.getComment().getId(), community.getId(), entity.getArticle().getId(), false, entrance, path)); + } + break; case "community_article_comment": community = new CommunityEntity(entity.getArticle().getCommunityId(), ""); if (view.getId() == R.id.message_original) { context.startActivity(ArticleDetailActivity.getIntent(context, community, entity.getArticle().getId(), entrance, path, null)); } else if (view.getId() == R.id.message_item) { // 打开评论管理 - context.startActivity(ArticleDetailActivity.getOpenCommentIntent(context, community, entity.getArticle().getId(), entrance, path)); + context.startActivity(ArticleDetailActivity.getCommentIntent(context, community, entity.getArticle().getId(), entrance, path)); } break; case "community_article_vote": @@ -535,21 +542,9 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder } break; case "reply_community_article_comment": - if (view.getId() == R.id.message_original) { + if (view.getId() == R.id.message_original || view.getId() == R.id.message_item) { community = new CommunityEntity(entity.getArticle().getCommunityId(), ""); - context.startActivity(ArticleDetailActivity.getIntent(context, community, entity.getArticle().getId(), entrance, path, null)); - } else if (view.getId() == R.id.message_item) { - linkEntity = new LinkEntity(); - linkEntity.setType("community_article"); - linkEntity.setLink(entity.getArticle().getId()); - linkEntity.setTitle(entity.getArticle().getTitle()); - linkEntity.setCommunity(new CommunityEntity(entity.getArticle().getCommunityId(), "")); - Intent intent = CommentDetailActivity.getCommunityArticleCommentIntent( - context, entity.getArticle().getId(), - entity.getDialogue().getFrom().getId(), - entity.getArticle().getCommunityId(), - linkEntity); - context.startActivity(intent); + context.startActivity(ArticleDetailCommentActivity.Companion.getIntent(context, entity.getComment().getId(), community.getId(), entity.getArticle().getId(), false, entrance, path)); } break; case "game_comment_vote": diff --git a/app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt index 5bceebbf5e..54e72bf1d8 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt @@ -6,9 +6,11 @@ import com.airbnb.lottie.LottieAnimationView import com.gh.base.BaseRecyclerViewHolder import com.gh.common.util.* import com.gh.gamecenter.R +import com.gh.gamecenter.entity.CommunityEntity import com.gh.gamecenter.entity.VoteEntity import com.gh.gamecenter.forum.detail.ForumDetailActivity import com.gh.gamecenter.manager.UserManager +import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity import com.gh.gamecenter.qa.comment.CommentActivity import com.gh.gamecenter.qa.entity.AnswerEntity import com.gh.gamecenter.qa.entity.ArticleEntity @@ -42,10 +44,10 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH if (entity.type == "community_article") { val communityId = if (entity.articleCommunityId.isNotEmpty()) entity.articleCommunityId else UserManager.getInstance().community.id - val intent = CommentActivity.getArticleCommentIntent(itemView.context, - entity.id!!, - entity.commentCount, - entity.commentCount == 0, communityId) + val intent = ArticleDetailActivity.getCommentIntent(itemView.context, + CommunityEntity(communityId, entity.communityName ?: ""), + entity.id ?: "", + entrance, "") itemView.context.startActivity(intent) } else { val intent = CommentActivity.getAnswerCommentIntent(itemView.context, @@ -101,10 +103,10 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH val communityId = if (entity.community.id.isNotEmpty()) entity.community.id else UserManager.getInstance().community.id - val intent = CommentActivity.getArticleCommentIntent(itemView.context, + val intent = ArticleDetailActivity.getCommentIntent(itemView.context, + CommunityEntity(communityId, entity.community.name), entity.id, - entity.count.comment, - entity.count.comment == 0, communityId) + entrance, "") itemView.context.startActivity(intent) MtaHelper.onEvent(getEventId(entrance), getKey(entrance), "评论图标") } diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailActivity.kt index 76de34c322..976e8a5657 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailActivity.kt @@ -41,13 +41,16 @@ class ArticleDetailActivity : NormalActivity() { return intent } + /** + * 自动滚动到评论区域 + */ @JvmStatic - fun getOpenCommentIntent(context: Context, community: CommunityEntity, articleId: String, entrance: String, path: String): Intent { + fun getCommentIntent(context: Context, community: CommunityEntity, articleId: String, entrance: String, path: String): Intent { val intent = Intent(context, ArticleDetailActivity::class.java) intent.putExtra(EntranceUtils.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path)) intent.putExtra(EntranceUtils.KEY_COMMUNITY_ARTICLE_ID, articleId) intent.putExtra(EntranceUtils.KEY_COMMUNITY_DATA, community) - intent.putExtra(EntranceUtils.KEY_SHOW_ARTICLE_COMMENT, true) + intent.putExtra(EntranceUtils.KEY_SCROLL_TO_COMMENT_AREA, true) intent.putExtra(EntranceUtils.KEY_PATH, path) return intent } diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailAdapter.kt index fa97bfdf9f..62b97939d0 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailAdapter.kt @@ -8,8 +8,8 @@ import com.gh.gamecenter.R import com.gh.gamecenter.baselist.LoadStatus import com.gh.gamecenter.databinding.ItemArticleDetailContentBinding -class ArticleDetailAdapter(context: Context, var mViewModel: ArticleDetailViewModel, type: AdapterType) - : BaseArticleDetailCommentAdapter(context, mViewModel, type) { +class ArticleDetailAdapter(context: Context, var mViewModel: ArticleDetailViewModel, type: AdapterType, entrance: String) + : BaseArticleDetailCommentAdapter(context, mViewModel, type, entrance) { var articleDetailVH: ArticleDetailContentViewHolder? = null 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 bf20be5df2..d3a8e95152 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 @@ -131,11 +131,11 @@ class ArticleDetailContentViewHolder(var binding: ItemArticleDetailContentBindin userNameTv.setOnClickListener { MtaHelper.onEvent("帖子详情", "内容区域", "用户名字") - DirectUtils.directToHomeActivity(root.context, article.user.id, mEntrance, "帖子详情") + DirectUtils.directToHomeActivity(root.context, article.user.id, 1, mEntrance, "帖子详情") } userIconContainer.setOnClickListener { - MtaHelper.onEvent("帖子详情", "内容区域", "用户名字") - DirectUtils.directToHomeActivity(root.context, article.user.id, mEntrance, "帖子详情") + MtaHelper.onEvent("帖子详情", "内容区域", "用户头像") + DirectUtils.directToHomeActivity(root.context, article.user.id, 1, mEntrance, "帖子详情") } binding.run { @@ -150,9 +150,7 @@ class ArticleDetailContentViewHolder(var binding: ItemArticleDetailContentBindin detail = article richEditor.setContentOwner(article.me.isContentOwner) // 避免列表刷新 - if (TextUtils.isEmpty(richEditor.html)) { - richEditor.setHtml(article.content, true) - } + richEditor.setHtml(article.content, true) if (article.time.create == article.time.edit) { releaseTimeTv.text = String.format("发布于 %s", NewsUtils.getFormattedTime(article.time.create)) diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailFragment.kt index 73ff65ff80..0f3899d488 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailFragment.kt @@ -54,7 +54,7 @@ class ArticleDetailFragment : BaseArticleDetailCommentFragment(ArticleDetailEntity::class.java.simpleName)?.let { mViewModel.detailEntity = it + mAdapter?.articleDetailVH?.bindView(it) updateView() } mReuseNoConn?.performClick() //重新刷新 @@ -155,7 +156,7 @@ class ArticleDetailFragment : BaseArticleDetailCommentFragment { return mAdapter - ?: ArticleDetailAdapter(requireContext(), mViewModel, BaseArticleDetailCommentAdapter.AdapterType.COMMENT).apply { mAdapter = this } + ?: ArticleDetailAdapter(requireContext(), mViewModel, BaseArticleDetailCommentAdapter.AdapterType.COMMENT, mEntrance).apply { mAdapter = this } } override fun getItemDecoration(): RecyclerView.ItemDecoration { @@ -207,10 +208,6 @@ class ArticleDetailFragment : BaseArticleDetailCommentFragment @@ -461,8 +464,8 @@ class ArticleDetailFragment : BaseArticleDetailCommentFragment 60F.dip2px()) { forumGameIv.visibility = View.VISIBLE - ImageUtils.display(forumGameIv.getIconIv(), articleDetail.community.icon) - ImageUtils.display(forumGameIv.getIconDecoratorIv(), articleDetail.community.iconSubscript) + ImageUtils.display(forumGameIv.getIconIv(), articleDetail.community.game?.getIcon()) + ImageUtils.display(forumGameIv.getIconDecoratorIv(), articleDetail.community.game?.iconSubscript) forumTitleTv.text = articleDetail.community.name } else if (forumGameIv.visibility == View.VISIBLE @@ -479,6 +482,7 @@ class ArticleDetailFragment : BaseArticleDetailCommentFragment Unit)? = null) : ListAdapter(context), ISyncAdapterHandler { @@ -62,7 +63,7 @@ abstract class BaseArticleDetailCommentAdapter(context: Context, ITEM_COMMENT_NORMAL -> { val binding: ItemArticleDetailCommentBinding = DataBindingUtil.inflate(mLayoutInflater, R.layout.item_article_detail_comment, parent, false) - ArticleDetailCommentViewHolder(binding, type) + ArticleDetailCommentViewHolder(binding, mType) } ITEM_FILTER -> { @@ -102,7 +103,7 @@ abstract class BaseArticleDetailCommentAdapter(context: Context, override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { when (holder) { is ArticleDetailCommentViewHolder -> { - holder.bindComment(mEntityList[position].commentNormal!!, mViewModel, commentClosure) + holder.bindComment(mEntityList[position].commentNormal!!, mViewModel, mEntrance, commentClosure) } is ArticleDetailCommentFooterViewHolder -> { @@ -197,18 +198,27 @@ abstract class BaseArticleDetailCommentAdapter(context: Context, } @SuppressLint("SetTextI18n") - fun bindComment(comment: CommentEntity, viewModel: BaseArticleDetailCommentViewModel, commentClosure: ((CommentEntity) -> Unit)? = null) { - bindComment(binding, viewModel, comment) + fun bindComment(comment: CommentEntity, + viewModel: BaseArticleDetailCommentViewModel, + entrance: String, + commentClosure: ((CommentEntity) -> Unit)? = null) { + bindComment(binding, viewModel, comment, entrance) if (type == AdapterType.COMMENT) { // 帖子详情页面用的样式 updateSubComment(comment.subCommentList) - binding.floorHintTv.text = "${adapterPosition - 1}F" + binding.floorHintTv.text = "${adapterPosition - 1}楼" binding.root.setOnClickListener { - ArticleDetailCommentActivity.getIntent(binding.root.context, comment.id!!, viewModel.communityId, viewModel.articleId, "", "").apply { + ArticleDetailCommentActivity.getIntent(binding.root.context, comment.id!!, viewModel.communityId, viewModel.articleId, false, entrance, PATH_ARTICLE_DETAIL).apply { binding.root.context.startActivity(this) } MtaHelper.onEvent("帖子详情", "全部评论", "评论正文") } + binding.commentCountTv.setOnClickListener { + ArticleDetailCommentActivity.getIntent(binding.root.context, comment.id!!, viewModel.communityId, viewModel.articleId, true, entrance, PATH_ARTICLE_DETAIL).apply { + binding.root.context.startActivity(this) + } + MtaHelper.onEvent("帖子详情", "全部评论", "回复") + } binding.commentCountTv.text = viewModel.getCommentText(comment.reply, "评论") } else { // 评论详情用的样式 @@ -217,13 +227,13 @@ abstract class BaseArticleDetailCommentAdapter(context: Context, binding.commentCountTv.setCompoundDrawables(null, null, null, null) binding.commentCountTv.text = "回复" binding.replyUserContainer.goneIf(comment.parentUser == null) + binding.root.setOnClickListener { binding.moreIv.performClick() } comment.parentUser?.let { binding.replyUserNameTv.text = it.name binding.replyAuthorHintTv.goneIf(it.me?.isContentOwner == null || it.me?.isContentOwner == false) ImageUtils.display(binding.replyBadgeIv, it.badge?.icon) - binding.replyBadgeTv.text = it.badge?.name binding.replyUserNameTv.setOnClickListener { - DirectUtils.directToHomeActivity(binding.root.context, comment.user.id, 1, "", "") + DirectUtils.directToHomeActivity(binding.root.context, comment.user.id, 1, entrance, PATH_ARTICLE_DETAIL_COMMENT) MtaHelper.onEvent("帖子详情", "引用回复区域", "用户名字") } } @@ -235,7 +245,6 @@ abstract class BaseArticleDetailCommentAdapter(context: Context, binding.subCommentContainer.goneIf(subCommentList.isNullOrEmpty()) binding.firstSubCommentTv.goneIf(subCommentList?.firstOrNull() == null) binding.secondSubCommentTv.goneIf(subCommentList?.secondOrNull() == null) - binding.moreSubCommentBtn.goneIf(subCommentList == null || subCommentList.size < 3) subCommentList?.firstOrNull()?.let { binding.firstSubCommentTv.text = "${it.user.name}:${it.content}" @@ -246,25 +255,21 @@ abstract class BaseArticleDetailCommentAdapter(context: Context, } companion object { - fun bindComment(binding: ItemArticleDetailCommentBinding, viewModel: BaseArticleDetailCommentViewModel, comment: CommentEntity) { + fun bindComment(binding: ItemArticleDetailCommentBinding, + viewModel: BaseArticleDetailCommentViewModel, + comment: CommentEntity, + entrance: String) { + val path = if (viewModel is ArticleDetailViewModel) PATH_ARTICLE_DETAIL else PATH_ARTICLE_DETAIL_COMMENT + val mtaKey = if (viewModel is ArticleDetailViewModel) "全部评论" else "评论详情-全部回复" + binding.comment = comment binding.iconContainer.setOnClickListener { - // TODO 补全路径 - DirectUtils.directToHomeActivity(binding.root.context, comment.user.id, 1, "", "") - if (viewModel is ArticleDetailViewModel) { - MtaHelper.onEvent("帖子详情", "全部评论", "用户头像") - } else { - MtaHelper.onEvent("帖子详情", "评论详情-全部回复", "用户头像") - } + MtaHelper.onEvent("帖子详情", mtaKey, "用户头像") + DirectUtils.directToHomeActivity(binding.root.context, comment.user.id, 1, entrance, path) } binding.userNameTv.setOnClickListener { - DirectUtils.directToHomeActivity(binding.root.context, comment.user.id, 1, "", "") - - if (viewModel is ArticleDetailViewModel) { - MtaHelper.onEvent("帖子详情", "全部评论", "用户名字") - } else { - MtaHelper.onEvent("帖子详情", "评论详情-全部回复", "用户名字") - } + DirectUtils.directToHomeActivity(binding.root.context, comment.user.id, 1, entrance, path) + MtaHelper.onEvent("帖子详情", mtaKey, "用户名字") } binding.likeCountTv.text = viewModel.getLikeText(comment.vote) @@ -324,6 +329,9 @@ abstract class BaseArticleDetailCommentAdapter(context: Context, const val ITEM_COMMENT_NORMAL = 804 const val ITEM_ERROR_EMPTY = 805 const val ITEM_ERROR_CONNECTION = 806 + + const val PATH_ARTICLE_DETAIL = "帖子详情" + const val PATH_ARTICLE_DETAIL_COMMENT = "帖子评论详情" } enum class AdapterType { diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentActivity.kt index 7b17be8fb7..133a4df8f1 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentActivity.kt @@ -32,6 +32,7 @@ class ArticleDetailCommentActivity : NormalActivity() { commentId: String, communityId: String, articleId: String, + showKeyboard: Boolean = false, entrance: String, path: String): Intent { val intent = Intent(context, ArticleDetailCommentActivity::class.java) @@ -39,6 +40,7 @@ class ArticleDetailCommentActivity : NormalActivity() { intent.putExtra(EntranceUtils.KEY_COMMUNITY_ARTICLE_ID, articleId) intent.putExtra(EntranceUtils.KEY_COMMUNITY_ID, communityId) intent.putExtra(EntranceUtils.KEY_ARTICLE_COMMENT_ID, commentId) + intent.putExtra(EntranceUtils.KEY_SHOW_KEYBOARD_IF_NEEDED, showKeyboard) intent.putExtra(EntranceUtils.KEY_PATH, path) return intent } diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentAdapter.kt index 651e17af4d..bd4513c13d 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentAdapter.kt @@ -15,8 +15,9 @@ import com.gh.gamecenter.qa.article.detail.BaseArticleDetailCommentAdapter class ArticleDetailCommentAdapter(context: Context, var mViewModel: ArticleDetailCommentViewModel, type: AdapterType, + private var mEntrance: String, commentClosure: ((CommentEntity) -> Unit)? = null) - : BaseArticleDetailCommentAdapter(context, mViewModel, type, commentClosure) { + : BaseArticleDetailCommentAdapter(context, mViewModel, type, mEntrance, commentClosure) { var topCommentVH: ArticleDetailTopCommentViewHolder? = null @@ -58,11 +59,11 @@ class ArticleDetailCommentAdapter(context: Context, binding.comment = comment binding.moreIv.visibility = View.GONE - binding.floorHintTv.text = "1F" + binding.floorHintTv.text = "1楼" binding.commentCountTv.text = mViewModel.getCommentText(comment.reply, "回复") binding.commentCountTv.setOnClickListener { commentClosure?.invoke(comment) } - ArticleDetailCommentViewHolder.bindComment(binding, mViewModel, comment) + ArticleDetailCommentViewHolder.bindComment(binding, mViewModel, comment, mEntrance) } } diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentFragment.kt index 9e1a2d4bef..d1e48e8f69 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentFragment.kt @@ -67,7 +67,7 @@ class ArticleDetailCommentFragment : BaseArticleDetailCommentFragment { return mAdapter - ?: ArticleDetailCommentAdapter(requireContext(), mViewModel, BaseArticleDetailCommentAdapter.AdapterType.SUB_COMMENT) { + ?: ArticleDetailCommentAdapter(requireContext(), mViewModel, BaseArticleDetailCommentAdapter.AdapterType.SUB_COMMENT, mEntrance) { mCurrentComment = it startCommentActivity(it) }.apply { mAdapter = this } @@ -133,6 +133,11 @@ class ArticleDetailCommentFragment : BaseArticleDetailCommentFragment { if (it == BaseArticleDetailCommentViewModel.LoadResult.DELETED) { diff --git a/app/src/main/res/layout/item_article_detail_comment.xml b/app/src/main/res/layout/item_article_detail_comment.xml index d382a457a2..f46f2933f5 100644 --- a/app/src/main/res/layout/item_article_detail_comment.xml +++ b/app/src/main/res/layout/item_article_detail_comment.xml @@ -116,7 +116,7 @@ - -