修复首页排行榜需要点击两次才能关注的问题

修复首页排行榜top3点击直播进个人中心问题
This commit is contained in:
zlzw 2022-11-18 14:38:54 +08:00
parent e0a2f7c798
commit c99d139940
2 changed files with 37 additions and 13 deletions

View File

@ -27,7 +27,6 @@ import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.main.R;
import com.yunbao.main.bean.ListBean;
@ -61,7 +60,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
mTopList = new ArrayList<>();
mFollow = (WordUtil.getString(R.string.follow));
mFollowing = WordUtil.getString(R.string.following);
mItemClickListener = v -> ViewClicksAntiShake.clicksAntiShake(v, () -> {
mItemClickListener = v -> {
Object tag = v.getTag();
if (tag != null && mOnItemClickListener != null) {
ListBean model = (ListBean) tag;
@ -72,8 +71,8 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
}
}
});
mFollowClickListener2 = v -> ViewClicksAntiShake.clicksAntiShake(v, () -> {
};
mFollowClickListener2 = v -> {
if (!canClick()) {
return;
}
@ -90,7 +89,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
}
});
}
});
};
}

View File

@ -36,12 +36,10 @@ import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil;
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.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R;
import com.yunbao.main.activity.LoginActivity;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.adapter.MainListAdapter;
import com.yunbao.main.bean.ListBean;
@ -140,7 +138,9 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
mAdapter.updateItem(touid, isAttention);
}
}
private LiveRoomCheckLivePresenter mCheckLivePresenter;
@Override
public void onItemClick(ListBean bean, int position) {
if (bean.getIslive() == 1) {
@ -362,13 +362,38 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
});
});
getItem(position, mItem1, mItem2, mItem3).setOnClickListener(v -> {
ViewClicksAntiShake.clicksAntiShake(v, () -> {
if (bean.isHide()) {
ToastUtil.show(R.string.can_not_go);
} else {
RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
if (bean.getIslive() == 1) {
LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (mCheckLivePresenter == null) {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) {
return;
}
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
NoviceInstructorManager.get(mContext).setFrist(false);
}
});
}
mCheckLivePresenter.checkLive(liveBean);
} else {
MainActivity.forward(mContext, false);
}
}
});
} else {
RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
}
}
});
}