diff --git a/app/src/main/java/com/gh/common/util/CommentUtils.java b/app/src/main/java/com/gh/common/util/CommentUtils.java index 09e7aa625d..e0f704b053 100644 --- a/app/src/main/java/com/gh/common/util/CommentUtils.java +++ b/app/src/main/java/com/gh/common/util/CommentUtils.java @@ -211,7 +211,7 @@ public class CommentUtils { final TextView commentLikeCountTv, final ImageView commentLikeIv, final OnVoteListener listener) { if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme_font)) { - Utils.toast(context, "已经点过赞啦!"); + ToastUtils.INSTANCE.showToast("已经点过赞啦!"); return; } commentEntity.setVote(commentEntity.getVote() + 1); @@ -248,7 +248,7 @@ public class CommentUtils { try { String detail = new JSONObject(exception.response().errorBody().string()).getString("detail"); if ("voted".equals(detail)) { - Utils.toast(context, "已经点过赞啦!"); + ToastUtils.INSTANCE.showToast("已经点过赞啦!"); } } catch (Exception ex) { ex.printStackTrace(); @@ -277,7 +277,7 @@ public class CommentUtils { } CheckLoginUtils.checkLogin(context, entrance, () -> { if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme_font)) { - Utils.toast(context, "已经点过赞啦!"); + ToastUtils.INSTANCE.showToast("已经点过赞啦!"); return; } commentEntity.setVote(commentEntity.getVote() + 1); @@ -313,7 +313,7 @@ public class CommentUtils { try { String detail = new JSONObject(exception.response().errorBody().string()).getString("detail"); if ("voted".equals(detail)) { - Utils.toast(context, "已经点过赞啦!"); + ToastUtils.INSTANCE.showToast("已经点过赞啦!"); } } catch (Exception ex) { ex.printStackTrace(); @@ -433,7 +433,7 @@ public class CommentUtils { ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); cmb.setText(copyContent); - Utils.toast(context, "复制成功"); + ToastUtils.INSTANCE.showToast("复制成功"); } diff --git a/app/src/main/java/com/gh/common/util/Extensions.kt b/app/src/main/java/com/gh/common/util/Extensions.kt index dca00d803d..9b7601d124 100644 --- a/app/src/main/java/com/gh/common/util/Extensions.kt +++ b/app/src/main/java/com/gh/common/util/Extensions.kt @@ -28,7 +28,6 @@ import com.gh.gamecenter.BuildConfig import com.gh.gamecenter.R import com.google.gson.reflect.TypeToken import com.halo.assistant.HaloApp -import com.lightgame.utils.Utils import io.reactivex.Observable import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.Disposable @@ -289,7 +288,7 @@ fun String.copyTextAndToast(toastText: String = "复制成功") { val application = HaloApp.getInstance().application val cmb = application.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager cmb.text = this - Utils.toast(application, toastText) + ToastUtils.showToast(toastText) } fun Map.createRequestBody(): RequestBody { diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt index b63b744a0d..223b38159b 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingReplyAdapter.kt @@ -246,21 +246,23 @@ class RatingReplyAdapter(context: Context, replyCallback.invoke(null) } vote.setOnClickListener { - mContext.ifLogin(entrance) { - if (!vote.isChecked) { - viewModel.voteComment { - vote.text = (commentData.vote + 1).toString() - commentData.vote = commentData.vote + 1 - commentData.me.isVoted = true - vote.isChecked = true - } - } else { - viewModel.unvoteComment { - val count = commentData.vote - 1 - vote.text = if (count == 0) "" else count.toString() - commentData.vote = count - commentData.me.isVoted = false - vote.isChecked = false + debounceActionWithInterval(vote.id, 1000L) { + mContext.ifLogin(entrance) { + if (!vote.isChecked) { + viewModel.voteComment { + vote.text = (commentData.vote + 1).toString() + commentData.vote = commentData.vote + 1 + commentData.me.isVoted = true + vote.isChecked = true + } + } else { + viewModel.unvoteComment { + val count = commentData.vote - 1 + vote.text = if (count == 0) "" else count.toString() + commentData.vote = count + commentData.me.isVoted = false + vote.isChecked = false + } } } } @@ -316,17 +318,19 @@ class RatingReplyAdapter(context: Context, tvBadgeName.setOnClickListener { sdvUserBadge.performClick() } vote.setOnClickListener { - mContext.ifLogin("游戏详情-评分-评论详情-点赞评论") { - if (!vote.isChecked) { - viewModel.voteReply(replyEntity.id, callback = { - vote.text = (replyEntity.vote).toString() - vote.isChecked = true - }) - } else { - viewModel.voteReply(replyEntity.id, false, callback = { - vote.text = (replyEntity.vote).toString() - vote.isChecked = false - }) + debounceActionWithInterval(vote.id, 1000L) { + mContext.ifLogin("游戏详情-评分-评论详情-点赞评论") { + if (!vote.isChecked) { + viewModel.voteReply(replyEntity.id, callback = { + vote.text = (replyEntity.vote).toString() + vote.isChecked = true + }) + } else { + viewModel.voteReply(replyEntity.id, false, callback = { + vote.text = if (replyEntity.vote == 0) "" else (replyEntity.vote).toString() + vote.isChecked = false + }) + } } } } diff --git a/app/src/main/res/layout/rating_reply_item.xml b/app/src/main/res/layout/rating_reply_item.xml index cb7c1eac51..8a929ffeab 100644 --- a/app/src/main/res/layout/rating_reply_item.xml +++ b/app/src/main/res/layout/rating_reply_item.xml @@ -159,7 +159,7 @@ android:layout_height="48dp" android:checked="@{data.me.isVoted}" android:drawableLeft="@drawable/comment_vote_selector" - android:drawablePadding="7dp" + android:drawablePadding="4dp" android:paddingLeft="8dp" android:paddingRight="8dp" android:gravity="center_vertical"