feat: 评论回复\游戏评分\消息推送需支持链接点击跳转—客户端 https://jira.shanqu.cc/browse/GHZSCY-5551
This commit is contained in:
@ -14,6 +14,7 @@ import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.ItemViewType;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
@ -178,7 +179,12 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
holder.commentTimeTv.setText(holder.commentTimeTv.getText() + " · " + commentEntity.getSource().getRegion());
|
||||
}
|
||||
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(holder.commentContentTv, commentEntity.getContent());
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(
|
||||
holder.commentContentTv,
|
||||
commentEntity.getContent(),
|
||||
Constants.DEFAULT_TEXT_WRAPPER,
|
||||
new TextHelper.DirectToWebViewHighlightedTextClick(mContext, "评论详情")
|
||||
);
|
||||
ArticleCommentParent parent = commentEntity.getParent();
|
||||
if (parent != null && !TextUtils.isEmpty(parent.getUser().getName())) {
|
||||
holder.quoteContainer.setVisibility(View.VISIBLE);
|
||||
@ -197,7 +203,12 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
content = mContext.getString(R.string.comment_hide_hint);
|
||||
holder.quoteContentTv.setTextColor(mContext.getResources().getColor(R.color.text_d5d5d5));
|
||||
}
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(holder.quoteContentTv, content);
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(
|
||||
holder.quoteContentTv,
|
||||
content,
|
||||
Constants.DEFAULT_TEXT_WRAPPER,
|
||||
new TextHelper.DirectToWebViewHighlightedTextClick(mContext, "评论详情")
|
||||
);
|
||||
} else {
|
||||
holder.quoteContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import com.gh.gamecenter.ShareCardPicActivity;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentHeadViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.common.retrofit.OkHttpCache;
|
||||
@ -393,7 +394,12 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
return;
|
||||
}
|
||||
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(holder.commentContentTv, commentEntity.getContent());
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(
|
||||
holder.commentContentTv,
|
||||
commentEntity.getContent(),
|
||||
Constants.DEFAULT_TEXT_WRAPPER,
|
||||
new TextHelper.DirectToWebViewHighlightedTextClick(holder.commentContentTv.getContext(), "消息详情")
|
||||
);
|
||||
ArticleCommentParent parent = commentEntity.getParent();
|
||||
if (parent != null && !TextUtils.isEmpty(parent.getUser().getName())) {
|
||||
holder.quoteContainer.setVisibility(View.VISIBLE);
|
||||
@ -412,7 +418,12 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
content = mContext.getString(R.string.comment_hide_hint);
|
||||
holder.quoteContentTv.setTextColor(mContext.getResources().getColor(R.color.text_d5d5d5));
|
||||
}
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(holder.quoteContentTv, content);
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(
|
||||
holder.quoteContentTv,
|
||||
content,
|
||||
Constants.DEFAULT_TEXT_WRAPPER,
|
||||
new TextHelper.DirectToWebViewHighlightedTextClick(holder.quoteContentTv.getContext(), "消息详情")
|
||||
);
|
||||
} else {
|
||||
holder.quoteContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@ -234,11 +234,14 @@ class AmwayAdapter(
|
||||
if (m.find()) {
|
||||
val contents =
|
||||
TextHelper.getCommentLabelSpannableStringBuilder(amway.comment.content, R.color.text_theme)
|
||||
binding.amwayContentTv.setTextWithHighlightedTextWrappedInsideWrapper(contents, copyClickedText = true)
|
||||
binding.amwayContentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
contents,
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(context, "安利墙")
|
||||
)
|
||||
} else {
|
||||
binding.amwayContentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
amway.comment.content,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(context, "安利墙")
|
||||
)
|
||||
}
|
||||
|
||||
@ -333,7 +336,11 @@ class AmwayAdapter(
|
||||
binding.sdvUserBadge.setOnClickListener {
|
||||
DialogUtils.showViewBadgeDialog(context, amway.comment.user.badge, object : ConfirmListener {
|
||||
override fun onConfirm() {
|
||||
MtaHelper.onEvent("进入徽章墙_用户记录", "安利墙", "${amway.comment.user.name}(${amway.comment.user.id})")
|
||||
MtaHelper.onEvent(
|
||||
"进入徽章墙_用户记录",
|
||||
"安利墙",
|
||||
"${amway.comment.user.name}(${amway.comment.user.id})"
|
||||
)
|
||||
MtaHelper.onEvent("徽章中心", "进入徽章中心", "安利墙")
|
||||
DirectUtils.directToBadgeWall(
|
||||
context,
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.gamecenter.gamecollection.detail
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.TextUtils
|
||||
@ -26,6 +27,7 @@ import com.gh.gamecenter.common.syncpage.SyncDataEntity
|
||||
import com.gh.gamecenter.common.syncpage.SyncFieldConstants
|
||||
import com.gh.gamecenter.common.syncpage.SyncPageRepository
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.CustomLinkMovementMethod
|
||||
import com.gh.gamecenter.common.view.DrawableView
|
||||
import com.gh.gamecenter.common.view.GridSpacingItemColorDecoration
|
||||
import com.gh.gamecenter.core.utils.MtaHelper
|
||||
@ -227,7 +229,13 @@ open class GameCollectionDetailAdapter(
|
||||
)
|
||||
}
|
||||
|
||||
contentTv.text = comment.content
|
||||
contentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = comment.content ?: "",
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
mEntrance
|
||||
)
|
||||
)
|
||||
|
||||
commentCountTv.text = mViewModel.getCommentText(comment.reply, "回复")
|
||||
} else {
|
||||
@ -270,15 +278,30 @@ open class GameCollectionDetailAdapter(
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
val commentText = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(
|
||||
binding.contentTv.context,
|
||||
comment.content ?: "",
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.contentTv.context,
|
||||
entrance = mEntrance
|
||||
)
|
||||
)
|
||||
contentTv.text = SpannableStringBuilder()
|
||||
.append(prefixSpan)
|
||||
.append(parentUserNameSpan)
|
||||
.append(authorSpan)
|
||||
.append(colonSpan)
|
||||
.append(comment.content)
|
||||
.append(commentText)
|
||||
contentTv.movementMethod = CustomLinkMovementMethod.getInstance()
|
||||
binding.contentTv.highlightColor = Color.TRANSPARENT
|
||||
} else {
|
||||
contentTv.text = comment.content
|
||||
contentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = comment.content ?: "",
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
mEntrance
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -482,17 +505,29 @@ open class GameCollectionDetailAdapter(
|
||||
binding.subCommentContainer.setRoundedColorBackground(R.color.ui_container_2, 5F)
|
||||
|
||||
subCommentList?.firstOrNull()?.let {
|
||||
binding.firstSubCommentTv.text = getSubCommentSpanned(
|
||||
it.user.name,
|
||||
if (it.user.id == ownerUserId) "作者" else "",
|
||||
it.content
|
||||
binding.firstSubCommentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = getSubCommentSpanned(
|
||||
it.user.name,
|
||||
if (it.user.id == ownerUserId) "作者" else "",
|
||||
it.content
|
||||
),
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
mEntrance
|
||||
)
|
||||
)
|
||||
}
|
||||
subCommentList?.secondOrNull()?.let {
|
||||
binding.secondSubCommentTv.text = getSubCommentSpanned(
|
||||
it.user.name,
|
||||
if (it.user.id == ownerUserId) "作者" else "",
|
||||
it.content
|
||||
binding.secondSubCommentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = getSubCommentSpanned(
|
||||
it.user.name,
|
||||
if (it.user.id == ownerUserId) "作者" else "",
|
||||
it.content
|
||||
),
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
mEntrance
|
||||
)
|
||||
)
|
||||
}
|
||||
binding.subCommentContainer.setOnClickListener {
|
||||
@ -517,7 +552,6 @@ open class GameCollectionDetailAdapter(
|
||||
val finalAuthor = author ?: ""
|
||||
val finalName = "$name "
|
||||
val colon = " :"
|
||||
|
||||
val nameSpan =
|
||||
SpanBuilder(finalName).color(mContext, 0, finalName.length, R.color.text_theme).build()
|
||||
val authorSpan = if (finalAuthor.isNotEmpty()) SpanBuilder(finalAuthor).image(
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.gamecenter.gamedetail.desc
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
@ -30,6 +31,7 @@ import com.gh.common.util.NewLogUtils
|
||||
import com.gh.gamecenter.GameNewsActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.callback.SimpleCallback
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
@ -41,6 +43,7 @@ import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.divider.HorizontalDividerItemDecoration
|
||||
import com.gh.gamecenter.common.view.divider.VerticalDividerItemDecoration
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.core.HaloApp.Companion.getInstance
|
||||
import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.databinding.*
|
||||
import com.gh.gamecenter.entity.SubjectEntity
|
||||
@ -57,6 +60,7 @@ import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
|
||||
import com.gh.gamecenter.gamedetail.history.HistoryApkListActivity
|
||||
import com.gh.gamecenter.help.HelpAndFeedbackBridge
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
import com.lightgame.utils.Utils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
class DescAdapter(
|
||||
@ -302,7 +306,12 @@ class DescAdapter(
|
||||
|
||||
galleryRv.layoutManager = LinearLayoutManager(mContext, RecyclerView.HORIZONTAL, false)
|
||||
subjectAdapter =
|
||||
GameHorizontalAdapter(mContext, subjectEntity, GameHorizontalListType.GameDetailHorizontalType, false)
|
||||
GameHorizontalAdapter(
|
||||
mContext,
|
||||
subjectEntity,
|
||||
GameHorizontalListType.GameDetailHorizontalType,
|
||||
false
|
||||
)
|
||||
subjectAdapter.gameName = mGameName
|
||||
subjectAdapter.game = mViewModel.game
|
||||
subjectAdapter.gameId = mViewModel.gameId ?: ""
|
||||
@ -997,11 +1006,15 @@ class DescAdapter(
|
||||
} else {
|
||||
shrankSpanned = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(
|
||||
mContext,
|
||||
customColumn.desBrief ?: ""
|
||||
customColumn.desBrief ?: "",
|
||||
Constants.DEFAULT_TEXT_WRAPPER_2,
|
||||
highlightedTextClickListener = TextHelper.CopyToClipboardHighlightedTextClick()
|
||||
)
|
||||
expandedSpanned = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(
|
||||
mContext,
|
||||
customColumn.des ?: ""
|
||||
customColumn.des ?: "",
|
||||
Constants.DEFAULT_TEXT_WRAPPER_2,
|
||||
highlightedTextClickListener = TextHelper.CopyToClipboardHighlightedTextClick()
|
||||
)
|
||||
setShrankTextAndExpandedText(shrankSpanned, expandedSpanned)
|
||||
}
|
||||
|
||||
@ -78,11 +78,14 @@ class DescCommentsAdapter(
|
||||
if (m.find()) {
|
||||
val contents =
|
||||
TextHelper.getCommentLabelSpannableStringBuilder(commentData.content, R.color.text_theme)
|
||||
content.setTextWithHighlightedTextWrappedInsideWrapper(text = contents, copyClickedText = true)
|
||||
content.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = contents,
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(mContext, path)
|
||||
)
|
||||
} else {
|
||||
content.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = commentData.content,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(mContext, path)
|
||||
)
|
||||
}
|
||||
if (commentData.user.badge != null) {
|
||||
@ -108,6 +111,7 @@ class DescCommentsAdapter(
|
||||
NewsUtils.getFormattedTime(commentData.time)
|
||||
}
|
||||
}
|
||||
|
||||
commentData.isEditContent!! -> {
|
||||
time.setTextColor(ContextCompat.getColor(mContext, R.color.text_F56614))
|
||||
time.text = if (commentData.ignore) {
|
||||
@ -116,6 +120,7 @@ class DescCommentsAdapter(
|
||||
"${NewsUtils.getFormattedTime(commentData.time)} 已修改 >"
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
time.setTextColor(ContextCompat.getColor(mContext, R.color.text_F56614))
|
||||
time.text = if (commentData.ignore) {
|
||||
@ -204,6 +209,7 @@ class DescCommentsAdapter(
|
||||
.copyTextAndToast()
|
||||
MtaHelper.onEvent("游戏详情_新", "玩家评论_复制", mViewModel.game?.name)
|
||||
}
|
||||
|
||||
"修改" -> {
|
||||
MtaHelper.onEvent("游戏详情_新", "玩家评论_修改", mViewModel.game?.name)
|
||||
val intent = RatingEditActivity.getPatchIntent(mContext, mViewModel.game!!, commentData)
|
||||
@ -214,6 +220,7 @@ class DescCommentsAdapter(
|
||||
position
|
||||
)
|
||||
}
|
||||
|
||||
"投诉" -> {
|
||||
MtaHelper.onEvent("游戏详情_新", "玩家评论_投诉", mViewModel.game?.name)
|
||||
mContext.ifLogin(BaseActivity.mergeEntranceAndPath(mEntrance, path)) {
|
||||
@ -229,6 +236,7 @@ class DescCommentsAdapter(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"删除" -> {
|
||||
DialogHelper.showDeleteGameCommentDialog(
|
||||
mContext,
|
||||
@ -273,7 +281,11 @@ class DescCommentsAdapter(
|
||||
holder.itemView.setOnClickListener {
|
||||
EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_RATING))
|
||||
MtaHelper.onEvent("游戏详情_新", "玩家评论_查看全部评论", gameName)
|
||||
NewLogUtils.logGameDetailCommentClick(mViewModel.game?.name ?: "", mViewModel.game?.id ?: "", "查看全部评论")
|
||||
NewLogUtils.logGameDetailCommentClick(
|
||||
mViewModel.game?.name ?: "",
|
||||
mViewModel.game?.id ?: "",
|
||||
"查看全部评论"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,10 +34,12 @@ class MyRatingAdapter(
|
||||
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)
|
||||
FooterViewHolder(view)
|
||||
}
|
||||
|
||||
ItemViewType.ITEM_BODY -> {
|
||||
view = mLayoutInflater.inflate(R.layout.item_my_game_rating, parent, false)
|
||||
MyRatingViewHolder(ItemMyGameRatingBinding.bind(view))
|
||||
}
|
||||
|
||||
else -> throw NullPointerException()
|
||||
}
|
||||
}
|
||||
@ -69,12 +71,12 @@ class MyRatingAdapter(
|
||||
val contents = TextHelper.getCommentLabelSpannableStringBuilder(rating.content, R.color.text_theme)
|
||||
holder.binding.tvComment.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = contents,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(mContext, mEntrance)
|
||||
)
|
||||
} else {
|
||||
holder.binding.tvComment.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = rating.content,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(mContext, mEntrance)
|
||||
)
|
||||
}
|
||||
holder.binding.tvComment.setExpandCallback {
|
||||
@ -123,7 +125,8 @@ class MyRatingAdapter(
|
||||
commentId = rating.id,
|
||||
showKeyboardIfReplyListIsEmpty = false,
|
||||
entrance = "我的游戏评论",
|
||||
path = "")
|
||||
path = ""
|
||||
)
|
||||
/* if(!rating.active){
|
||||
intent = RatingReplyActivity.getIntent(mContext, rating.transformGameEntity(), rating.transformCommentEntity(), "我的游戏评论", "")
|
||||
}else if(!rating.game.active){
|
||||
@ -141,6 +144,7 @@ class MyRatingAdapter(
|
||||
return@OnLongClickListener true
|
||||
})
|
||||
}
|
||||
|
||||
is FooterViewHolder -> {
|
||||
holder.initItemPadding()
|
||||
holder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver)
|
||||
|
||||
@ -88,7 +88,7 @@ class RatingAdapter(
|
||||
}
|
||||
else -> {
|
||||
view = mLayoutInflater.inflate(R.layout.rating_comment_item, parent, false)
|
||||
RatingCommentItemViewHolder(RatingCommentItemBinding.bind(view))
|
||||
RatingCommentItemViewHolder(RatingCommentItemBinding.bind(view), path)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -174,7 +174,7 @@ class RatingAdapter(
|
||||
if (ratingData?.serviceComment != null) {
|
||||
includeServiceComment.commentItem.visibility = View.VISIBLE
|
||||
initRatingComment(
|
||||
RatingCommentItemViewHolder(includeServiceComment),
|
||||
RatingCommentItemViewHolder(includeServiceComment, path),
|
||||
ratingData?.serviceComment!!,
|
||||
headServiceCommentPosition
|
||||
)
|
||||
@ -183,7 +183,7 @@ class RatingAdapter(
|
||||
if (ratingData?.myComment != null) {
|
||||
includeMyComment.commentItem.visibility = View.VISIBLE
|
||||
initRatingComment(
|
||||
RatingCommentItemViewHolder(includeMyComment),
|
||||
RatingCommentItemViewHolder(includeMyComment, path),
|
||||
ratingData?.myComment!!,
|
||||
headMyCommentPosition
|
||||
)
|
||||
|
||||
@ -44,7 +44,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseRecyclerViewHolder<Any>(binding.root) {
|
||||
class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding, val path: String) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root) {
|
||||
|
||||
fun setContent(
|
||||
commentData: RatingComment,
|
||||
@ -71,11 +72,14 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
|
||||
val m = p.matcher(commentData.content)
|
||||
if (m.find()) {
|
||||
val contents = TextHelper.getCommentLabelSpannableStringBuilder(commentData.content, R.color.text_theme)
|
||||
content.setTextWithHighlightedTextWrappedInsideWrapper(text = contents, copyClickedText = true)
|
||||
content.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = contents,
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(binding.root.context, path)
|
||||
)
|
||||
} else {
|
||||
content.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = commentData.content,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(binding.root.context, path)
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -130,6 +134,7 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
|
||||
NewsUtils.getFormattedTime(commentData.time)
|
||||
}
|
||||
}
|
||||
|
||||
commentData.isEditContent!! -> {
|
||||
time.setTextColor(ContextCompat.getColor(context, R.color.text_F56614))
|
||||
time.text = if (commentData.ignore) {
|
||||
@ -138,6 +143,7 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
|
||||
"${NewsUtils.getFormattedTime(commentData.time)} 已修改 >"
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
time.setTextColor(ContextCompat.getColor(context, R.color.text_F56614))
|
||||
time.text = if (commentData.ignore) {
|
||||
@ -441,6 +447,7 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
|
||||
commentData.content.replace(RatingEditActivity.LABEL_REPLACE_REGEX.toRegex(), "")
|
||||
.copyTextAndToast()
|
||||
}
|
||||
|
||||
"修改" -> {
|
||||
NewFlatLogUtils.logGameDetailCommentTabCommentClick(
|
||||
location,
|
||||
@ -459,6 +466,7 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
|
||||
dataPosition
|
||||
)
|
||||
}
|
||||
|
||||
"投诉" -> {
|
||||
NewLogUtils.logCommentTabOrCommentDetailClick(
|
||||
"click_allcomment_report",
|
||||
@ -487,6 +495,7 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"删除" -> {
|
||||
NewFlatLogUtils.logGameDetailCommentTabCommentClick(
|
||||
location,
|
||||
@ -593,7 +602,11 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
|
||||
.size(0, commentData.replyData?.user?.name!!.length, 13)
|
||||
.build()
|
||||
|
||||
val contentSpan = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(context, spanned)
|
||||
val contentSpan = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(
|
||||
context,
|
||||
spanned,
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(context, path)
|
||||
)
|
||||
if (commentData.replyData!!.isService) {
|
||||
contentSpan.setSpan(LeadingMarginSpan.Standard(34F.dip2px(), 0), 0, contentSpan.length, 0)
|
||||
} else {
|
||||
|
||||
@ -36,7 +36,7 @@ import com.gh.gamecenter.gamedetail.rating.logs.CommentLogsActivity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class RatingDetailCommentItemViewHolder(val binding: ItemArticleDetailCommentBinding) :
|
||||
class RatingDetailCommentItemViewHolder(val binding: ItemArticleDetailCommentBinding, val entrance: String) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root) {
|
||||
@SuppressLint("CheckResult")
|
||||
fun setContent(
|
||||
@ -79,11 +79,20 @@ class RatingDetailCommentItemViewHolder(val binding: ItemArticleDetailCommentBin
|
||||
val m = p.matcher(commentData.content)
|
||||
if (m.find()) {
|
||||
val contents = TextHelper.getCommentLabelSpannableStringBuilder(commentData.content, R.color.text_theme)
|
||||
contentTv.setTextWithHighlightedTextWrappedInsideWrapper(text = contents, copyClickedText = true)
|
||||
contentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = contents,
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
} else {
|
||||
contentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = commentData.content,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
}
|
||||
root.setBackgroundColor(R.color.ui_surface.toColor(context))
|
||||
@ -123,6 +132,7 @@ class RatingDetailCommentItemViewHolder(val binding: ItemArticleDetailCommentBin
|
||||
NewsUtils.getFormattedTime(commentData.time)
|
||||
}
|
||||
}
|
||||
|
||||
commentData.isEditContent!! -> {
|
||||
time.setTextColor(ContextCompat.getColor(context, R.color.text_F56614))
|
||||
time.text = if (commentData.ignore) {
|
||||
@ -131,6 +141,7 @@ class RatingDetailCommentItemViewHolder(val binding: ItemArticleDetailCommentBin
|
||||
"${NewsUtils.getFormattedTime(commentData.time)} 已修改 >"
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
time.setTextColor(ContextCompat.getColor(context, R.color.text_F56614))
|
||||
time.text = if (commentData.ignore) {
|
||||
@ -264,6 +275,7 @@ class RatingDetailCommentItemViewHolder(val binding: ItemArticleDetailCommentBin
|
||||
commentData.content.replace(RatingEditActivity.LABEL_REPLACE_REGEX.toRegex(), "")
|
||||
.copyTextAndToast()
|
||||
}
|
||||
|
||||
"修改" -> {
|
||||
// if (path == "游戏详情:评分") MtaHelper.onEvent("游戏详情_新", "评论Tab_修改", game?.name)
|
||||
// if (path == "折叠评论") MtaHelper.onEvent("折叠评论", "更多-修改", game?.name)
|
||||
@ -276,6 +288,7 @@ class RatingDetailCommentItemViewHolder(val binding: ItemArticleDetailCommentBin
|
||||
dataPosition
|
||||
)
|
||||
}
|
||||
|
||||
"投诉" -> {
|
||||
// if (path == "游戏详情:评分") MtaHelper.onEvent("游戏详情_新", "评论Tab_投诉", game?.name)
|
||||
// if (path == "折叠评论") MtaHelper.onEvent("折叠评论", "更多-投诉", game?.name)
|
||||
@ -298,6 +311,7 @@ class RatingDetailCommentItemViewHolder(val binding: ItemArticleDetailCommentBin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"删除" -> {
|
||||
logGameDetailCommentDetailCommentClick(viewModel, entrance, "评价右上角-删除")
|
||||
DialogHelper.showDeleteGameCommentDialog(
|
||||
|
||||
@ -112,7 +112,7 @@ class RatingReplyAdapter(
|
||||
|
||||
ITEM_COMMENT -> {
|
||||
view = mLayoutInflater.inflate(R.layout.item_article_detail_comment, parent, false)
|
||||
RatingDetailCommentItemViewHolder(ItemArticleDetailCommentBinding.bind(view))
|
||||
RatingDetailCommentItemViewHolder(ItemArticleDetailCommentBinding.bind(view), entrance)
|
||||
}
|
||||
|
||||
ITEM_SECTION_TITLE -> {
|
||||
@ -342,7 +342,10 @@ class RatingReplyAdapter(
|
||||
|
||||
contentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = contentCharSequence,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
mContext,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
badgeIv.setOnClickListener {
|
||||
DialogUtils.showViewBadgeDialog(mContext, replyEntity.user.badge, object : ConfirmListener {
|
||||
|
||||
@ -38,9 +38,21 @@ class CustomHomeAmwayItemViewHolder(val binding: HomeAmwayItemCustomBinding) : B
|
||||
val m = Pattern.compile(RatingEditActivity.LABEL_REGEX).matcher(amway.comment.content)
|
||||
if (m.find()) {
|
||||
val contents = TextHelper.getCommentLabelSpannableStringBuilder(amway.comment.content, R.color.text_theme)
|
||||
binding.content.text = contents
|
||||
binding.content.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
contents,
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
"自定义页-热门评论"
|
||||
)
|
||||
)
|
||||
} else {
|
||||
binding.content.text = amway.comment.content
|
||||
binding.content.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
amway.comment.content,
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
"自定义页-热门评论"
|
||||
)
|
||||
)
|
||||
}
|
||||
binding.run {
|
||||
amwayBackground.background = R.drawable.home_amway_selector.toDrawable(root.context)
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.gh.gamecenter.newsdetail;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@ -42,6 +44,7 @@ import com.gh.gamecenter.adapter.viewholder.NewsDetailCommentListViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.NewsDetailGameViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.UnAvaliableWebviewViewHolder;
|
||||
import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
|
||||
import com.gh.gamecenter.common.callback.SimpleCallback;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.DarkModeUtils;
|
||||
@ -50,6 +53,7 @@ import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.common.view.DrawableView;
|
||||
import com.gh.gamecenter.core.HaloApp;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.core.utils.NumberUtils;
|
||||
@ -510,7 +514,10 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(
|
||||
viewHolder.commentContentTv,
|
||||
commentEntity.getContent());
|
||||
commentEntity.getContent(),
|
||||
Constants.DEFAULT_TEXT_WRAPPER_2,
|
||||
new TextHelper.CopyToClipboardHighlightedTextClick()
|
||||
);
|
||||
ArticleCommentParent parent = commentEntity.getParent();
|
||||
if (parent != null && !TextUtils.isEmpty(parent.getUser().getName())) {
|
||||
viewHolder.quoteContainer.setVisibility(View.VISIBLE);
|
||||
@ -532,7 +539,10 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
|
||||
TextHelper.highlightTextThatIsWrappedInsideWrapperByDefault(
|
||||
viewHolder.quoteContentTv,
|
||||
content);
|
||||
content,
|
||||
Constants.DEFAULT_TEXT_WRAPPER_2,
|
||||
new TextHelper.CopyToClipboardHighlightedTextClick()
|
||||
);
|
||||
} else {
|
||||
viewHolder.quoteContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@ -117,12 +117,12 @@ class UserHistoryAdapter(
|
||||
TextHelper.getCommentLabelSpannableStringBuilder(historyEntity.comment.content, R.color.text_theme)
|
||||
holder.binding.content.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = contents,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(mContext, mEntrance)
|
||||
)
|
||||
} else {
|
||||
holder.binding.content.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = historyEntity.comment.content,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(mContext, mEntrance)
|
||||
)
|
||||
}
|
||||
holder.binding.content.setExpandCallback {
|
||||
|
||||
@ -94,12 +94,12 @@ class UserCommentHistoryAdapter(
|
||||
val contents = TextHelper.getCommentLabelSpannableStringBuilder(rating.content, R.color.text_theme)
|
||||
holder.binding.tvComment.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = contents,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(mContext, mEntrance)
|
||||
)
|
||||
} else {
|
||||
holder.binding.tvComment.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = rating.content,
|
||||
copyClickedText = true
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(mContext, mEntrance)
|
||||
)
|
||||
}
|
||||
holder.binding.tvComment.setExpandCallback {
|
||||
|
||||
@ -27,7 +27,7 @@ class StairsCommentAdapter(
|
||||
FooterViewHolder(view)
|
||||
} else {
|
||||
val view = mLayoutInflater.inflate(R.layout.stairs_comment_item, parent, false)
|
||||
StairsCommentViewHolder(StairsCommentItemBinding.bind(view))
|
||||
StairsCommentViewHolder(StairsCommentItemBinding.bind(view), mEntrance)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ class StairsCommentReplyAdapter(
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val view = mLayoutInflater.inflate(R.layout.stairs_comment_item, parent, false)
|
||||
return StairsCommentViewHolder(StairsCommentItemBinding.bind(view), true)
|
||||
return StairsCommentViewHolder(StairsCommentItemBinding.bind(view), mEntrance, true)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = replyComments.size
|
||||
|
||||
@ -26,7 +26,8 @@ import com.halo.assistant.HaloApp
|
||||
|
||||
class StairsCommentViewHolder(
|
||||
val binding: StairsCommentItemBinding,
|
||||
val isReplyComment: Boolean = false
|
||||
val entrance: String,
|
||||
val isReplyComment: Boolean = false,
|
||||
) : BaseRecyclerViewHolder<CommentEntity>(binding.root) {
|
||||
|
||||
var isFirstClick = true
|
||||
@ -146,8 +147,9 @@ class StairsCommentViewHolder(
|
||||
|
||||
if (!TextUtils.isEmpty(mViewModel.videoId)) {
|
||||
val spannable = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(
|
||||
context, commentEntity.content
|
||||
?: ""
|
||||
context,
|
||||
commentEntity.content ?: "",
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(context, mEntrance)
|
||||
)
|
||||
|
||||
//当评论同时满足以下两个条件:①来源于作者;②权重为1时,前端不显示“置顶”标志
|
||||
|
||||
@ -2,6 +2,7 @@ package com.gh.gamecenter.qa.comment.base
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
@ -23,6 +24,7 @@ import com.gh.gamecenter.common.syncpage.SyncDataEntity
|
||||
import com.gh.gamecenter.common.syncpage.SyncFieldConstants
|
||||
import com.gh.gamecenter.common.syncpage.SyncPageRepository
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.CustomLinkMovementMethod
|
||||
import com.gh.gamecenter.common.view.GridSpacingItemColorDecoration
|
||||
import com.gh.gamecenter.common.view.SegmentedFilterView
|
||||
import com.gh.gamecenter.core.utils.MtaHelper
|
||||
@ -437,7 +439,13 @@ abstract class BaseCommentAdapter(
|
||||
comment.user.id ?: "", contentType, comment.id ?: "", bbsId, bbsType
|
||||
)
|
||||
}
|
||||
binding.contentTv.text = comment.content
|
||||
binding.contentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = comment.content ?: "",
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
binding.commentCountTv.text = viewModel.getCommentText(comment.reply, "回复")
|
||||
} else {
|
||||
// 评论详情用的样式
|
||||
@ -480,14 +488,30 @@ abstract class BaseCommentAdapter(
|
||||
""
|
||||
}
|
||||
|
||||
val commentText = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(
|
||||
binding.contentTv.context,
|
||||
comment.content ?: "",
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.contentTv.context,
|
||||
entrance = entrance
|
||||
)
|
||||
)
|
||||
binding.contentTv.text = SpannableStringBuilder()
|
||||
.append(prefixSpan)
|
||||
.append(parentUserNameSpan)
|
||||
.append(authorSpan)
|
||||
.append(colonSpan)
|
||||
.append(comment.content)
|
||||
.append(commentText)
|
||||
binding.contentTv.movementMethod = CustomLinkMovementMethod.getInstance()
|
||||
binding.contentTv.highlightColor = Color.TRANSPARENT
|
||||
} else {
|
||||
binding.contentTv.text = comment.content
|
||||
binding.contentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = comment.content ?: "",
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -518,19 +542,31 @@ abstract class BaseCommentAdapter(
|
||||
binding.subCommentContainer.setRoundedColorBackground(R.color.ui_container_2, 5F)
|
||||
|
||||
subCommentList?.firstOrNull()?.let {
|
||||
binding.firstSubCommentTv.text = getSubCommentSpanned(
|
||||
binding.root.context,
|
||||
it.user.name,
|
||||
if (it.user.id == ownerUserId) "作者" else "",
|
||||
it.content
|
||||
binding.firstSubCommentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = getSubCommentSpanned(
|
||||
binding.root.context,
|
||||
it.user.name,
|
||||
if (it.user.id == ownerUserId) "作者" else "",
|
||||
it.content
|
||||
),
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
}
|
||||
subCommentList?.secondOrNull()?.let {
|
||||
binding.secondSubCommentTv.text = getSubCommentSpanned(
|
||||
binding.root.context,
|
||||
it.user.name,
|
||||
if (it.user.id == ownerUserId) "作者" else "",
|
||||
it.content
|
||||
binding.secondSubCommentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = getSubCommentSpanned(
|
||||
binding.root.context,
|
||||
it.user.name,
|
||||
if (it.user.id == ownerUserId) "作者" else "",
|
||||
it.content
|
||||
),
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
}
|
||||
binding.subCommentContainer.setOnClickListener {
|
||||
@ -555,7 +591,7 @@ abstract class BaseCommentAdapter(
|
||||
context: Context,
|
||||
name: String?,
|
||||
author: String?,
|
||||
content: String?
|
||||
content: CharSequence?
|
||||
): SpannableStringBuilder {
|
||||
val finalAuthor = author ?: ""
|
||||
val finalName = "$name "
|
||||
|
||||
@ -8,8 +8,10 @@ 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.TextHelper
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.setTextWithHighlightedTextWrappedInsideWrapper
|
||||
import com.gh.gamecenter.databinding.ItemArticleDetailCommentBinding
|
||||
import com.gh.gamecenter.feature.entity.CommentEntity
|
||||
import com.gh.gamecenter.qa.comment.base.BaseCommentAdapter
|
||||
@ -90,7 +92,13 @@ class CommentConversationAdapter(
|
||||
bottomFloorHintTv.goneIf(mViewModelCommunity.topCommentId.isNotBlank()) {
|
||||
bottomFloorHintTv.text = if (comment.floor != 0) "${comment.floor}楼" else ""
|
||||
}
|
||||
contentTv.text = comment.content
|
||||
contentTv.setTextWithHighlightedTextWrappedInsideWrapper(
|
||||
text = comment.content ?: "",
|
||||
highlightedTextClickListener = TextHelper.DirectToWebViewHighlightedTextClick(
|
||||
binding.root.context,
|
||||
mEntrance
|
||||
)
|
||||
)
|
||||
contentTv.maxLines = Int.MAX_VALUE
|
||||
commentTopTimeTv.goneIf(mViewModelCommunity.topCommentId.isBlank())
|
||||
commentTopTimeTv.text = if (comment.source != null && comment.source!!.region.isNotEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user