diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 09456e3115..47a1f41388 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -735,6 +735,10 @@ android:name="com.gh.gamecenter.qa.subject.CommunitySubjectActivity" android:screenOrientation="portrait" /> + + Permissions.GUEST && !commentEntity.choiceness ) { dialogOptions.add("加精选") } - if (questionId != null && + if (!isOnlyShowCopyAndReport && questionId != null && commentEntity.me?.isModerator == true && (commentEntity.me?.moderatorPermissions?.cancelChoicenessAnswer ?: Permissions.GUEST) > Permissions.GUEST && @@ -173,11 +196,11 @@ object CommentHelper { ) { dialogOptions.add("取消精选") } - if (commentEntity.user.id == UserManager.getInstance().userId || commentEntity.me?.isModerator == true || commentEntity.me?.isContentAuthor == true) { + if (!isOnlyShowCopyAndReport && commentEntity.user.id == UserManager.getInstance().userId || commentEntity.me?.isModerator == true || commentEntity.me?.isContentAuthor == true) { dialogOptions.add("删除评论") } - if (commentEntity.parentUser != null && showConversation) { + if (!isOnlyShowCopyAndReport && commentEntity.parentUser != null && showConversation) { dialogOptions.add("查看对话") } diff --git a/app/src/main/java/com/gh/common/util/DirectUtils.kt b/app/src/main/java/com/gh/common/util/DirectUtils.kt index da338ec8c7..1d53932cad 100644 --- a/app/src/main/java/com/gh/common/util/DirectUtils.kt +++ b/app/src/main/java/com/gh/common/util/DirectUtils.kt @@ -1708,10 +1708,11 @@ object DirectUtils { * 跳转至游戏单详情 */ @JvmStatic - fun directToGameCollectionDetail(context: Context, id: String, entrance: String? = null) { + fun directToGameCollectionDetail(context: Context, id: String, entrance: String? = null, path: String? = null) { if (id.isEmpty()) return val bundle = Bundle() bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER) + bundle.putString(KEY_PATH, path) bundle.putString(KEY_TO, GameCollectionDetailActivity::class.java.name) bundle.putString(KEY_GAME_COLLECTION_ID, id) jumpActivity(context, bundle) diff --git a/app/src/main/java/com/gh/gamecenter/SkipActivity.java b/app/src/main/java/com/gh/gamecenter/SkipActivity.java index b220ac0b2a..cbb7e0cd67 100644 --- a/app/src/main/java/com/gh/gamecenter/SkipActivity.java +++ b/app/src/main/java/com/gh/gamecenter/SkipActivity.java @@ -394,7 +394,7 @@ public class SkipActivity extends BaseActivity { DirectUtils.directToHelpAndFeedback(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position)); break; case HOST_GAME_COLLECTION_DETAIL: - DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER); + DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, ""); break; case HOST_GAME_COLLECTION_SQUARE: DirectUtils.directToGameCollectionSquare(this, ENTRANCE_BROWSER, "", "", ""); diff --git a/app/src/main/java/com/gh/gamecenter/category2/SubCategoryAdapter.kt b/app/src/main/java/com/gh/gamecenter/category2/SubCategoryAdapter.kt index 36c6f7d557..c135fe7cd4 100644 --- a/app/src/main/java/com/gh/gamecenter/category2/SubCategoryAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/category2/SubCategoryAdapter.kt @@ -37,7 +37,7 @@ class SubCategoryAdapter( name.setTextColor(R.color.theme_font.toColor(mContext)) } else { selectedIv.visibility = View.GONE - container.background = R.drawable.bg_category_unselect.toDrawable(mContext) + container.background = R.drawable.bg_shape_f8_radius_8.toDrawable(mContext) name.setTextColor(R.color.text_title.toColor(mContext)) } @@ -48,7 +48,7 @@ class SubCategoryAdapter( categoryEntity.selected -> { categoryEntity.selected = false selectedIv.visibility = View.GONE - container.background = R.drawable.bg_category_unselect.toDrawable(mContext) + container.background = R.drawable.bg_shape_f8_radius_8.toDrawable(mContext) name.setTextColor(R.color.text_title.toColor(mContext)) mViewModel.run { if (selectedCount > 0) { 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 b258c49336..470985fb90 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/CommentEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/CommentEntity.kt @@ -34,7 +34,9 @@ data class CommentEntity( var floor: Int = 0, var isExpand: Boolean = false, @SerializedName("attached") // 楼中楼 - var subCommentList: ArrayList? = null + var subCommentList: ArrayList? = null, + var isHighlight: Boolean = false, // 是否高亮处理 + var isForceExpand: Boolean = false // 是否强制展开,即显示时就是展开状态 ) : Parcelable { fun clone(): CommentEntity { diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailViewModel.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailViewModel.kt index b91d92061d..4a45c9d018 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailViewModel.kt @@ -126,8 +126,12 @@ open class GameCollectionDetailViewModel(application: Application, } else if (list.isNullOrEmpty() && mLoadStatusLiveData.value == LoadStatus.INIT_FAILED) { add(CommentItemData(errorConnection = true)) } else { - list?.forEach { - add(CommentItemData(commentNormal = it)) + list?.forEachIndexed { index, commentEntity -> + if (topCommentId.isNotBlank() && index == 0) { + commentEntity.isHighlight = true + commentEntity.isForceExpand = true + } + add(CommentItemData(commentNormal = commentEntity)) } add(CommentItemData(footer = true)) } diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/conversation/GameCollectionCommentConversationViewModel.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/conversation/GameCollectionCommentConversationViewModel.kt index 131883d36d..5c968c4393 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/conversation/GameCollectionCommentConversationViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/conversation/GameCollectionCommentConversationViewModel.kt @@ -22,7 +22,11 @@ class GameCollectionCommentConversationViewModel(application: Application, override fun provideDataObservable(page: Int) = null override fun provideDataSingle(page: Int): Single> { - return mApi.getGameCollectionCommentReply(gameCollectionId, commentId, page) + val map = hashMapOf() + if (topCommentId.isNotEmpty()) { + map["top_comment_id"] = topCommentId + } + return mApi.getGameCollectionCommentReply(gameCollectionId, commentId, page, map) } @SuppressLint("CheckResult") diff --git a/app/src/main/java/com/gh/gamecenter/message/MessageAdapter.java b/app/src/main/java/com/gh/gamecenter/message/MessageAdapter.java index 7d827d9989..6f79abc5b4 100644 --- a/app/src/main/java/com/gh/gamecenter/message/MessageAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/message/MessageAdapter.java @@ -127,12 +127,6 @@ public class MessageAdapter extends ListAdapter { FooterViewHolder footerViewHolder = (FooterViewHolder) holder; footerViewHolder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver); footerViewHolder.initItemPadding(); - - if (mIsOver && (mEntityList == null || mEntityList.isEmpty())) { - footerViewHolder.itemView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0)); - } else { - footerViewHolder.itemView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - } break; } } diff --git a/app/src/main/java/com/gh/gamecenter/message/MessageFragment.java b/app/src/main/java/com/gh/gamecenter/message/MessageFragment.java index 2ca26c1ff3..2cd3191a0d 100644 --- a/app/src/main/java/com/gh/gamecenter/message/MessageFragment.java +++ b/app/src/main/java/com/gh/gamecenter/message/MessageFragment.java @@ -4,8 +4,11 @@ import android.os.Bundle; import android.view.View; import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; import androidx.lifecycle.ViewModelProviders; +import androidx.recyclerview.widget.RecyclerView; +import com.gh.gamecenter.common.view.CustomDividerItemDecoration; import com.gh.gamecenter.core.utils.MtaHelper; import com.gh.gamecenter.MessageInviteActivity; import com.gh.gamecenter.MessageKeFuActivity; @@ -51,6 +54,14 @@ public class MessageFragment extends ListFragment public void setMessageItem(MessageEntity messageEntity, Context context, String entrance) { mBinding.messageItem.setBackground(ContextCompat.getDrawable(mBinding.getRoot().getContext(), R.drawable.reuse_listview_item_style)); - mBinding.messageOriginal.setBackgroundColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.background)); - mBinding.messageUserName.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.text_black)); + mBinding.messageOriginal.setBackground(ContextCompat.getDrawable(mBinding.getRoot().getContext(), R.drawable.bg_shape_f8_radius_8)); + mBinding.messageUserName.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.text_title)); mBinding.messageUserMore.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.theme_font)); - mBinding.messageCommand.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.title)); - mBinding.messageTime.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.hint)); - mBinding.messageContent.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.text_black)); - mBinding.messageOriginalTitle.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.title)); + mBinding.messageCommand.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.text_title)); + mBinding.messageTime.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.text_subtitleDesc)); + mBinding.messageContent.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.text_subtitle)); + mBinding.messageOriginalTitle.setTextColor(ContextCompat.getColor(mBinding.getRoot().getContext(), R.color.text_subtitleDesc)); setClickData(messageEntity); - ImageUtils.display(mBinding.messageUserIcon, messageEntity.getUserEntity().getIcon()); if (messageEntity.getUserEntity().getAuth() != null) { - ImageUtils.display(mBinding.messageUserBadge, messageEntity.getUserEntity().getAuth().getIcon()); + mBinding.messageUserIcon.display(messageEntity.getUserEntity().getBorder(), messageEntity.getUserEntity().getIcon(), messageEntity.getUserEntity().getAuth().getIcon()); + } else { + mBinding.messageUserIcon.display(messageEntity.getUserEntity().getBorder(), messageEntity.getUserEntity().getIcon(), null); } - BindingAdapters.showHide(mBinding.messageUserBadge, messageEntity.getUserEntity().getAuth() != null); BindingAdapters.showHide(mBinding.messageUnread, !messageEntity.getRead()); mBinding.messageUserName.setText(messageEntity.getUserEntity().getName()); @@ -100,7 +102,6 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder case "answer": mBinding.messageCommand.setText("回答了你的问题"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(3); mBinding.messageContent.setText(messageEntity.getAnswer().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getQuestion().getTitle()); images = messageEntity.getAnswer().getImages(); @@ -115,7 +116,6 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder case "reply": mBinding.messageCommand.setText("回复了你"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getDialogue().getFrom().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getArticle().getTitle()); targetUrl = messageEntity.getArticle().getThumb(); @@ -127,7 +127,6 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder case "follow_question": mBinding.messageCommand.setText("回答了你关注的问题"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(3); mBinding.messageContent.setText(messageEntity.getAnswer().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getQuestion().getTitle()); images = messageEntity.getAnswer().getImages(); @@ -140,9 +139,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "reply_answer_comment": - mBinding.messageCommand.setText("回复了你"); + mBinding.messageCommand.setText("回复了你的回答"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getDialogue().getFrom().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getQuestion().getTitle()); images = messageEntity.getAnswer().getImages(); @@ -157,7 +155,6 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder case "answer_comment": mBinding.messageCommand.setText("评论了你"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getComment().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getQuestion().getTitle()); images = messageEntity.getAnswer().getImages(); @@ -245,9 +242,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "community_article_comment": - mBinding.messageCommand.setText("评论了你"); + mBinding.messageCommand.setText("评论了你的帖子"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getComment().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getArticle().getTitle()); images = messageEntity.getArticle().getImages(); @@ -286,9 +282,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "reply_community_article_comment": - mBinding.messageCommand.setText("回复了你"); + mBinding.messageCommand.setText("回复了你的评论"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getDialogue().getFrom().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getArticle().getTitle()); images = messageEntity.getArticle().getImages(); @@ -313,7 +308,6 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder case "update-answer": mBinding.messageCommand.setText("更新了回答"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(3); mBinding.messageContent.setText(messageEntity.getAnswer().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getQuestion().getTitle()); images = messageEntity.getAnswer().getImages(); @@ -336,9 +330,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "game_comment_reply": - mBinding.messageCommand.setText("回复了你"); + mBinding.messageCommand.setText("回复了你的评价"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getReply().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getGame().getName()); targetUrl = messageEntity.getGame().getDefaultIcon(); @@ -348,9 +341,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "video_comment": - mBinding.messageCommand.setText("评论了你"); + mBinding.messageCommand.setText("评论了你的帖子"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getComment().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getVideo().getTitle()); targetUrl = messageEntity.getVideo().getPoster(); @@ -360,9 +352,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "video_comment_reply": - mBinding.messageCommand.setText("回复了你"); + mBinding.messageCommand.setText("回复了你的评论"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getDialogue().getFrom().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getVideo().getTitle()); targetUrl = messageEntity.getVideo().getPoster(); @@ -404,7 +395,6 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder case "reply_activity_comment": mBinding.messageCommand.setText("回复了你"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getDialogue().getFrom().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getActivity().getTitle()); targetUrl = messageEntity.getActivity().getImageUrl(); @@ -444,9 +434,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "game_list_comment": - mBinding.messageCommand.setText("评论了你"); + mBinding.messageCommand.setText("评价了你的游戏单"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getComment().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getGameList().getTitle()); targetUrl = messageEntity.getGameList().getCover(); @@ -456,9 +445,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder voteMoreUser(messageEntity); break; case "game_list_comment_reply": - mBinding.messageCommand.setText("回复了你"); + mBinding.messageCommand.setText("回复了你的游戏单评价"); mBinding.messageContent.setVisibility(View.VISIBLE); - mBinding.messageContent.setMaxLines(Integer.MAX_VALUE); mBinding.messageContent.setText(messageEntity.getComment().getContent()); mBinding.messageOriginalTitle.setText(messageEntity.getGameList().getTitle()); targetUrl = messageEntity.getGameList().getCover(); @@ -564,23 +552,24 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder MtaHelper.onEvent("消息中心", outerInfo, "点击卡片"); } + Intent intent; switch (entity.getType()) { case "comment_vote": if (view.getId() == R.id.message_original) { - Intent intent = NewsDetailActivity.getIntentById(context, entity.getArticle().getId(), BaseActivity.mergeEntranceAndPath(entrance, path)); + intent = NewsDetailActivity.getIntentById(context, entity.getArticle().getId(), BaseActivity.mergeEntranceAndPath(entrance, path)); context.startActivity(intent); } else if (view.getId() == R.id.message_item) { - Intent intent = MessageDetailActivity.getIntentById(context, + intent = MessageDetailActivity.getIntentById(context, entity.getArticle().getId(), -1, false, BaseActivity.mergeEntranceAndPath(entrance, path)); context.startActivity(intent); } break; case "reply": if (view.getId() == R.id.message_original) { - Intent intent = NewsDetailActivity.getIntentById(context, entity.getArticle().getId(), BaseActivity.mergeEntranceAndPath(entrance, path)); + intent = NewsDetailActivity.getIntentById(context, entity.getArticle().getId(), BaseActivity.mergeEntranceAndPath(entrance, path)); context.startActivity(intent); } else if (view.getId() == R.id.message_item) { - Intent intent = CommentDetailActivity.getIntent(context, entity.getDialogue().getFrom().getId(), entity.getArticle()); + intent = CommentDetailActivity.getIntent(context, entity.getDialogue().getFrom().getId(), entity.getArticle()); context.startActivity(intent); } break; @@ -596,15 +585,20 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder } break; case "answer": + intent = NewQuestionDetailActivity.getSpecifiedCommentIntent( + context, + entity.getQuestion().getId(), + entity.getAnswer().getId(), + entrance, + path + ); + context.startActivity(intent); + break; case "update-answer": case "follow_question": if (view.getId() == R.id.message_original) { MessageEntity.Question question = entity.getQuestion(); context.startActivity(NewQuestionDetailActivity.getCommentIntent(context, question.getId(), entity.getAnswer().getId(), entrance, path)); - - Questions questions = new Questions(); - questions.setId(question.getId()); - questions.setTitle(question.getTitle()); } else if (view.getId() == R.id.message_item) { context.startActivity(SimpleAnswerDetailActivity.getIntent(context, entity.getAnswer().getId(), entrance, path)); } @@ -624,7 +618,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder linkEntity.setType("answer"); linkEntity.setLink(entity.getAnswer().getId()); linkEntity.setTitle(entity.getQuestion().getTitle()); - Intent intent = CommentDetailActivity.getAnswerCommentIntent(context, + intent = CommentDetailActivity.getAnswerCommentIntent(context, entity.getDialogue().getFrom().getId(), entity.getAnswer().getId(), linkEntity); @@ -653,11 +647,14 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder 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.getCommentIntent(context, community, entity.getArticle().getId(), entrance, path)); - } + intent = ArticleDetailActivity.getSpecifiedCommentIntent( + context, + community, + entity.getArticle().getId(), + entity.getComment().getId(), + entrance, + path); + context.startActivity(intent); break; case "community_article_vote": if (view.getId() == R.id.message_original || view.getId() == R.id.message_item) { @@ -666,9 +663,19 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder } break; case "reply_community_article_comment": - if (view.getId() == R.id.message_original || view.getId() == R.id.message_item) { - context.startActivity(CommentActivity.getCommentDetailIntent(context, entity.getDialogue().getTo().getTopId(), entity.getArticle().getCommunityId(), entity.getArticle().getId(), "", "", false, 1, entrance, path)); - } + intent = NewCommentDetailActivity.Companion.getIntent( + context, + entity.getDialogue().getTo().getTopId(), + entity.getArticle().getCommunityId(), + entity.getArticle().getId(), + "", + "", + "", + entity.getDialogue().getFrom().getId(), + entrance, + path + ); + context.startActivity(intent); break; case "game_comment_vote": if (view.getId() == R.id.message_original || view.getId() == R.id.message_item) { @@ -678,7 +685,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder case "game_comment_reply": case "game_comment_reply_vote": if (view.getId() == R.id.message_original || view.getId() == R.id.message_item) { - Intent intent = RatingReplyActivity.getIntent(context, entity.getGame().getId(), entity.getReply().getCommentId(), entrance, path); + intent = RatingReplyActivity.getIntent(context, entity.getGame().getId(), entity.getReply().getCommentId(), entrance, path); context.startActivity(intent); } break; @@ -697,8 +704,30 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder } break; case "video_comment": - case "video_comment_vote": + intent = ForumVideoDetailActivity.Companion.getSpecifiedCommentIntent( + context, + entity.getVideo().getId(), + "", + entity.getComment().getId() + ); + context.startActivity(intent); + break; case "video_comment_reply": + intent = NewCommentDetailActivity.Companion.getIntent( + context, + entity.getDialogue().getTo().getId(), + "", + "", + entity.getVideo().getId(), + "", + "", + entity.getDialogue().getFrom().getId(), + entrance, + path + ); + context.startActivity(intent); + break; + case "video_comment_vote": case "video_comment_reply_vote": boolean showComment = false; @@ -734,6 +763,20 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder } break; case "game_list_comment_reply": + intent = NewCommentDetailActivity.Companion.getIntent( + context, + entity.getComment().getTopId(), + "", + "", + "", + "", + entity.getGameList().getId(), + entity.getComment().getId(), + entrance, + path + ); + context.startActivity(intent); + break; case "game_list_comment_vote": if (view.getId() == R.id.message_original) { context.startActivity(GameCollectionDetailActivity.getIntent(context, entity.getGameList().getId(), false)); 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 60d31bbd87..c19d9b80df 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 @@ -101,5 +101,27 @@ class ArticleDetailActivity : NormalActivity() { intent.putExtra(EntranceConsts.KEY_PATH, path) return intent } + + /** + * 定位到指定的评论并置顶 + */ + @JvmStatic + fun getSpecifiedCommentIntent( + context: Context, + community: CommunityEntity, + articleId: String, + topCommentId: String, + entrance: String, + path: String + ): Intent { + val intent = Intent(context, ArticleDetailActivity::class.java) + intent.putExtra(EntranceConsts.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path)) + intent.putExtra(EntranceConsts.KEY_COMMUNITY_ARTICLE_ID, articleId) + intent.putExtra(EntranceConsts.KEY_COMMUNITY_DATA, community) + intent.putExtra(EntranceConsts.KEY_SCROLL_TO_COMMENT_AREA, true) + intent.putExtra(EntranceConsts.KEY_TOP_COMMENT_ID, topCommentId) + intent.putExtra(EntranceConsts.KEY_PATH, path) + return intent + } } } \ No newline at end of file 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 ce6db26907..8c678a9301 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 @@ -191,7 +191,8 @@ class ArticleDetailFragment : BaseCommentFragment(EntranceConsts.KEY_COMMUNITY_DATA)?.id ?: "", - arguments?.getString(EntranceConsts.KEY_RECOMMEND_ID) ?: "" + arguments?.getString(EntranceConsts.KEY_RECOMMEND_ID) ?: "", + arguments?.getString(EntranceConsts.KEY_TOP_COMMENT_ID) ?: "" ) ) } diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailViewModel.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailViewModel.kt index 65fcbc4f52..18c3c54da1 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailViewModel.kt @@ -33,13 +33,15 @@ class ArticleDetailViewModel( application: Application, articleId: String = "", communityId: String = "", - val recommendId: String = "" + val recommendId: String = "", + topCommentId: String ) : BaseCommentViewModel( application, articleId = articleId, communityId = communityId, videoId = "", - questionId = "" + questionId = "", + topCommentId = topCommentId ) { var detailEntity: ArticleDetailEntity? = null @@ -60,11 +62,16 @@ class ArticleDetailViewModel( var articlePageFinishedLiveData = MutableLiveData() override fun provideDataObservable(page: Int): Observable> { + val map = hashMapOf() + if (topCommentId.isNotEmpty()) { + map["top_comment_id"] = topCommentId + } return RetrofitManager.getInstance().api.getCommunityArticleCommentList( communityId, articleId, currentSortType.value, - page + page, + map ) } @@ -408,7 +415,8 @@ class ArticleDetailViewModel( private val application: Application, private val articleId: String = "", private val communityId: String = "", - private val recommendId: String = "" + private val recommendId: String = "", + private val topCommentId: String = "" ) : ViewModelProvider.NewInstanceFactory() { override fun create(modelClass: Class): T { @@ -416,7 +424,8 @@ class ArticleDetailViewModel( application = application, articleId = articleId, communityId = communityId, - recommendId = recommendId + recommendId = recommendId, + topCommentId = topCommentId ) as T } } diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentViewModel.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentViewModel.kt index 48ef8cd317..e8e920496d 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/comment/ArticleDetailCommentViewModel.kt @@ -31,7 +31,7 @@ class ArticleDetailCommentViewModel(application: Application, } override fun provideDataSingle(page: Int): Single> { - return RetrofitManager.getInstance().api.getCommunityArticleCommentReply(communityId, articleId, commentId, currentSortType.value, page) + return RetrofitManager.getInstance().api.getCommunityArticleCommentReply(communityId, articleId, commentId, currentSortType.value, page, mapOf()) } @SuppressLint("CheckResult") diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentDetailActivity.kt new file mode 100644 index 0000000000..bb82be1375 --- /dev/null +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentDetailActivity.kt @@ -0,0 +1,45 @@ +package com.gh.gamecenter.qa.comment + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import com.gh.gamecenter.NormalActivity +import com.gh.gamecenter.common.constant.EntranceConsts +import com.gh.gamecenter.qa.comment.conversation.CommentConversationFragment + +class NewCommentDetailActivity: NormalActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setNavigationTitle("评论详情") + } + + companion object { + @JvmStatic + fun getIntent( + context: Context, + commentId: String, + communityId: String, + articleId: String, + videoId: String, + questionId: String, + gameCollectionId: String, + topCommentId: String, + entrance: String, + path: String + ): Intent { + val bundle = Bundle() + bundle.putString(EntranceConsts.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path)) + bundle.putInt(EntranceConsts.KEY_POSITION, 1) + bundle.putString(EntranceConsts.KEY_COMMENT_ID, commentId) + bundle.putString(EntranceConsts.KEY_COMMUNITY_ID, communityId) + bundle.putString(EntranceConsts.KEY_COMMUNITY_ARTICLE_ID, articleId) + bundle.putString(CommentActivity.VIDEO_ID, videoId) + bundle.putString(CommentActivity.QUESTION_ID, questionId) + bundle.putString(CommentActivity.GAME_COLLECTION_ID, gameCollectionId) + bundle.putString(EntranceConsts.KEY_TOP_COMMENT_ID, topCommentId) + bundle.putString(EntranceConsts.KEY_PATH, path) + return getTargetIntent(context, NewCommentDetailActivity::class.java, CommentConversationFragment::class.java, bundle) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentFragment.kt index d3cbd952f8..c765106154 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentFragment.kt @@ -237,7 +237,7 @@ open class NewCommentFragment : ListFragment if (mShowInputOnly) { if (mCommentEntity != null) { - commentEt.hint = "回复:${mCommentEntity?.user?.name}" + commentEt.hint = "回复 @${mCommentEntity?.user?.name}" } commentContainer?.visibility = View.GONE commentEt.requestFocus() diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentViewModel.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentViewModel.kt index 885538806e..7da5eda265 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentViewModel.kt @@ -65,7 +65,7 @@ open class NewCommentViewModel( CommentType.ANSWER -> api.getAnswerCommentList(answerId, page) CommentType.ANSWER_CONVERSATION -> api.getAnswerCommentConversationList(answerId, commentId, page) - CommentType.COMMUNITY_ARTICLE -> api.getCommunityArticleCommentList(communityId, articleId, "time.create:1", page) + CommentType.COMMUNITY_ARTICLE -> api.getCommunityArticleCommentList(communityId, articleId, "time.create:1", page, mapOf()) CommentType.COMMUNITY_ARTICLE_CONVERSATION -> api.getCommunityArticleCommentConversation(communityId, articleId, commentId, page) CommentType.VIDEO -> api.getVideoCommentList(videoId, page, mapOf()) 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 02d0bc797a..27dc21a0ca 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 @@ -203,6 +203,7 @@ abstract class BaseCommentAdapter( } is CommentFooterViewHolder -> { + holder.itemView.setBackgroundColor(R.color.background_white.toColor(mContext)) holder.bindView(mIsLoading, mIsNetworkError, mIsOver) } @@ -251,7 +252,8 @@ abstract class BaseCommentAdapter( article: ArticleDetailEntity? = null, questions: QuestionsDetailEntity? = null, comment: CommentEntity? = null, - gameCollection: Boolean? = null + gameCollection: Boolean? = null, + commentDetail: Boolean? = null ) { binding.run { filterView.setBackgroundColor(R.color.background_white.toColor(mContext)) @@ -278,6 +280,9 @@ abstract class BaseCommentAdapter( gameCollection != null -> { "玩家评论" } + commentDetail != null -> { + "全部讨论" + } else -> { "" } @@ -289,7 +294,7 @@ abstract class BaseCommentAdapter( commentCount.toSimpleCount() } - divider.goneIf(gameCollection == true) + divider.goneIf(gameCollection == true || commentDetail == true) if (orderSfv.getItemList().isEmpty()) { orderSfv.setItemList(listOf("正序", "倒序"), 0) } @@ -327,14 +332,6 @@ abstract class BaseCommentAdapter( var type: AdapterType ) : RecyclerView.ViewHolder(binding.root) { - init { - if (type == AdapterType.SUB_COMMENT) { - binding.userNameTv.textSize = 12F - binding.contentTv.textSize = 14F - binding.timeTv.visibility = View.GONE - } - } - @SuppressLint("SetTextI18n") fun bindComment( comment: CommentEntity, @@ -431,9 +428,9 @@ abstract class BaseCommentAdapter( binding.commentCountTv.text = viewModel.getCommentText(comment.reply, "回复") } else { // 评论详情用的样式 - binding.floorHintTv.text = CommentUtils.getCommentTime(comment.time) + binding.floorHintTv.visibility = View.GONE binding.commentCountTv.setOnClickListener { commentClosure?.invoke(comment) } - binding.commentCountTv.setCompoundDrawables(null, null, null, null) +// binding.commentCountTv.setCompoundDrawables(null, null, null, null) binding.commentCountTv.text = "回复" binding.likeCountTv.text = viewModel.getLikeText(comment.vote, "") binding.root.setOnClickListener { binding.commentCountTv.performClick() } @@ -441,17 +438,16 @@ abstract class BaseCommentAdapter( if (comment.parentUser != null) { val prefix = "回复" val colon = " :" - val parentUserName = " ${comment.parentUser?.name} " + val parentUserName = " @${comment.parentUser?.name} " val prefixSpan = SpanBuilder(prefix).color( binding.root.context, 0, prefix.length, - R.color.text_subtitleDesc + R.color.text_4D4D4D ).build() val parentUserNameSpan = SpanBuilder(parentUserName) - .bold(0, parentUserName.length) - .click(0, parentUserName.length, R.color.text_subtitle) { + .click(0, parentUserName.length, R.color.text_subtitleDesc) { DirectUtils.directToHomeActivity( binding.root.context, comment.user.id, @@ -465,7 +461,7 @@ abstract class BaseCommentAdapter( binding.root.context, 0, colon.length, - R.color.text_subtitleDesc + R.color.text_4D4D4D ).build() val authorSpan = if (comment.parentUser?.me?.isCommentOwner == true) { SpanBuilder("作者").image(0, "作者".length, R.drawable.ic_hint_author).build() @@ -596,6 +592,18 @@ abstract class BaseCommentAdapter( } val mtaKey = if (viewModel is ArticleDetailViewModel) "全部评论" else "评论详情-全部回复" + if (comment.isHighlight) { + comment.isHighlight = false + binding.highlightBg.run { + visibility = View.VISIBLE + postDelayed({ + tryWithDefaultCatch { + visibility = View.GONE + } + }, 3000) + } + } + if (!comment.images.isNullOrEmpty()) { if (binding.commentPictureRv.adapter == null) { binding.commentPictureRv.apply { @@ -613,9 +621,18 @@ abstract class BaseCommentAdapter( binding.commentPictureRv.visibility = View.GONE } bindView(binding, comment) - binding.contentTv.setExpandMaxLines(if (comment.isExpand) Int.MAX_VALUE else 4) - binding.contentTv.setIsExpanded(comment.isExpand) - binding.collapseTv.goneIf(!comment.isExpand) + if (comment.isForceExpand) { + comment.isForceExpand = false + binding.contentTv.setExpandMaxLines(Int.MAX_VALUE) + binding.contentTv.setIsExpanded(true) + binding.contentTv.post { + binding.collapseTv.goneIf(binding.contentTv.lineCount <= 4) + } + } else { + binding.contentTv.setExpandMaxLines(if (comment.isExpand) Int.MAX_VALUE else 4) + binding.contentTv.setIsExpanded(comment.isExpand) + binding.collapseTv.goneIf(!comment.isExpand) + } binding.contentTv.setExpandCallback { comment.isExpand = true binding.collapseTv.visibility = View.VISIBLE @@ -664,7 +681,7 @@ abstract class BaseCommentAdapter( ) } - binding.likeCountTv.text = viewModel.getLikeText(comment.vote) + binding.likeCountTv.text = viewModel.getLikeText(comment.vote, if (viewModel is CommentConversationViewModel) "" else "赞同") if (comment.me?.isCommentVoted == true) { binding.likeCountTv.setCompoundDrawablesWithIntrinsicBounds( diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentFragment.kt index 9cc756ec82..5104ae73c5 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentFragment.kt @@ -98,10 +98,13 @@ abstract class BaseCommentFragment : ListFragment< override fun getItemDecoration(): RecyclerView.ItemDecoration { val drawable = ContextCompat.getDrawable(requireContext(), R.drawable.divider_article_detail_comment) - val itemDecoration = if (this !is CommentConversationFragment) { - CustomDividerItemDecoration(requireContext(), notDecorateTheFirstTwoItems = true, notDecorateTheLastItem = true) - } else { - CustomDividerItemDecoration(requireContext(), notDecorateTheFirstItem = true, notDecorateTheLastItem = true) + val itemDecoration = when { + this !is CommentConversationFragment || mListViewModel.topCommentId.isNotBlank() -> { + CustomDividerItemDecoration(requireContext(), notDecorateTheFirstTwoItems = true, notDecorateTheLastItem = true) + } + else -> { + CustomDividerItemDecoration(requireContext(), notDecorateTheFirstItem = true, notDecorateTheLastItem = true) + } } itemDecoration.setDrawable(drawable!!) diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentViewModel.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentViewModel.kt index 306e82a9f3..46cca1293f 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentViewModel.kt @@ -35,7 +35,8 @@ abstract class BaseCommentViewModel( var articleId: String, var videoId: String, var questionId: String, - var communityId: String + var communityId: String, + var topCommentId: String = "" ) : ListViewModel(application) { protected val mApi: ApiService = RetrofitManager.getInstance().api var currentSortType: SortType = SortType.OLDEST @@ -46,6 +47,8 @@ abstract class BaseCommentViewModel( var commentCount = 0 + var isHandleTopComment = false + override fun loadStatusControl(size: Int) { if (mCurLoadParams.loadOffset == LoadParams.DEFAULT_OFFSET) { // 初始化列表 when { @@ -89,7 +92,7 @@ abstract class BaseCommentViewModel( fun mergeListData( commentList: List?, displayFloor: Boolean = false, - hasFilter: Boolean = true + hasFilter: Boolean = true, ) { topItemData?.let { val mergedList = arrayListOf().apply { @@ -112,15 +115,19 @@ abstract class BaseCommentViewModel( } else { //从第二楼开始 var floor = 2 - commentList?.forEach { + commentList?.forEachIndexed { index, commentEntity -> if (displayFloor) { - it.floor = floor + commentEntity.floor = floor } // 没有 me 会导致不能跨页面更新点赞 - if (it.me == null) { - it.me = MeEntity() + if (commentEntity.me == null) { + commentEntity.me = MeEntity() } - add(CommentItemData(commentNormal = it)) + if (topCommentId.isNotBlank() && index == 0) { + commentEntity.isHighlight = true + commentEntity.isForceExpand = true + } + add(CommentItemData(commentNormal = commentEntity)) if (displayFloor) { floor++ } diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationAdapter.kt index b2b0bb1046..6219851c05 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationAdapter.kt @@ -6,7 +6,10 @@ import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.recyclerview.widget.RecyclerView +import com.gh.common.util.CommentUtils +import com.gh.common.util.DirectUtils import com.gh.gamecenter.common.utils.dip2px +import com.gh.gamecenter.common.utils.goneIf import com.gh.gamecenter.databinding.ItemArticleDetailCommentBinding import com.gh.gamecenter.entity.CommentEntity import com.gh.gamecenter.qa.comment.base.BaseCommentAdapter @@ -39,6 +42,10 @@ class CommentConversationAdapter( holder.bindView(mEntityList[position].commentTop!!) } + is CommentFilterViewHolder -> { + holder.bindView(commentDetail = true) + } + else -> super.onBindViewHolder(holder, position) } } @@ -54,8 +61,8 @@ class CommentConversationAdapter( clear(binding.commentPictureRv.id, ConstraintSet.START) connect(binding.commentPictureRv.id, ConstraintSet.START, binding.userIconIv.id, ConstraintSet.START) - clear(binding.timeTv.id, ConstraintSet.START) - connect(binding.timeTv.id, ConstraintSet.START, binding.userIconIv.id, ConstraintSet.START) + clear(binding.bottomContainer.id, ConstraintSet.START) + connect(binding.bottomContainer.id, ConstraintSet.START, binding.userIconIv.id, ConstraintSet.START) applyTo(binding.contentTv.parent as ConstraintLayout) } @@ -70,17 +77,64 @@ class CommentConversationAdapter( binding.commentPictureRv.layoutParams = this } - (binding.timeTv.layoutParams as ConstraintLayout.LayoutParams).apply { + (binding.bottomContainer.layoutParams as ConstraintLayout.LayoutParams).apply { leftMargin = 9F.dip2px() - binding.timeTv.layoutParams = this + binding.bottomContainer.layoutParams = this } - binding.moreIv.visibility = View.GONE - binding.divider.visibility = View.VISIBLE - binding.commentCountTv.visibility = View.GONE - binding.floorHintTv.text = if (comment.floor != 0) "${comment.floor}楼" else "" - binding.contentTv.text = comment.content - binding.contentTv.maxLines = Int.MAX_VALUE + binding.run { + moreIv.visibility = View.GONE + divider.visibility = View.VISIBLE + commentCountTv.visibility = View.GONE + floorHintTv.text = if (comment.floor != 0) "${comment.floor}楼" else "" + contentTv.text = comment.content + contentTv.maxLines = Int.MAX_VALUE + commentTopTimeTv.goneIf(mViewModelCommunity.topCommentId.isBlank()) + commentTopTimeTv.text = CommentUtils.getCommentTime(comment.time) + timeTv.goneIf(mViewModelCommunity.topCommentId.isNotBlank()) + originalTv.goneIf(mViewModelCommunity.topCommentId.isBlank()) + originalTv.text = if (mViewModelCommunity.gameCollectionId.isNotEmpty()) "查看游戏单" else "查看原文" + originalTv.setOnClickListener { + mViewModelCommunity.run { + val path = if (gameCollectionId.isNotEmpty()) "评论详情-查看游戏单" else "评论详情-查看原文" + when { + articleId.isNotEmpty() -> { + DirectUtils.directToCommunityArticle( + mContext, + articleId, + communityId, + mEntrance, + path + ) + } + videoId.isNotEmpty() -> { + DirectUtils.directToVideoDetail( + mContext, + videoId, + mEntrance, + path + ) + } + questionId.isNotEmpty() -> { + DirectUtils.directToQuestionDetail( + mContext, + questionId, + mEntrance, + path + ) + } + gameCollectionId.isNotEmpty() -> { + DirectUtils.directToGameCollectionDetail( + mContext, + gameCollectionId, + mEntrance, + path + ) + } + } + } + } + } CommentItemViewHolder.bindComment(binding, mViewModelCommunity, comment, mEntrance, null) } diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationFragment.kt index 8122f97097..d954f71549 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/conversation/CommentConversationFragment.kt @@ -5,8 +5,12 @@ import android.app.Activity import android.content.Intent import android.os.Bundle import android.view.LayoutInflater +import android.view.MenuItem import android.view.View +import android.view.ViewGroup import com.ethanhua.skeleton.Skeleton +import com.gh.base.ToolBarActivity +import com.gh.common.util.CommentHelper import com.gh.gamecenter.core.AppExecutor import com.gh.gamecenter.common.syncpage.SyncDataEntity import com.gh.gamecenter.common.syncpage.SyncFieldConstants @@ -26,19 +30,20 @@ import com.gh.gamecenter.qa.article.detail.CommentItemData import com.gh.gamecenter.qa.comment.CommentActivity import com.halo.assistant.HaloApp -class CommentConversationFragment : BaseCommentFragment() { +class CommentConversationFragment : + BaseCommentFragment() { private lateinit var mViewModel: CommentConversationViewModel private lateinit var mBinding: FragmentArticleDetailCommentBinding private var mAdapterCommunity: CommentConversationAdapter? = null - override fun getLayoutId() = R.layout.fragment_article_detail_comment + override fun getLayoutId() = 0 override fun onCreate(savedInstanceState: Bundle?) { mViewModel = provideListViewModel() super.onCreate(savedInstanceState) mViewModel.getComment() mViewModel.positionInOriginList = arguments?.getInt(EntranceConsts.KEY_POSITION) - ?: -1 + ?: -1 } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -48,20 +53,29 @@ class CommentConversationFragment : BaseCommentFragment { return mAdapterCommunity - ?: CommentConversationAdapter(requireContext(), mViewModel, BaseCommentAdapter.AdapterType.SUB_COMMENT, mEntrance) { - if (it.user.id == UserManager.getInstance().userId) { - toast("不能回复自己") - } else { - startCommentActivity(it) - } - }.apply { - mAdapterCommunity = this + ?: CommentConversationAdapter( + requireContext(), + mViewModel, + BaseCommentAdapter.AdapterType.SUB_COMMENT, + mEntrance + ) { + if (it.user.id == UserManager.getInstance().userId) { + toast("不能回复自己") + } else { + startCommentActivity(it) } + }.apply { + mAdapterCommunity = this + } } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { @@ -72,27 +86,67 @@ class CommentConversationFragment : BaseCommentFragment 2) { mListRv.smoothScrollToPosition(1) @@ -143,14 +200,17 @@ class CommentConversationFragment : BaseCommentFragment>? = null override fun provideDataSingle(page: Int): Single>? { + val map = hashMapOf() + if (topCommentId.isNotEmpty()) { + map["top_comment_id"] = topCommentId + } return when { articleId.isNotEmpty() -> { - mApi.getCommunityArticleCommentReply(communityId, articleId, commentId, currentSortType.value, page) + mApi.getCommunityArticleCommentReply( + communityId, + articleId, + commentId, + currentSortType.value, + page, + map + ) } videoId.isNotEmpty() -> { - mApi.getVideoCommentReply(videoId, commentId, currentSortType.value, page) + mApi.getVideoCommentReply(videoId, commentId, currentSortType.value, page, map) } questionId.isNotEmpty() -> { - mApi.getQuestionCommentReply(questionId, commentId, currentSortType.value, page) + mApi.getQuestionCommentReply(questionId, commentId, currentSortType.value, page, map) } gameCollectionId.isNotEmpty() -> { - mApi.getGameCollectionCommentReply(gameCollectionId, commentId, page) + mApi.getGameCollectionCommentReply(gameCollectionId, commentId, page, map) } else -> null } @@ -62,49 +75,54 @@ class CommentConversationViewModel(application: Application, else -> null } ?: return single.subscribeOn(Schedulers.io()) - .subscribe(object : BiResponse() { - @SuppressLint("CheckResult") - override fun onSuccess(data: CommentEntity) { - commentDetail = data - commentDetail?.floor = positionInOriginList - commentCount = data.reply - topItemData = CommentItemData(commentTop = data) - loadResultLiveData.postValue(LoadResult.SUCCESS) - mergeListData(mListLiveData.value, hasFilter = false) - } + .subscribe(object : BiResponse() { + @SuppressLint("CheckResult") + override fun onSuccess(data: CommentEntity) { + commentDetail = data + commentDetail?.floor = positionInOriginList + commentCount = data.reply + topItemData = CommentItemData(commentTop = data) + loadResultLiveData.postValue(LoadResult.SUCCESS) + mergeListData(mListLiveData.value, hasFilter = topCommentId.isNotBlank()) + } - override fun onFailure(exception: Exception) { - if (exception is HttpException && exception.code().toString().contains("404")) { - loadResultLiveData.postValue(LoadResult.DELETED) - } else { - loadResultLiveData.postValue(LoadResult.NETWORK_ERROR) - } + override fun onFailure(exception: Exception) { + if (exception is HttpException && exception.code().toString().contains("404")) { + loadResultLiveData.postValue(LoadResult.DELETED) + } else { + loadResultLiveData.postValue(LoadResult.NETWORK_ERROR) } - }) + } + }) } override fun mergeResultLiveData() { - mResultLiveData.addSource(mListLiveData) { mergeListData(it, hasFilter = false) } + mResultLiveData.addSource(mListLiveData) { mergeListData(it, hasFilter = topCommentId.isNotBlank()) } } - class Factory(private val application: Application, - private val articleId: String = "", - private val videoId: String = "", - private val questionId: String = "", - private val communityId: String = "", - private val gameCollectionId: String = "", - private val commentId: String) : ViewModelProvider.NewInstanceFactory() { + class Factory( + private val application: Application, + private val articleId: String = "", + private val videoId: String = "", + private val questionId: String = "", + private val communityId: String = "", + private val gameCollectionId: String = "", + private val commentId: String, + private val topCommentId: String + ) : ViewModelProvider.NewInstanceFactory() { override fun create(modelClass: Class): T { return CommentConversationViewModel( - application = application, - articleId = articleId, - videoId = videoId, - questionId = questionId, - communityId = communityId, - gameCollectionId = gameCollectionId, - commentId = commentId) as T + application = application, + articleId = articleId, + videoId = videoId, + questionId = questionId, + communityId = communityId, + gameCollectionId = gameCollectionId, + commentId = commentId, + topCommentId = topCommentId + ) as T } } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailActivity.kt index 6f4c50b07a..34ea8415d2 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailActivity.kt @@ -111,5 +111,23 @@ class NewQuestionDetailActivity : NormalActivity() { intent.putExtra(EntranceConsts.KEY_PATH, path) return intent } + + @JvmStatic + fun getSpecifiedCommentIntent( + context: Context, + questionId: String, + answerId: String, + entrance: String, + path: String + ): Intent { + val intent = Intent(context, NewQuestionDetailActivity::class.java) + intent.putExtra(EntranceConsts.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path)) + intent.putExtra(EntranceConsts.KEY_QUESTIONS_ID, questionId) + intent.putExtra(EntranceConsts.KEY_ANSWER_ID, answerId) + intent.putExtra(EntranceConsts.KEY_TOP_COMMENT_ID, answerId) + intent.putExtra(EntranceConsts.KEY_SCROLL_TO_COMMENT_AREA, true) + intent.putExtra(EntranceConsts.KEY_PATH, path) + return intent + } } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailFragment.kt index 61ca8df7ae..1545bf1a74 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailFragment.kt @@ -452,7 +452,8 @@ class NewQuestionDetailFragment : arguments?.getString(EntranceConsts.KEY_QUESTIONS_ID) ?: "", arguments?.getParcelable(EntranceConsts.KEY_COMMUNITY_DATA)?.id ?: "", arguments?.getString(EntranceConsts.KEY_ANSWER_ID) ?: "", - arguments?.getString(EntranceConsts.KEY_RECOMMEND_ID) ?: "" + arguments?.getString(EntranceConsts.KEY_RECOMMEND_ID) ?: "", + arguments?.getString(EntranceConsts.KEY_RECOMMEND_ID) ?: "", ) ) } diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailViewModel.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailViewModel.kt index 8305205e9d..8f050ed9e3 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/newdetail/NewQuestionDetailViewModel.kt @@ -40,13 +40,15 @@ class NewQuestionDetailViewModel( communityId: String = "", val answerId: String = "", val recommendId: String = "", + topCommentId: String = "", ) : BaseCommentViewModel( application, articleId = "", communityId = communityId, videoId = "", - questionId = questionId + questionId = questionId, + topCommentId = topCommentId ) { var questionRenderedLiveData = MutableLiveData() var questionPageFinishedLiveData = MutableLiveData() @@ -221,7 +223,8 @@ class NewQuestionDetailViewModel( private val questionId: String = "", private val communityId: String = "", private val answerId: String = "", - private val recommendId: String = "" + private val recommendId: String = "", + private val topCommentId: String = "" ) : ViewModelProvider.NewInstanceFactory() { override fun create(modelClass: Class): T { @@ -230,7 +233,8 @@ class NewQuestionDetailViewModel( questionId = questionId, communityId = communityId, answerId = answerId, - recommendId = recommendId + recommendId = recommendId, + topCommentId = topCommentId ) as T } } diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailActivity.kt index d008ab03b2..accb866dd3 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailActivity.kt @@ -45,9 +45,10 @@ class ForumVideoDetailActivity : BaseActivity() { fun getIntent( context: Context, - videoId: String, bbsId: String + videoId: String, + bbsId: String ): Intent { - return getIntent(context, videoId, bbsId, "", false) + return getIntent(context, videoId, bbsId, "", "", false) } fun getIntent( @@ -56,7 +57,7 @@ class ForumVideoDetailActivity : BaseActivity() { bbsId: String, scrollToComment: Boolean = false ): Intent { - return getIntent(context, videoId, bbsId, "", scrollToComment) + return getIntent(context, videoId, bbsId, "", "", scrollToComment) } fun getRecommendIntent( @@ -65,7 +66,16 @@ class ForumVideoDetailActivity : BaseActivity() { bbsId: String, recommendId: String ): Intent { - return getIntent(context, videoId, bbsId, recommendId, false) + return getIntent(context, videoId, bbsId, recommendId, "", false) + } + + fun getSpecifiedCommentIntent( + context: Context, + videoId: String, + bbsId: String, + topCommentId: String + ): Intent { + return getIntent(context, videoId, bbsId, "", topCommentId, true) } fun getIntent( @@ -73,12 +83,14 @@ class ForumVideoDetailActivity : BaseActivity() { videoId: String, bbsId: String, recommendId: String = "", + topCommentId: String = "", scrollToComment: Boolean = false ): Intent { val intent = Intent(context, ForumVideoDetailActivity::class.java) intent.putExtra(EntranceConsts.KEY_VIDEO_ID, videoId) intent.putExtra(EntranceConsts.KEY_BBS_ID, bbsId) intent.putExtra(EntranceConsts.KEY_RECOMMEND_ID, recommendId) + intent.putExtra(EntranceConsts.KEY_TOP_COMMENT_ID, topCommentId) if (scrollToComment) { intent.putExtra(PAGE_INDEX, 1) } diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailFragment.kt index c05a150197..0d43f39974 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumVideoDetailFragment.kt @@ -70,6 +70,7 @@ class ForumVideoDetailFragment : BaseFragment_TabLayout() { private var mForumVideoEntity: ForumVideoEntity? = null private var mVideoId = "" private var mBbsId = "" + private var mTopCommentId = "" private var mVideoDescFragment: VideoDescFragment? = null private var mVideoCommentFragment: VideoCommentFragment? = null private var mIsPortrait = false @@ -100,7 +101,11 @@ class ForumVideoDetailFragment : BaseFragment_TabLayout() { }) fragments.add(VideoCommentFragment().apply { arguments = - bundleOf(EntranceConsts.KEY_VIDEO_ID to mVideoId, EntranceConsts.KEY_BBS_ID to mBbsId) + bundleOf( + EntranceConsts.KEY_VIDEO_ID to mVideoId, + EntranceConsts.KEY_BBS_ID to mBbsId, + EntranceConsts.KEY_TOP_COMMENT_ID to mTopCommentId + ) mVideoCommentFragment = this }) } @@ -113,6 +118,7 @@ class ForumVideoDetailFragment : BaseFragment_TabLayout() { override fun onCreate(savedInstanceState: Bundle?) { mVideoId = arguments?.getString(EntranceConsts.KEY_VIDEO_ID) ?: "" mBbsId = arguments?.getString(EntranceConsts.KEY_BBS_ID) ?: "" + mTopCommentId = arguments?.getString(EntranceConsts.KEY_TOP_COMMENT_ID) ?: "" super.onCreate(savedInstanceState) NewLogUtils.logVideoDetailClick("view_video_detail") } diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/comment/VideoCommentFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/comment/VideoCommentFragment.kt index e3ff0727fd..3a1f29195a 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/comment/VideoCommentFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/comment/VideoCommentFragment.kt @@ -53,7 +53,13 @@ class VideoCommentFragment : LazyListFragment() override fun provideDataObservable(page: Int): Observable>? { + val map = hashMapOf() + map["sort"] = currentSortType.value + if (topCommentId.isNotEmpty()) { + map["top_comment_id"] = topCommentId + } return mApi.getVideoCommentList(videoId, page, mapOf("sort" to currentSortType.value)) } @@ -30,9 +39,13 @@ class VideoCommentViewModel(application: Application, videoId: String, bbsId: St itemDataList.add(CommentItemData(errorConnection = true)) } else { var floor = 1 - list.forEach { - it.floor = floor - itemDataList.add(CommentItemData(commentNormal = it)) + list.forEachIndexed { index, commentEntity -> + commentEntity.floor = floor + if (topCommentId.isNotBlank() && index == 0) { + commentEntity.isHighlight = true + commentEntity.isForceExpand = true + } + itemDataList.add(CommentItemData(commentNormal = commentEntity)) floor++ } itemDataList.add(CommentItemData(footer = true)) @@ -46,10 +59,10 @@ class VideoCommentViewModel(application: Application, videoId: String, bbsId: St deleteCommentLiveData.postValue(true) } - class Factory(private val videoId: String, private val bbsId: String) : + class Factory(private val videoId: String, private val bbsId: String, private val topCommentId: String) : ViewModelProvider.NewInstanceFactory() { override fun create(modelClass: Class): T { - return VideoCommentViewModel(HaloApp.getInstance().application, videoId, bbsId) as T + return VideoCommentViewModel(HaloApp.getInstance().application, videoId, bbsId, topCommentId) as T } } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java index 6fb5bfd1ee..6b4b237027 100644 --- a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java +++ b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java @@ -1489,7 +1489,8 @@ public interface ApiService { Observable> getCommunityArticleCommentList(@Path("community_id") String communityId, @Path("article_id") String articleId, @Query("sort") String type, - @Query("page") int page); + @Query("page") int page, + @QueryMap Map params); /** * 获取社区文章评论的对话列表. @@ -1516,7 +1517,8 @@ public interface ApiService { @Path("article_id") String articleId, @Path("comment_id") String commentId, @Query("sort") String sort, - @Query("page") int page); + @Query("page") int page, + @QueryMap Map params); /** * 评论社区文章评论 @@ -3118,7 +3120,11 @@ public interface ApiService { * 获取问题评论(回答)的回复(评论)列表 */ @GET("bbses/questions/{question_id}/comments/{comment_id}/replies") - Single> getQuestionCommentReply(@Path("question_id") String questionId, @Path("comment_id") String commentId, @Query("sort") String sort, @Query("page") int page); + Single> getQuestionCommentReply(@Path("question_id") String questionId, + @Path("comment_id") String commentId, + @Query("sort") String sort, + @Query("page") int page, + @QueryMap Map params); /** * 点赞问题评论(回答) @@ -3172,7 +3178,11 @@ public interface ApiService { * 获取视频评论回复 */ @GET("videos/{video_id}/comments/{comment_id}/replies") - Single> getVideoCommentReply(@Path("video_id") String videoId, @Path("comment_id") String commentId, @Query("sort") String sort, @Query("page") int page); + Single> getVideoCommentReply(@Path("video_id") String videoId, + @Path("comment_id") String commentId, + @Query("sort") String sort, + @Query("page") int page, + @QueryMap Map params); /** * 加精视频贴 @@ -3399,7 +3409,10 @@ public interface ApiService { * 获取游戏单评论的回复列表 */ @GET("api_go/game_list/{game_list_id}/comment/{comment_id}/reply") - Single> getGameCollectionCommentReply(@Path("game_list_id") String gameCollectionId, @Path("comment_id") String commentId, @Query("page") int page); + Single> getGameCollectionCommentReply(@Path("game_list_id") String gameCollectionId, + @Path("comment_id") String commentId, + @Query("page") int page, + @QueryMap Map params); /** * 游戏单添加评论 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_comment_original_arrow.webp b/app/src/main/res/drawable-xxxhdpi/ic_comment_original_arrow.webp new file mode 100644 index 0000000000..1eb1172c61 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_comment_original_arrow.webp differ diff --git a/app/src/main/res/drawable/bg_category_unselect.xml b/app/src/main/res/drawable/bg_category_unselect.xml deleted file mode 100644 index bbf0367142..0000000000 --- a/app/src/main/res/drawable/bg_category_unselect.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_category_reset.xml b/app/src/main/res/drawable/bg_shape_f2_radius_999.xml similarity index 74% rename from app/src/main/res/drawable/bg_category_reset.xml rename to app/src/main/res/drawable/bg_shape_f2_radius_999.xml index 9a4dfb90d9..2832d2730f 100644 --- a/app/src/main/res/drawable/bg_category_reset.xml +++ b/app/src/main/res/drawable/bg_shape_f2_radius_999.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_shape_f8_radius_8.xml b/app/src/main/res/drawable/bg_shape_f8_radius_8.xml index a49afdae08..89ae3c0093 100644 --- a/app/src/main/res/drawable/bg_shape_f8_radius_8.xml +++ b/app/src/main/res/drawable/bg_shape_f8_radius_8.xml @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_message_unread_hint.xml b/app/src/main/res/drawable/shape_message_unread_hint.xml new file mode 100644 index 0000000000..0b59aa8717 --- /dev/null +++ b/app/src/main/res/drawable/shape_message_unread_hint.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_article_detail_comment.xml b/app/src/main/res/layout/fragment_article_detail_comment.xml index 1a278644bc..2e6b5fb9be 100644 --- a/app/src/main/res/layout/fragment_article_detail_comment.xml +++ b/app/src/main/res/layout/fragment_article_detail_comment.xml @@ -8,15 +8,15 @@ + android:layout_height="@dimen/dialog_panel_titlebar_height" /> 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 871cea24f0..0dc086e03f 100644 --- a/app/src/main/res/layout/item_article_detail_comment.xml +++ b/app/src/main/res/layout/item_article_detail_comment.xml @@ -6,6 +6,17 @@ android:layout_height="wrap_content" android:background="@color/background_white"> + + + + - + app:layout_constraintEnd_toEndOf="parent"> + - + + + + + + - + android:paddingRight="16dp" + android:paddingBottom="16dp"> - - - - - - - + app:layout_constraintTop_toTopOf="parent" /> @@ -47,10 +36,12 @@ android:id="@+id/message_user_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="12dp" - android:textColor="@color/text_black" - android:textSize="12sp" - app:layout_constraintLeft_toRightOf="@id/message_icon_container" + android:layout_marginTop="18dp" + android:layout_marginLeft="3dp" + android:includeFontPadding="false" + android:textColor="@color/text_title" + android:textSize="14sp" + app:layout_constraintLeft_toRightOf="@id/message_user_icon" app:layout_constraintTop_toTopOf="parent" tools:text="欢喜哥" /> @@ -58,86 +49,92 @@ android:id="@+id/message_user_more" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:includeFontPadding="false" android:textColor="@color/theme_font" - android:textSize="12sp" + android:textSize="14sp" android:visibility="visible" app:layout_constraintLeft_toRightOf="@id/message_user_name" - app:layout_constraintTop_toTopOf="parent" + app:layout_constraintTop_toTopOf="@id/message_user_name" tools:text="等2人" /> - + tools:text="这是一个神奇的饿回答这是一个神奇的饿回答这是一个神奇的饿回答这是一个神奇的饿回答这是一个神奇的饿回答这是一个神奇的饿回答这是一个神奇的饿回答这是一个神奇的饿回答这是一个神奇的饿回答" /> - + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintRight_toRightOf="parent"> @@ -155,14 +152,19 @@ android:id="@+id/message_original_title" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerVertical="true" - android:layout_marginLeft="10dp" - android:layout_marginRight="10dp" - android:layout_toRightOf="@+id/message_data_icon_container" + android:layout_marginLeft="12dp" + android:layout_marginRight="12dp" android:ellipsize="end" android:maxLines="2" - android:textColor="@color/title" - android:textSize="12sp" /> - + android:textColor="@color/text_subtitleDesc" + android:textSize="12sp" + tools:text="我是内容我是内容我是内容" + app:layout_constrainedWidth="true" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/message_data_icon_container" /> + diff --git a/app/src/main/res/layout/message_item_top.xml b/app/src/main/res/layout/message_item_top.xml index 1b4f21f76e..ac576968a0 100644 --- a/app/src/main/res/layout/message_item_top.xml +++ b/app/src/main/res/layout/message_item_top.xml @@ -1,15 +1,19 @@ - + android:layout_height="wrap_content" + android:paddingBottom="8dp"> + android:background="@drawable/reuse_listview_item_style" + app:layout_constraintHorizontal_weight="1" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/message_invite" + app:layout_constraintTop_toTopOf="parent"> + android:background="@drawable/reuse_listview_item_style" + app:layout_constraintHorizontal_weight="1" + app:layout_constraintLeft_toRightOf="@+id/message_vote" + app:layout_constraintRight_toLeftOf="@+id/message_service" + app:layout_constraintTop_toTopOf="parent"> + android:background="@drawable/reuse_listview_item_style" + app:layout_constraintHorizontal_weight="1" + app:layout_constraintLeft_toRightOf="@+id/message_invite" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/piece_article_detail_comment_filter.xml b/app/src/main/res/layout/piece_article_detail_comment_filter.xml index 1ec497cc9b..211ed47be8 100644 --- a/app/src/main/res/layout/piece_article_detail_comment_filter.xml +++ b/app/src/main/res/layout/piece_article_detail_comment_filter.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/filterView" android:layout_width="match_parent" - android:layout_height="44dp" + android:layout_height="48dp" android:background="@color/background_white" android:clickable="false" tools:showIn="@layout/fragment_article_detail"> diff --git a/app/src/main/res/layout/sub_category_item.xml b/app/src/main/res/layout/sub_category_item.xml index fd94f05837..26986d676d 100644 --- a/app/src/main/res/layout/sub_category_item.xml +++ b/app/src/main/res/layout/sub_category_item.xml @@ -4,7 +4,7 @@ android:id="@+id/container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/bg_category_unselect"> + android:background="@drawable/bg_shape_f8_radius_8"> + + + + + + + \ No newline at end of file diff --git a/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java b/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java index ff6ed0e26d..2b607b8691 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java +++ b/module_common/src/main/java/com/gh/gamecenter/common/constant/EntranceConsts.java @@ -100,6 +100,7 @@ public class EntranceConsts { public static final String KEY_CURRENTITEM = "currentItem"; public static final String KEY_COMMENTID = "commentId"; public static final String KEY_COMMENT_ID = "comment_id"; + public static final String KEY_TOP_COMMENT_ID = "top_comment_id"; public static final String KEY_SHOW_KEYBOARD_IF_NEEDED = "show_key_board_if_needed"; public static final String KEY_PATH = "path"; public static final String KEY_LOCAL_PATH = "local_path"; diff --git a/module_common/src/main/res/values-night/colors.xml b/module_common/src/main/res/values-night/colors.xml index 191456ed62..1c4942c5ef 100644 --- a/module_common/src/main/res/values-night/colors.xml +++ b/module_common/src/main/res/values-night/colors.xml @@ -127,10 +127,8 @@ #FA8850 #39B5FA - - @color/background - - @color/background + + #0A2496FF @android:color/black @@ -198,6 +196,8 @@ #EDF5FC #F2F7FC #EBFAF7 + @color/background + @color/background #b2b2b2 @color/text_subtitleDesc @color/text_title @@ -301,6 +301,7 @@ #07B896 #279BFE #C4C4C4 + #4D4D4D #99666666 #6621282E diff --git a/module_common/src/main/res/values/colors.xml b/module_common/src/main/res/values/colors.xml index 5b42e6f10f..37bd64e09b 100644 --- a/module_common/src/main/res/values/colors.xml +++ b/module_common/src/main/res/values/colors.xml @@ -128,11 +128,8 @@ #FA8850 #39B5FA - - #F8F8F8 - - #F2F2F2 - + + #0A2496FF @android:color/black #08000000 @@ -200,6 +197,8 @@ #EDF5FC #F2F7FC #EBFAF7 + #F2F2F2 + #F8F8F8 #b2b2b2 #9a9a9a #3a3a3a @@ -309,6 +308,7 @@ #FA8850 #A2ADB8 #CCFF5269 + #4D4D4D #99666666 #6621282E