diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index a208324..edae671 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -331,6 +331,7 @@ public class CommonHttpUtil { callback.callback(isAttention); } } + ToastUtil.show(msg); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/NineGridLayout.java b/common/src/main/java/com/yunbao/common/views/NineGridLayout.java index b303cbc..54af3ee 100644 --- a/common/src/main/java/com/yunbao/common/views/NineGridLayout.java +++ b/common/src/main/java/com/yunbao/common/views/NineGridLayout.java @@ -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]; diff --git a/main/src/main/java/com/yunbao/main/activity/CommunityDetailsActivity.java b/main/src/main/java/com/yunbao/main/activity/CommunityDetailsActivity.java index d1c11ed..057524e 100644 --- a/main/src/main/java/com/yunbao/main/activity/CommunityDetailsActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CommunityDetailsActivity.java @@ -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 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) { 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 362e0af..59a8323 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -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; } /** diff --git a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java index 3763c11..8070f6e 100644 --- a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java @@ -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 videoList = new ArrayList<>(); List beanList = new ArrayList<>(); - private UserHomeImgsViewHolder userHomeImgsViewHolder; + private Map 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) { diff --git a/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java b/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java index 9fc4751..7a44eae 100644 --- a/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java +++ b/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java @@ -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 tagList = new ArrayList<>(); tagList.add("#" + bean.getTalk_name());