From 9dc9add896c4e523cd82307af44daf91fa8fd88c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E7=8E=89=E4=B9=85?= <1484288157@qq.com>
Date: Thu, 16 Jul 2020 09:11:05 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8A=98=E5=8F=A0=E8=AF=84=E8=AE=BAUI?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/AndroidManifest.xml | 3 +
.../java/com/gh/common/util/DialogUtils.java | 32 ++++++
.../java/com/gh/common/util/SpanBuilder.kt | 24 ++++-
.../gamedetail/desc/DescCommentsAdapter.kt | 15 ++-
.../gamedetail/rating/RatingAdapter.kt | 66 ++++++++++---
.../rating/RatingCommentItemViewHolder.kt | 28 +++---
.../gamedetail/rating/RatingFoldActivity.kt | 26 +++++
.../gamedetail/rating/RatingFragment.kt | 38 +++++++-
.../gamedetail/rating/RatingItemViewHolder.kt | 6 +-
.../gamedetail/rating/RatingViewModel.kt | 18 +++-
.../drawable-xxhdpi/ic_fold_rating_remind.png | Bin 0 -> 1497 bytes
.../res/drawable-xxhdpi/ic_rating_remind.png | Bin 0 -> 1573 bytes
.../res/drawable/bg_fold_rating_reason.xml | 6 ++
.../drawable/bg_rating_stop_server_remind.xml | 6 ++
.../main/res/layout/dialog_kaifu_remind.xml | 1 +
.../res/layout/fragment_list_fold_rating.xml | 43 +++++++++
.../res/layout/game_comment_hint_item.xml | 4 +-
.../main/res/layout/rating_comment_item.xml | 4 +-
app/src/main/res/layout/rating_item.xml | 91 +++++++++++++-----
app/src/main/res/values/colors.xml | 1 +
20 files changed, 335 insertions(+), 77 deletions(-)
create mode 100644 app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFoldActivity.kt
create mode 100644 app/src/main/res/drawable-xxhdpi/ic_fold_rating_remind.png
create mode 100644 app/src/main/res/drawable-xxhdpi/ic_rating_remind.png
create mode 100644 app/src/main/res/drawable/bg_fold_rating_reason.xml
create mode 100644 app/src/main/res/drawable/bg_rating_stop_server_remind.xml
create mode 100644 app/src/main/res/layout/fragment_list_fold_rating.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 75316f157c..8090cc1a66 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -514,6 +514,9 @@
+
{
+ MtaHelper.onEvent("评论说明弹窗", "滑动内容", gameName);
+ });
+ ok.setOnClickListener(v -> {
+ MtaHelper.onEvent("评论说明弹窗", "弹窗", "点击我知道了");
+ MtaHelper.onEvent("评论说明弹窗", "点击我知道了", gameName);
+ dialog.dismiss();
+ });
+
+ Window window = dialog.getWindow();
+ if (window != null) {
+ window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ }
+
+ dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ dialog.setContentView(contentView);
+ dialog.show();
+ }
+
public static void showPluggableNeverRemindDialog(Context context, String nameAndPlatform, @NonNull ConfirmListener listener) {
context = checkDialogContext(context);
diff --git a/app/src/main/java/com/gh/common/util/SpanBuilder.kt b/app/src/main/java/com/gh/common/util/SpanBuilder.kt
index cd32e74a22..7ce8e53711 100644
--- a/app/src/main/java/com/gh/common/util/SpanBuilder.kt
+++ b/app/src/main/java/com/gh/common/util/SpanBuilder.kt
@@ -5,10 +5,9 @@ import android.graphics.Color
import android.graphics.Typeface
import android.text.SpannableStringBuilder
import android.text.Spanned
-import android.text.style.AbsoluteSizeSpan
-import android.text.style.ForegroundColorSpan
-import android.text.style.StrikethroughSpan
-import android.text.style.StyleSpan
+import android.text.TextPaint
+import android.text.style.*
+import android.view.View
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import com.gh.common.view.CenterImageSpan
@@ -65,6 +64,23 @@ class SpanBuilder(content: String) {
return this
}
+ fun click(start: Int, end: Int, colorRes: Int, onClick: () -> Unit): SpanBuilder {
+ val clickSpan = object : ClickableSpan() {
+ override fun updateDrawState(ds: TextPaint) {
+ super.updateDrawState(ds)
+ ds.color = ContextCompat.getColor(HaloApp.getInstance().application, colorRes)
+ ds.isUnderlineText = false
+ }
+
+ override fun onClick(widget: View) {
+ onClick.invoke()
+ }
+
+ }
+ spannableString.setSpan(clickSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
+ return this
+ }
+
fun build(): SpannableStringBuilder {
return spannableString
}
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 76203a1548..ca4e0208a1 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
@@ -97,21 +97,17 @@ class DescCommentsAdapter(context: Context,
}
sdvUserBadge.setOnClickListener {
- val key = when (path) {
- "游戏详情:介绍" -> "游戏详情-玩家评论"
- "游戏详情:评分" -> "游戏详情-评论列表"
- "评论详情" -> "游戏评论详情"
- else -> ""
- }
- MtaHelper.onEvent("进入徽章墙_用户记录", key, "${commentData.user.name}(${commentData.user.id})")
- MtaHelper.onEvent("徽章中心", "进入徽章中心", key)
+ MtaHelper.onEvent("进入徽章墙_用户记录", "游戏详情-玩家评论", "${commentData.user.name}(${commentData.user.id})")
+ MtaHelper.onEvent("徽章中心", "进入徽章中心", "游戏详情-玩家评论")
DirectUtils.directToBadgeWall(mContext, commentData.user.id, commentData.user.name, commentData.user.icon)
}
userIcon.setOnClickListener {
- DirectUtils.directToHomeActivity(mContext, commentData.user.id, mEntrance, path)
+ DirectUtils.directToHomeActivity(mContext, commentData.user.id, mEntrance, "游戏详情-玩家评论")
+ MtaHelper.onEvent("游戏详情_新", "玩家评论_点击用户头像", mViewModel.game?.name)
}
userName.setOnClickListener {
userIcon.performClick()
+ MtaHelper.onEvent("游戏详情_新", "玩家评论_点击用户名字", mViewModel.game?.name)
}
tvBadgeName.setOnClickListener { sdvUserBadge.performClick() }
@@ -159,6 +155,7 @@ class DescCommentsAdapter(context: Context,
}
time.setOnClickListener {
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 75bf510128..66dc45cbe2 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
@@ -4,9 +4,12 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.util.SparseBooleanArray
+import android.view.Gravity
import android.view.View
import android.view.ViewGroup
+import android.widget.LinearLayout
import androidx.core.content.ContextCompat
+import androidx.recyclerview.widget.RecyclerView
import com.gh.common.constant.ItemViewType
import com.gh.common.util.*
import com.gh.gamecenter.R
@@ -25,7 +28,7 @@ class RatingAdapter(context: Context,
private val mEntrance: String) : ListAdapter(context) {
var ratingData: Rating? = null
- val path = "游戏详情:评分"
+ val path = if (mListViewModel.type == RatingViewModel.RatingType.RATING) "游戏详情:评分" else "折叠评论"
val headServiceCommentPosition = -1
val headMyCommentPosition = -2
@@ -45,10 +48,17 @@ class RatingAdapter(context: Context,
}
override fun getItemViewType(position: Int): Int {
- return when (position) {
- itemCount - 1 -> ItemViewType.ITEM_FOOTER
- 0 -> ItemViewType.ITEM_HEADER
- else -> ItemViewType.ITEM_BODY
+ return if (mListViewModel.type == RatingViewModel.RatingType.RATING) {
+ when (position) {
+ itemCount - 1 -> ItemViewType.ITEM_FOOTER
+ 0 -> ItemViewType.ITEM_HEADER
+ else -> ItemViewType.ITEM_BODY
+ }
+ } else {
+ when (position) {
+ itemCount - 1 -> ItemViewType.ITEM_FOOTER
+ else -> ItemViewType.ITEM_BODY
+ }
}
}
@@ -72,17 +82,46 @@ class RatingAdapter(context: Context,
override fun getItemCount(): Int {
var index = 0
- if (ratingData != null) index++
- if (mEntityList != null && ratingData != null) index += mEntityList.size
+ if (mListViewModel.type == RatingViewModel.RatingType.RATING) {
+ if (ratingData != null) index++
+ if (mEntityList != null && ratingData != null) index += mEntityList.size
+ } else {
+ if (mEntityList != null) index += mEntityList.size
+ }
if (index > 0) index++
return index
}
- override fun onBindViewHolder(holder: androidx.recyclerview.widget.RecyclerView.ViewHolder, position: Int) {
+ override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
is RatingItemViewHolder -> bindRatingItem(holder)
- is RatingCommentItemViewHolder -> initRatingComment(holder, mEntityList[position - 1], position - 1)
- is FooterViewHolder -> holder.initFooterViewHolder(mListViewModel, mIsLoading, isNetworkError, mIsOver)
+ is RatingCommentItemViewHolder -> {
+ if (mListViewModel.type == RatingViewModel.RatingType.RATING) {
+ initRatingComment(holder, mEntityList[position - 1], position - 1)
+ } else {
+ initRatingComment(holder, mEntityList[position], position)
+ }
+ }
+ is FooterViewHolder -> {
+ if (mIsOver && mListViewModel.type == RatingViewModel.RatingType.RATING) {
+ holder.initItemPadding()
+ val params = holder.itemView.layoutParams as RecyclerView.LayoutParams
+ params.height = 44F.dip2px()
+ holder.itemView.layoutParams = params
+ holder.itemView.background = ContextCompat.getDrawable(mContext, R.drawable.background_shape_white_radius_5)
+ holder.lineLeft.visibility = View.GONE
+ holder.lineRight.visibility = View.GONE
+ holder.loading.visibility = View.GONE
+ holder.hint.text = "查看折叠评论>"
+ holder.hint.textSize = 12F
+ holder.hint.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font))
+ holder.itemView.setOnClickListener {
+ mContext.startActivity(RatingFoldActivity.getIntent(mContext, mListViewModel.game, mEntrance, path))
+ }
+ } else {
+ holder.initFooterViewHolder(mListViewModel, mIsLoading, isNetworkError, mIsOver)
+ }
+ }
}
}
@@ -108,6 +147,9 @@ class RatingAdapter(context: Context,
MtaHelper.onEvent("发表评论", "我要安利", mListViewModel.game.name)
skipRatingEdit(0.0F, "游戏详情-评论-[我要安利]", fromAmway = true, isSkipSuccessPage = false)
}
+ stopServerIv.setOnClickListener {
+ DialogUtils.showStopServerExplanationDialog(mContext, "", mListViewModel.game.name)
+ }
if (ratingData?.serviceComment != null) {
includeServiceComment.commentItem.visibility = View.VISIBLE
initRatingComment(RatingCommentItemViewHolder(includeServiceComment), ratingData?.serviceComment!!, headServiceCommentPosition)
@@ -123,7 +165,7 @@ class RatingAdapter(context: Context,
}
sort.setOnClickListener {
- holder.showPopWindow(sort, RatingItemViewHolder.POP_SORT) { text ->
+ holder.showPopWindow(sort, RatingItemViewHolder.POP_SORT, sort.text.toString()) { text ->
if (text != sort.text) {
sort.text = text
mListViewModel.filterList(text, filter.text.toString())
@@ -133,7 +175,7 @@ class RatingAdapter(context: Context,
}
filter.setOnClickListener {
- holder.showPopWindow(filter, RatingItemViewHolder.POP_FILTER) { text ->
+ holder.showPopWindow(filter, RatingItemViewHolder.POP_FILTER, filter.text.toString()) { text ->
if (text != filter.text) {
filter.text = text
mListViewModel.filterList(sort.text.toString(), text)
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 999bd6e85d..55ed573076 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
@@ -91,7 +91,7 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
Picasso.with(context).load(Uri.parse(it)).priority(Picasso.Priority.HIGH).get()
}.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
- .subscribe ({
+ .subscribe({
val bitmapDrawable = BitmapDrawable(context.resources, it)
bitmapDrawable.setBounds(0, 0, DensityUtil.dip2px(16F), DensityUtil.dip2px(16F))
contentSpan.setSpan(CenterImageSpan(bitmapDrawable), commentData.replyData?.user?.name!!.length + 2, commentData.replyData?.user?.name!!.length + 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
@@ -116,7 +116,7 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
}, commentData.replyData?.user?.name!!.length + 2, commentData.replyData?.user?.name!!.length + 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
replyContent.movementMethod = CustomLinkMovementMethod.getInstance()
replyContent.text = contentSpan
- },{
+ }, {
it.printStackTrace()
})
} else {
@@ -149,21 +149,15 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
badge.visibility = View.GONE
}
userIcon.setOnClickListener {
- DirectUtils.directToHomeActivity(context, commentData.user.id, entrance, path)
+ DirectUtils.directToHomeActivity(context, commentData.user.id, entrance, getKey(path))
}
userName.setOnClickListener {
- DirectUtils.directToHomeActivity(context, commentData.user.id, entrance, path)
+ userIcon.performClick()
}
sdvUserBadge.setOnClickListener {
- val key = when (path) {
- "游戏详情:介绍" -> "游戏详情-玩家评论"
- "游戏详情:评分" -> "游戏详情-评论列表"
- "评论详情" -> "游戏评论详情"
- else -> ""
- }
- MtaHelper.onEvent("进入徽章墙_用户记录", key, "${commentData.user.name}(${commentData.user.id})")
- MtaHelper.onEvent("徽章中心", "进入徽章中心", key)
+ MtaHelper.onEvent("进入徽章墙_用户记录", getKey(path), "${commentData.user.name}(${commentData.user.id})")
+ MtaHelper.onEvent("徽章中心", "进入徽章中心", getKey(path))
DirectUtils.directToBadgeWall(context, commentData.user.id, commentData.user.name, commentData.user.icon)
}
tvBadgeName.setOnClickListener { sdvUserBadge.performClick() }
@@ -234,6 +228,16 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
}
}
+ private fun getKey(path: String): String {
+ return when (path) {
+ "游戏详情:介绍" -> "游戏详情-玩家评论"
+ "游戏详情:评分" -> "游戏详情-评论列表"
+ "评论详情" -> "游戏评论详情"
+ "折叠评论" -> "折叠评论"
+ else -> ""
+ }
+ }
+
private fun getSpan(context: Context, name: String, commentData: RatingComment): SpannableStringBuilder {
val spanned = SpanBuilder(name)
.color(context, 0, commentData.replyData?.user?.name!!.length, R.color.text_333333)
diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFoldActivity.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFoldActivity.kt
new file mode 100644
index 0000000000..8b9dad38d1
--- /dev/null
+++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingFoldActivity.kt
@@ -0,0 +1,26 @@
+package com.gh.gamecenter.gamedetail.rating
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import com.gh.common.util.EntranceUtils
+import com.gh.gamecenter.NormalActivity
+import com.gh.gamecenter.entity.GameEntity
+
+class RatingFoldActivity : NormalActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setNavigationTitle("折叠评论")
+ }
+ companion object {
+ @JvmStatic
+ fun getIntent(context: Context, game: GameEntity, entrance: String, path: String): Intent {
+ val bundle = Bundle()
+ bundle.putParcelable(GameEntity.TAG, game)
+ bundle.putString(EntranceUtils.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path))
+ bundle.putSerializable(EntranceUtils.KEY_LOCATION, RatingViewModel.RatingType.FOLD_RATING)
+ return getTargetIntent(context, RatingFoldActivity::class.java, RatingFragment::class.java, bundle)
+ }
+ }
+}
\ No newline at end of file
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 a993e63673..b4413e10ad 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
@@ -3,17 +3,21 @@ package com.gh.gamecenter.gamedetail.rating
import android.app.Activity
import android.content.Intent
import android.os.Bundle
+import android.text.method.LinkMovementMethod
import android.view.View
import android.widget.ProgressBar
+import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.databinding.BindingAdapter
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.RecyclerView
-import com.gh.common.util.DisplayUtils
import com.gh.common.util.EntranceUtils
+import com.gh.common.util.SpanBuilder
+import com.gh.common.util.dip2px
import com.gh.common.view.VerticalItemDecoration
import com.gh.gamecenter.R
+import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.baselist.ListFragment
import com.gh.gamecenter.baselist.LoadStatus
import com.gh.gamecenter.entity.GameEntity
@@ -31,6 +35,16 @@ class RatingFragment : ListFragment() {
private var mSkipGameComment: Boolean? = null
+ private var mRatingType: RatingViewModel.RatingType? = null
+
+ override fun getLayoutId(): Int {
+ return if (mRatingType == RatingViewModel.RatingType.RATING) {
+ super.getLayoutId()
+ } else {
+ R.layout.fragment_list_fold_rating
+ }
+ }
+
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == RATING_EDIT_REQUEST && resultCode == Activity.RESULT_OK) {
@@ -43,7 +57,7 @@ class RatingFragment : ListFragment() {
}
override fun getItemDecoration(): RecyclerView.ItemDecoration? {
- return VerticalItemDecoration(requireContext(), 12F, false, R.color.transparent)
+ return VerticalItemDecoration(requireContext(), 12F, mRatingType != RatingViewModel.RatingType.RATING, R.color.transparent)
}
override fun provideListAdapter(): RatingAdapter {
@@ -58,7 +72,7 @@ class RatingFragment : ListFragment() {
override fun provideListViewModel(): RatingViewModel {
val factory = RatingViewModel.Factory(
HaloApp.getInstance().application,
- arguments?.getParcelable(GameEntity.TAG)!!)
+ arguments?.getParcelable(GameEntity.TAG)!!, mRatingType!!)
return ViewModelProviders.of(this, factory).get(RatingViewModel::class.java)
}
@@ -67,11 +81,13 @@ class RatingFragment : ListFragment() {
}
override fun onCreate(savedInstanceState: Bundle?) {
+ mRatingType = arguments?.getSerializable(EntranceUtils.KEY_LOCATION) as? RatingViewModel.RatingType
+ ?: RatingViewModel.RatingType.RATING
super.onCreate(savedInstanceState)
mSkipGameComment = arguments?.getBoolean(EntranceUtils.KEY_SKIP_GAME_COMMENT)
- mListRv.setPadding(DisplayUtils.dip2px(20f), 0, DisplayUtils.dip2px(20f), 0)
+ mListRv.setPadding(20F.dip2px(), 0, 20F.dip2px(), 0)
mListRefresh?.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.transparent))
- mListRefresh?.isEnabled = false
+ mListRefresh?.isEnabled = mRatingType != RatingViewModel.RatingType.RATING
mListViewModel.ratingLiveData.observe(this, Observer {
mAdapter?.ratingData = it
mAdapter?.notifyDataSetChanged()
@@ -79,6 +95,18 @@ class RatingFragment : ListFragment() {
}
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ if (mRatingType == RatingViewModel.RatingType.FOLD_RATING) {
+ val foldRatingReasonTv = requireView().findViewById(R.id.foldRatingReasonTv)
+ val text = "折叠原因:因违反《光环助手评论规则》被管理员折叠"
+ foldRatingReasonTv.text = SpanBuilder(text).click(8, 18, R.color.theme_font) {
+ requireContext().startActivity(WebActivity.getCommentRulesIntent(requireContext()))
+ }.build()
+ foldRatingReasonTv.movementMethod = LinkMovementMethod()
+ }
+ }
+
override fun onLoadDone() {
super.onLoadDone()
if (mSkipGameComment == true) {
diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingItemViewHolder.kt
index 76c1e8b83c..1a34b1fb8b 100644
--- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingItemViewHolder.kt
+++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingItemViewHolder.kt
@@ -3,6 +3,7 @@ package com.gh.gamecenter.gamedetail.rating
import android.view.LayoutInflater
import android.widget.LinearLayout
import android.widget.TextView
+import androidx.core.content.ContextCompat
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.util.showAutoOrientation
import com.gh.common.view.BugFixedPopupWindow
@@ -15,13 +16,13 @@ class RatingItemViewHolder(val binding: RatingItemBinding) : BaseRecyclerViewHol
* 注意:
* contentList [POP_SORT] 和 [POP_FILTER] 文案的内容 与[RatingViewModel.filterList] 判断对应
*/
- fun showPopWindow(view: TextView, type: Int, clickListener: (String) -> Unit) {
+ fun showPopWindow(view: TextView, type: Int, selectedValue: String, clickListener: (String) -> Unit) {
val bottomDrawable = view.context.resources.getDrawable(R.drawable.game_comment_filter_top)
bottomDrawable.setBounds(0, 0, bottomDrawable.minimumWidth, bottomDrawable.minimumHeight)
view.setCompoundDrawables(null, null, bottomDrawable, null)
val contentList = when (type) {
- POP_SORT -> arrayListOf("最新", "热门")
+ POP_SORT -> arrayListOf("默认", "最新", "热门")
POP_FILTER -> arrayListOf("全部评论", "同设备", "1星", "2星", "3星", "4星", "5星")
else -> throw IllegalArgumentException()
}
@@ -41,6 +42,7 @@ class RatingItemViewHolder(val binding: RatingItemBinding) : BaseRecyclerViewHol
val hitText = item.findViewById(R.id.hint_text)
hitText.text = text
+ hitText.setTextColor(ContextCompat.getColor(view.context, if (text == selectedValue) R.color.theme_font else R.color.text_666666))
item.setOnClickListener {
popupWindow.dismiss()
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 12947adef5..4880df1627 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
@@ -27,7 +27,7 @@ import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
import retrofit2.HttpException
-class RatingViewModel(application: Application, val game: GameEntity) : ListViewModel(application) {
+class RatingViewModel(application: Application, val game: GameEntity, val type: RatingType = RatingType.RATING) : ListViewModel(application) {
private val mApi = RetrofitManager.getInstance(getApplication()).api
@@ -36,7 +36,11 @@ class RatingViewModel(application: Application, val game: GameEntity) : ListView
var packageNameList = ArrayList()
init {
- initData()
+ if (type == RatingType.RATING) {
+ initData()
+ } else {
+ load(LoadType.NORMAL)
+ }
}
override fun provideDataObservable(page: Int): Observable>? {
@@ -166,9 +170,10 @@ class RatingViewModel(application: Application, val game: GameEntity) : ListView
}
class Factory(private val mApplication: Application,
- private val game: GameEntity) : ViewModelProvider.NewInstanceFactory() {
+ private val game: GameEntity,
+ val type: RatingType = RatingType.RATING) : ViewModelProvider.NewInstanceFactory() {
override fun create(modelClass: Class): T {
- return RatingViewModel(mApplication, game) as T
+ return RatingViewModel(mApplication, game, type) as T
}
}
@@ -177,4 +182,9 @@ class RatingViewModel(application: Application, val game: GameEntity) : ListView
private const val FILTER_DEVICE_KEY = "device"
private const val FILTER_START_KEY = "star"
}
+
+ enum class RatingType {
+ RATING,//评论列表
+ FOLD_RATING//折叠评论
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-xxhdpi/ic_fold_rating_remind.png b/app/src/main/res/drawable-xxhdpi/ic_fold_rating_remind.png
new file mode 100644
index 0000000000000000000000000000000000000000..1f3a89518ecd333d325eb1040a3f141bde142c7c
GIT binary patch
literal 1497
zcmV;~1t$85P)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@
z1ONa40RR91B%lKT1ONa40RR91Bme*a04fgS`~Uz2LrFwIR9Fekm|aXR3PDF0e}C?%;xU0%ie1-b&`AM%$alk=YMDBo|$_Cc|J>X
zbMyTxD=TfAo14$zx|gdIxl}NLKp;+~YZm!hVPWCrfq{W}^?5A;uZFd?wH?@=CQu6m
zLSFo^O<;Qy+Y4i3V?CaHav9at)kU!R7~n&0TY`<#{)sD2pGHL^q><8f0NsA+Y@siP
zd}efXbkOQD)mcZVv$HdQdV2aSz;9YdKy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htuSbEVM$JJ^mo`Y0I{)52phzr!j
zp^aOi8t5!NCEE}{cOcXY%ajk(l8%WMdP&pa6aSA+i*~vV1`Kc-tkMrTJ^#+H68H^(
z<>xu@mb@PB8=x&-6##!F)+ImVg`v(1RBSy(-|DZ#t6}xf0N{sYD|_PKx7JS?7n!cA
ze+<`^r{yPUN9<<6dT9eX{%Ns#Cix>%n$z
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_rating_stop_server_remind.xml b/app/src/main/res/drawable/bg_rating_stop_server_remind.xml
new file mode 100644
index 0000000000..ba7a95a36a
--- /dev/null
+++ b/app/src/main/res/drawable/bg_rating_stop_server_remind.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_kaifu_remind.xml b/app/src/main/res/layout/dialog_kaifu_remind.xml
index 66c636b349..8708a5b463 100644
--- a/app/src/main/res/layout/dialog_kaifu_remind.xml
+++ b/app/src/main/res/layout/dialog_kaifu_remind.xml
@@ -14,6 +14,7 @@
android:orientation="vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/game_comment_hint_item.xml b/app/src/main/res/layout/game_comment_hint_item.xml
index 89393243f6..70f2f74f6a 100644
--- a/app/src/main/res/layout/game_comment_hint_item.xml
+++ b/app/src/main/res/layout/game_comment_hint_item.xml
@@ -7,5 +7,5 @@
android:gravity = "center"
android:orientation = "vertical"
android:text = "修改"
- android:textColor = "@color/text_3a3a3a"
- android:textSize = "12dp" />
\ No newline at end of file
+ android:textColor = "@color/text_666666"
+ android:textSize = "12sp" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/rating_comment_item.xml b/app/src/main/res/layout/rating_comment_item.xml
index 458fe5118a..f00b25d983 100644
--- a/app/src/main/res/layout/rating_comment_item.xml
+++ b/app/src/main/res/layout/rating_comment_item.xml
@@ -314,9 +314,9 @@
android:layout_marginRight="20dp"
app:layout_constraintTop_toBottomOf="@id/line">
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 8b5e6dbda2..bd241347d0 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -173,4 +173,5 @@
#3CB9FF
#E8F3FF
#05CBA3
+ #EDF4FB
\ No newline at end of file