用户主页ui
This commit is contained in:
parent
aa1db981e8
commit
63669dbfa4
@ -74,6 +74,9 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustResize" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.UserHomeActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
package com.yunbao.common.activity;
|
package com.yunbao.common.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.util.SparseArray;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -25,6 +29,9 @@ import com.yunbao.common.http.CommonHttpUtil;
|
|||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.manager.OpenAdManager;
|
import com.yunbao.common.manager.OpenAdManager;
|
||||||
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.views.NineGridLayout;
|
import com.yunbao.common.views.NineGridLayout;
|
||||||
import com.yunbao.common.views.TopGradual;
|
import com.yunbao.common.views.TopGradual;
|
||||||
|
|
||||||
@ -49,6 +56,9 @@ public class CommunityDetailsActivity extends AbsActivity {
|
|||||||
private ImageView userAvatar;
|
private ImageView userAvatar;
|
||||||
private ImageView like;
|
private ImageView like;
|
||||||
private TextView replyCount;
|
private TextView replyCount;
|
||||||
|
private EditText comment;
|
||||||
|
private ImageView send;
|
||||||
|
private boolean isComment = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -76,6 +86,8 @@ public class CommunityDetailsActivity extends AbsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
|
send = findViewById(R.id.send);
|
||||||
|
comment = findViewById(R.id.comment);
|
||||||
replyCount = findViewById(R.id.replyCount);
|
replyCount = findViewById(R.id.replyCount);
|
||||||
like = findViewById(R.id.like);
|
like = findViewById(R.id.like);
|
||||||
userAvatar = findViewById(R.id.userAvatar);
|
userAvatar = findViewById(R.id.userAvatar);
|
||||||
@ -128,21 +140,76 @@ public class CommunityDetailsActivity extends AbsActivity {
|
|||||||
like.setOnClickListener(new View.OnClickListener() {
|
like.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (activeBean.getIs_love().equals("1")) {
|
CommonHttpUtil.dynamicLove(activeBean.getId(), new HttpCallback() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
} else {
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
}
|
if (code == 0) {
|
||||||
|
ToastUtil.show(msg);
|
||||||
|
if (activeBean.getIs_love().equals("1")) {
|
||||||
|
activeBean.setIs_love("0");
|
||||||
|
ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like01, like);
|
||||||
|
likeCount.setText(Integer.parseInt(activeBean.getLove_num()) - 1 + "人觉得很赞");
|
||||||
|
} else {
|
||||||
|
activeBean.setIs_love("1");
|
||||||
|
ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like, like);
|
||||||
|
likeCount.setText(Integer.parseInt(activeBean.getLove_num()) + 1 + "人觉得很赞");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
findViewById(R.id.setting).setOnClickListener(new View.OnClickListener() {
|
findViewById(R.id.setting).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
SparseArray<String> array = new SparseArray<>();
|
||||||
|
array.append(0, "举报");
|
||||||
|
array.append(1, "不感兴趣");
|
||||||
|
DialogUitl.showStringArrayDialog(CommunityDetailsActivity.this, array, new DialogUitl.StringArrayDialogCallback() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(String text, int tag) {
|
||||||
|
if (tag == 0) {
|
||||||
|
RouteUtil.forwardCommentReportActivity(activeBean.getId(), activeBean.getId());
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
send.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
CommonHttpUtil.dynamicReply(activeBean.getId(), isComment ? replyComment.getId() : "0", comment.getText().toString(), new HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
comment.setText("");
|
||||||
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.showSoftInput(comment, InputMethodManager.SHOW_FORCED);
|
||||||
|
imm.hideSoftInputFromWindow(comment.getWindowToken(), 0); //强制隐藏键盘
|
||||||
|
getReply();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
comment.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
isComment = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
findViewById(R.id.userLayout).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
UserHomeActivity.forwardUserHomeActivity(CommunityDetailsActivity.this, activeBean.getUser_id());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//回复评论
|
||||||
|
CommentBean replyComment;
|
||||||
|
|
||||||
private void getReply() {
|
private void getReply() {
|
||||||
CommonHttpUtil.getCommunityComment(activeBean.getId(), activeBean.getUser_id(), new HttpCallback() {
|
CommonHttpUtil.getCommunityComment(activeBean.getId(), activeBean.getUser_id(), new HttpCallback() {
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@ -151,6 +218,22 @@ public class CommunityDetailsActivity extends AbsActivity {
|
|||||||
List<CommentBean> list = JSON.parseArray(Arrays.toString(info), CommentBean.class);
|
List<CommentBean> list = JSON.parseArray(Arrays.toString(info), CommentBean.class);
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
commentAdapter = new CommentAdapter(mContext, list);
|
commentAdapter = new CommentAdapter(mContext, list);
|
||||||
|
commentAdapter.setOnItemClickListener(new CommentAdapter.onItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onReply(CommentBean commentBean) {
|
||||||
|
replyComment = commentBean;
|
||||||
|
isComment = true;
|
||||||
|
comment.requestFocus();
|
||||||
|
//键盘输入法管理器
|
||||||
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.showSoftInput(comment, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReport(CommentBean commentBean) {
|
||||||
|
RouteUtil.forwardCommentReportActivity(activeBean.getId(), commentBean.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
commentRecyclerView.setAdapter(commentAdapter);
|
commentRecyclerView.setAdapter(commentAdapter);
|
||||||
replyCount.setText("评论 " + list.size());
|
replyCount.setText("评论 " + list.size());
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,44 @@
|
|||||||
package com.yunbao.common.activity;
|
package com.yunbao.common.activity;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Outline;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewOutlineProvider;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.ms.banner.Banner;
|
||||||
|
import com.ms.banner.listener.OnBannerClickListener;
|
||||||
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.adapter.UserHomeImgAdapter;
|
||||||
|
import com.yunbao.common.bean.UserHomeImgBean;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.StringUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.views.TopGradual;
|
||||||
|
import com.yunbao.common.views.UserHomeImgsViewHolder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class UserHomeActivity extends AbsActivity {
|
public class UserHomeActivity extends AbsActivity {
|
||||||
|
String uid;
|
||||||
|
Banner mBanner;
|
||||||
|
RecyclerView imgsRecyclerView;
|
||||||
|
UserHomeImgAdapter userHomeImgAdapter;
|
||||||
|
|
||||||
View bodyLayout;
|
List<String> bannerImgList = new ArrayList<>();
|
||||||
|
List<UserHomeImgBean> tempList;
|
||||||
|
|
||||||
|
public static void forwardUserHomeActivity(Context content, String uid) {
|
||||||
|
Intent intent = new Intent(content, UserHomeActivity.class);
|
||||||
|
intent.putExtra(Constants.TO_UID, String.valueOf(97717));
|
||||||
|
content.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -21,6 +52,66 @@ public class UserHomeActivity extends AbsActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void main() {
|
protected void main() {
|
||||||
|
uid = getIntent().getStringExtra(Constants.TO_UID);
|
||||||
|
if (StringUtil.isEmpty(uid)) {
|
||||||
|
ToastUtil.show("用户不存在");
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
initView();
|
||||||
|
initUseData();
|
||||||
|
initUserImgs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
mBanner = (Banner) findViewById(R.id.banner);
|
||||||
|
imgsRecyclerView = findViewById(R.id.imgsRecyclerView);
|
||||||
|
imgsRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
||||||
|
imgsRecyclerView.addItemDecoration(new TopGradual());
|
||||||
|
imgsRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUserImgs() {
|
||||||
|
mBanner.setOutlineProvider(new ViewOutlineProvider() {
|
||||||
|
@Override
|
||||||
|
public void getOutline(View view, Outline outline) {
|
||||||
|
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
LiveNetManager.get(UserHomeActivity.this).getUserHomeBanner(uid, new HttpCallback<List<String>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<String> data) {
|
||||||
|
bannerImgList = data;
|
||||||
|
tempList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
tempList.add(new UserHomeImgBean(data.get(i)));
|
||||||
|
}
|
||||||
|
tempList.get(0).setShow(true);
|
||||||
|
userHomeImgAdapter = new UserHomeImgAdapter(UserHomeActivity.this, tempList);
|
||||||
|
imgsRecyclerView.setAdapter(userHomeImgAdapter);
|
||||||
|
mBanner.setAutoPlay(false).setPages(bannerImgList, new UserHomeImgsViewHolder()).setOnBannerClickListener(new OnBannerClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onBannerClick(List datas, int position) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUseData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,11 +18,17 @@ import com.yunbao.common.bean.CommentBean;
|
|||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.views.TopGradual;
|
import com.yunbao.common.views.TopGradual;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CommentAdapter extends RecyclerView.Adapter {
|
public class CommentAdapter extends RecyclerView.Adapter {
|
||||||
private List<CommentBean> commentBeanList;
|
private List<CommentBean> commentBeanList;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
private onItemClickListener onItemClickListener;
|
||||||
|
|
||||||
|
public void setOnItemClickListener(CommentAdapter.onItemClickListener onItemClickListener) {
|
||||||
|
this.onItemClickListener = onItemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
public CommentAdapter(Context content, List<CommentBean> commentBeanList) {
|
public CommentAdapter(Context content, List<CommentBean> commentBeanList) {
|
||||||
this.mContext = content;
|
this.mContext = content;
|
||||||
@ -52,29 +58,53 @@ public class CommentAdapter extends RecyclerView.Adapter {
|
|||||||
private TextView name;
|
private TextView name;
|
||||||
private TextView content;
|
private TextView content;
|
||||||
private TextView report;
|
private TextView report;
|
||||||
|
private TextView replyTextView;
|
||||||
private RoundedImageView mAvatar01;
|
private RoundedImageView mAvatar01;
|
||||||
private RoundedImageView mAvatar02;
|
|
||||||
private TextView replyContent;
|
private TextView replyContent;
|
||||||
private TextView replyCount;
|
private TextView replyCount;
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
private LinearLayout replyLayout;
|
private LinearLayout replyLayout;
|
||||||
|
private TextView firstName;
|
||||||
|
private TextView isAuth;
|
||||||
|
|
||||||
public CommentViewHolder(@NonNull View itemView) {
|
public CommentViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
firstName = itemView.findViewById(R.id.firstName);
|
||||||
mAvatar = itemView.findViewById(R.id.avatar);
|
mAvatar = itemView.findViewById(R.id.avatar);
|
||||||
name = itemView.findViewById(R.id.name);
|
name = itemView.findViewById(R.id.name);
|
||||||
content = itemView.findViewById(R.id.content);
|
content = itemView.findViewById(R.id.content);
|
||||||
|
replyTextView = itemView.findViewById(R.id.replyTextView);
|
||||||
report = itemView.findViewById(R.id.report);
|
report = itemView.findViewById(R.id.report);
|
||||||
mAvatar01 = itemView.findViewById(R.id.avatar01);
|
mAvatar01 = itemView.findViewById(R.id.avatar01);
|
||||||
mAvatar02 = itemView.findViewById(R.id.avatar02);
|
isAuth = itemView.findViewById(R.id.isAuth);
|
||||||
replyContent = itemView.findViewById(R.id.replyContent);
|
replyContent = itemView.findViewById(R.id.replyContent);
|
||||||
replyCount = itemView.findViewById(R.id.expand);
|
replyCount = itemView.findViewById(R.id.expand);
|
||||||
replyLayout = itemView.findViewById(R.id.replyLayout);
|
replyLayout = itemView.findViewById(R.id.replyLayout);
|
||||||
recyclerView = itemView.findViewById(R.id.recyclerView);
|
recyclerView = itemView.findViewById(R.id.recyclerView);
|
||||||
|
report.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (onItemClickListener != null) {
|
||||||
|
CommentBean bean = (CommentBean) v.getTag();
|
||||||
|
onItemClickListener.onReport(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
replyTextView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (onItemClickListener != null) {
|
||||||
|
CommentBean bean = (CommentBean) v.getTag();
|
||||||
|
onItemClickListener.onReply(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public void setData(CommentBean bean) {
|
public void setData(CommentBean bean) {
|
||||||
|
report.setTag(bean);
|
||||||
|
replyTextView.setTag(bean);
|
||||||
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar);
|
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar);
|
||||||
name.setText(bean.getUser_name());
|
name.setText(bean.getUser_name());
|
||||||
content.setText(bean.getContent());
|
content.setText(bean.getContent());
|
||||||
@ -83,35 +113,45 @@ public class CommentAdapter extends RecyclerView.Adapter {
|
|||||||
if (bean.getReplyCommentList().size() > 0) {
|
if (bean.getReplyCommentList().size() > 0) {
|
||||||
replyContent.setText(bean.getReplyCommentList().get(0).getContent());
|
replyContent.setText(bean.getReplyCommentList().get(0).getContent());
|
||||||
ImgLoader.display(itemView.getContext(), bean.getReplyCommentList().get(0).getUser_avatar(), mAvatar01);
|
ImgLoader.display(itemView.getContext(), bean.getReplyCommentList().get(0).getUser_avatar(), mAvatar01);
|
||||||
ImgLoader.display(itemView.getContext(), bean.getReplyCommentList().get(0).getUser_avatar(), mAvatar02);
|
firstName.setText(bean.getReplyCommentList().get(0).getUser_name());
|
||||||
replyLayout.setVisibility(View.VISIBLE);
|
|
||||||
} else if (bean.getReplyCommentList().size() > 1) {
|
|
||||||
replyCount.setVisibility(View.VISIBLE);
|
|
||||||
replyLayout.setVisibility(View.VISIBLE);
|
replyLayout.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
replyLayout.setVisibility(View.GONE);
|
replyLayout.setVisibility(View.GONE);
|
||||||
replyCount.setVisibility(View.GONE);
|
replyCount.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
if (bean.getReplyCommentList().size() > 1) {
|
||||||
recyclerView.addItemDecoration(new TopGradual());
|
replyCount.setVisibility(View.VISIBLE);
|
||||||
CommentReplyAdapter commentReplyAdapter = new CommentReplyAdapter(mContext, bean.getReplyCommentList());
|
replyLayout.setVisibility(View.VISIBLE);
|
||||||
recyclerView.setAdapter(commentReplyAdapter);
|
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
recyclerView.addItemDecoration(new TopGradual());
|
||||||
replyCount.setOnClickListener(new View.OnClickListener() {
|
List<CommentBean.ReplyComment> tempList = new ArrayList<>();
|
||||||
@Override
|
tempList.addAll(bean.getReplyCommentList());
|
||||||
public void onClick(View v) {
|
tempList.remove(0);
|
||||||
if (!bean.isShow()) {
|
CommentReplyAdapter commentReplyAdapter = new CommentReplyAdapter(mContext, tempList);
|
||||||
recyclerView.setVisibility(View.VISIBLE);
|
recyclerView.setAdapter(commentReplyAdapter);
|
||||||
replyCount.setText("收起");
|
recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||||
} else {
|
replyCount.setOnClickListener(new View.OnClickListener() {
|
||||||
recyclerView.setVisibility(View.GONE);
|
@Override
|
||||||
replyCount.setText("共" + bean.getReplyCommentList().size() + "条回复>");
|
public void onClick(View v) {
|
||||||
|
if (!bean.isShow()) {
|
||||||
|
recyclerView.setVisibility(View.VISIBLE);
|
||||||
|
replyCount.setText("收起");
|
||||||
|
} else {
|
||||||
|
recyclerView.setVisibility(View.GONE);
|
||||||
|
replyCount.setText("共" + bean.getReplyCommentList().size() + "条回复>");
|
||||||
|
}
|
||||||
|
bean.setShow(!bean.isShow());
|
||||||
}
|
}
|
||||||
bean.setShow(!bean.isShow());
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface onItemClickListener {
|
||||||
|
void onReply(CommentBean activeBean);
|
||||||
|
|
||||||
|
void onReport(CommentBean activeBean);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,21 +47,18 @@ public class CommentReplyAdapter extends RecyclerView.Adapter {
|
|||||||
class CommentViewHolder extends RecyclerView.ViewHolder {
|
class CommentViewHolder extends RecyclerView.ViewHolder {
|
||||||
private TextView name;
|
private TextView name;
|
||||||
private RoundedImageView mAvatar01;
|
private RoundedImageView mAvatar01;
|
||||||
private RoundedImageView mAvatar02;
|
|
||||||
private TextView replyContent;
|
private TextView replyContent;
|
||||||
|
|
||||||
public CommentViewHolder(@NonNull View itemView) {
|
public CommentViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
name = itemView.findViewById(R.id.name);
|
name = itemView.findViewById(R.id.name);
|
||||||
mAvatar01 = itemView.findViewById(R.id.avatar01);
|
mAvatar01 = itemView.findViewById(R.id.avatar01);
|
||||||
mAvatar02 = itemView.findViewById(R.id.avatar02);
|
|
||||||
replyContent = itemView.findViewById(R.id.replyContent);
|
replyContent = itemView.findViewById(R.id.replyContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public void setData(CommentBean.ReplyComment bean) {
|
public void setData(CommentBean.ReplyComment bean) {
|
||||||
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar01);
|
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar01);
|
||||||
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar02);
|
|
||||||
name.setText(bean.getUser_name());
|
name.setText(bean.getUser_name());
|
||||||
replyContent.setText(bean.getContent());
|
replyContent.setText(bean.getContent());
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.yunbao.common.adapter;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.bean.UserHomeImgBean;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class UserHomeImgAdapter extends RecyclerView.Adapter {
|
||||||
|
private List<UserHomeImgBean> commentBeanList;
|
||||||
|
private Context mContext;
|
||||||
|
private onItemClickListener onItemClickListener;
|
||||||
|
|
||||||
|
public void setOnItemClickListener(UserHomeImgAdapter.onItemClickListener onItemClickListener) {
|
||||||
|
this.onItemClickListener = onItemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserHomeImgAdapter(Context content, List<UserHomeImgBean> commentBeanList) {
|
||||||
|
this.mContext = content;
|
||||||
|
this.commentBeanList = commentBeanList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_user_home_img, parent, false);
|
||||||
|
return new CommentViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
CommentViewHolder commentViewHolder = (CommentViewHolder) holder;
|
||||||
|
commentViewHolder.setData(commentBeanList.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return commentBeanList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CommentViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private RoundedImageView mAvatar;
|
||||||
|
|
||||||
|
public CommentViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
mAvatar = itemView.findViewById(R.id.avatar);
|
||||||
|
mAvatar.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
onItemClickListener.onImgItem((String) v.getTag());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
public void setData(UserHomeImgBean bean) {
|
||||||
|
mAvatar.setTag(bean);
|
||||||
|
ImgLoader.display(itemView.getContext(), bean.getImgurl(), mAvatar);
|
||||||
|
if (bean.isShow()) {
|
||||||
|
ViewGroup.LayoutParams viewGroup = mAvatar.getLayoutParams();
|
||||||
|
viewGroup.height = 200;
|
||||||
|
viewGroup.width = 200;
|
||||||
|
mAvatar.setLayoutParams(viewGroup);
|
||||||
|
} else {
|
||||||
|
ViewGroup.LayoutParams viewGroup = mAvatar.getLayoutParams();
|
||||||
|
viewGroup.height = 100;
|
||||||
|
viewGroup.width = 100;
|
||||||
|
mAvatar.setLayoutParams(viewGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface onItemClickListener {
|
||||||
|
void onImgItem(String activeBean);
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,15 @@ public class CommentBean extends BaseModel {
|
|||||||
private String user_id;
|
private String user_id;
|
||||||
private String user_avatar;
|
private String user_avatar;
|
||||||
private List<ReplyComment> child;
|
private List<ReplyComment> child;
|
||||||
|
|
||||||
|
public List<ReplyComment> getChild() {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChild(List<ReplyComment> child) {
|
||||||
|
this.child = child;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isShow;
|
private boolean isShow;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
public class NewCommunityType extends BaseModel {
|
||||||
|
private int id;
|
||||||
|
private String talk_name;
|
||||||
|
private String img;
|
||||||
|
private String is_hot;
|
||||||
|
private String hot_time;
|
||||||
|
private String sort;
|
||||||
|
|
||||||
|
public NewCommunityType() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NewCommunityType(int id, String talk_name, String img, String is_hot, String hot_time, String sort) {
|
||||||
|
this.id = id;
|
||||||
|
this.talk_name = talk_name;
|
||||||
|
this.img = img;
|
||||||
|
this.is_hot = is_hot;
|
||||||
|
this.hot_time = hot_time;
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTalk_name() {
|
||||||
|
return talk_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTalk_name(String talk_name) {
|
||||||
|
this.talk_name = talk_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(String img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIs_hot() {
|
||||||
|
return is_hot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_hot(String is_hot) {
|
||||||
|
this.is_hot = is_hot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHot_time() {
|
||||||
|
return hot_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHot_time(String hot_time) {
|
||||||
|
this.hot_time = hot_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(String sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社區动态
|
||||||
|
*/
|
||||||
|
public class UserHomeImgBean extends BaseModel {
|
||||||
|
private String imgurl;
|
||||||
|
private boolean isShow;
|
||||||
|
|
||||||
|
public UserHomeImgBean(String imgurl) {
|
||||||
|
this.imgurl = imgurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImgurl() {
|
||||||
|
return imgurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImgurl(String imgurl) {
|
||||||
|
this.imgurl = imgurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShow() {
|
||||||
|
return isShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShow(boolean show) {
|
||||||
|
isShow = show;
|
||||||
|
}
|
||||||
|
}
|
@ -551,6 +551,63 @@ public class CommonHttpUtil {
|
|||||||
.execute(callback);
|
.execute(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取动态列表-点赞
|
||||||
|
*
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
public static void dynamicLove(String dynamic_id, HttpCallback callback) {
|
||||||
|
HttpClient.getInstance().get("Pdlcommunity.dynamicLove", "Pdlcommunity.dynamicLove")
|
||||||
|
.params("dynamic_id", dynamic_id)
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取动态列表-回复
|
||||||
|
*
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
public static void dynamicReply(String dynamic_id, String to_comment_id, String content, HttpCallback callback) {
|
||||||
|
HttpClient.getInstance().get("Pdlcommunity.sendDynamicComment", "Pdlcommunity.sendDynamicComment")
|
||||||
|
.params("dynamic_id", dynamic_id)
|
||||||
|
.params("content", content)
|
||||||
|
.params("to_comment_id", to_comment_id)
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取动态-发现
|
||||||
|
*/
|
||||||
|
public static void getCommunityFind(int p, HttpCallback callback) {
|
||||||
|
HttpClient.getInstance().get("Pdlcommunity.getFindDynamicList", "Pdlcommunity.getFindDynamicList")
|
||||||
|
.params("p", p)
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取动态-关注
|
||||||
|
*/
|
||||||
|
public static void getCommunityFollow(int p, HttpCallback callback) {
|
||||||
|
HttpClient.getInstance().get("Pdlcommunity.getFindDynamicList", "Pdlcommunity.getFindDynamicList")
|
||||||
|
.params("p", p)
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取动态-分类
|
||||||
|
*/
|
||||||
|
public static void getTag(HttpCallback callback) {
|
||||||
|
HttpClient.getInstance().get("Pdlcommunity.getTalkBanner", "Pdlcommunity.getTalkBanner")
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void getTalkHotDynamicList(int talkId, int p, HttpCallback callback) {
|
||||||
|
HttpClient.getInstance().get("Pdlcommunity.getTalkHotDynamicList", "Pdlcommunity.getTalkHotDynamicList")
|
||||||
|
.params("talk_id", talkId)
|
||||||
|
.params("p", p)
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.yunbao.common.manager;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.yunbao.common.bean.FansModel;
|
||||||
|
import com.yunbao.common.bean.NewCommunityType;
|
||||||
|
import com.yunbao.common.bean.NewLevelModel;
|
||||||
|
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态类别管理
|
||||||
|
*/
|
||||||
|
public class CommunityTypeManager extends BaseCacheManager {
|
||||||
|
|
||||||
|
private final String KEY_COMMUNITY_TYPE = "keyCommunityType";
|
||||||
|
private List<NewCommunityType> newCommunityTypeList = new ArrayList<>();
|
||||||
|
|
||||||
|
public CommunityTypeManager(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NewCommunityType> getCommunityTypeList() {
|
||||||
|
return getList(KEY_COMMUNITY_TYPE, new TypeToken<List<NewCommunityType>>() {
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpCommunityType(String json) {
|
||||||
|
newCommunityTypeList = new Gson().fromJson(json, new TypeToken<List<NewLevelModel>>() {
|
||||||
|
}.getType());
|
||||||
|
put(KEY_COMMUNITY_TYPE, newCommunityTypeList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package com.yunbao.common.utils;
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ public class RouteUtil {
|
|||||||
//Intent隐式启动 action
|
//Intent隐式启动 action
|
||||||
public static final String PATH_LAUNCHER = "/app/LauncherActivity";
|
public static final String PATH_LAUNCHER = "/app/LauncherActivity";
|
||||||
public static final String PATH_LOGIN_INVALID = "/main/LoginInvalidActivity";
|
public static final String PATH_LOGIN_INVALID = "/main/LoginInvalidActivity";
|
||||||
public static final String PATH_USER_HOME = "/main/UserHomeActivity";
|
|
||||||
public static final String PATH_COIN = "/main/MyWalletActivity";
|
public static final String PATH_COIN = "/main/MyWalletActivity";
|
||||||
public static final String PATH_REWARD = "/main/RewardActivity";
|
public static final String PATH_REWARD = "/main/RewardActivity";
|
||||||
public static final String PATH_EDITPROFILE = "/main/EditProfileActivity";
|
public static final String PATH_EDITPROFILE = "/main/EditProfileActivity";
|
||||||
@ -46,21 +45,22 @@ public class RouteUtil {
|
|||||||
public static final String PATH_RED_PACKET_LIST = "/main/RedPacketListActivity";
|
public static final String PATH_RED_PACKET_LIST = "/main/RedPacketListActivity";
|
||||||
public static final String PATH_RED_PACKET_INFO = "/main/RedPacketInfoActivity";
|
public static final String PATH_RED_PACKET_INFO = "/main/RedPacketInfoActivity";
|
||||||
public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity";
|
public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity";
|
||||||
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
|
public static final String PATH_SELECT_AVATAR = "/main/UserAvatarSelectActivity";
|
||||||
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
|
public static final String PATH_BattlePassActivity = "/main/BattlePassActivity";
|
||||||
public static final String PATH_SudGameActivity="/live/SudGameActivity";
|
public static final String PATH_SudGameActivity = "/live/SudGameActivity";
|
||||||
public static final String PATH_COMMUNITY_Activity="/main/MainHomeCommunityActivity";
|
public static final String PATH_COMMUNITY_Activity = "/main/MainHomeCommunityActivity";
|
||||||
|
|
||||||
|
|
||||||
public static void forwardCommunityActivity() {
|
public static void forwardCommunityActivity() {
|
||||||
ARouter.getInstance().build(PATH_COMMUNITY_Activity)
|
ARouter.getInstance().build(PATH_COMMUNITY_Activity)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void forwardFansActivity(String uid) {
|
public static void forwardFansActivity(String uid) {
|
||||||
ARouter.getInstance().build(PATH_FANSACTIVITY)
|
ARouter.getInstance().build(PATH_FANSACTIVITY)
|
||||||
.withString(Constants.TO_UID, uid)
|
.withString(Constants.TO_UID, uid)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void forwardSudGameActivity(String CreateSudRoom) {
|
public static void forwardSudGameActivity(String CreateSudRoom) {
|
||||||
ARouter.getInstance().build(PATH_SudGameActivity)
|
ARouter.getInstance().build(PATH_SudGameActivity)
|
||||||
.withString("CreateSudRoom", CreateSudRoom)
|
.withString("CreateSudRoom", CreateSudRoom)
|
||||||
@ -215,7 +215,7 @@ public class RouteUtil {
|
|||||||
* 跳转到充值页面
|
* 跳转到充值页面
|
||||||
*/
|
*/
|
||||||
public static void forwardMyCoin(Context context) {
|
public static void forwardMyCoin(Context context) {
|
||||||
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=zhifu&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=zhifu&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
||||||
ARouter.getInstance().build(PATH_COIN).withString("url", url).navigation();
|
ARouter.getInstance().build(PATH_COIN).withString("url", url).navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,14 +266,14 @@ public class RouteUtil {
|
|||||||
postcard.navigation();
|
postcard.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void forwardGiftWallActivity(String mStream, String mAnchorName, String mLiveUid, String mAvatarUrl, int isAttention,boolean isLive) {
|
public static void forwardGiftWallActivity(String mStream, String mAnchorName, String mLiveUid, String mAvatarUrl, int isAttention, boolean isLive) {
|
||||||
ARouter.getInstance().build(PATH_GIFT_WALL)
|
ARouter.getInstance().build(PATH_GIFT_WALL)
|
||||||
.withString(Constants.LIVE_UID, mLiveUid)
|
.withString(Constants.LIVE_UID, mLiveUid)
|
||||||
.withString(Constants.STREAM, mStream)
|
.withString(Constants.STREAM, mStream)
|
||||||
.withString("mAnchorName", mAnchorName)
|
.withString("mAnchorName", mAnchorName)
|
||||||
.withString("mAvatarUrl", mAvatarUrl)
|
.withString("mAvatarUrl", mAvatarUrl)
|
||||||
.withInt("isAttention", isAttention)
|
.withInt("isAttention", isAttention)
|
||||||
.withBoolean("isLive",isLive)
|
.withBoolean("isLive", isLive)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,6 +295,19 @@ public class RouteUtil {
|
|||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 举报动态
|
||||||
|
*
|
||||||
|
* @param dynamicId
|
||||||
|
* @param commentId
|
||||||
|
*/
|
||||||
|
public static void forwardCommentReportActivity(String dynamicId, String commentId) {
|
||||||
|
ARouter.getInstance().build(PATH_LIVEREPORT)
|
||||||
|
.withString(Constants.TO_UID, dynamicId)
|
||||||
|
.withString("comment_id", commentId)
|
||||||
|
.navigation();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进入facebook登录
|
* 进入facebook登录
|
||||||
*/
|
*/
|
||||||
@ -351,7 +364,7 @@ public class RouteUtil {
|
|||||||
/**
|
/**
|
||||||
* 战令
|
* 战令
|
||||||
*/
|
*/
|
||||||
public static void forwardBattlePass(){
|
public static void forwardBattlePass() {
|
||||||
ARouter.getInstance().build(PATH_BattlePassActivity)
|
ARouter.getInstance().build(PATH_BattlePassActivity)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,283 @@
|
|||||||
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.BuildConfig;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class FullyLinearLayoutManager extends LinearLayoutManager {
|
||||||
|
|
||||||
|
private static boolean canMakeInsetsDirty = true;
|
||||||
|
private static Field insetsDirtyField = null;
|
||||||
|
|
||||||
|
private static final int CHILD_WIDTH = 0;
|
||||||
|
private static final int CHILD_HEIGHT = 1;
|
||||||
|
private static final int DEFAULT_CHILD_SIZE = 100;
|
||||||
|
|
||||||
|
private final int[] childDimensions = new int[2];
|
||||||
|
private final RecyclerView view;
|
||||||
|
|
||||||
|
private int childSize = DEFAULT_CHILD_SIZE;
|
||||||
|
private boolean hasChildSize;
|
||||||
|
private int overScrollMode = ViewCompat.OVER_SCROLL_ALWAYS;
|
||||||
|
private final Rect tmpRect = new Rect();
|
||||||
|
|
||||||
|
public FullyLinearLayoutManager(Context context) {
|
||||||
|
super(context);
|
||||||
|
this.view = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FullyLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
||||||
|
super(context, orientation, reverseLayout);
|
||||||
|
this.view = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FullyLinearLayoutManager(RecyclerView view) {
|
||||||
|
super(view.getContext());
|
||||||
|
this.view = view;
|
||||||
|
this.overScrollMode = ViewCompat.getOverScrollMode(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FullyLinearLayoutManager(RecyclerView view, int orientation, boolean reverseLayout) {
|
||||||
|
super(view.getContext(), orientation, reverseLayout);
|
||||||
|
this.view = view;
|
||||||
|
this.overScrollMode = ViewCompat.getOverScrollMode(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverScrollMode(int overScrollMode) {
|
||||||
|
if (overScrollMode < ViewCompat.OVER_SCROLL_ALWAYS || overScrollMode > ViewCompat.OVER_SCROLL_NEVER)
|
||||||
|
throw new IllegalArgumentException("Unknown overscroll mode: " + overScrollMode);
|
||||||
|
if (this.view == null) throw new IllegalStateException("view == null");
|
||||||
|
this.overScrollMode = overScrollMode;
|
||||||
|
ViewCompat.setOverScrollMode(view, overScrollMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int makeUnspecifiedSpec() {
|
||||||
|
return View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) {
|
||||||
|
final int widthMode = View.MeasureSpec.getMode(widthSpec);
|
||||||
|
final int heightMode = View.MeasureSpec.getMode(heightSpec);
|
||||||
|
|
||||||
|
final int widthSize = View.MeasureSpec.getSize(widthSpec);
|
||||||
|
final int heightSize = View.MeasureSpec.getSize(heightSpec);
|
||||||
|
|
||||||
|
final boolean hasWidthSize = widthMode != View.MeasureSpec.UNSPECIFIED;
|
||||||
|
final boolean hasHeightSize = heightMode != View.MeasureSpec.UNSPECIFIED;
|
||||||
|
|
||||||
|
final boolean exactWidth = widthMode == View.MeasureSpec.EXACTLY;
|
||||||
|
final boolean exactHeight = heightMode == View.MeasureSpec.EXACTLY;
|
||||||
|
|
||||||
|
final int unspecified = makeUnspecifiedSpec();
|
||||||
|
|
||||||
|
if (exactWidth && exactHeight) {
|
||||||
|
// in case of exact calculations for both dimensions let's use default "onMeasure" implementation
|
||||||
|
super.onMeasure(recycler, state, widthSpec, heightSpec);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final boolean vertical = getOrientation() == VERTICAL;
|
||||||
|
|
||||||
|
initChildDimensions(widthSize, heightSize, vertical);
|
||||||
|
|
||||||
|
int width = 0;
|
||||||
|
int height = 0;
|
||||||
|
|
||||||
|
// it's possible to get scrap views in recycler which are bound to old (invalid) adapter entities. This
|
||||||
|
// happens because their invalidation happens after "onMeasure" method. As a workaround let's clear the
|
||||||
|
// recycler now (it should not cause any performance issues while scrolling as "onMeasure" is never
|
||||||
|
// called whiles scrolling)
|
||||||
|
recycler.clear();
|
||||||
|
|
||||||
|
final int stateItemCount = state.getItemCount();
|
||||||
|
final int adapterItemCount = getItemCount();
|
||||||
|
// adapter always contains actual data while state might contain old data (f.e. data before the animation is
|
||||||
|
// done). As we want to measure the view with actual data we must use data from the adapter and not from the
|
||||||
|
// state
|
||||||
|
for (int i = 0; i < adapterItemCount; i++) {
|
||||||
|
if (vertical) {
|
||||||
|
if (!hasChildSize) {
|
||||||
|
if (i < stateItemCount) {
|
||||||
|
// we should not exceed state count, otherwise we'll get IndexOutOfBoundsException. For such items
|
||||||
|
// we will use previously calculated dimensions
|
||||||
|
measureChild(recycler, i, widthSize, unspecified, childDimensions);
|
||||||
|
} else {
|
||||||
|
logMeasureWarning(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
height += childDimensions[CHILD_HEIGHT];
|
||||||
|
if (i == 0) {
|
||||||
|
width = childDimensions[CHILD_WIDTH];
|
||||||
|
}
|
||||||
|
if (hasHeightSize && height >= heightSize) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!hasChildSize) {
|
||||||
|
if (i < stateItemCount) {
|
||||||
|
// we should not exceed state count, otherwise we'll get IndexOutOfBoundsException. For such items
|
||||||
|
// we will use previously calculated dimensions
|
||||||
|
measureChild(recycler, i, unspecified, heightSize, childDimensions);
|
||||||
|
} else {
|
||||||
|
logMeasureWarning(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
width += childDimensions[CHILD_WIDTH];
|
||||||
|
if (i == 0) {
|
||||||
|
height = childDimensions[CHILD_HEIGHT];
|
||||||
|
}
|
||||||
|
if (hasWidthSize && width >= widthSize) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exactWidth) {
|
||||||
|
width = widthSize;
|
||||||
|
} else {
|
||||||
|
width += getPaddingLeft() + getPaddingRight();
|
||||||
|
if (hasWidthSize) {
|
||||||
|
width = Math.min(width, widthSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exactHeight) {
|
||||||
|
height = heightSize;
|
||||||
|
} else {
|
||||||
|
height += getPaddingTop() + getPaddingBottom();
|
||||||
|
if (hasHeightSize) {
|
||||||
|
height = Math.min(height, heightSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setMeasuredDimension(width, height);
|
||||||
|
|
||||||
|
if (view != null && overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS) {
|
||||||
|
final boolean fit = (vertical && (!hasHeightSize || height < heightSize))
|
||||||
|
|| (!vertical && (!hasWidthSize || width < widthSize));
|
||||||
|
|
||||||
|
ViewCompat.setOverScrollMode(view, fit ? ViewCompat.OVER_SCROLL_NEVER : ViewCompat.OVER_SCROLL_ALWAYS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logMeasureWarning(int child) {
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Log.w("LinearLayoutManager", "Can't measure child #" + child + ", previously used dimensions will be reused." +
|
||||||
|
"To remove this message either use #setChildSize() method or don't run RecyclerView animations");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initChildDimensions(int width, int height, boolean vertical) {
|
||||||
|
if (childDimensions[CHILD_WIDTH] != 0 || childDimensions[CHILD_HEIGHT] != 0) {
|
||||||
|
// already initialized, skipping
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vertical) {
|
||||||
|
childDimensions[CHILD_WIDTH] = width;
|
||||||
|
childDimensions[CHILD_HEIGHT] = childSize;
|
||||||
|
} else {
|
||||||
|
childDimensions[CHILD_WIDTH] = childSize;
|
||||||
|
childDimensions[CHILD_HEIGHT] = height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOrientation(int orientation) {
|
||||||
|
// might be called before the constructor of this class is called
|
||||||
|
//noinspection ConstantConditions
|
||||||
|
if (childDimensions != null) {
|
||||||
|
if (getOrientation() != orientation) {
|
||||||
|
childDimensions[CHILD_WIDTH] = 0;
|
||||||
|
childDimensions[CHILD_HEIGHT] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.setOrientation(orientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearChildSize() {
|
||||||
|
hasChildSize = false;
|
||||||
|
setChildSize(DEFAULT_CHILD_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildSize(int childSize) {
|
||||||
|
hasChildSize = true;
|
||||||
|
if (this.childSize != childSize) {
|
||||||
|
this.childSize = childSize;
|
||||||
|
requestLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void measureChild(RecyclerView.Recycler recycler, int position, int widthSize, int heightSize, int[] dimensions) {
|
||||||
|
final View child;
|
||||||
|
try {
|
||||||
|
child = recycler.getViewForPosition(position);
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Log.w("LinearLayoutManager", "LinearLayoutManager doesn't work well with animations. Consider switching them off", e);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final RecyclerView.LayoutParams p = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||||
|
|
||||||
|
final int hPadding = getPaddingLeft() + getPaddingRight();
|
||||||
|
final int vPadding = getPaddingTop() + getPaddingBottom();
|
||||||
|
|
||||||
|
final int hMargin = p.leftMargin + p.rightMargin;
|
||||||
|
final int vMargin = p.topMargin + p.bottomMargin;
|
||||||
|
|
||||||
|
// we must make insets dirty in order calculateItemDecorationsForChild to work
|
||||||
|
makeInsetsDirty(p);
|
||||||
|
// this method should be called before any getXxxDecorationXxx() methods
|
||||||
|
calculateItemDecorationsForChild(child, tmpRect);
|
||||||
|
|
||||||
|
final int hDecoration = getRightDecorationWidth(child) + getLeftDecorationWidth(child);
|
||||||
|
final int vDecoration = getTopDecorationHeight(child) + getBottomDecorationHeight(child);
|
||||||
|
|
||||||
|
final int childWidthSpec = getChildMeasureSpec(widthSize, hPadding + hMargin + hDecoration, p.width, canScrollHorizontally());
|
||||||
|
final int childHeightSpec = getChildMeasureSpec(heightSize, vPadding + vMargin + vDecoration, p.height, canScrollVertically());
|
||||||
|
|
||||||
|
child.measure(childWidthSpec, childHeightSpec);
|
||||||
|
|
||||||
|
dimensions[CHILD_WIDTH] = getDecoratedMeasuredWidth(child) + p.leftMargin + p.rightMargin;
|
||||||
|
dimensions[CHILD_HEIGHT] = getDecoratedMeasuredHeight(child) + p.bottomMargin + p.topMargin;
|
||||||
|
|
||||||
|
// as view is recycled let's not keep old measured values
|
||||||
|
makeInsetsDirty(p);
|
||||||
|
recycler.recycleView(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void makeInsetsDirty(RecyclerView.LayoutParams p) {
|
||||||
|
if (!canMakeInsetsDirty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (insetsDirtyField == null) {
|
||||||
|
insetsDirtyField = RecyclerView.LayoutParams.class.getDeclaredField("mInsetsDirty");
|
||||||
|
insetsDirtyField.setAccessible(true);
|
||||||
|
}
|
||||||
|
insetsDirtyField.set(p, true);
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
onMakeInsertDirtyFailed();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
onMakeInsertDirtyFailed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void onMakeInsertDirtyFailed() {
|
||||||
|
canMakeInsetsDirty = false;
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Log.w("LinearLayoutManager", "Can't make LayoutParams insets dirty, decorations measurements might be incorrect");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.ViewConfiguration;
|
||||||
|
import android.widget.ScrollView;
|
||||||
|
|
||||||
|
public class MyScrollview extends ScrollView {
|
||||||
|
private int downX;
|
||||||
|
private int downY;
|
||||||
|
private int mTouchSlop;
|
||||||
|
|
||||||
|
public MyScrollview(Context context) {
|
||||||
|
super(context);
|
||||||
|
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyScrollview(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MyScrollview(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||||
|
int action = e.getAction();
|
||||||
|
switch (action) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
downX = (int) e.getRawX();
|
||||||
|
downY = (int) e.getRawY();
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
int moveY = (int) e.getRawY();
|
||||||
|
if (Math.abs(moveY - downY) > mTouchSlop) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
super.onInterceptTouchEvent(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onInterceptTouchEvent(e);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.ms.banner.holder.BannerViewHolder;
|
||||||
|
import com.yunbao.common.bean.BannerBean;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
|
||||||
|
public class UserHomeImgsViewHolder implements BannerViewHolder<String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View createView(Context context, int position, String data) {
|
||||||
|
// 返回mImageView页面布局
|
||||||
|
ImageView imageView = new ImageView(context);
|
||||||
|
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
);
|
||||||
|
imageView.setLayoutParams(params);
|
||||||
|
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||||
|
//Glide.with(context).load(data.getImageUrl()).into(imageView);
|
||||||
|
ImgLoader.display(context, data, imageView);
|
||||||
|
|
||||||
|
return imageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
<corners
|
<corners
|
||||||
android:bottomLeftRadius="0dp"
|
android:bottomLeftRadius="0dp"
|
||||||
android:bottomRightRadius="0dp"
|
android:bottomRightRadius="0dp"
|
||||||
android:topLeftRadius="35dp"
|
android:topLeftRadius="25dp"
|
||||||
android:topRightRadius="35dp" />
|
android:topRightRadius="25dp" />
|
||||||
|
|
||||||
</shape>
|
</shape>
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<include layout="@layout/view_title_new" />
|
<include layout="@layout/view_title_new" />
|
||||||
|
|
||||||
<ScrollView
|
<com.yunbao.common.views.MyScrollview
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
@ -22,6 +22,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/userLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@ -168,7 +169,7 @@
|
|||||||
android:id="@+id/replyCount"
|
android:id="@+id/replyCount"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="评论123"
|
android:text="评论0"
|
||||||
android:textColor="#333333"
|
android:textColor="#333333"
|
||||||
android:textSize="16dp"
|
android:textSize="16dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
@ -181,21 +182,28 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<RelativeLayout
|
||||||
android:id="@+id/commentListView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp" />
|
android:descendantFocusability="blocksDescendants">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/commentListView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</com.yunbao.common.views.MyScrollview>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="55dp"
|
android:layout_height="70dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingLeft="20dp"
|
android:paddingLeft="20dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
android:paddingRight="20dp">
|
android:paddingRight="20dp">
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
@ -31,14 +31,15 @@
|
|||||||
android:layout_height="380dp"
|
android:layout_height="380dp"
|
||||||
android:background="@color/gray1">
|
android:background="@color/gray1">
|
||||||
|
|
||||||
<ImageView
|
<com.ms.banner.Banner
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/banner"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:src="@mipmap/temp" />
|
android:src="@mipmap/temp" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/imgsRecyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
@ -367,6 +368,7 @@
|
|||||||
android:paddingRight="20dp">
|
android:paddingRight="20dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
android:layout_width="34dp"
|
android:layout_width="34dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:src="@mipmap/icon_left" />
|
android:src="@mipmap/icon_left" />
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
tools:ignore="MissingDefaultResource">
|
tools:ignore="MissingDefaultResource">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/bg_item_comment"
|
android:background="@drawable/bg_item_comment"
|
||||||
@ -15,36 +16,23 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RelativeLayout
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
android:layout_width="25dp"
|
android:id="@+id/avatar01"
|
||||||
android:layout_height="20dp">
|
android:layout_width="23dp"
|
||||||
|
android:layout_height="23dp"
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
android:src="@mipmap/icon_data_empty"
|
||||||
android:id="@+id/avatar01"
|
app:riv_corner_radius="20dp" />
|
||||||
android:layout_width="20dp"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:src="@mipmap/icon_data_empty"
|
|
||||||
app:riv_corner_radius="20dp" />
|
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
|
||||||
android:id="@+id/avatar02"
|
|
||||||
android:layout_width="12dp"
|
|
||||||
android:layout_height="12dp"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:src="@mipmap/icon_data_empty"
|
|
||||||
app:riv_corner_radius="20dp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/name"
|
android:id="@+id/name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:text="A回复B"
|
android:text=""
|
||||||
android:textColor="#333333"
|
android:textColor="#333333"
|
||||||
android:textSize="12dp"
|
android:textSize="12dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
@ -69,8 +57,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
android:layout_marginTop="5dp"
|
android:text=""
|
||||||
android:text="现在还没有结冰哦,但是雪大了会封路现在还没有结冰哦,但是雪大了会封路"
|
|
||||||
android:textColor="#777777"
|
android:textColor="#777777"
|
||||||
android:textSize="12dp" />
|
android:textSize="12dp" />
|
||||||
|
|
||||||
@ -79,7 +66,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="20dp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -10,12 +10,13 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
android:layout_width="35dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="35dp"
|
android:layout_height="30dp"
|
||||||
android:src="@mipmap/icon_data_empty"
|
android:src="@mipmap/icon_data_empty"
|
||||||
app:riv_oval="true" />
|
app:riv_oval="true" />
|
||||||
|
|
||||||
@ -23,7 +24,7 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="7dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -48,14 +49,14 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/reply"
|
android:id="@+id/replyTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="回复"
|
android:text="回复"
|
||||||
android:textColor="#777777"
|
android:textColor="#777777"
|
||||||
android:textSize="12dp" />
|
android:textSize="11dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/report"
|
android:id="@+id/report"
|
||||||
@ -66,7 +67,7 @@
|
|||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="举报"
|
android:text="举报"
|
||||||
android:textColor="#333333"
|
android:textColor="#333333"
|
||||||
android:textSize="12dp"
|
android:textSize="11dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -75,50 +76,39 @@
|
|||||||
android:id="@+id/replyLayout"
|
android:id="@+id/replyLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="60dp"
|
android:layout_marginLeft="50dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:background="@drawable/bg_item_comment"
|
android:background="@drawable/bg_item_comment"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="10dp">
|
android:padding="10dp"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RelativeLayout
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
android:layout_width="25dp"
|
android:id="@+id/avatar01"
|
||||||
android:layout_height="20dp">
|
android:layout_width="23dp"
|
||||||
|
android:layout_height="23dp"
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
android:src="@mipmap/icon_data_empty"
|
||||||
android:id="@+id/avatar01"
|
app:riv_corner_radius="20dp" />
|
||||||
android:layout_width="20dp"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:src="@mipmap/icon_data_empty"
|
|
||||||
app:riv_corner_radius="20dp" />
|
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
|
||||||
android:id="@+id/avatar02"
|
|
||||||
android:layout_width="12dp"
|
|
||||||
android:layout_height="12dp"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:src="@mipmap/icon_data_empty"
|
|
||||||
app:riv_corner_radius="20dp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/firstName"
|
android:id="@+id/firstName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:text="A回复B"
|
android:text=""
|
||||||
android:textColor="#333333"
|
android:textColor="#333333"
|
||||||
android:textSize="12dp"
|
android:textSize="12dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/isAuth"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
@ -128,7 +118,8 @@
|
|||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp"
|
||||||
android:text="作者"
|
android:text="作者"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="12dp" />
|
android:textSize="11dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -138,9 +129,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:text="现在还没有结冰哦,但是雪大了会封路现在还没有结冰哦,但是雪大了会封路"
|
android:text=""
|
||||||
android:textColor="#777777"
|
android:textColor="#777777"
|
||||||
android:textSize="12dp" />
|
android:textSize="11dp" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
@ -163,5 +154,10 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="#FFE9F6" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
18
common/src/main/res/layout/item_user_home_img.xml
Normal file
18
common/src/main/res/layout/item_user_home_img.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:ignore="MissingDefaultResource">
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:src="@mipmap/icon_data_empty"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -178,9 +178,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
private String mUrlCsd;
|
private String mUrlCsd;
|
||||||
private TextView v_table_redpoint;
|
private TextView v_table_redpoint;
|
||||||
private View v_table_redpoint_me;
|
private View v_table_redpoint_me;
|
||||||
|
|
||||||
String TAG = "GooglePay";
|
String TAG = "GooglePay";
|
||||||
|
|
||||||
public static int Height;
|
public static int Height;
|
||||||
private boolean isWebClose = false;
|
private boolean isWebClose = false;
|
||||||
public static boolean isTabClose = false;
|
public static boolean isTabClose = false;
|
||||||
@ -189,7 +187,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
private ImageView waitingTip;
|
private ImageView waitingTip;
|
||||||
private FloatBannerView floatBanner;
|
private FloatBannerView floatBanner;
|
||||||
private boolean isfloatBannernet = true, isFirst = true;
|
private boolean isfloatBannernet = true, isFirst = true;
|
||||||
|
|
||||||
private View floatRedPacket;
|
private View floatRedPacket;
|
||||||
|
|
||||||
private View floatWarOrder;//战令浮窗
|
private View floatWarOrder;//战令浮窗
|
||||||
@ -206,7 +203,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
super.create();
|
super.create();
|
||||||
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
|
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
|
||||||
getWindow().setSharedElementEnterTransition(new FullAdToBannerTransition(1, 0.4f, new DecelerateInterpolator()));
|
getWindow().setSharedElementEnterTransition(new FullAdToBannerTransition(1, 0.4f, new DecelerateInterpolator()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1136,16 +1132,15 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
mainHomeComViewHolder = new MainHomeComViewHolder(mContext, parent);
|
mainHomeComViewHolder = new MainHomeComViewHolder(mContext, parent);
|
||||||
vh = mainHomeComViewHolder;
|
vh = mainHomeComViewHolder;
|
||||||
|
|
||||||
} else if (position == 1) {
|
} else if (position == 1) {
|
||||||
mMainHomeCommunityViewHolder = new MainHomeCommunityViewHolder(mContext, parent, this);//直播
|
mainHomeLiveViewHolder = new MainHomeLiveViewHolder(mContext, parent);//直播
|
||||||
vh = mMainHomeCommunityViewHolder;
|
vh = mainHomeLiveViewHolder;
|
||||||
|
/* mMainHomeCommunityViewHolder = new MainHomeCommunityViewHolder(mContext, parent, this);//直播
|
||||||
|
vh = mMainHomeCommunityViewHolder;*/
|
||||||
} else if (position == 2) {
|
} else if (position == 2) {
|
||||||
mainMessageViewHolder = new MainMessageViewHolder(this, parent);
|
mainMessageViewHolder = new MainMessageViewHolder(this, parent);
|
||||||
vh = mainMessageViewHolder;
|
vh = mainMessageViewHolder;
|
||||||
|
|
||||||
|
|
||||||
} else if (position == 3) {
|
} else if (position == 3) {
|
||||||
mMeViewHolder = new MainMeViewHolder(mContext, parent);
|
mMeViewHolder = new MainMeViewHolder(mContext, parent);
|
||||||
vh = mMeViewHolder;
|
vh = mMeViewHolder;
|
||||||
|
@ -2,7 +2,6 @@ package com.yunbao.main.activity;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
@ -20,7 +19,7 @@ import com.yunbao.main.views.UserHomeViewHolder2;
|
|||||||
/**
|
/**
|
||||||
* Created by cxf on 2018/9/25.
|
* Created by cxf on 2018/9/25.
|
||||||
*/
|
*/
|
||||||
@Route(path = RouteUtil.PATH_USER_HOME)
|
//@Route(path = RouteUtil.PATH_USER_HOME)
|
||||||
public class UserHomeActivity extends AbsActivity {
|
public class UserHomeActivity extends AbsActivity {
|
||||||
|
|
||||||
private UserHomeViewHolder2 mUserHomeViewHolder;
|
private UserHomeViewHolder2 mUserHomeViewHolder;
|
||||||
|
@ -84,42 +84,44 @@ public class MainHomeComAdapter extends RefreshAdapter<ActiveBean> {
|
|||||||
|
|
||||||
void setData(ActiveBean bean, int position) {
|
void setData(ActiveBean bean, int position) {
|
||||||
itemView.setTag(bean);
|
itemView.setTag(bean);
|
||||||
if (bean.getImg_or_video().equals("1")) {
|
if (bean != null) {
|
||||||
JSONArray jsonArray = (JSONArray) JSONArray.parse(bean.getImg_json());
|
if (bean.getImg_or_video().equals("1")) {
|
||||||
if (jsonArray.size() != 0) {
|
JSONArray jsonArray = (JSONArray) JSONArray.parse(bean.getImg_json());
|
||||||
ImgLoader.display(mContext, String.valueOf(jsonArray.get(0)), img);
|
if (jsonArray.size() != 0) {
|
||||||
|
ImgLoader.display(mContext, String.valueOf(jsonArray.get(0)), img);
|
||||||
|
}
|
||||||
|
isVideo.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
ImgLoader.display(mContext, bean.getUser_avatar(), img);
|
||||||
|
isVideo.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
isVideo.setVisibility(View.GONE);
|
name.setText(bean.getUser_name());
|
||||||
} else {
|
JSONObject json = JSONObject.parseObject(bean.getContent());
|
||||||
ImgLoader.display(mContext, bean.getUser_avatar(), img);
|
if (json != null) {
|
||||||
isVideo.setVisibility(View.VISIBLE);
|
String content = (String) json.get("msg");
|
||||||
}
|
title.setText(content);
|
||||||
name.setText(bean.getUser_name());
|
}
|
||||||
JSONObject json = JSONObject.parseObject(bean.getContent());
|
likeCount.setText(bean.getLove_num());
|
||||||
if (json != null) {
|
ImgLoader.display(mContext, bean.getUser_avatar(), author);
|
||||||
String content = (String) json.get("msg");
|
|
||||||
title.setText(content);
|
|
||||||
}
|
|
||||||
likeCount.setText(bean.getLove_num());
|
|
||||||
ImgLoader.display(mContext, bean.getUser_avatar(), author);
|
|
||||||
|
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
|
||||||
params.height = 550;
|
params.height = 550;
|
||||||
heightLayout.setLayoutParams(params);
|
heightLayout.setLayoutParams(params);
|
||||||
|
|
||||||
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
|
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
|
||||||
imgPa.height = 550;
|
imgPa.height = 550;
|
||||||
img.setLayoutParams(imgPa);
|
img.setLayoutParams(imgPa);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
|
||||||
params.height = 750;
|
params.height = 750;
|
||||||
heightLayout.setLayoutParams(params);
|
heightLayout.setLayoutParams(params);
|
||||||
|
|
||||||
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
|
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
|
||||||
imgPa.height = 750;
|
imgPa.height = 750;
|
||||||
img.setLayoutParams(imgPa);
|
img.setLayoutParams(imgPa);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.yunbao.common.bean.LiveClassBean;
|
import com.yunbao.common.bean.NewCommunityType;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
|
|
||||||
@ -22,15 +22,15 @@ import java.util.Locale;
|
|||||||
public class MainHomeComClassAdapter extends RecyclerView.Adapter<MainHomeComClassAdapter.Vh> {
|
public class MainHomeComClassAdapter extends RecyclerView.Adapter<MainHomeComClassAdapter.Vh> {
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<LiveClassBean> mList;
|
private List<NewCommunityType> mList;
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private View.OnClickListener mOnClickListener;
|
private View.OnClickListener mOnClickListener;
|
||||||
private OnItemClickListener<LiveClassBean> mOnItemClickListener;
|
private OnItemClickListener<NewCommunityType> mOnItemClickListener;
|
||||||
|
|
||||||
//选中的
|
//选中的
|
||||||
public static int choice = 0;
|
public static int choice = 0;
|
||||||
|
|
||||||
public MainHomeComClassAdapter(Context context, List<LiveClassBean> list, boolean dialog) {
|
public MainHomeComClassAdapter(Context context, List<NewCommunityType> list, boolean dialog) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mList = list;
|
mList = list;
|
||||||
mInflater = LayoutInflater.from(context);
|
mInflater = LayoutInflater.from(context);
|
||||||
@ -40,7 +40,7 @@ public class MainHomeComClassAdapter extends RecyclerView.Adapter<MainHomeComCla
|
|||||||
Object tag = v.getTag();
|
Object tag = v.getTag();
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
int position = (int) tag;
|
int position = (int) tag;
|
||||||
LiveClassBean bean = mList.get(position);
|
NewCommunityType bean = mList.get(position);
|
||||||
if (mOnItemClickListener != null) {
|
if (mOnItemClickListener != null) {
|
||||||
mOnItemClickListener.onItemClick(bean, position);
|
mOnItemClickListener.onItemClick(bean, position);
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ public class MainHomeComClassAdapter extends RecyclerView.Adapter<MainHomeComCla
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setOnItemClickListener(OnItemClickListener<LiveClassBean> onItemClickListener) {
|
public void setOnItemClickListener(OnItemClickListener<NewCommunityType> onItemClickListener) {
|
||||||
mOnItemClickListener = onItemClickListener;
|
mOnItemClickListener = onItemClickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ public class MainHomeComClassAdapter extends RecyclerView.Adapter<MainHomeComCla
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
void setData(LiveClassBean bean, int position) {
|
void setData(NewCommunityType bean, int position) {
|
||||||
itemView.setTag(position);
|
itemView.setTag(position);
|
||||||
Locale locale;
|
Locale locale;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
@ -90,9 +90,9 @@ public class MainHomeComClassAdapter extends RecyclerView.Adapter<MainHomeComCla
|
|||||||
locale = mContext.getResources().getConfiguration().locale;
|
locale = mContext.getResources().getConfiguration().locale;
|
||||||
}
|
}
|
||||||
if (locale.getLanguage().equals("zh")) {
|
if (locale.getLanguage().equals("zh")) {
|
||||||
mName.setText(bean.getChinese());
|
mName.setText(bean.getTalk_name());
|
||||||
} else {
|
} else {
|
||||||
mName.setText(bean.getEnglish());
|
mName.setText(bean.getTalk_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position == choice) {
|
if (position == choice) {
|
||||||
|
@ -1,22 +1,28 @@
|
|||||||
package com.yunbao.main.views;
|
package com.yunbao.main.views;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
|
import com.yunbao.common.activity.CommunityDetailsActivity;
|
||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
|
import com.yunbao.common.bean.ActiveBean;
|
||||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||||
import com.yunbao.common.bean.LiveBean;
|
import com.yunbao.common.bean.ActiveBean;
|
||||||
import com.yunbao.common.custom.CommonRefreshWaterfallView;
|
import com.yunbao.common.custom.CommonRefreshWaterfallView;
|
||||||
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.activity.MainActivity;
|
import com.yunbao.main.activity.MainActivity;
|
||||||
import com.yunbao.main.activity.WeekWebViewActivity;
|
import com.yunbao.main.activity.WeekWebViewActivity;
|
||||||
|
import com.yunbao.main.adapter.MainHomeComAdapter;
|
||||||
import com.yunbao.main.adapter.MainHomeRemFollComAdapter;
|
import com.yunbao.main.adapter.MainHomeRemFollComAdapter;
|
||||||
import com.yunbao.main.http.MainHttpConsts;
|
import com.yunbao.main.http.MainHttpConsts;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
@ -29,9 +35,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<LiveBean> {
|
public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<ActiveBean> {
|
||||||
private CommonRefreshWaterfallView mRefreshView;
|
private CommonRefreshWaterfallView mRefreshView;
|
||||||
private MainHomeRemFollComAdapter mAdapter;
|
private MainHomeComAdapter mAdapter;
|
||||||
|
|
||||||
public MainHomeFollComViewHolder(Context context, ViewGroup parentView) {
|
public MainHomeFollComViewHolder(Context context, ViewGroup parentView) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
@ -71,11 +77,11 @@ public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implem
|
|||||||
mRefreshView.setItemDecoration(decoration);
|
mRefreshView.setItemDecoration(decoration);
|
||||||
*/
|
*/
|
||||||
mRefreshView.setRecyclerViewAdapter(mAdapter);
|
mRefreshView.setRecyclerViewAdapter(mAdapter);
|
||||||
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<LiveBean>() {
|
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<ActiveBean>() {
|
||||||
@Override
|
@Override
|
||||||
public RefreshAdapter<LiveBean> getAdapter() {
|
public RefreshAdapter<ActiveBean> getAdapter() {
|
||||||
if (mAdapter == null) {
|
if (mAdapter == null) {
|
||||||
mAdapter = new MainHomeRemFollComAdapter(mContext, MainActivity.Height);
|
mAdapter = new MainHomeComAdapter(mContext);
|
||||||
mAdapter.setOnItemClickListener(MainHomeFollComViewHolder.this);
|
mAdapter.setOnItemClickListener(MainHomeFollComViewHolder.this);
|
||||||
}
|
}
|
||||||
return mAdapter;
|
return mAdapter;
|
||||||
@ -85,16 +91,16 @@ public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implem
|
|||||||
public void loadData(int p, HttpCallback callback) {
|
public void loadData(int p, HttpCallback callback) {
|
||||||
Log.i("t2", "aaa" + p);
|
Log.i("t2", "aaa" + p);
|
||||||
pp = 1;
|
pp = 1;
|
||||||
MainHttpUtil.getHomeFollow(p, callback);
|
CommonHttpUtil.getCommunityFollow(p, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LiveBean> processData(String[] info) {
|
public List<ActiveBean> processData(String[] info) {
|
||||||
return JSON.parseArray(Arrays.toString(info), LiveBean.class);
|
return JSON.parseArray(Arrays.toString(info), ActiveBean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshSuccess(List<LiveBean> list, int count) {
|
public void onRefreshSuccess(List<ActiveBean> list, int count) {
|
||||||
EventBus.getDefault().post(new AnchorRecommendModel());
|
EventBus.getDefault().post(new AnchorRecommendModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,14 +110,8 @@ public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadMoreSuccess(List<LiveBean> loadItemList, int loadItemCount) {
|
public void onLoadMoreSuccess(List<ActiveBean> loadItemList, int loadItemCount) {
|
||||||
List<LiveBean> new_data = new ArrayList<>();
|
mAdapter.insertList(loadItemList);
|
||||||
for (int j = 0; j < loadItemList.size(); j++) {
|
|
||||||
if (loadItemList.get(j).getUserNiceName() != null) {
|
|
||||||
new_data.add(loadItemList.get(j));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mAdapter.insertList(new_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -119,23 +119,14 @@ public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implem
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mRefreshView.initData();
|
mRefreshView.initData();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(LiveBean bean, int position) {
|
public void onItemClick(ActiveBean bean, int position) {
|
||||||
if ("1".equals(bean.getIslive())) {
|
Intent intent = new Intent(mContext, CommunityDetailsActivity.class);
|
||||||
watchLive(bean, Constants.LIVE_HOME, position);
|
intent.putExtra("active", (Parcelable) bean);
|
||||||
} else if (bean.getIs_week() != null && bean.getIs_week().equals("1")) {
|
mContext.startActivity(intent);
|
||||||
String url = CommonAppConfig.HOST + bean.getUrl() + "?a=1";
|
|
||||||
WeekWebViewActivity.forward(mContext, url, true);
|
|
||||||
} else {
|
|
||||||
RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,36 +15,25 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.google.gson.Gson;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.umeng.analytics.MobclickAgent;
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
|
||||||
import com.yunbao.common.Constants;
|
|
||||||
import com.yunbao.common.activity.CommunityDetailsActivity;
|
import com.yunbao.common.activity.CommunityDetailsActivity;
|
||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.bean.ActiveBean;
|
import com.yunbao.common.bean.ActiveBean;
|
||||||
import com.yunbao.common.bean.BannerBean;
|
import com.yunbao.common.bean.NewCommunityType;
|
||||||
import com.yunbao.common.bean.LiveClassBean;
|
|
||||||
import com.yunbao.common.bean.VideoBean;
|
|
||||||
import com.yunbao.common.custom.CommonRefreshWaterfallView;
|
import com.yunbao.common.custom.CommonRefreshWaterfallView;
|
||||||
import com.yunbao.common.http.CommonHttpUtil;
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.manager.LiveClassManager;
|
import com.yunbao.common.manager.CommunityTypeManager;
|
||||||
import com.yunbao.common.manager.OpenAdManager;
|
import com.yunbao.common.manager.OpenAdManager;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.live.adapter.LiveAdminRoomAdapter;
|
import com.yunbao.live.bean.RedPackBean;
|
||||||
import com.yunbao.live.bean.LiveAdminRoomBean;
|
|
||||||
import com.yunbao.live.views.LiveMyRoomViewHolder;
|
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.adapter.MainHomeComAdapter;
|
import com.yunbao.main.adapter.MainHomeComAdapter;
|
||||||
import com.yunbao.main.adapter.MainHomeComClassAdapter;
|
import com.yunbao.main.adapter.MainHomeComClassAdapter;
|
||||||
import com.yunbao.main.http.MainHttpConsts;
|
import com.yunbao.main.http.MainHttpConsts;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
import com.yunbao.video.activity.VideoPlayActivity;
|
|
||||||
import com.yunbao.video.http.VideoHttpUtil;
|
|
||||||
import com.yunbao.video.interfaces.VideoScrollDataHelper;
|
import com.yunbao.video.interfaces.VideoScrollDataHelper;
|
||||||
import com.yunbao.video.utils.VideoStorge;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@ -86,8 +75,6 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
|
|||||||
return R.layout.view_main_home_com_hot;
|
return R.layout.view_main_home_com_hot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int pp;
|
|
||||||
|
|
||||||
//显示顶部商城tab时,显示底部tabGroup
|
//显示顶部商城tab时,显示底部tabGroup
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onUpdata(String str) {
|
public void onUpdata(String str) {
|
||||||
@ -105,10 +92,30 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
List<LiveClassBean> list = new LiveClassManager(mContext).getLiveClass();
|
CommonHttpUtil.getTag(new HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
List<NewCommunityType> list = JSON.parseArray(Arrays.toString(info), NewCommunityType.class);
|
||||||
|
CommunityTypeManager communityTypeManager = new CommunityTypeManager(mContext);
|
||||||
|
communityTypeManager.UpCommunityType(Arrays.toString(info));
|
||||||
|
initCommunityTypeList(list);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
List<NewCommunityType> list = new CommunityTypeManager(mContext).getCommunityTypeList();
|
||||||
if (list != null && !list.isEmpty()) {
|
if (list != null && !list.isEmpty()) {
|
||||||
typeHot = list.get(0).getEnglish();
|
typeHot = list.get(0).getTalk_name();
|
||||||
select = list.get(0).getId();
|
select = list.get(0).getId();
|
||||||
|
} else {
|
||||||
|
CommonHttpUtil.getTag(new HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
List<NewCommunityType> list = JSON.parseArray(Arrays.toString(info), NewCommunityType.class);
|
||||||
|
CommunityTypeManager communityTypeManager = new CommunityTypeManager(mContext);
|
||||||
|
communityTypeManager.UpCommunityType(Arrays.toString(info));
|
||||||
|
initCommunityTypeList(list);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
mBtnDismiss = findViewById(R.id.btn_dismiss);
|
mBtnDismiss = findViewById(R.id.btn_dismiss);
|
||||||
mBtnDismiss.setOnClickListener(new View.OnClickListener() {
|
mBtnDismiss.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -144,12 +151,11 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
|
|||||||
@Override
|
@Override
|
||||||
public void loadData(int p, HttpCallback callback) {
|
public void loadData(int p, HttpCallback callback) {
|
||||||
Log.i("t2", "aaa" + p);
|
Log.i("t2", "aaa" + p);
|
||||||
|
CommonHttpUtil.getCommunityHotList(p, callback);
|
||||||
if (TextUtils.equals(typeHot, "Hot") || TextUtils.equals(typeHot, "hot") || TextUtils.equals(typeHot, "熱門")) {
|
if (TextUtils.equals(typeHot, "Hot") || TextUtils.equals(typeHot, "hot") || TextUtils.equals(typeHot, "熱門")) {
|
||||||
pp = 1;
|
|
||||||
CommonHttpUtil.getCommunityHotList(p, callback);
|
CommonHttpUtil.getCommunityHotList(p, callback);
|
||||||
} else {
|
} else {
|
||||||
pp = 0;
|
CommonHttpUtil.getTalkHotDynamicList(select, p, callback);
|
||||||
MainHttpUtil.getClassLive(select, p, callback);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,19 +195,24 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
|
|||||||
mClassRecyclerViewTop = (RecyclerView) findViewById(R.id.classRecyclerView_top);
|
mClassRecyclerViewTop = (RecyclerView) findViewById(R.id.classRecyclerView_top);
|
||||||
mClassRecyclerViewTop.setHasFixedSize(true);
|
mClassRecyclerViewTop.setHasFixedSize(true);
|
||||||
mClassRecyclerViewTop.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
mClassRecyclerViewTop.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
||||||
|
mRefreshView.initData();
|
||||||
|
initCommunityTypeList(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void initCommunityTypeList(List<NewCommunityType> list) {
|
||||||
if (list != null && list.size() > 0) {
|
if (list != null && list.size() > 0) {
|
||||||
List<LiveClassBean> targetList = new ArrayList<>();
|
List<NewCommunityType> targetList = new ArrayList<>();
|
||||||
if (list.size() <= 6) {
|
if (list.size() <= 6) {
|
||||||
targetList.addAll(list);
|
targetList.addAll(list);
|
||||||
} else {
|
} else {
|
||||||
targetList.addAll(list);
|
targetList.addAll(list);
|
||||||
}
|
}
|
||||||
final MainHomeComClassAdapter topAdapter = new MainHomeComClassAdapter(mContext, targetList, false);
|
final MainHomeComClassAdapter topAdapter = new MainHomeComClassAdapter(mContext, targetList, false);
|
||||||
topAdapter.setOnItemClickListener(new OnItemClickListener<LiveClassBean>() {
|
topAdapter.setOnItemClickListener(new OnItemClickListener<NewCommunityType>() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(LiveClassBean bean, int position) {
|
public void onItemClick(NewCommunityType bean, int position) {
|
||||||
switch (bean.getEnglish()) {
|
/*switch (bean.getEnglish()) {
|
||||||
case "Hot":
|
case "Hot":
|
||||||
MobclickAgent.onEvent(mContext, "home_page_recommend_hot", "热门");
|
MobclickAgent.onEvent(mContext, "home_page_recommend_hot", "热门");
|
||||||
break;
|
break;
|
||||||
@ -223,12 +234,12 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
|
|||||||
default:
|
default:
|
||||||
MobclickAgent.onEvent(mContext, "home_page_recommend_other", "其他");
|
MobclickAgent.onEvent(mContext, "home_page_recommend_other", "其他");
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
if (!canClick()) {
|
if (!canClick()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
select = bean.getId();
|
select = bean.getId();
|
||||||
typeHot = bean.getEnglish();
|
typeHot = bean.getTalk_name();
|
||||||
mRefreshView.initData();
|
mRefreshView.initData();
|
||||||
topAdapter.choice = position;
|
topAdapter.choice = position;
|
||||||
topAdapter.notifyDataSetChanged();
|
topAdapter.notifyDataSetChanged();
|
||||||
@ -238,7 +249,6 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
|
|||||||
mClassRecyclerViewTop.setAdapter(topAdapter);
|
mClassRecyclerViewTop.setAdapter(topAdapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mRefreshView.initData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private VideoScrollDataHelper mVideoScrollDataHelper;
|
private VideoScrollDataHelper mVideoScrollDataHelper;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.yunbao.main.views;
|
package com.yunbao.main.views;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
@ -8,18 +10,22 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
|
import com.yunbao.common.activity.CommunityDetailsActivity;
|
||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
|
import com.yunbao.common.bean.ActiveBean;
|
||||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||||
import com.yunbao.common.bean.LiveBean;
|
import com.yunbao.common.bean.LiveBean;
|
||||||
import com.yunbao.common.custom.CommonRefreshView;
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
import com.yunbao.common.custom.CommonRefreshWaterfallView;
|
import com.yunbao.common.custom.CommonRefreshWaterfallView;
|
||||||
import com.yunbao.common.custom.ItemDecoration;
|
import com.yunbao.common.custom.ItemDecoration;
|
||||||
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.activity.MainActivity;
|
import com.yunbao.main.activity.MainActivity;
|
||||||
import com.yunbao.main.activity.WeekWebViewActivity;
|
import com.yunbao.main.activity.WeekWebViewActivity;
|
||||||
|
import com.yunbao.main.adapter.MainHomeComAdapter;
|
||||||
import com.yunbao.main.adapter.MainHomeRemFindComAdapter;
|
import com.yunbao.main.adapter.MainHomeRemFindComAdapter;
|
||||||
import com.yunbao.main.adapter.MainHomeRemFollLiveAdapter;
|
import com.yunbao.main.adapter.MainHomeRemFollLiveAdapter;
|
||||||
import com.yunbao.main.http.MainHttpConsts;
|
import com.yunbao.main.http.MainHttpConsts;
|
||||||
@ -35,9 +41,9 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 社区-发现
|
* 社区-发现
|
||||||
*/
|
*/
|
||||||
public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<LiveBean> {
|
public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<ActiveBean> {
|
||||||
private CommonRefreshWaterfallView mRefreshView;
|
private CommonRefreshWaterfallView mRefreshView;
|
||||||
private MainHomeRemFindComAdapter mAdapter;
|
private MainHomeComAdapter mAdapter;
|
||||||
|
|
||||||
public MainHomeRecomComViewHolder(Context context, ViewGroup parentView) {
|
public MainHomeRecomComViewHolder(Context context, ViewGroup parentView) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
@ -58,7 +64,7 @@ public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder imple
|
|||||||
mRefreshView.showRefreshBar();
|
mRefreshView.showRefreshBar();
|
||||||
mRefreshView.mRecyclerView.scrollToPosition(0);
|
mRefreshView.mRecyclerView.scrollToPosition(0);
|
||||||
}
|
}
|
||||||
}else if ("blacklist".equals(str)) {
|
} else if ("blacklist".equals(str)) {
|
||||||
if (mRefreshView != null) {
|
if (mRefreshView != null) {
|
||||||
mRefreshView.showRefreshBar();
|
mRefreshView.showRefreshBar();
|
||||||
}
|
}
|
||||||
@ -72,11 +78,11 @@ public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder imple
|
|||||||
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_live);
|
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_live);
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
mRefreshView.setRecyclerViewAdapter(mAdapter);
|
mRefreshView.setRecyclerViewAdapter(mAdapter);
|
||||||
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<LiveBean>() {
|
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<ActiveBean>() {
|
||||||
@Override
|
@Override
|
||||||
public RefreshAdapter<LiveBean> getAdapter() {
|
public RefreshAdapter<ActiveBean> getAdapter() {
|
||||||
if (mAdapter == null) {
|
if (mAdapter == null) {
|
||||||
mAdapter = new MainHomeRemFindComAdapter(mContext, MainActivity.Height);
|
mAdapter = new MainHomeComAdapter(mContext);
|
||||||
mAdapter.setOnItemClickListener(MainHomeRecomComViewHolder.this);
|
mAdapter.setOnItemClickListener(MainHomeRecomComViewHolder.this);
|
||||||
}
|
}
|
||||||
return mAdapter;
|
return mAdapter;
|
||||||
@ -84,21 +90,21 @@ public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadData(int p, HttpCallback callback) {
|
public void loadData(int p, HttpCallback callback) {
|
||||||
pp = p;
|
pp = p;
|
||||||
MainHttpUtil.getRandom(p, callback);
|
CommonHttpUtil.getCommunityFind(p, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LiveBean> processData(String[] info) {
|
public List<ActiveBean> processData(String[] info) {
|
||||||
if(pp == 1){
|
if (pp == 1) {
|
||||||
return JSON.parseArray(Arrays.toString(info), LiveBean.class);
|
return JSON.parseArray(Arrays.toString(info), ActiveBean.class);
|
||||||
}else{
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshSuccess(List<LiveBean> list, int count) {
|
public void onRefreshSuccess(List<ActiveBean> list, int count) {
|
||||||
EventBus.getDefault().post(new AnchorRecommendModel());
|
EventBus.getDefault().post(new AnchorRecommendModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +114,7 @@ public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadMoreSuccess(List<LiveBean> loadItemList, int loadItemCount) {
|
public void onLoadMoreSuccess(List<ActiveBean> loadItemList, int loadItemCount) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,20 +129,11 @@ public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder imple
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(LiveBean bean, int position) {
|
public void onItemClick(ActiveBean bean, int position) {
|
||||||
if ("1".equals(bean.getIslive())) {
|
Intent intent = new Intent(mContext, CommunityDetailsActivity.class);
|
||||||
watchLive(bean, Constants.LIVE_HOME, position);
|
intent.putExtra("active", (Parcelable) bean);
|
||||||
}else if(bean.getIs_week()!=null&&bean.getIs_week().equals("1")){
|
mContext.startActivity(intent);
|
||||||
String url = CommonAppConfig.HOST + bean.getUrl()+"?a=1";
|
|
||||||
WeekWebViewActivity.forward(mContext, url, true);
|
|
||||||
} else {
|
|
||||||
RouteUtil.forwardUserHome(mContext, bean.getUid(),0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -464,7 +464,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
|
|||||||
avatar = userBean.getAvatar();
|
avatar = userBean.getAvatar();
|
||||||
ImgLoader.displayBlur(mContext, avatar, mAvatarBg);
|
ImgLoader.displayBlur(mContext, avatar, mAvatarBg);
|
||||||
ImgLoader.displayAvatar(mContext, avatar, mAvatar);
|
ImgLoader.displayAvatar(mContext, avatar, mAvatar);
|
||||||
if (userBean.getDress().getAvatar_frame() != null) {
|
/*if (userBean.getDress().getAvatar_frame() != null) {
|
||||||
if (userBean.getDress().getAvatar_frame().contains("svga")) {
|
if (userBean.getDress().getAvatar_frame().contains("svga")) {
|
||||||
try {
|
try {
|
||||||
new SVGAParser(mContext).parse(new URL(userBean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
|
new SVGAParser(mContext).parse(new URL(userBean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
|
||||||
@ -485,7 +485,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
|
|||||||
} else {
|
} else {
|
||||||
ImgLoader.display(mContext, userBean.getDress().getAvatar_frame(), gift_svga);
|
ImgLoader.display(mContext, userBean.getDress().getAvatar_frame(), gift_svga);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
if (userBean.getDress().getMedal() != null) {
|
if (userBean.getDress().getMedal() != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user