防抖,主播私聊修复

This commit is contained in:
18401019693 2022-08-15 09:19:11 +08:00
parent 892aaab6c0
commit a453a526fa
6 changed files with 130 additions and 111 deletions

View File

@ -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",

View File

@ -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() {

View File

@ -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<ListBean> {
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<ListBean> {
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> {
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<ListBean> {
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<ListBean> {
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> {
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<ListBean> {
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<ListBean> {
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<ListBean> {
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<ListBean> {
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<ListBean> {
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<ListBean> {
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<ListBean> {
}
}
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<ListBean> {
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);

View File

@ -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 {

View File

@ -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;
}
};

View File

@ -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);
}
});
}