热门条目ui调整完成

This commit is contained in:
ningwenqiang 2024-10-30 13:21:57 +08:00
parent ac1b8eeae5
commit ccc4802a23
4 changed files with 66 additions and 60 deletions

View File

@ -156,29 +156,29 @@ public class MainHomeComAdapter2 extends RefreshAdapter<ActiveBean> {
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<ActiveBean> {
});
}
});
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();
// }
// });

View File

@ -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<ActiveBean> {
private CommonRefreshWaterfallView mRefreshView;
private MainHomeComAdapter mAdapter;
private CommonRefreshView mRefreshView;
private MainHomeComAdapter2 mAdapter;
private List<ActiveBean> videoList = new ArrayList<>();
private List<ActiveBean> 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<ActiveBean>() {
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<ActiveBean>() {
@Override
public RefreshAdapter<ActiveBean> getAdapter() {
if (mAdapter == null) {
mAdapter = new MainHomeComAdapter(mContext);
mAdapter = new MainHomeComAdapter2(mContext);
mAdapter.setOnItemClickListener(MainHomeFollComViewHolder.this);
}
return mAdapter;

View File

@ -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<ActiveBean> {
private CommonRefreshWaterfallView mRefreshView;
private MainHomeComAdapter mAdapter;
private CommonRefreshView mRefreshView;
private MainHomeComAdapter2 mAdapter;
private List<ActiveBean> videoList = new ArrayList<>();
private List<ActiveBean> 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<ActiveBean>() {
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<ActiveBean>() {
@Override
public RefreshAdapter<ActiveBean> getAdapter() {
if (mAdapter == null) {
mAdapter = new MainHomeComAdapter(mContext);
mAdapter = new MainHomeComAdapter2(mContext);
mAdapter.setOnItemClickListener(MainHomeRecomComViewHolder.this);
}
return mAdapter;

View File

@ -8,7 +8,7 @@
tools:ignore="MissingDefaultResource">
<com.yunbao.common.custom.CommonRefreshWaterfallView
<com.yunbao.common.custom.CommonRefreshView
android:id="@+id/refreshView"
android:layout_width="match_parent"
android:layout_height="match_parent"