fix [关注按钮修复,直播状态跳转直播间,首页精彩直播位置展示问题,社区图片5张图片展示问题]

This commit is contained in:
hch 2024-03-27 16:58:01 +08:00
parent 79c691f5b2
commit 6b616a4ff8
6 changed files with 148 additions and 29 deletions

View File

@ -331,6 +331,7 @@ public class CommonHttpUtil {
callback.callback(isAttention);
}
}
ToastUtil.show(msg);
}
});
}

View File

@ -29,6 +29,7 @@ public class NineGridLayout extends FrameLayout {
private LayoutParams mLayoutParams00;
private LayoutParams mLayoutParams10;
private LayoutParams mLayoutParams11;
private LayoutParams mLayoutParams22;
private LayoutParams[] mLayoutParamsArray;
private OnClickListener mOnClickListener;
private List<?> mDataList;
@ -137,6 +138,68 @@ public class NineGridLayout extends FrameLayout {
mActionListener.displayImage(list.get(0), imageView0);
mActionListener.displayImage(list.get(1), imageView1);
}
} else if (dataSize == 5) {
RoundedImageView imageView0 = mViewList.get(0);
RoundedImageView imageView1 = mViewList.get(1);
RoundedImageView imageView2 = mViewList.get(2);
RoundedImageView imageView3 = mViewList.get(3);
RoundedImageView imageView4 = mViewList.get(4);
if (mLayoutParams10 == null) {
mLayoutParams10 = new LayoutParams(mWidth2, mWidth2);
}
if (mLayoutParams11 == null) {
mLayoutParams11 = new LayoutParams(mWidth2, mWidth2);
mLayoutParams11.leftMargin = mWidth2 + mDividerWidth;
}
if (imageView0.getLayoutParams() != mLayoutParams10) {
imageView0.setLayoutParams(mLayoutParams10);
}
if (imageView1.getLayoutParams() != mLayoutParams11) {
imageView1.setLayoutParams(mLayoutParams11);
}
if (imageView2.getLayoutParams() != mLayoutParams22) {
mLayoutParams22 = new LayoutParams(mWidth3, mWidth3);
mLayoutParams22.topMargin = mWidth2 + mDividerWidth;
imageView2.setLayoutParams(mLayoutParams22);
}
if (imageView3.getLayoutParams() != mLayoutParams22) {
mLayoutParams22 = new LayoutParams(mWidth3, mWidth3);
mLayoutParams22.topMargin = mWidth2 + mDividerWidth;
mLayoutParams22.leftMargin = mWidth3 + mDividerWidth;
imageView3.setLayoutParams(mLayoutParams22);
}
if (imageView4.getLayoutParams() != mLayoutParams22) {
mLayoutParams22 = new LayoutParams(mWidth3, mWidth3);
mLayoutParams22.topMargin = mWidth2 + mDividerWidth;
mLayoutParams22.leftMargin = mWidth3 + mWidth3 + mDividerWidth + mDividerWidth;
imageView4.setLayoutParams(mLayoutParams22);
}
setHeight(mWidth2 + mWidth3 + mDividerWidth);
if (imageView0.getVisibility() != VISIBLE) {
imageView0.setVisibility(VISIBLE);
}
if (imageView1.getVisibility() != VISIBLE) {
imageView1.setVisibility(VISIBLE);
}
if (imageView2.getVisibility() != VISIBLE) {
imageView2.setVisibility(VISIBLE);
}
if (imageView3.getVisibility() != VISIBLE) {
imageView3.setVisibility(VISIBLE);
}
if (imageView4.getVisibility() != VISIBLE) {
imageView4.setVisibility(VISIBLE);
}
if (mActionListener != null) {
mActionListener.displayImage(list.get(0), imageView0);
mActionListener.displayImage(list.get(1), imageView1);
mActionListener.displayImage(list.get(2), imageView2);
mActionListener.displayImage(list.get(3), imageView3);
mActionListener.displayImage(list.get(4), imageView4);
}
} else {
if (mLayoutParamsArray == null) {
mLayoutParamsArray = new LayoutParams[9];

View File

@ -28,14 +28,17 @@ import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.adapter.CommentAdapter;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.CommentBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.dialog.ImagePreviewDialog;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.OpenAdManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
@ -46,7 +49,9 @@ import com.yunbao.share.ui.SharePopDialog;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import pl.droidsonroids.gif.GifImageView;
@ -74,6 +79,7 @@ public class CommunityDetailsActivity extends AbsActivity {
private boolean isComment = false;
private RelativeLayout videoLayout;
private GifImageView liveStatus;
private Map<String, String> gotoRoomKey = new HashMap<>();
@Override
protected int getLayoutId() {
@ -216,6 +222,34 @@ public class CommunityDetailsActivity extends AbsActivity {
});
}
});
liveStatus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LiveHttpUtil.getLiveInfo(activeBean.getUser_id(), new com.yunbao.common.http.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 (liveBean == null) {
return;
}
liveBean.setParams(gotoRoomKey);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
}
}
});
}
});
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View File

