diff --git a/main/src/main/java/com/yunbao/main/adapter/MainHomeComAdapter2.java b/main/src/main/java/com/yunbao/main/adapter/MainHomeComAdapter2.java index c13474eef..84ad73bcc 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainHomeComAdapter2.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainHomeComAdapter2.java @@ -156,29 +156,29 @@ public class MainHomeComAdapter2 extends RefreshAdapter { attentionImg.setImageResource(R.mipmap.ic_yola_attention); } - likeImg.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - CommonHttpUtil.dynamicLove(bean.getId(), new HttpCallback() { - @SuppressLint("SetTextI18n") - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - ToastUtil.show(msg); - if (bean.getIs_love().equals("1")) { - bean.setIs_love("0"); - msgText.setText(String.valueOf(Integer.parseInt(bean.getComment_num()) - 1)); - bean.setLove_num(String.valueOf(Integer.parseInt(bean.getLove_num()) + 1)); - } else { - msgText.setText(String.valueOf(Integer.parseInt(bean.getComment_num()) + 1)); - bean.setLove_num(String.valueOf(Integer.parseInt(bean.getLove_num()) + 1)); - bean.setIs_love("1"); - } - } - } - }); - } - }); +// likeImg.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// CommonHttpUtil.dynamicLove(bean.getId(), new HttpCallback() { +// @SuppressLint("SetTextI18n") +// @Override +// public void onSuccess(int code, String msg, String[] info) { +// if (code == 0) { +// ToastUtil.show(msg); +// if (bean.getIs_love().equals("1")) { +// bean.setIs_love("0"); +// msgText.setText(String.valueOf(Integer.parseInt(bean.getComment_num()) - 1)); +// bean.setLove_num(String.valueOf(Integer.parseInt(bean.getLove_num()) + 1)); +// } else { +// msgText.setText(String.valueOf(Integer.parseInt(bean.getComment_num()) + 1)); +// bean.setLove_num(String.valueOf(Integer.parseInt(bean.getLove_num()) + 1)); +// bean.setIs_love("1"); +// } +// } +// } +// }); +// } +// }); attentionImg.setOnClickListener(new View.OnClickListener() { @Override @@ -198,28 +198,28 @@ public class MainHomeComAdapter2 extends RefreshAdapter { }); } }); - shareImg.setOnClickListener(new View.OnClickListener(){ - @Override - public void onClick(View v) { - String image = null; - if (bean.getImg_or_video().equals("1")) { - JSONArray jsonArray = (JSONArray) JSONArray.parse(bean.getImg_json()); - if (!jsonArray.isEmpty()) { - image = jsonArray.getString(0); - } - } else { - image = bean.getVideo() + "?vframe/jpg/offset/0"; - } - new SharePopDialog(mContext).setShareType(SharePopDialog.TYPE_DYNAMIC) - .setShareData(ShareBean.ShareBuilder.create() - .setShareType(SharePopDialog.TYPE_DYNAMIC) - .setUid(CommonAppConfig.getInstance().getUid()) - .setCover(StringUtil.isEmpty(image) ? bean.getUser_avatar() : image) - .setTitle(StringUtil.isEmpty(bean.getContent()) ? bean.getUser_name() : JSONObject.parseObject(bean.getContent()).getString("msg")) - .setAnchorId(bean.getUser_id()).setAnchorName(bean.getUser_name()).setAnchorAvatar(bean.getUser_avatar()). - setExtraData(bean.getId()).build()).showDialog(); - } - }); +// shareImg.setOnClickListener(new View.OnClickListener(){ +// @Override +// public void onClick(View v) { +// String image = null; +// if (bean.getImg_or_video().equals("1")) { +// JSONArray jsonArray = (JSONArray) JSONArray.parse(bean.getImg_json()); +// if (!jsonArray.isEmpty()) { +// image = jsonArray.getString(0); +// } +// } else { +// image = bean.getVideo() + "?vframe/jpg/offset/0"; +// } +// new SharePopDialog(mContext).setShareType(SharePopDialog.TYPE_DYNAMIC) +// .setShareData(ShareBean.ShareBuilder.create() +// .setShareType(SharePopDialog.TYPE_DYNAMIC) +// .setUid(CommonAppConfig.getInstance().getUid()) +// .setCover(StringUtil.isEmpty(image) ? bean.getUser_avatar() : image) +// .setTitle(StringUtil.isEmpty(bean.getContent()) ? bean.getUser_name() : JSONObject.parseObject(bean.getContent()).getString("msg")) +// .setAnchorId(bean.getUser_id()).setAnchorName(bean.getUser_name()).setAnchorAvatar(bean.getUser_avatar()). +// setExtraData(bean.getId()).build()).showDialog(); +// } +// }); diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeFollComViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeFollComViewHolder.java index 1b300ba12..5cf128f52 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeFollComViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeFollComViewHolder.java @@ -4,18 +4,20 @@ import android.content.Context; import android.util.Log; import android.view.ViewGroup; +import androidx.recyclerview.widget.LinearLayoutManager; + import com.alibaba.fastjson.JSON; import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.ActiveBean; import com.yunbao.common.bean.AnchorRecommendModel; -import com.yunbao.common.custom.CommonRefreshWaterfallView; +import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.RouteUtil; import com.yunbao.main.R; -import com.yunbao.main.adapter.MainHomeComAdapter; +import com.yunbao.main.adapter.MainHomeComAdapter2; import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpUtil; import com.yunbao.video.activity.VideoPlayActivity; @@ -30,8 +32,8 @@ import java.util.Arrays; import java.util.List; public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener { - private CommonRefreshWaterfallView mRefreshView; - private MainHomeComAdapter mAdapter; + private CommonRefreshView mRefreshView; + private MainHomeComAdapter2 mAdapter; private List videoList = new ArrayList<>(); private List new_data; @@ -64,7 +66,7 @@ public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implem @Override public void init() { - mRefreshView = (CommonRefreshWaterfallView) findViewById(R.id.refreshView); + mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView); mRefreshView.setEmptyLayoutId(R.layout.view_no_data_foll_live); EventBus.getDefault().register(this); @@ -72,12 +74,13 @@ public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implem decoration.setOnlySetItemOffsetsButNoDraw(true); mRefreshView.setItemDecoration(decoration); */ + mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); mRefreshView.setRecyclerViewAdapter(mAdapter); - mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper() { + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { @Override public RefreshAdapter getAdapter() { if (mAdapter == null) { - mAdapter = new MainHomeComAdapter(mContext); + mAdapter = new MainHomeComAdapter2(mContext); mAdapter.setOnItemClickListener(MainHomeFollComViewHolder.this); } return mAdapter; diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeRecomComViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeRecomComViewHolder.java index 719af74ee..207d75385 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeRecomComViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeRecomComViewHolder.java @@ -4,18 +4,20 @@ import android.content.Context; import android.view.ViewGroup; +import androidx.recyclerview.widget.LinearLayoutManager; + import com.alibaba.fastjson.JSON; import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.ActiveBean; import com.yunbao.common.bean.AnchorRecommendModel; -import com.yunbao.common.custom.CommonRefreshWaterfallView; +import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.RouteUtil; import com.yunbao.main.R; -import com.yunbao.main.adapter.MainHomeComAdapter; +import com.yunbao.main.adapter.MainHomeComAdapter2; import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpUtil; import com.yunbao.video.activity.VideoPlayActivity; @@ -33,8 +35,8 @@ import java.util.List; * 社区-发现 */ public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener { - private CommonRefreshWaterfallView mRefreshView; - private MainHomeComAdapter mAdapter; + private CommonRefreshView mRefreshView; + private MainHomeComAdapter2 mAdapter; private List videoList = new ArrayList<>(); private List new_data = new ArrayList<>(); @@ -67,15 +69,16 @@ public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder imple @Override public void init() { - mRefreshView = (CommonRefreshWaterfallView) findViewById(R.id.refreshView); + mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView); mRefreshView.setEmptyLayoutId(R.layout.view_no_data_live); EventBus.getDefault().register(this); + mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); mRefreshView.setRecyclerViewAdapter(mAdapter); - mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper() { + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { @Override public RefreshAdapter getAdapter() { if (mAdapter == null) { - mAdapter = new MainHomeComAdapter(mContext); + mAdapter = new MainHomeComAdapter2(mContext); mAdapter.setOnItemClickListener(MainHomeRecomComViewHolder.this); } return mAdapter; diff --git a/main/src/main/res/layout/view_main_home_com_recom.xml b/main/src/main/res/layout/view_main_home_com_recom.xml index 24dfc2357..0485c628a 100644 --- a/main/src/main/res/layout/view_main_home_com_recom.xml +++ b/main/src/main/res/layout/view_main_home_com_recom.xml @@ -8,7 +8,7 @@ tools:ignore="MissingDefaultResource"> -