From a453a526fae09b201f0ea21b4c638c10cc069a79 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 15 Aug 2022 09:19:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=8A=96,=E4=B8=BB=E6=92=AD=E7=A7=81?= =?UTF-8?q?=E8=81=8A=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 4 +- .../yunbao/main/activity/MainActivity.java | 35 +++--- .../yunbao/main/adapter/MainListAdapter.java | 113 ++++++++++-------- .../yunbao/main/adapter/SettingAdapter.java | 27 +++-- .../ConversationIMListManager.java | 3 +- .../yunbao/main/views/MainMeViewHolder.java | 59 +++++---- 6 files changed, 130 insertions(+), 111 deletions(-) diff --git a/config.gradle b/config.gradle index 3f66756b1..492fa93ba 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", //測試 - serverHost : "https://ceshi.yaoulive.com", +// serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 1ef242629..87dd0070f 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -76,6 +76,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.VersionUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.AbsMainViewHolder; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.bean.LiveBean; import com.yunbao.live.http.LiveHttpConsts; @@ -557,20 +558,26 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene // }); public void mainClick(View v) { - if (!canClick()) { - return; - } - int i = v.getId(); - if (i == R.id.btn_start) { - showStartDialog(); - } else if (i == R.id.btn_search) { - SearchActivity.forward(mContext); - } else if (i == R.id.btn_follow) { - //关注 - FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0); - } else if (i == R.id.img_trophy) { - MainListActivity.forward(this, 0); - } + ViewClicksAntiShake.clicksAntiShake(v, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (!canClick()) { + return; + } + int i = v.getId(); + if (i == R.id.btn_start) { + showStartDialog(); + } else if (i == R.id.btn_search) { + SearchActivity.forward(mContext); + } else if (i == R.id.btn_follow) { + //关注 + FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0); + } else if (i == R.id.img_trophy) { + MainListActivity.forward(mContext, 0); + } + } + }); + } private void showStartDialog() { diff --git a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java index a5bc0a226..026336a26 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java @@ -2,8 +2,6 @@ package com.yunbao.main.adapter; import android.content.Context; import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -11,6 +9,9 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; @@ -23,6 +24,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; import com.yunbao.main.bean.ListBean; @@ -58,42 +60,51 @@ public class MainListAdapter extends RefreshAdapter { CommonAppConfig appConfig = CommonAppConfig.getInstance(); mCoinName = type == TYPE_PROFIT ? appConfig.getVotesName() : appConfig.getCoinName(); mTopList = new ArrayList<>(); - mFollow = ("+"+WordUtil.getString(R.string.follow)); + mFollow = ("+" + WordUtil.getString(R.string.follow)); mFollowing = WordUtil.getString(R.string.following); mItemClickListener = new View.OnClickListener() { @Override public void onClick(View v) { - Object tag = v.getTag(); - if (tag != null && mOnItemClickListener != null) { - mOnItemClickListener.onItemClick((ListBean) tag, 0); - } + ViewClicksAntiShake.clicksAntiShake(v, () -> { + Object tag = v.getTag(); + if (tag != null && mOnItemClickListener != null) { + mOnItemClickListener.onItemClick((ListBean) tag, 0); + } + }); + } }; mFollowClickListener1 = new View.OnClickListener() { @Override public void onClick(View v) { - if (!canClick()) { - return; - } - Object tag = v.getTag(); - if (tag != null) { - final ListBean bean = (ListBean) tag; - CommonHttpUtil.setAttention(bean.getUid(), null); - } + ViewClicksAntiShake.clicksAntiShake(v, () -> { + if (!canClick()) { + return; + } + Object tag = v.getTag(); + if (tag != null) { + final ListBean bean = (ListBean) tag; + CommonHttpUtil.setAttention(bean.getUid(), null); + } + }); + } }; mFollowClickListener2 = new View.OnClickListener() { @Override public void onClick(View v) { - if (!canClick()) { - return; - } - Object tag = v.getTag(); - if (tag != null) { - final int position = (int) tag; - final ListBean bean = mList.get(position); - CommonHttpUtil.setAttention(bean.getUid(), null); - } + ViewClicksAntiShake.clicksAntiShake(v, () -> { + if (!canClick()) { + return; + } + Object tag = v.getTag(); + if (tag != null) { + final int position = (int) tag; + final ListBean bean = mList.get(position); + CommonHttpUtil.setAttention(bean.getUid(), null); + } + }); + } }; @@ -244,9 +255,9 @@ public class MainListAdapter extends RefreshAdapter { mBtnFollow1.setOnClickListener(mFollowClickListener1); mBtnFollow2.setOnClickListener(mFollowClickListener1); mBtnFollow3.setOnClickListener(mFollowClickListener1); - svga1 = (SVGAImageView)itemView.findViewById(R.id.svga1); - svga2 = (SVGAImageView)itemView.findViewById(R.id.svga2); - svga3 = (SVGAImageView)itemView.findViewById(R.id.svga3); + svga1 = (SVGAImageView) itemView.findViewById(R.id.svga1); + svga2 = (SVGAImageView) itemView.findViewById(R.id.svga2); + svga3 = (SVGAImageView) itemView.findViewById(R.id.svga3); // mDataGroup2 = itemView.findViewById(R.id.data_group_2); // mDataGroup3 = itemView.findViewById(R.id.data_group_3); @@ -260,7 +271,7 @@ public class MainListAdapter extends RefreshAdapter { ListBean bean = mTopList.get(0); svga1.setVisibility(View.GONE); - if (bean.getDress_head()!= null) { + if (bean.getDress_head() != null) { if (bean.getDress_head().contains("svga")) { svga1.setVisibility(View.VISIBLE); @@ -289,7 +300,7 @@ public class MainListAdapter extends RefreshAdapter { if (payload == null) { mItem1.setTag(bean); mItem1.setVisibility(View.VISIBLE); - ImgLoader.display(mContext,bean.getAvatarThumb(), mAvatar1); + ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar1); mName1.setText(bean.getUserNiceName()); mVotes1.setText(bean.getTotalCoinFormat()); mSex1.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); @@ -300,14 +311,14 @@ public class MainListAdapter extends RefreshAdapter { levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); } if (levelBean != null) { - ImgLoader.display(mContext,levelBean.getThumb(), mLevel1); + ImgLoader.display(mContext, levelBean.getThumb(), mLevel1); } } mBtnFollow1.setTag(bean); liveing1.setVisibility(View.INVISIBLE); - if(bean.getIslive() == 1){ + if (bean.getIslive() == 1) { liveing1.setVisibility(View.VISIBLE); - }else{ + } else { liveing1.setVisibility(View.INVISIBLE); } if (bean.getAttention() == 1) { @@ -326,7 +337,7 @@ public class MainListAdapter extends RefreshAdapter { ListBean bean = mTopList.get(1); svga2.setVisibility(View.GONE); - if (bean.getDress_head()!= null) { + if (bean.getDress_head() != null) { if (bean.getDress_head().contains("svga")) { svga2.setVisibility(View.VISIBLE); @@ -355,9 +366,9 @@ public class MainListAdapter extends RefreshAdapter { if (payload == null) { mItem2.setVisibility(View.VISIBLE); mItem2.setTag(bean); - ImgLoader.display(mContext,bean.getAvatarThumb(), mAvatar2); + ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar2); mName2.setText(bean.getUserNiceName()); - mVotes2.setText(bean.getTotalCoinFormat() + " " ); + mVotes2.setText(bean.getTotalCoinFormat() + " "); mSex2.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); LevelBean levelBean = null; if (mType == TYPE_PROFIT) { @@ -366,14 +377,14 @@ public class MainListAdapter extends RefreshAdapter { levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); } if (levelBean != null) { - ImgLoader.display(mContext,levelBean.getThumb(), mLevel2); + ImgLoader.display(mContext, levelBean.getThumb(), mLevel2); } } mBtnFollow2.setTag(bean); liveing2.setVisibility(View.INVISIBLE); - if(bean.getIslive() == 1){ + if (bean.getIslive() == 1) { liveing2.setVisibility(View.VISIBLE); - }else{ + } else { liveing2.setVisibility(View.INVISIBLE); } if (bean.getAttention() == 1) { @@ -404,7 +415,7 @@ public class MainListAdapter extends RefreshAdapter { if (topSize > 2) { ListBean bean = mTopList.get(2); - if (bean.getDress_head()!= null) { + if (bean.getDress_head() != null) { svga3.setVisibility(View.GONE); if (bean.getDress_head().contains("svga")) { svga3.setVisibility(View.VISIBLE); @@ -434,9 +445,9 @@ public class MainListAdapter extends RefreshAdapter { if (payload == null) { mItem3.setVisibility(View.VISIBLE); mItem3.setTag(bean); - ImgLoader.display(mContext,bean.getAvatarThumb(), mAvatar3); + ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar3); mName3.setText(bean.getUserNiceName()); - mVotes3.setText(bean.getTotalCoinFormat() + " " ); + mVotes3.setText(bean.getTotalCoinFormat() + " "); mSex3.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); LevelBean levelBean = null; if (mType == TYPE_PROFIT) { @@ -445,14 +456,14 @@ public class MainListAdapter extends RefreshAdapter { levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); } if (levelBean != null) { - ImgLoader.display(mContext,levelBean.getThumb(), mLevel3); + ImgLoader.display(mContext, levelBean.getThumb(), mLevel3); } } mBtnFollow3.setTag(bean); liveing3.setVisibility(View.INVISIBLE); - if(bean.getIslive() == 1){ + if (bean.getIslive() == 1) { liveing3.setVisibility(View.VISIBLE); - }else{ + } else { liveing3.setVisibility(View.INVISIBLE); } if (bean.getAttention() == 1) { @@ -513,7 +524,7 @@ public class MainListAdapter extends RefreshAdapter { void setData(ListBean bean, int position, Object payload) { if (payload == null) { svga.setVisibility(View.GONE); - if (bean.getDress_head()!= null) { + if (bean.getDress_head() != null) { if (bean.getDress_head().contains("svga")) { svga.setVisibility(View.VISIBLE); try { @@ -538,10 +549,10 @@ public class MainListAdapter extends RefreshAdapter { } } itemView.setTag(bean); - mOrder.setText(""+ (position + 4)); - ImgLoader.display(mContext,bean.getAvatarThumb(), mAvatar); + mOrder.setText("" + (position + 4)); + ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar); mName.setText(bean.getUserNiceName()); - mVotes.setText(bean.getTotalCoinFormat() + " " ); + mVotes.setText(bean.getTotalCoinFormat() + " "); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); LevelBean levelBean = null; if (mType == TYPE_PROFIT) { @@ -550,13 +561,13 @@ public class MainListAdapter extends RefreshAdapter { levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); } if (levelBean != null) { - ImgLoader.display(mContext,levelBean.getThumb(), mLevel); + ImgLoader.display(mContext, levelBean.getThumb(), mLevel); } } liveing.setVisibility(View.INVISIBLE); - if(bean.getIslive() == 1){ + if (bean.getIslive() == 1) { liveing.setVisibility(View.VISIBLE); - }else{ + } else { liveing.setVisibility(View.INVISIBLE); } mBtnFollow.setTag(position); diff --git a/main/src/main/java/com/yunbao/main/adapter/SettingAdapter.java b/main/src/main/java/com/yunbao/main/adapter/SettingAdapter.java index d9bb1ac19..b3a2ce6ad 100644 --- a/main/src/main/java/com/yunbao/main/adapter/SettingAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/SettingAdapter.java @@ -2,18 +2,20 @@ package com.yunbao.main.adapter; import android.content.Context; import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + import com.yunbao.common.Constants; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.BuildConfig; import com.yunbao.main.R; import com.yunbao.main.bean.SettingBean; -import com.yunbao.common.interfaces.OnItemClickListener; import java.util.List; @@ -42,14 +44,17 @@ public class SettingAdapter extends RecyclerView.Adapter { mOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { - Object tag = v.getTag(); - if (tag != null) { - int position = (int) tag; - SettingBean bean = mList.get(position); - if (mOnItemClickListener != null) { - mOnItemClickListener.onItemClick(bean, position); + ViewClicksAntiShake.clicksAntiShake(v, () -> { + Object tag = v.getTag(); + if (tag != null) { + int position = (int) tag; + SettingBean bean = mList.get(position); + if (mOnItemClickListener != null) { + mOnItemClickListener.onItemClick(bean, position); + } } - } + }); + } }; } @@ -134,7 +139,7 @@ public class SettingAdapter extends RecyclerView.Adapter { mName.setText(bean.getName()); if (bean.getId() == Constants.SETTING_CLEAR_CACHE) { mText.setText(mCacheString); - }else if(bean.getId() == 19){ + } else if (bean.getId() == 19) { mText.setText(BuildConfig.VERSION_NAME); mText.setTextColor(Color.parseColor("#969696")); } else { diff --git a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java index 24728e2ec..c6b14e4a0 100644 --- a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java +++ b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java @@ -17,6 +17,7 @@ import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.InstructorRemarkManager; import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.activity.PDLIiveChatActivity; import com.yunbao.live.activity.PDLiveConversationActivity; import com.yunbao.live.bean.SearchUserBean; @@ -245,7 +246,7 @@ public class ConversationIMListManager { */ @Override public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) { - jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId()); + ViewClicksAntiShake.clicksAntiShake(view, () -> jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId())); return true; } }; diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index f8d9ad567..62b432047 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -451,38 +451,33 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi @Override public void onClick(View v) { - int i = v.getId(); - if (i == R.id.lt_name) { - mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); - } else if (i == R.id.signature) { - mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); - } -// else if (i == R.id.btn_follow) { -// forwardFollow(); -// } -// else if (i == R.id.btn_fans) { -// forwardFans(); -// } else if (i == R.id.btn_msg) { -// ChatActivity.forward(mContext); -// } - else if (i == R.id.lt_star_coin) { - mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1)); - } else if (i == R.id.btn_coin) { - mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 0)); - } else if (i == R.id.btn_gold) { - // mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 2)); - String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index"; - RewardActivity.forward(mContext, url); - } else if (i == R.id.rt_kefu) { - WebViewActivity.forward(mContext, beanKefu.getHref()); - } else if (i == R.id.rt_setting) { - forwardSetting(); - } else if (i == R.id.lt_noble) { - Constants.isTitle = true; - UserBean u = CommonAppConfig.getInstance().getUserBean(); - String url = CommonAppConfig.HOST + "/h5/Nobility.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid(); - ZhuangBanActivity.forward(mContext, url, false); - } + ViewClicksAntiShake.clicksAntiShake(v, () -> { + int i = v.getId(); + if (i == R.id.lt_name) { + mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); + } else if (i == R.id.signature) { + mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); + } + else if (i == R.id.lt_star_coin) { + mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1)); + } else if (i == R.id.btn_coin) { + mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 0)); + } else if (i == R.id.btn_gold) { + // mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 2)); + String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index"; + RewardActivity.forward(mContext, url); + } else if (i == R.id.rt_kefu) { + WebViewActivity.forward(mContext, beanKefu.getHref()); + } else if (i == R.id.rt_setting) { + forwardSetting(); + } else if (i == R.id.lt_noble) { + Constants.isTitle = true; + UserBean u = CommonAppConfig.getInstance().getUserBean(); + String url = CommonAppConfig.HOST + "/h5/Nobility.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid(); + ZhuangBanActivity.forward(mContext, url, false); + } + }); + }