@ -341,13 +341,13 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
switch (position) {
case 0:
//点击埋点
MobclickAgent.onEvent(mContext, "home_page", "首页");
MobclickAgent.onEvent(mContext, "home_page", "社区");
if (mMainHomeCommunityViewHolder != null) {
mMainHomeCommunityViewHolder.onPauseVideo();
}
break;
case 1:
MobclickAgent.onEvent(mContext, "community", "社区");
MobclickAgent.onEvent(mContext, "community", "直播");
if (mMainHomeCommunityViewHolder != null) {
mMainHomeCommunityViewHolder.onResumePlay();
}
@ -519,10 +519,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
//选中监听
mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> {
if (index == 0) {
isfloatBannernet = true;
initAnchorRecommendBanner();
floatBanner.setVisibility(View.GONE);
floatRedPacket.setVisibility(View.GONE);
floatWarOrder.setVisibility(View.GONE);
findViewById(R.id.banner_click).setVisibility(View.GONE);
isfloatBannernet = false;
} else if (index == 2) {
floatBanner.setVisibility(View.GONE);
floatRedPacket.setVisibility(View.GONE);
@ -531,11 +533,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
isfloatBannernet = false;
if (mainMessageViewHolder != null) mainMessageViewHolder.onResume();
} else {
floatBanner.setVisibility(View.GONE);
floatRedPacket.setVisibility(View.GONE);
floatWarOrder.setVisibility(View.GONE);
findViewById(R.id.banner_click).setVisibility(View.GONE);
isfloatBannernet = false;
isfloatBannernet = true;
initAnchorRecommendBanner();
}
});
//获取指导员账号
@ -936,7 +935,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
//获取指导员引导逻辑
NoviceInstructorManager.get(mContext).getNoviceInstructor();
NoviceInstructorManager.get(mContext).checktHomeZdyPop();
initAnchorRecommendBanner();
//initAnchorRecommendBanner();
floatBanner.setVisibility(View.GONE);
floatRedPacket.setVisibility(View.GONE);
floatWarOrder.setVisibility(View.GONE);
findViewById(R.id.banner_click).setVisibility(View.GONE);
isfloatBannernet = false;
}
/**

View File

@ -27,6 +27,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
@ -46,10 +47,12 @@ import com.yunbao.common.bean.ActiveOtherBean;
import com.yunbao.common.bean.HomeUserExhibitInfoBean;
import com.yunbao.common.bean.HomeUserInfoBean;
import com.yunbao.common.bean.LabelBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.UserHomeImgBean;
import com.yunbao.common.dialog.ImagePreviewDialog;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.CommonCallback;
@ -59,6 +62,7 @@ import com.yunbao.common.upload.UploadQnImpl;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.FilesUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
@ -71,7 +75,9 @@ import com.yunbao.live.views.ShowBigPhoto;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import pl.droidsonroids.gif.GifImageView;
@ -147,8 +153,8 @@ public class UserHomeActivity extends AbsActivity {
private UploadQnImpl mUploadStrategy;
private List<ActiveBean> videoList = new ArrayList<>();
List<ActiveOtherBean> beanList = new ArrayList<>();
private UserHomeImgsViewHolder userHomeImgsViewHolder;
private Map<String, String> gotoRoomKey = new HashMap<>();
@Override
protected int getLayoutId() {
@ -542,6 +548,34 @@ public class UserHomeActivity extends AbsActivity {
});
}
});
liveStatus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LiveHttpUtil.getLiveInfo(uid, new com.yunbao.common.http.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 (liveBean == null) {
return;
}
liveBean.setParams(gotoRoomKey);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
}
}
});
}
});
moreLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View File

@ -263,9 +263,6 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
if (mVideoBean != null && mBtnFollow != null) {
String toUid = mVideoBean.getUser_id();
if (!TextUtils.isEmpty(toUid) && !toUid.equals(CommonAppConfig.getInstance().getUid())) {
if (mBtnFollow.getVisibility() != View.VISIBLE) {
mBtnFollow.setVisibility(View.VISIBLE);
}
if (bean.getIs_attention().equals("1")) {
mBtnFollow.setImageDrawable(mFollowDrawable);
} else {
@ -277,20 +274,6 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
}
}
}
if (!Constants.myUid.endsWith(bean.getUser_id())) {
if (bean.getIs_attention().equals("2")) {
mBtnFollow.setVisibility(View.VISIBLE);
if (bean.getIs_attention().equals("1")) {
mBtnFollow.setImageDrawable(mFollowDrawable);
} else {
mBtnFollow.setImageDrawable(mUnFollowDrawable);
}
} else {
mBtnFollow.setVisibility(View.GONE);
}
} else {
mBtnFollow.setVisibility(View.GONE);
}
if (!StringUtil.isEmpty(bean.getTalk_name())) {
List<String> tagList = new ArrayList<>();
tagList.add("#" + bean.getTalk_name());