diff --git a/common/src/main/java/com/yunbao/common/adapter/UserCommunityAdapter.java b/common/src/main/java/com/yunbao/common/adapter/UserCommunityAdapter.java index 465885796..70ef56e51 100644 --- a/common/src/main/java/com/yunbao/common/adapter/UserCommunityAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/UserCommunityAdapter.java @@ -17,6 +17,7 @@ import com.alibaba.fastjson.JSONObject; import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.R; import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.ActiveBean; import com.yunbao.common.bean.ActiveOtherBean; import com.yunbao.common.dialog.ImagePreviewDialog; import com.yunbao.common.glide.ImgLoader; @@ -27,7 +28,7 @@ import java.util.ArrayList; import java.util.List; public class UserCommunityAdapter extends RecyclerView.Adapter { - private List commentBeanList; + private List commentBeanList; private Context mContext; private onItemClickListener onItemClickListener; private boolean isMe; @@ -36,7 +37,7 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { this.onItemClickListener = onItemClickListener; } - public UserCommunityAdapter(Context content, List commentBeanList, boolean isMe) { + public UserCommunityAdapter(Context content, List commentBeanList, boolean isMe) { this.mContext = content; this.commentBeanList = commentBeanList; this.isMe = isMe; @@ -90,7 +91,7 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { @Override public void onClick(View v) { if (onItemClickListener != null) { - onItemClickListener.onItemMore((ActiveOtherBean) v.getTag(), getPosition()); + onItemClickListener.onItemMore((ActiveBean) v.getTag(), getPosition()); } } }); @@ -98,19 +99,26 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { @Override public void onClick(View v) { if (onItemClickListener != null) { - onItemClickListener.onImgItem((ActiveOtherBean) v.getTag(), getPosition()); + ActiveBean activeOtherBean = (ActiveBean) v.getTag(); + if (activeOtherBean.getImg_or_video().equals("1")) { + onItemClickListener.onImgItem(activeOtherBean, getPosition()); + } else { + onItemClickListener.onItemVideo(activeOtherBean, getPosition()); + } } } }); } @SuppressLint("SetTextI18n") - public void setData(ActiveOtherBean bean) { + public void setData(ActiveBean bean) { itemView.setTag(bean); mAvatar.setTag(bean); more_del.setTag(bean); if (isMe) { more_del.setVisibility(View.VISIBLE); + } else { + more_del.setVisibility(View.INVISIBLE); } ImgLoader.display(mContext, bean.getUser_avatar(), mAvatar); userName.setText(bean.getUser_name()); @@ -161,8 +169,10 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { } public interface onItemClickListener { - void onImgItem(ActiveOtherBean activeBean, int position); + void onImgItem(ActiveBean activeBean, int position); - void onItemMore(ActiveOtherBean activeBean, int position); + void onItemMore(ActiveBean activeBean, int position); + + void onItemVideo(ActiveBean activeBean, int position); } } diff --git a/common/src/main/res/layout/activity_user_community_item.xml b/common/src/main/res/layout/activity_user_community_item.xml index 330a6eed8..0c22f04af 100644 --- a/common/src/main/res/layout/activity_user_community_item.xml +++ b/common/src/main/res/layout/activity_user_community_item.xml @@ -19,6 +19,7 @@ android:id="@+id/avatar" android:layout_width="40dp" android:layout_height="40dp" + android:scaleType="centerCrop" android:src="@mipmap/icon_data_empty" app:riv_oval="true" /> @@ -55,7 +56,7 @@ android:layout_height="30dp" android:padding="4dp" android:src="@mipmap/icon_active_more" - android:visibility="invisible" /> + android:visibility="visible" /> diff --git a/common/src/main/res/layout/activity_user_home.xml b/common/src/main/res/layout/activity_user_home.xml index 27c6f6344..4004f148f 100644 --- a/common/src/main/res/layout/activity_user_home.xml +++ b/common/src/main/res/layout/activity_user_home.xml @@ -800,7 +800,8 @@ android:id="@+id/setting" android:layout_width="30dp" android:layout_height="30dp" - android:src="@mipmap/icon_right_gray" /> + android:src="@mipmap/icon_right_gray" + android:visibility="invisible" /> diff --git a/common/src/main/res/layout/adapter_item_tag.xml b/common/src/main/res/layout/adapter_item_tag.xml index 716856e6f..a276246d3 100644 --- a/common/src/main/res/layout/adapter_item_tag.xml +++ b/common/src/main/res/layout/adapter_item_tag.xml @@ -15,7 +15,7 @@ android:paddingEnd="15dp" android:paddingBottom="5dp" android:text="标签" - android:textColor="@color/black2" + android:textColor="#C38764" android:textSize="11dp" /> 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 59a832330..a9acf35bc 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -519,12 +519,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //选中监听 mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> { - if (index == 0) { - floatBanner.setVisibility(View.GONE); - floatRedPacket.setVisibility(View.GONE); - floatWarOrder.setVisibility(View.GONE); - findViewById(R.id.banner_click).setVisibility(View.GONE); - isfloatBannernet = false; + if (index == 1) { + isfloatBannernet = true; + initAnchorRecommendBanner(); } else if (index == 2) { floatBanner.setVisibility(View.GONE); floatRedPacket.setVisibility(View.GONE); @@ -533,8 +530,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene isfloatBannernet = false; if (mainMessageViewHolder != null) mainMessageViewHolder.onResume(); } else { - 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; } }); //获取指导员账号 @@ -545,20 +545,19 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } private void showFirstLogin() { - LiveNetManager.get(mContext) - .isFirstLogin(new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(FirstLoginBean data) { - if (data.getStatus() == 0) { - mContext.startActivity(new Intent(mContext, CompleteUserInfoActivity.class)); - } - } + LiveNetManager.get(mContext).isFirstLogin(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(FirstLoginBean data) { + if (data.getStatus() == 0) { + mContext.startActivity(new Intent(mContext, CompleteUserInfoActivity.class)); + } + } - @Override - public void onError(String error) { + @Override + public void onError(String error) { - } - }); + } + }); } /** 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 8070f6ed0..db1c41fab 100644 --- a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java @@ -71,6 +71,8 @@ import com.yunbao.common.views.UserHomeImgsViewHolder; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.dialog.GiftWallDialog; import com.yunbao.live.views.ShowBigPhoto; +import com.yunbao.video.activity.VideoPlayActivity; +import com.yunbao.video.utils.VideoStorge; import java.io.File; import java.util.ArrayList; @@ -152,7 +154,7 @@ public class UserHomeActivity extends AbsActivity { private LinearLayout bottomEditLayout; private UploadQnImpl mUploadStrategy; private List videoList = new ArrayList<>(); - List beanList = new ArrayList<>(); + List beanList = new ArrayList<>(); private UserHomeImgsViewHolder userHomeImgsViewHolder; private Map gotoRoomKey = new HashMap<>(); @@ -176,33 +178,27 @@ public class UserHomeActivity extends AbsActivity { } initView(); getUseData(); - getCommunityList(); } private void getCommunityList() { CommonHttpUtil.getOtherDynamicList(uid, new com.yunbao.common.http.HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class); + beanList = JSONArray.parseArray(Arrays.toString(info), ActiveBean.class); + for (int j = 0; j < beanList.size(); j++) { + if (beanList.get(j).getImg_or_video().equals("2")) { + videoList.add(beanList.get(j)); + } + } UserCommunityAdapter userCommunityAdapter = new UserCommunityAdapter(mContext, beanList, isMe); userCommunityAdapter.setOnItemClickListener(new UserCommunityAdapter.onItemClickListener() { @Override - public void onImgItem(ActiveOtherBean bean, int position) { - if (bean.getImg_or_video().equals("1")) { - RouteUtil.forwardCommunity(bean.getId()); - } else { - /*int playPosition = 0; - for (int i = 0; i < videoList.size(); i++) { - if (videoList.get(i).getId().equals(bean.getId())) { - playPosition = i; - } - } - RouteUtil.forwardVideoActivity();*/ - } + public void onImgItem(ActiveBean bean, int position) { + RouteUtil.forwardCommunity(bean.getId()); } @Override - public void onItemMore(ActiveOtherBean bean, int position) { + public void onItemMore(ActiveBean bean, int position) { DialogUitl.showSimpleDialog(mContext, getResources().getString(com.yunbao.main.R.string.msg_del_sure), false, new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { @@ -218,6 +214,18 @@ public class UserHomeActivity extends AbsActivity { } }); } + + @Override + public void onItemVideo(ActiveBean activeBean, int position) { + int playPosition = 0; + for (int i = 0; i < videoList.size(); i++) { + if (videoList.get(i).getId().equals(activeBean.getId())) { + playPosition = i; + } + } + VideoStorge.getInstance().put(Constants.VIDEO_HOME, videoList); + VideoPlayActivity.forward(mContext, playPosition, Constants.VIDEO_HOME, 1); + } }); communityRecyclerView.setAdapter(userCommunityAdapter); } @@ -240,6 +248,7 @@ public class UserHomeActivity extends AbsActivity { likeCount.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_love_num()));//关注数量 if (isMe) { + findViewById(R.id.setting).setVisibility(View.VISIBLE); bottomEditLayout.setVisibility(View.VISIBLE); imgUp.setVisibility(View.VISIBLE); imgLabel.setVisibility(View.VISIBLE); @@ -437,6 +446,7 @@ public class UserHomeActivity extends AbsActivity { } }); mBanner.start(); + getCommunityList(); } private void initView() { 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 7a44eae3b..81c34e02c 100644 --- a/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java +++ b/video/src/main/java/com/yunbao/video/views/VideoPlayWrapViewHolder.java @@ -144,7 +144,7 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli public void onClick(View v) { SparseArray array = new SparseArray<>(); array.append(0, mContext.getResources().getString(com.yunbao.common.R.string.report)); - array.append(1, "不感兴趣"); + array.append(1, mContext.getResources().getString(com.yunbao.common.R.string.not_interested)); DialogUitl.showStringArrayDialog(mContext, array, new DialogUitl.StringArrayDialogCallback() { @Override public void onItemClick(String text, int tag) { @@ -441,6 +441,7 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli } String isLike = mVideoBean.getIs_love().equals("1") ? "0" : "1"; mVideoBean.setIs_love(isLike); + mLikeNum.setText(String.valueOf(mVideoBean.getLove_num())); EventBus.getDefault().post(new VideoLikeEvent(mVideoBean.getId(), Integer.parseInt(mVideoBean.getIs_love()), mVideoBean.getLove_num())); if (mVideoBean.getIs_love().equals("1")) { mBtnLike.setImageResource(R.mipmap.icon_video_zan_new02);