diff --git a/app/src/main/java/com/gh/common/util/DialogUtils.java b/app/src/main/java/com/gh/common/util/DialogUtils.java index 99a6ac1d2f..faf9e7bd13 100644 --- a/app/src/main/java/com/gh/common/util/DialogUtils.java +++ b/app/src/main/java/com/gh/common/util/DialogUtils.java @@ -29,12 +29,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.core.content.ContextCompat; -import androidx.databinding.DataBindingUtil; -import androidx.recyclerview.widget.RecyclerView; - import com.facebook.drawee.generic.GenericDraweeHierarchy; import com.gh.common.AppExecutor; import com.gh.common.constant.Config; @@ -64,6 +58,12 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.core.content.ContextCompat; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.RecyclerView; + public class DialogUtils { public static Dialog showWaitDialog(Context context, String msg) { @@ -1377,7 +1377,7 @@ public class DialogUtils { TextView contentTv = contentView.findViewById(R.id.contentTv); MaxHeightNestedScrollView scrollView = contentView.findViewById(R.id.scrollView); titleTv.setText("特殊停服状态说明:"); - contentTv.setText(Html.fromHtml(content)); + contentTv.setText(content); TextView ok = contentView.findViewById(R.id.dialog_ok); scrollView.setScrollChangedListener((l, t, oldl, oldt) -> { MtaHelper.onEvent("评论说明弹窗", "滑动内容", gameName); diff --git a/app/src/main/java/com/gh/gamecenter/entity/GameEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/GameEntity.kt index a4c551e66d..6699ebe01b 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/GameEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/GameEntity.kt @@ -206,6 +206,8 @@ data class GameEntity( val assignRemark: AssignRemark = AssignRemark(), @SerializedName("zone_setting") var zone: ZoneEntity = ZoneEntity(), + @SerializedName("comment_description") + var commentDescription: String = "", // 本地字段,使用镜像信息 var useMirrorInfo: Boolean = false, diff --git a/app/src/main/java/com/gh/gamecenter/entity/Rating.kt b/app/src/main/java/com/gh/gamecenter/entity/Rating.kt index cc40dffc2a..c7177c5224 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/Rating.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/Rating.kt @@ -11,7 +11,12 @@ class Rating(val star: Star = Star(), @SerializedName("comment") var myComment: RatingComment? = null, @SerializedName("comment_count") - var commentCount: Int = 0) + var commentCount: Int = 0, + @SerializedName("ignore_comment") + var ignoreComment: Boolean = false, + @SerializedName("comment_description") + var commentDescription: String = "" +) class Star(var average: Float = 0F, val hits: Int = 0, diff --git a/app/src/main/java/com/gh/gamecenter/entity/RatingComment.kt b/app/src/main/java/com/gh/gamecenter/entity/RatingComment.kt index b84a230fe4..4214bce55f 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/RatingComment.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/RatingComment.kt @@ -34,9 +34,11 @@ class RatingComment(@SerializedName("_id") val gameVersion: String = "", @SerializedName("is_jingxuan") val isWonderful: Boolean = false, - val active:Boolean = true, + val active: Boolean = true, @Synchronize - var audit: Boolean = false) : Parcelable { + var audit: Boolean = false, + var ignore: Boolean = false//此评分是否计入总分 +) : Parcelable { fun getDevice(): String { return device.trim() } diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt index ca4e0208a1..b66d13ae34 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt @@ -8,12 +8,14 @@ import android.view.ViewGroup import android.widget.LinearLayout import android.widget.PopupWindow import android.widget.TextView +import androidx.core.content.ContextCompat import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.gh.base.BaseActivity import com.gh.common.constant.Constants import com.gh.common.constant.ItemViewType import com.gh.common.util.* +import com.gh.gamecenter.BuildConfig import com.gh.gamecenter.R import com.gh.gamecenter.baselist.ListAdapter import com.gh.gamecenter.databinding.ItemGameDetailRatingCommentBinding @@ -83,16 +85,30 @@ class DescCommentsAdapter(context: Context, when { commentData.isEditContent == null -> { - time.text = NewsUtils.getFormattedTime(commentData.time) - time.setTextColor(mContext.resources.getColor(R.color.hint)) + time.setTextColor(ContextCompat.getColor(mContext, R.color.text_999999)) + time.text = if (commentData.ignore) { + val s = "${NewsUtils.getFormattedTime(commentData.time)} 保护期评论不计入总分" + SpanBuilder(s).image(s.length - 12, s.length - 11, R.drawable.ic_ignore_rating_tips).color(mContext, s.length - 10, s.length, R.color.text_666666).build() + } else { + NewsUtils.getFormattedTime(commentData.time) + } } commentData.isEditContent!! -> { - time.text = (NewsUtils.getFormattedTime(commentData.time) + " 已修改 >") - time.setTextColor(mContext.resources.getColor(R.color.tag_orange)) + time.setTextColor(ContextCompat.getColor(mContext, R.color.text_F56614)) + time.text = if (commentData.ignore) { + "${NewsUtils.getFormattedTime(commentData.time)} 保护期间修改评论 >" + } else { + "${NewsUtils.getFormattedTime(commentData.time)} 已修改 >" + } } else -> { - time.text = (NewsUtils.getFormattedTime(commentData.time) + " 已修改") - time.setTextColor(mContext.resources.getColor(R.color.tag_orange)) + time.setTextColor(ContextCompat.getColor(mContext, R.color.text_F56614)) + time.text = if (commentData.ignore) { + "${NewsUtils.getFormattedTime(commentData.time)} 保护期间修改评论" + } else { + "${NewsUtils.getFormattedTime(commentData.time)} 已修改" + } + } } @@ -154,7 +170,11 @@ class DescCommentsAdapter(context: Context, } } time.setOnClickListener { - if (commentData.isEditContent == true) { + if (commentData.isEditContent == null && commentData.ignore) { + DialogUtils.showStopServerExplanationDialog(mContext, if (mViewModel.game?.commentDescription?.isNotEmpty() == true) + mViewModel.game?.commentDescription else mContext.getString(R.string.rating_protection), mViewModel.game?.name + ?: "") + } else if (commentData.isEditContent == true) { MtaHelper.onEvent("游戏详情_新", "玩家评论-点击时间", mViewModel.game?.name) val intent = CommentLogsActivity.getIntent(mContext, mViewModel.game!!.id, commentData.id) mContext.startActivity(intent) diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt index 66dc45cbe2..0b978978d0 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt @@ -103,7 +103,7 @@ class RatingAdapter(context: Context, } } is FooterViewHolder -> { - if (mIsOver && mListViewModel.type == RatingViewModel.RatingType.RATING) { + if (mIsOver && mListViewModel.type == RatingViewModel.RatingType.RATING && ratingData != null && ratingData!!.ignoreComment) { holder.initItemPadding() val params = holder.itemView.layoutParams as RecyclerView.LayoutParams params.height = 44F.dip2px() @@ -148,7 +148,7 @@ class RatingAdapter(context: Context, skipRatingEdit(0.0F, "游戏详情-评论-[我要安利]", fromAmway = true, isSkipSuccessPage = false) } stopServerIv.setOnClickListener { - DialogUtils.showStopServerExplanationDialog(mContext, "", mListViewModel.game.name) + DialogUtils.showStopServerExplanationDialog(mContext, ratingData?.commentDescription, mListViewModel.game.name) } if (ratingData?.serviceComment != null) { includeServiceComment.commentItem.visibility = View.VISIBLE diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt index 55ed573076..11661f38f8 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingCommentItemViewHolder.kt @@ -24,6 +24,7 @@ import com.gh.common.util.* import com.gh.common.view.CenterImageSpan import com.gh.common.view.CustomLinkMovementMethod import com.gh.common.view.DrawableView +import com.gh.gamecenter.BuildConfig import com.gh.gamecenter.R import com.gh.gamecenter.WebActivity import com.gh.gamecenter.databinding.RatingCommentItemBinding @@ -54,17 +55,36 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR } data = commentData - if (commentData.isEditContent == null) { - time.text = NewsUtils.getFormattedTime(commentData.time) - time.setTextColor(context.resources.getColor(R.color.text_999999)) - } else if (commentData.isEditContent!!) { - time.text = (NewsUtils.getFormattedTime(commentData.time) + " 已修改 >") - time.setTextColor(context.resources.getColor(R.color.text_F56614)) - } else { - time.text = (NewsUtils.getFormattedTime(commentData.time) + " 已修改") - time.setTextColor(context.resources.getColor(R.color.text_F56614)) + when { + commentData.isEditContent == null -> { + time.setTextColor(ContextCompat.getColor(context, R.color.text_999999)) + time.text = if (commentData.ignore) { + val s = "${NewsUtils.getFormattedTime(commentData.time)} 保护期评论不计入总分" + SpanBuilder(s).image(s.length - 12, s.length - 11, R.drawable.ic_ignore_rating_tips).color(context, s.length - 10, s.length, R.color.text_666666).build() + } else { + NewsUtils.getFormattedTime(commentData.time) + } + } + commentData.isEditContent!! -> { + time.setTextColor(ContextCompat.getColor(context, R.color.text_F56614)) + time.text = if (commentData.ignore) { + "${NewsUtils.getFormattedTime(commentData.time)} 保护期间修改评论 >" + } else { + "${NewsUtils.getFormattedTime(commentData.time)} 已修改 >" + } + } + else -> { + time.setTextColor(ContextCompat.getColor(context, R.color.text_F56614)) + time.text = if (commentData.ignore) { + "${NewsUtils.getFormattedTime(commentData.time)} 保护期间修改评论" + } else { + "${NewsUtils.getFormattedTime(commentData.time)} 已修改" + } + + } } + if (commentData.user.badge != null) { sdvUserBadge.visibility = View.VISIBLE tvBadgeName.visibility = View.VISIBLE @@ -188,7 +208,10 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR } time.setOnClickListener { - if (commentData.isEditContent == true) { + if (commentData.isEditContent == null && commentData.ignore) { + DialogUtils.showStopServerExplanationDialog(context, if (game?.commentDescription?.isNotEmpty() == true) game.commentDescription else + context.getString(R.string.rating_protection), game?.name ?: "") + } else if (commentData.isEditContent == true) { val intent = CommentLogsActivity.getIntent(context, game!!.id, commentData.id) context.startActivity(intent) } diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFragment.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFragment.kt index b4413e10ad..3367eeb213 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFragment.kt @@ -132,7 +132,7 @@ class RatingFragment : ListFragment() { } override fun onLoadError() { - if (mListViewModel.ratingLiveData.value != null) { + if (mRatingType == RatingViewModel.RatingType.RATING && mListViewModel.ratingLiveData.value != null) { mAdapter?.setListData(arrayListOf()) mAdapter?.loadChange(LoadStatus.LIST_FAILED) super.onLoadDone() @@ -142,7 +142,7 @@ class RatingFragment : ListFragment() { } override fun onLoadEmpty() { - if (mListViewModel.ratingLiveData.value != null) { + if (mRatingType == RatingViewModel.RatingType.RATING && mListViewModel.ratingLiveData.value != null) { mAdapter?.loadChange(LoadStatus.LIST_OVER) super.onLoadDone() if (mAdapter?.ratingData != null && mListViewModel.filterMap.isEmpty()) { diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingViewModel.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingViewModel.kt index 4880df1627..0a003710ad 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingViewModel.kt @@ -44,12 +44,17 @@ class RatingViewModel(application: Application, val game: GameEntity, val type: } override fun provideDataObservable(page: Int): Observable>? { - return mApi.getGameComments(game.id, page, - UrlFilterUtils.getFilterQuery(FILTER_DEVICE_KEY, - filterMap[FILTER_DEVICE_KEY], - FILTER_START_KEY, - filterMap[FILTER_START_KEY]), - filterMap[FILTER_SORT_KEY]) + return if (type == RatingType.RATING) { + mApi.getGameComments(game.id, page, + UrlFilterUtils.getFilterQuery(FILTER_DEVICE_KEY, + filterMap[FILTER_DEVICE_KEY], + FILTER_START_KEY, + filterMap[FILTER_START_KEY]), + filterMap[FILTER_SORT_KEY]) + } else { + mApi.getGameComments(game.id, page, UrlFilterUtils.getFilterQuery("fold", "true"), "") + } + } override fun mergeResultLiveData() { @@ -147,10 +152,16 @@ class RatingViewModel(application: Application, val game: GameEntity, val type: fun filterList(sort: String?, filter: String?) { filterMap.clear() - if (sort == "热门") { - filterMap[FILTER_SORT_KEY] = "vote:-1" - } else { - filterMap[FILTER_SORT_KEY] = "time:-1" + when (sort) { + "默认" -> { + filterMap[FILTER_SORT_KEY] = "" + } + "热门" -> { + filterMap[FILTER_SORT_KEY] = "vote:-1" + } + else -> { + filterMap[FILTER_SORT_KEY] = "time:-1" + } } if (filter == "同设备") { diff --git a/app/src/main/res/drawable-xxhdpi/ic_ignore_rating_tips.png b/app/src/main/res/drawable-xxhdpi/ic_ignore_rating_tips.png new file mode 100644 index 0000000000..22759ba3bf Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_ignore_rating_tips.png differ diff --git a/app/src/main/res/layout/rating_item.xml b/app/src/main/res/layout/rating_item.xml index f35342a0e5..cddb63a273 100644 --- a/app/src/main/res/layout/rating_item.xml +++ b/app/src/main/res/layout/rating_item.xml @@ -6,6 +6,7 @@ + + android:background="@drawable/bg_rating_stop_server_remind" + android:visibility="gone" + goneIf="@{TextUtils.isEmpty(data.commentDescription)}"> 你有%1$d]]>款预约的游戏上线啦 该游戏暂时仅提供试玩版本。试玩版资源来自第三方网站,可能存在bug或兼容性问题。敬请留意后续相关消息。 该游戏暂时仅提供试玩版本。试玩版可能存在bug或兼容性问题。敬请留意后续相关消息。 + 游戏停服更新维护中,为避免情绪化内容对游戏评分带来的影响,因此开启停服保护功能。在停服保护状态期间,所新增及修改发布的评分将不计入总分,所评分评论内容在展示上也会有文字提示告知其他玩家。\n\n感谢您的配合及谅解,祝您游戏愉快!\n\n光环助手会持续关注产品建议及反馈,如您在使用过程中有任何问题,欢迎向我们反馈。