Merge branch 'pandorapan_社区相关' into dev_改版主分支

# Conflicts:
#	common/build.gradle
#	common/src/main/java/com/yunbao/common/bean/MessageUserInfoBean.java
#	common/src/main/java/com/yunbao/common/http/PDLiveApi.java
#	common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java
#	common/src/main/java/com/yunbao/common/utils/RouteUtil.java
#	common/src/main/res/values/strings.xml
#	main/src/main/java/com/yunbao/main/activity/MainActivity.java
This commit is contained in:
hch 2024-03-15 17:27:31 +08:00
commit ba7e59a946
148 changed files with 9764 additions and 237 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#252525" />
<corners android:radius="26dp" />
</shape>

View File

@ -224,5 +224,12 @@ dependencies {
//
api 'com.contrarywind:Android-PickerView:4.1.9'
//
api 'com.wuxiaolong.pullloadmorerecyclerview:library:1.1.2'
//
api 'com.contrarywind:Android-PickerView:4.1.9'
//UI框架
api 'com.github.xuexiangjys:XUI:1.1.6'
api 'com.github.xuexiangjys.XUtil:xutil-core:2.0.0'
}

View File

@ -57,7 +57,6 @@
android:name="com.yunbao.common.activity.SelectImageActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.yunbao.common.activity.PreviewImageActivity"
android:screenOrientation="portrait" />
@ -66,6 +65,18 @@
android:name="com.yunbao.common.activity.PreviewVideoActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.CommunitySendActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.CommunityDetailsActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".activity.UserHomeActivity"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@ -0,0 +1,341 @@
package com.yunbao.common.activity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.util.SparseArray;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R;
import com.yunbao.common.adapter.CommentAdapter;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.CommentBean;
import com.yunbao.common.dialog.ImagePreviewDialog;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.OpenAdManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.NineGridLayout;
import com.yunbao.common.views.TopGradual;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class CommunityDetailsActivity extends AbsActivity {
ActiveBean activeBean;
private ImageView avatar;
private TextView name;
private TextView time;
private TextView content;
private LinearLayout followLayout;
private ImageView followIcon;
private TextView followName;
private NineGridLayout mNineGridLayout;
private ImageView videoImage;
private RecyclerView commentRecyclerView;
private CommentAdapter commentAdapter;
private TextView likeCount;
private ImageView userAvatar;
private ImageView like;
private TextView replyCount;
private EditText comment;
private ImageView send;
private boolean isComment = false;
@Override
protected int getLayoutId() {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
return R.layout.activity_community_details;
}
@Override
protected void create() {
super.create();
}
@Override
protected void onPause() {
super.onPause();
OpenAdManager.getInstance().dismiss();
}
@Override
protected void main() {
activeBean = getIntent().getParcelableExtra("active");
initView();
initData();
getReply();
}
private void initView() {
send = findViewById(R.id.send);
comment = findViewById(R.id.comment);
replyCount = findViewById(R.id.replyCount);
like = findViewById(R.id.like);
userAvatar = findViewById(R.id.userAvatar);
likeCount = findViewById(R.id.likeCount);
avatar = findViewById(R.id.avatar);
name = findViewById(R.id.name);
time = findViewById(R.id.time);
content = findViewById(R.id.content);
followLayout = findViewById(R.id.followLayout);
followIcon = findViewById(R.id.followIcon);
followName = findViewById(R.id.followName);
videoImage = findViewById(R.id.videoImage);
mNineGridLayout = findViewById(R.id.nine_grid_layout);
commentRecyclerView = findViewById(R.id.commentListView);
commentRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
commentRecyclerView.addItemDecoration(new TopGradual());
commentRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
mNineGridLayout.setActionListener(new NineGridLayout.ActionListener() {
@Override
public void onItemClick(List<?> dataList, int position) {
ImagePreviewDialog dialog = new ImagePreviewDialog();
dialog.setImageInfo(dataList.size(), position, false, new ImagePreviewDialog.ActionListener() {
@Override
public void loadImage(ImageView imageView, int position) {
ImgLoader.display(mContext, (String) (dataList.get(position)), imageView);
}
@Override
public void onDeleteClick(int position) {
}
});
dialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "ImagePreviewDialog");
}
@Override
public void displayImage(Object path, ImageView imageView) {
ImgLoader.display(CommunityDetailsActivity.this, String.valueOf(path), imageView);
}
});
followLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CommonHttpUtil.setAttention(activeBean.getUser_id(), new CommonCallback<Integer>() {
@Override
public void callback(Integer isAttention) {
if (isAttention == 1) {
ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like_followed, followIcon);
followName.setText("已关注");
followName.setTextColor(Color.parseColor("#777777"));
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type_1));
} else {
ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like_follow, followIcon);
followName.setText("关注");
followName.setTextColor(getResources().getColor(R.color.white));
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type));
}
}
});
}
});
like.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CommonHttpUtil.dynamicLove(activeBean.getId(), new HttpCallback() {
@SuppressLint("SetTextI18n")
@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).setVisibility(View.VISIBLE);
findViewById(R.id.setting).setOnClickListener(new View.OnClickListener() {
@Override
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 {
CommonHttpUtil.noInterest(activeBean.getUser_id(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
ToastUtil.show(msg);
}
});
}
}
});
}
});
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() {
CommonHttpUtil.getCommunityComment(activeBean.getId(), activeBean.getUser_id(), new HttpCallback() {
@SuppressLint("SetTextI18n")
@Override
public void onSuccess(int code, String msg, String[] info) {
List<CommentBean> list = JSON.parseArray(Arrays.toString(info), CommentBean.class);
if (list != null) {
commentAdapter = new CommentAdapter(mContext, list, activeBean.getUser_id());
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());
}
@Override
public void onDel(CommentBean activeBean, int position) {
//一级回复 删除
CommonHttpUtil.delCom(activeBean.getId(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
ToastUtil.show(msg);
getReply();
}
}
});
}
@Override
public void onReport(CommentBean.ReplyComment activeBean) {
//二级回复 举报
RouteUtil.forwardCommentReportActivity(activeBean.getId(), activeBean.getId());
}
@Override
public void onDel(CommentBean.ReplyComment activeBean) {
//二级回复 删除
CommonHttpUtil.delCom(activeBean.getId(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
ToastUtil.show(msg);
getReply();
}
}
});
}
});
commentRecyclerView.setAdapter(commentAdapter);
replyCount.setText("评论 " + list.size());
}
}
});
}
@SuppressLint("UseCompatLoadingForDrawables")
private void initData() {
ImgLoader.display(CommunityDetailsActivity.this, CommonAppConfig.getInstance().getUserBean().getAvatarThumb(), userAvatar);
ImgLoader.display(CommunityDetailsActivity.this, activeBean.getUser_avatar(), avatar);
name.setText(activeBean.getUser_name());
time.setText(activeBean.getCreate_time());
likeCount.setText(activeBean.getLove_num() + "人觉得很赞");
if (!StringUtil.isEmpty(activeBean.getContent())) {
content.setText(String.valueOf(JSONObject.parseObject(activeBean.getContent()).get("msg")));
}
if (activeBean.getIs_attention().equals("1")) {//关注
ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like_followed, followIcon);
followName.setText("已关注");
followName.setTextColor(Color.parseColor("#777777"));
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type_1));
} else {
ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like_follow, followIcon);
followName.setText("关注");
followName.setTextColor(getResources().getColor(R.color.white));
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type));
}
if (activeBean.getImg_or_video().equals("1")) {//图片
JSONArray jsonArray = (JSONArray) JSONArray.parse(activeBean.getImg_json());
List<String> tempList = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
tempList.add(String.valueOf(jsonArray.get(i)));
}
mNineGridLayout.setData(tempList);
} else {
ImgLoader.display(CommunityDetailsActivity.this, activeBean.getUser_avatar(), videoImage);
}
if (activeBean.getIs_love().equals("1")) {
ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like, like);
} else {
ImgLoader.display(CommunityDetailsActivity.this, R.mipmap.icon_like01, like);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
}
}

View File

@ -0,0 +1,347 @@
package com.yunbao.common.activity;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnDismissListener;
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.bigkoo.pickerview.view.TimePickerView;
import com.lzy.okgo.utils.HttpUtils;
import com.yunbao.common.R;
import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.OpenAdManager;
import com.yunbao.common.utils.ActiveImageAdapter;
import com.yunbao.common.utils.DateFormatUtil;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.ProcessResultUtil;
import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class CommunitySendActivity extends AbsActivity {
public static final int PERMISSION_REQUEST_CODE_IMG = 0;
public static final int PERMISSION_REQUEST_CODE_VIDEO = 1;
private RecyclerView mRecyclerViewImage;
private LinearLayout imgTextLayout;
private LinearLayout videoLayout;
private LinearLayout talkLayout;
private LinearLayout timeLayout;
private EditText content;
private TextView chooseTime;
private final int CHOOSE_IMG = 100;//Android 5.0以下的
private final int CHOOSE_VIDEO = 200;//Android 5.0以上的
private List<Uri> uriList = new ArrayList<>();
private Uri videoUri;
private ActiveImageAdapter activeImageAdapter;
private VideoView videoView;
private RelativeLayout videoViewLayout;
private ImageView delVideo;
private TextView talkContent;
private List<String> talkList = new ArrayList<>();
private TextView submit;
private boolean isImage;
@Override
protected int getLayoutId() {
return R.layout.activity_community_send;
}
@Override
protected void main() {
talkList.add("热门");
talkList.add("新秀");
talkList.add("颜值");
talkList.add("舞蹈");
talkList.add("男神");
talkList.add("音乐");
talkList.add("英语");
content = findViewById(R.id.content);
submit = findViewById(R.id.submit);
submit.setVisibility(View.VISIBLE);
talkContent = findViewById(R.id.talkContent);
delVideo = findViewById(R.id.delVideo);
videoViewLayout = findViewById(R.id.videoViewLayout);
videoView = findViewById(R.id.videoView);
imgTextLayout = findViewById(R.id.imgTextLayout);
videoLayout = findViewById(R.id.videoLayout);
talkLayout = findViewById(R.id.talkLayout);
timeLayout = findViewById(R.id.timeLayout);
chooseTime = findViewById(R.id.chooseTime);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
submit();
}
});
delVideo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
videoUri = null;
videoView.stopPlayback();
videoViewLayout.setVisibility(View.GONE);
}
});
talkLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showTalkChooseDialog();
}
});
timeLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showTimeChooseDialog();
}
});
imgTextLayout.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.TIRAMISU)
@Override
public void onClick(View v) {
String permission1 = Manifest.permission.READ_EXTERNAL_STORAGE;
String permission2 = Manifest.permission.WRITE_EXTERNAL_STORAGE;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permission1 = Manifest.permission.READ_MEDIA_IMAGES;
permission2 = Manifest.permission.READ_MEDIA_VIDEO;
}
int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
openImageChooserActivity();
} else {
//申请权限
ActivityCompat.requestPermissions(CommunitySendActivity.this, new String[]{permission1, permission2}, PERMISSION_REQUEST_CODE_IMG);
}
}
});
videoLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String permission1 = Manifest.permission.READ_EXTERNAL_STORAGE;
String permission2 = Manifest.permission.WRITE_EXTERNAL_STORAGE;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permission1 = Manifest.permission.READ_MEDIA_IMAGES;
permission2 = Manifest.permission.READ_MEDIA_VIDEO;
}
int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
openVideoChooserActivity();
} else {
//申请权限
ActivityCompat.requestPermissions(CommunitySendActivity.this, new String[]{permission1, permission2}, PERMISSION_REQUEST_CODE_VIDEO);
}
}
});
mRecyclerViewImage = findViewById(R.id.recyclerView_image);
mRecyclerViewImage.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false));
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 15, 15);
decoration.setOnlySetItemOffsetsButNoDraw(true);
mRecyclerViewImage.addItemDecoration(decoration);
activeImageAdapter = new ActiveImageAdapter(CommunitySendActivity.this);
mRecyclerViewImage.setAdapter(activeImageAdapter);
mRecyclerViewImage.setVisibility(View.VISIBLE);
activeImageAdapter.setActionListener(new ActiveImageAdapter.ActionListener() {
@Override
public void onAddClick() {
}
@Override
public void onItemClick(int position) {
}
@Override
public void onDeleteAll() {
}
@Override
public void onDel(int position) {
}
});
}
private void submit() {
StringBuffer files = new StringBuffer();
if (isImage) {
for (int i = 0; i < uriList.size(); i++) {
if (i == 0) {
files.append(uri2File(uriList.get(i)).getPath());
} else {
files.append("," + uri2File(uriList.get(i)).getPath());
}
}
} else {
files.append(uri2File(videoUri).getPath());
}
CommonHttpUtil.pushCommunity(isImage, content.getText().toString(), "1", files.toString(), chooseTime.getText().toString(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
private void showTalkChooseDialog() {
OptionsPickerView pickerView = new OptionsPickerBuilder(CommunitySendActivity.this, new OnOptionsSelectListener() {
@Override
public void onOptionsSelect(int options1, int options2, int options3, View v) {
talkContent.setText(talkList.get(options1));
}
}).setTitleText("选择话题").setContentTextSize(16).build();
pickerView.setPicker(talkList, null, null);
pickerView.show();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_CODE_IMG) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
openImageChooserActivity();
} else {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE_IMG);
}
}
if (requestCode == PERMISSION_REQUEST_CODE_VIDEO) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
openVideoChooserActivity();
} else {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE_VIDEO);
}
}
}
public void showTimeChooseDialog() {
TimePickerView timePickerView = new TimePickerBuilder(CommunitySendActivity.this, new OnTimeSelectListener() {
@SuppressLint("SetTextI18n")
@Override
public void onTimeSelect(Date date, View v) {
chooseTime.setText(DateFormatUtil.getTimeStrings(date.getTime()));
}
}).setType(new boolean[]{true, true, true, true, true, false})// 默认全部显示
.setCancelText("Cancel")//取消按钮文字
.setSubmitText("Sure")//确认按钮文字
.setTitleSize(20)//标题文字大小
.setTitleText("Title")//标题文字
.setOutSideCancelable(false)//点击屏幕点在控件外部范围时是否取消显示
.isCyclic(true)//是否循环滚动
.setLabel("", "", "", "", "", "")//默认设置为年月日时分秒
.isCenterLabel(false) //是否只显示中间选中项的label文字false则每项item全部都带有label
.build();
timePickerView.show();
timePickerView.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(Object o) {
}
});
}
private void openImageChooserActivity() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(intent, CHOOSE_IMG);
}
private void openVideoChooserActivity() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("video/*");
startActivityForResult(intent, CHOOSE_VIDEO);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == CHOOSE_IMG) {
// 获取用户选择的图片 URI
Uri[] imageUris = null;
if (data != null) {
ClipData clipData = data.getClipData();
if (clipData != null) {
// 如果支持多选则通过 getItemAt() 方法获取每个被选中的图片 URI
imageUris = new Uri[clipData.getItemCount()];
List<String> tempList = new ArrayList<>();
for (int i = 0; i < clipData.getItemCount(); i++) {
imageUris[i] = clipData.getItemAt(i).getUri();
File file = new File(uri2File(imageUris[i]).getPath());
tempList.add(file.getPath());
L.e("imageUris:" + imageUris[i].getPath() + "_" + imageUris[i].getEncodedPath());
}
activeImageAdapter.insertList(tempList);
} else {
// 单选情况下直接获取图片 URI
imageUris = new Uri[]{data.getData()};
uriList.add(imageUris[0]);
List<String> tempList = new ArrayList<>();
File file = new File(uri2File(imageUris[0]).getPath());
tempList.add(file.getPath());
activeImageAdapter.insertList(tempList);
}
}
isImage = true;
} else if (requestCode == CHOOSE_VIDEO && resultCode == RESULT_OK && data != null) {
Uri uri = data.getData();
videoUri = uri;
videoView.setVideoURI(videoUri);
videoView.start();
videoViewLayout.setVisibility(View.VISIBLE);
isImage = false;
}
}
private File uri2File(Uri uri) {
String img_path;
String[] proj = {MediaStore.Images.Media.DATA};
Cursor actualimagecursor = this.managedQuery(uri, proj, null, null, null);
if (actualimagecursor == null) {
img_path = uri.getPath();
} else {
int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
actualimagecursor.moveToFirst();
img_path = actualimagecursor.getString(actual_image_column_index);
}
File file = new File(img_path);
return file;
}
}

View File

@ -0,0 +1,387 @@
package com.yunbao.common.activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Outline;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import com.alibaba.fastjson.JSONArray;
import com.makeramen.roundedimageview.RoundedImageView;
import com.ms.banner.Banner;
import com.ms.banner.listener.OnBannerClickListener;
import com.xuexiang.xui.widget.flowlayout.FlowTagLayout;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.R;
import com.yunbao.common.adapter.LabelTagAdapter;
import com.yunbao.common.adapter.UserCommunityAdapter;
import com.yunbao.common.adapter.UserHomeImgAdapter;
import com.yunbao.common.bean.ActiveOtherBean;
import com.yunbao.common.bean.HomeUserExhibitInfoBean;
import com.yunbao.common.bean.HomeUserInfoBean;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LabelBean;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.bean.UserHomeImgBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.UserHomeImgsViewHolder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class UserHomeActivity extends AbsActivity {
private String uid;
private Banner mBanner;
private RecyclerView imgsRecyclerView;
private UserHomeImgAdapter userHomeImgAdapter;
private List<String> bannerImgList = new ArrayList<>();
private List<UserHomeImgBean> tempList;
private RoundedImageView avatar;
private TextView userName;
private TextView fansCount;
private TextView likeCount;
private LinearLayout followLayout;
private ImageView followIcon;
private TextView followName;
private TextView userId;
private TextView userStatus;
private ImageView userStatusIcon;
private ImageView user_sex;
private ImageView authorIcon;
private TextView level;
private ImageView levelIcon;
private TextView vipLevel;
private LinearLayout authenticationLayout;
private TextView signature;
private LinearLayout moreLayout;
private TextView moreText;
private ImageView moreIcon;
private HomeUserInfoBean userInfo;
RecyclerView communityRecyclerView;
private LinearLayout itemLayout01;
private LinearLayout itemLayout02;
private LinearLayout itemLayout03;
private LinearLayout itemLayout04;
FlowTagLayout myFlowTag; //我的标签
LabelTagAdapter myAdapter;
private boolean isShowcase;
private boolean isAnchor;
private RelativeLayout userPresidentLayout;
private TextView userPresidentName;
private RelativeLayout authorLayout;
private RelativeLayout levelLayout;
private RoundedImageView fansImg1;
private RoundedImageView fansImg2;
private RoundedImageView fansImg3;
private List<RoundedImageView> fansImgViewList = new ArrayList<>();
public static void forwardUserHomeActivity(Context content, String uid) {
Intent intent = new Intent(content, UserHomeActivity.class);
intent.putExtra(Constants.TO_UID, uid);
content.startActivity(intent);
}
@Override
protected int getLayoutId() {
return R.layout.activity_user_home;
}
@Override
protected void create() {
super.create();
}
@Override
protected void main() {
uid = getIntent().getStringExtra(Constants.TO_UID);
if (StringUtil.isEmpty(uid)) {
ToastUtil.show("用户不存在");
finish();
return;
}
initView();
getUseData();
getCommunityList();
}
private void getCommunityList() {
CommonHttpUtil.getOtherDynamicList(uid, new com.yunbao.common.http.HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
List<ActiveOtherBean> beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class);
UserCommunityAdapter userCommunityAdapter = new UserCommunityAdapter(mContext, beanList);
communityRecyclerView.setAdapter(userCommunityAdapter);
}
});
}
private void initData(HomeUserInfoBean userInfoBean) {
userInfo = userInfoBean;
if (!userInfo.getCheckBlack().get(0).getU2t().equals("0")) {
ToastUtil.show("已拉黑,无法查看");
finish();
return;
}
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getUser_president_name())) {
userPresidentLayout.setVisibility(View.VISIBLE);
userPresidentName.setText(userInfo.getUserHomeTopInfo().getUser_president_name());
}
isAnchor = userInfo.getUserHomeTopInfo().getIs_anchor() == 1;
ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_avatar(), avatar);
userName.setText(userInfo.getUserHomeTopInfo().getUser_name());//用户名称
fansCount.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_fans_num()));//粉丝数量
likeCount.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_love_num()));//关注数量
userId.setText("ID:" + userInfo.getUserHomeTopInfo().getUser_id());//用户ID
userStatus.setText("");//认证状态
ImgLoader.display(UserHomeActivity.this, Integer.parseInt(String.valueOf(userInfo.getUserHomeTopInfo().getUser_sex())) == 0 ? R.mipmap.icon_man_new : R.mipmap.icon_wumen, user_sex);
ImgLoader.display(UserHomeActivity.this, CommonAppConfig.HOST + userInfo.getUserHomeTopInfo().getUser_level_anchor_img(), authorIcon);
ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_level_img(), levelIcon);
if (isAnchor) {//是否是主播
authorLayout.setVisibility(View.VISIBLE);
levelLayout.setVisibility(View.VISIBLE);
authenticationLayout.setVisibility(View.VISIBLE);
itemLayout01.setVisibility(View.VISIBLE);
itemLayout02.setVisibility(View.VISIBLE);
itemLayout03.setVisibility(View.VISIBLE);
itemLayout04.setVisibility(View.VISIBLE);
} else {
authorLayout.setVisibility(View.GONE);
authenticationLayout.setVisibility(View.GONE);
itemLayout03.setVisibility(View.VISIBLE);
itemLayout04.setVisibility(View.VISIBLE);
}
signature.setText(userInfo.getUserHomeTopInfo().getUser_signature());//个性签名
//标签
myAdapter = new LabelTagAdapter(mContext, new LabelTagAdapter.OnSureOnClickListener() {
@Override
public void sure(LabelBean.Children labelBean) {
}
});
if (userInfo.getUserHomeTopInfo().getCn_label() != null) {
if (userInfo.getUserHomeTopInfo().getCn_label().size() > 0) {
myFlowTag.setAdapter(myAdapter);
myFlowTag.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_NONE);
myAdapter.setData(userInfo.getUserHomeTopInfo().getCn_label());
}
}
mBanner.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, 0, 0, 0);
}
});
mBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
bannerImgList = userInfo.getUserHomeTopInfo().getUser_home_banner();
tempList = new ArrayList<>();
for (int i = 0; i < bannerImgList.size(); i++) {
tempList.add(new UserHomeImgBean(bannerImgList.get(i)));
}
tempList.get(0).setShow(true);
userHomeImgAdapter = new UserHomeImgAdapter(UserHomeActivity.this, tempList);
imgsRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
imgsRecyclerView.setAdapter(userHomeImgAdapter);
userHomeImgAdapter.setOnItemClickListener(new UserHomeImgAdapter.onItemClickListener() {
@Override
public void onImgItem(UserHomeImgBean activeBean, int position) {
mBanner.onPageSelected(position);
mBanner.setCurrentPage(position);
for (int i = 0; i < tempList.size(); i++) {
if (i == position) {
tempList.get(i).setShow(true);
} else {
tempList.get(i).setShow(false);
}
}
userHomeImgAdapter.setCommentBeanList(tempList);
}
});
mBanner.setAutoPlay(false).setPages(bannerImgList, new UserHomeImgsViewHolder()).setOnBannerClickListener(new OnBannerClickListener() {
@Override
public void onBannerClick(List datas, int position) {
}
}).start();
}
private void initView() {
fansImg1 = findViewById(R.id.fansImg1);
fansImg2 = findViewById(R.id.fansImg2);
fansImg3 = findViewById(R.id.fansImg3);
fansImgViewList = new ArrayList<>();
fansImgViewList.add(fansImg1);
fansImgViewList.add(fansImg2);
fansImgViewList.add(fansImg3);
authorLayout = findViewById(R.id.authorLayout);
levelLayout = findViewById(R.id.levelLayout);
userPresidentLayout = findViewById(R.id.userPresidentLayout);
userPresidentName = findViewById(R.id.userPresidentName);
itemLayout01 = findViewById(R.id.itemLayout01);
itemLayout02 = findViewById(R.id.itemLayout02);
itemLayout03 = findViewById(R.id.itemLayout03);
itemLayout04 = findViewById(R.id.itemLayout04);
communityRecyclerView = findViewById(R.id.communityRecyclerView);
myFlowTag = findViewById(R.id.myFlowTag);
avatar = findViewById(R.id.avatar);
userName = findViewById(R.id.name);
fansCount = findViewById(R.id.fansCount);
likeCount = findViewById(R.id.likeCount);
followLayout = findViewById(R.id.followLayout);
followName = findViewById(R.id.followName);
followIcon = findViewById(R.id.followIcon);
userId = findViewById(R.id.userId);
userStatus = findViewById(R.id.userStatus);
userStatusIcon = findViewById(R.id.userStatusIcon);
user_sex = findViewById(R.id.user_sex);
levelIcon = findViewById(R.id.levelIcon);
level = findViewById(R.id.level);
authorIcon = findViewById(R.id.authorlIcon);
authenticationLayout = findViewById(R.id.authenticationLayout);
signature = findViewById(R.id.signature);
moreLayout = findViewById(R.id.moreLayout);
moreText = findViewById(R.id.moreText);
moreIcon = findViewById(R.id.moreIcon);
mBanner = findViewById(R.id.banner);
imgsRecyclerView = findViewById(R.id.imgsRecyclerView);
communityRecyclerView = findViewById(R.id.communityRecyclerView);
communityRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
communityRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
followLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CommonHttpUtil.setAttention(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()), new CommonCallback<Integer>() {
@Override
public void callback(Integer isAttention) {
if (isAttention == 1) {
ImgLoader.display(UserHomeActivity.this, R.mipmap.icon_like_followed, followIcon);
followName.setText("已关注");
followName.setTextColor(Color.parseColor("#777777"));
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type_1));
} else {
ImgLoader.display(UserHomeActivity.this, R.mipmap.icon_like_follow, followIcon);
followName.setText("关注");
followName.setTextColor(getResources().getColor(R.color.white));
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type));
}
}
});
}
});
moreLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isShowcase) {
if (isAnchor) {
itemLayout01.setVisibility(View.GONE);
itemLayout02.setVisibility(View.GONE);
itemLayout03.setVisibility(View.GONE);
itemLayout04.setVisibility(View.GONE);
} else {
itemLayout03.setVisibility(View.GONE);
itemLayout04.setVisibility(View.GONE);
}
moreText.setText("查看更多");
ImgLoader.display(mContext, R.mipmap.icon_down, moreIcon);
} else {
if (isAnchor) {
itemLayout01.setVisibility(View.VISIBLE);
itemLayout02.setVisibility(View.VISIBLE);
itemLayout03.setVisibility(View.VISIBLE);
itemLayout04.setVisibility(View.VISIBLE);
} else {
itemLayout01.setVisibility(View.GONE);
itemLayout02.setVisibility(View.GONE);
}
moreText.setText("收起");
ImgLoader.display(mContext, R.mipmap.icon_up, moreIcon);
}
isShowcase = !isShowcase;
}
});
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
private void getUseData() {
LiveNetManager.get(mContext).getUserHomeInfo(uid, new HttpCallback<HomeUserInfoBean>() {
@Override
public void onSuccess(HomeUserInfoBean data) {
initData(data);
}
@Override
public void onError(String error) {
}
});
LiveNetManager.get(mContext).getUserExhibitInfoInfo(uid, new HttpCallback<HomeUserExhibitInfoBean>() {
@Override
public void onSuccess(HomeUserExhibitInfoBean data) {
if (data.getUserHomeTopInfo().getFans().getList() != null) {
for (int i = 0; i < data.getUserHomeTopInfo().getFans().getList().size(); i++) {
ImgLoader.display(mContext, data.getUserHomeTopInfo().getFans().getList().get(i).getAvatar(), fansImgViewList.get(i));
}
}
}
@Override
public void onError(String error) {
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
}
}

View File

@ -0,0 +1,220 @@
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 android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R;
import com.yunbao.common.bean.CommentBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.views.TopGradual;
import java.util.ArrayList;
import java.util.List;
public class CommentAdapter extends RecyclerView.Adapter {
private List<CommentBean> commentBeanList;
private Context mContext;
private String authorId;
private String myUid;
private onItemClickListener onItemClickListener;
public void setOnItemClickListener(CommentAdapter.onItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
public CommentAdapter(Context content, List<CommentBean> commentBeanList, String authorId) {
this.mContext = content;
this.commentBeanList = commentBeanList;
this.authorId = authorId;
myUid = CommonAppConfig.getInstance().getUid();
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_comment_view, 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;
private TextView name;
private TextView content;
private TextView report;
private TextView replyTextView;
private RoundedImageView mAvatar01;
private TextView replyContent;
private TextView replyCount;
private RecyclerView recyclerView;
private LinearLayout replyLayout;
private TextView firstName;
private TextView isAuth;
private TextView del;
private TextView author;
private TextView del1;
private TextView report1;
public CommentViewHolder(@NonNull View itemView) {
super(itemView);
firstName = itemView.findViewById(R.id.firstName);
mAvatar = itemView.findViewById(R.id.avatar);
name = itemView.findViewById(R.id.name);
content = itemView.findViewById(R.id.content);
replyTextView = itemView.findViewById(R.id.replyTextView);
report = itemView.findViewById(R.id.report);
mAvatar01 = itemView.findViewById(R.id.avatar01);
isAuth = itemView.findViewById(R.id.isAuth);
replyContent = itemView.findViewById(R.id.replyContent);
replyCount = itemView.findViewById(R.id.expand);
replyLayout = itemView.findViewById(R.id.replyLayout);
recyclerView = itemView.findViewById(R.id.recyclerView);
del = itemView.findViewById(R.id.del);
author = itemView.findViewById(R.id.author);
del1 = itemView.findViewById(R.id.del1);
report1 = itemView.findViewById(R.id.report1);
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);
}
}
});
del.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onItemClickListener != null) {
CommentBean bean = (CommentBean) v.getTag();
onItemClickListener.onDel(bean, 0);
}
}
});
}
@SuppressLint("SetTextI18n")
public void setData(CommentBean bean) {
report.setTag(bean);
replyTextView.setTag(bean);
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar);
name.setText(bean.getUser_name());
content.setText(bean.getContent());
if (bean.getUser_id().equals(authorId)) {
author.setVisibility(View.VISIBLE);
} else {
author.setVisibility(View.GONE);
}
if (bean.getUser_id().equals(myUid)) {
del.setVisibility(View.VISIBLE);
} else {
del.setVisibility(View.GONE);
}
if (bean.getReplyCommentList() != null) {
replyCount.setText("" + bean.getReplyCommentList().size() + "条回复>");
if (bean.getReplyCommentList().size() > 0) {
replyContent.setText(bean.getReplyCommentList().get(0).getContent());
ImgLoader.display(itemView.getContext(), bean.getReplyCommentList().get(0).getUser_avatar(), mAvatar01);
firstName.setText(bean.getReplyCommentList().get(0).getUser_name());
replyLayout.setVisibility(View.VISIBLE);
if (bean.getReplyCommentList().get(0).getUser_id().equals(authorId)) {
isAuth.setVisibility(View.VISIBLE);
} else {
isAuth.setVisibility(View.GONE);
}
if (bean.getUser_id().equals(myUid)) {
del.setVisibility(View.VISIBLE);
} else {
del.setVisibility(View.GONE);
}
} else {
replyLayout.setVisibility(View.GONE);
replyCount.setVisibility(View.GONE);
}
if (bean.getReplyCommentList().size() > 1) {
replyCount.setVisibility(View.VISIBLE);
replyLayout.setVisibility(View.VISIBLE);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
recyclerView.addItemDecoration(new TopGradual());
List<CommentBean.ReplyComment> tempList = new ArrayList<>();
tempList.addAll(bean.getReplyCommentList());
tempList.remove(0);
CommentReplyAdapter commentReplyAdapter = new CommentReplyAdapter(mContext, tempList, authorId);
commentReplyAdapter.setOnItemClickListener(new CommentReplyAdapter.onItemClickListener() {
@Override
public void onReport(CommentBean.ReplyComment activeBean) {
if (onItemClickListener != null) {
onItemClickListener.onReport(activeBean);
}
}
@Override
public void onDel(CommentBean.ReplyComment activeBean) {
if (onItemClickListener != null) {
onItemClickListener.onDel(activeBean);
}
}
});
recyclerView.setAdapter(commentReplyAdapter);
recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
replyCount.setOnClickListener(new View.OnClickListener() {
@Override
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());
}
});
}
}
}
}
public interface onItemClickListener {
void onReply(CommentBean activeBean);
void onReport(CommentBean activeBean);
void onDel(CommentBean activeBean, int position);
void onReport(CommentBean.ReplyComment activeBean);
void onDel(CommentBean.ReplyComment activeBean);
}
}

View File

@ -0,0 +1,115 @@
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 android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R;
import com.yunbao.common.bean.CommentBean;
import com.yunbao.common.glide.ImgLoader;
import java.util.List;
public class CommentReplyAdapter extends RecyclerView.Adapter {
private List<CommentBean.ReplyComment> commentBeanList;
private Context mContext;
private String authorId;
private String myUid;
private onItemClickListener onItemClickListener;
public void setOnItemClickListener(onItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
public CommentReplyAdapter(Context content, List<CommentBean.ReplyComment> commentBeanList, String authorId) {
this.mContext = content;
this.commentBeanList = commentBeanList;
this.authorId = authorId;
myUid = CommonAppConfig.getInstance().getUid();
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_comment_reply_view, parent, false);
return new CommentViewHolder(runGamesView);
}
@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 TextView name;
private RoundedImageView mAvatar01;
private TextView replyContent;
private TextView author;
private TextView del;
private TextView report;
public CommentViewHolder(@NonNull View itemView) {
super(itemView);
name = itemView.findViewById(R.id.name);
mAvatar01 = itemView.findViewById(R.id.avatar01);
replyContent = itemView.findViewById(R.id.replyContent);
author = itemView.findViewById(R.id.author);
del = itemView.findViewById(R.id.del);
report = itemView.findViewById(R.id.report);
del.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onItemClickListener != null) {
onItemClickListener.onDel((CommentBean.ReplyComment) v.getTag());
}
}
});
report.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onItemClickListener != null) {
onItemClickListener.onReport((CommentBean.ReplyComment) v.getTag());
}
}
});
}
@SuppressLint("SetTextI18n")
public void setData(CommentBean.ReplyComment bean) {
del.setTag(bean);
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar01);
name.setText(bean.getUser_name());
replyContent.setText(bean.getContent());
if (bean.getUser_id().equals(authorId)) {
author.setVisibility(View.VISIBLE);
} else {
author.setVisibility(View.GONE);
}
if (bean.getUser_id().equals(myUid)) {
del.setVisibility(View.VISIBLE);
} else {
del.setVisibility(View.GONE);
}
}
}
public interface onItemClickListener {
void onReport(CommentBean.ReplyComment activeBean);
void onDel(CommentBean.ReplyComment activeBean);
}
}

View File

@ -0,0 +1,112 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
/**
* Created by cxf on 2018/11/28.
*/
public class ImagePreviewAdapter extends RecyclerView.Adapter<ImagePreviewAdapter.Vh> {
private LayoutInflater mInflater;
private ActionListener mActionListener;
private int mPageCount;
private LinearLayoutManager mLayoutManager;
private int mCurPosition;
public ImagePreviewAdapter(Context context, int pageCount) {
mPageCount = pageCount;
mInflater = LayoutInflater.from(context);
}
@NonNull
@Override
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.item_preview_img, parent, false));
}
@Override
public void onBindViewHolder(@NonNull Vh vh, int position) {
vh.setData(position);
}
@Override
public int getItemCount() {
return mPageCount;
}
class Vh extends RecyclerView.ViewHolder {
ImageView mImg;
public Vh(View itemView) {
super(itemView);
mImg = (ImageView) itemView;
}
void setData(int position) {
if (mActionListener != null) {
mActionListener.loadImage(mImg, position);
}
}
}
public void setActionListener(ActionListener actionListener) {
mActionListener = actionListener;
}
public void setCurPosition(int curPosition) {
mCurPosition = curPosition;
if (mActionListener != null) {
mActionListener.onPageChanged(curPosition);
}
}
public int getCurPosition(){
return mCurPosition;
}
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
mLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
PagerSnapHelper pagerSnapHelper = new PagerSnapHelper();
pagerSnapHelper.attachToRecyclerView(recyclerView);
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
if (position >= 0 && mCurPosition != position) {
mCurPosition = position;
if (mActionListener != null) {
mActionListener.onPageChanged(position);
}
}
}
});
}
public interface ActionListener {
void onPageChanged(int position);
void loadImage(ImageView imageView, int position);
}
}

View File

@ -0,0 +1,47 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
import com.xuexiang.xui.widget.flowlayout.BaseTagAdapter;
import com.yunbao.common.R;
import com.yunbao.common.bean.LabelBean;
public class LabelTagAdapter extends BaseTagAdapter<String, TextView> {
OnSureOnClickListener onSureOnClickListener;
Context mContext;
public LabelTagAdapter(Context context, OnSureOnClickListener onSureOnClickListener) {
super(context);
this.onSureOnClickListener = onSureOnClickListener;
this.mContext = context;
}
public LabelTagAdapter(Context context) {
super(context);
}
@Override
protected TextView newViewHolder(View convertView) {
return (TextView) convertView.findViewById(R.id.tv_tag);
}
@Override
protected int getLayoutId() {
return R.layout.adapter_item_tag;
}
@Override
protected void convert(TextView textView, String item, int position) {
textView.setText(item);
textView.setTextColor(mContext.getResources().getColor(R.color.black2));
}
public interface OnSureOnClickListener {
void sure(LabelBean.Children labelBean);
}
}

View File

@ -0,0 +1,132 @@
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 android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveOtherBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.views.NineGridLayout;
import java.util.ArrayList;
import java.util.List;
public class UserCommunityAdapter extends RecyclerView.Adapter {
private List<ActiveOtherBean> commentBeanList;
private Context mContext;
private onItemClickListener onItemClickListener;
public void setOnItemClickListener(UserCommunityAdapter.onItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
public UserCommunityAdapter(Context content, List<ActiveOtherBean> 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.activity_user_community_item, 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;
private TextView userName;
private TextView time;
private TextView content;
private NineGridLayout nineGridLayout;
private RelativeLayout videoLayout;
private ImageView videoImage;
private TextView likeCount;
private TextView comCount;
private TextView shareCount;
public CommentViewHolder(@NonNull View itemView) {
super(itemView);
mAvatar = itemView.findViewById(R.id.avatar);
userName = itemView.findViewById(R.id.userName);
time = itemView.findViewById(R.id.time);
content = itemView.findViewById(R.id.content);
nineGridLayout = itemView.findViewById(R.id.nine_grid_layout);
videoLayout = itemView.findViewById(R.id.videoLayout);
videoImage = itemView.findViewById(R.id.videoImage);
likeCount = itemView.findViewById(R.id.likeCount);
comCount = itemView.findViewById(R.id.comCount);
shareCount = itemView.findViewById(R.id.shareCount);
mAvatar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemClickListener.onImgItem((String) v.getTag(), getPosition());
}
});
}
@SuppressLint("SetTextI18n")
public void setData(ActiveOtherBean bean) {
mAvatar.setTag(bean);
ImgLoader.display(mContext, bean.getUser_avatar(), mAvatar);
userName.setText(bean.getUser_name());
time.setText(bean.getCreate_time());
if (!StringUtil.isEmpty(bean.getContent())) {
content.setText(String.valueOf(JSONObject.parseObject(bean.getContent()).get("msg")));
}
likeCount.setText(String.valueOf(bean.getLove_num()));
comCount.setText(String.valueOf(bean.getComment_num()));
shareCount.setText(String.valueOf(bean.getShare_num()));
nineGridLayout.setActionListener(new NineGridLayout.ActionListener() {
@Override
public void onItemClick(List<?> dataList, int position) {
}
@Override
public void displayImage(Object path, ImageView imageView) {
ImgLoader.display(mContext, String.valueOf(path), imageView);
}
});
if (bean.getImg_or_video().equals("1")) {//图片
JSONArray jsonArray = (JSONArray) JSONArray.parse(bean.getImg_json());
List<String> tempList = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
tempList.add(String.valueOf(jsonArray.get(i)));
}
nineGridLayout.setData(tempList);
} else {
ImgLoader.display(mContext, bean.getUser_avatar(), videoImage);
}
}
}
public interface onItemClickListener {
void onImgItem(String activeBean, int position);
}
}

View File

@ -0,0 +1,95 @@
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 android.widget.ImageView;
import android.widget.LinearLayout;
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 List<UserHomeImgBean> getCommentBeanList() {
return commentBeanList;
}
public UserHomeImgAdapter(Context content, List<UserHomeImgBean> commentBeanList) {
this.mContext = content;
this.commentBeanList = commentBeanList;
}
public void setCommentBeanList(List<UserHomeImgBean> commentBeanList) {
this.commentBeanList = commentBeanList;
notifyDataSetChanged();
}
@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) holder).setData(commentBeanList.get(position), position);
}
@Override
public int getItemCount() {
return commentBeanList.size();
}
class CommentViewHolder extends RecyclerView.ViewHolder {
RoundedImageView mAvatar01;
RoundedImageView mAvatar02;
public CommentViewHolder(@NonNull View itemView) {
super(itemView);
mAvatar01 = itemView.findViewById(R.id.avatar01);
mAvatar02 = itemView.findViewById(R.id.avatar02);
}
@SuppressLint("SetTextI18n")
public void setData(UserHomeImgBean bean, int position) {
mAvatar01.setTag(bean);
mAvatar01.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemClickListener.onImgItem((UserHomeImgBean) v.getTag(), position);
}
});
ImgLoader.display(mContext, bean.getImgurl(), mAvatar01);
ImgLoader.display(mContext, bean.getImgurl(), mAvatar02);
if (bean.isShow()) {
mAvatar01.setVisibility(View.GONE);
mAvatar02.setVisibility(View.VISIBLE);
} else {
mAvatar01.setVisibility(View.VISIBLE);
mAvatar02.setVisibility(View.GONE);
}
}
}
public interface onItemClickListener {
void onImgItem(UserHomeImgBean activeBean, int position);
}
}

View File

@ -0,0 +1,281 @@
package com.yunbao.common.bean;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
/**
* 社區动态
*/
public class ActiveBean extends BaseModel implements Parcelable {
private String id;
private String img_or_video;
private String img_json;
private String video;
private String content;
private String talk_id;
private String love_num;
private String comment_num;
private String share_num;
private String gift_num;
private String hot_num;
private String create_time;
private String ai_content;
private String is_delete;
private String user_name;
private String user_avatar;
private String is_anchor;
private String is_live;
private String is_attention;
private String user_id;
private String talk_name;
private String is_love;
public ActiveBean() {
}
protected ActiveBean(Parcel in) {
id = in.readString();
img_or_video = in.readString();
img_json = in.readString();
video = in.readString();
content = in.readString();
talk_id = in.readString();
love_num = in.readString();
comment_num = in.readString();
share_num = in.readString();
gift_num = in.readString();
hot_num = in.readString();
create_time = in.readString();
ai_content = in.readString();
is_delete = in.readString();
user_name = in.readString();
user_avatar = in.readString();
is_anchor = in.readString();
is_live = in.readString();
is_attention = in.readString();
user_id = in.readString();
talk_name = in.readString();
is_love = in.readString();
}
public static final Creator<ActiveBean> CREATOR = new Creator<ActiveBean>() {
@Override
public ActiveBean createFromParcel(Parcel in) {
return new ActiveBean(in);
}
@Override
public ActiveBean[] newArray(int size) {
return new ActiveBean[size];
}
};
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getImg_or_video() {
return img_or_video;
}
public void setImg_or_video(String img_or_video) {
this.img_or_video = img_or_video;
}
public String getImg_json() {
return img_json;
}
public void setImg_json(String img_json) {
this.img_json = img_json;
}
public String getVideo() {
return video;
}
public void setVideo(String video) {
this.video = video;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTalk_id() {
return talk_id;
}
public void setTalk_id(String talk_id) {
this.talk_id = talk_id;
}
public String getLove_num() {
return love_num;
}
public void setLove_num(String love_num) {
this.love_num = love_num;
}
public String getComment_num() {
return comment_num;
}
public void setComment_num(String comment_num) {
this.comment_num = comment_num;
}
public String getShare_num() {
return share_num;
}
public void setShare_num(String share_num) {
this.share_num = share_num;
}
public String getGift_num() {
return gift_num;
}
public void setGift_num(String gift_num) {
this.gift_num = gift_num;
}
public String getHot_num() {
return hot_num;
}
public void setHot_num(String hot_num) {
this.hot_num = hot_num;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getAi_content() {
return ai_content;
}
public void setAi_content(String ai_content) {
this.ai_content = ai_content;
}
public String getIs_delete() {
return is_delete;
}
public void setIs_delete(String is_delete) {
this.is_delete = is_delete;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_avatar() {
return user_avatar;
}
public void setUser_avatar(String user_avatar) {
this.user_avatar = user_avatar;
}
public String getIs_anchor() {
return is_anchor;
}
public void setIs_anchor(String is_anchor) {
this.is_anchor = is_anchor;
}
public String getIs_live() {
return is_live;
}
public void setIs_live(String is_live) {
this.is_live = is_live;
}
public String getIs_attention() {
return is_attention;
}
public void setIs_attention(String is_attention) {
this.is_attention = is_attention;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getTalk_name() {
return talk_name;
}
public void setTalk_name(String talk_name) {
this.talk_name = talk_name;
}
public String getIs_love() {
return is_love;
}
public void setIs_love(String is_love) {
this.is_love = is_love;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(img_or_video);
dest.writeString(img_json);
dest.writeString(video);
dest.writeString(content);
dest.writeString(talk_id);
dest.writeString(love_num);
dest.writeString(comment_num);
dest.writeString(share_num);
dest.writeString(gift_num);
dest.writeString(hot_num);
dest.writeString(create_time);
dest.writeString(ai_content);
dest.writeString(is_delete);
dest.writeString(user_name);
dest.writeString(user_avatar);
dest.writeString(is_anchor);
dest.writeString(is_live);
dest.writeString(is_attention);
dest.writeString(user_id);
dest.writeString(talk_name);
dest.writeString(is_love);
}
}

View File

@ -0,0 +1,23 @@
package com.yunbao.common.bean;
import java.io.File;
public class ActiveImageBean {
private File mImageFile;
public ActiveImageBean() {
}
public ActiveImageBean(File imageFile) {
mImageFile = imageFile;
}
public File getImageFile() {
return mImageFile;
}
public void setImageFile(File imageFile) {
mImageFile = imageFile;
}
}

View File

@ -0,0 +1,281 @@
package com.yunbao.common.bean;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
/**
* 社區动态
*/
public class ActiveOtherBean extends BaseModel implements Parcelable {
private String id;
private String img_or_video;
private String img_json;
private String video;
private String content;
private String talk_id;
private String love_num;
private String comment_num;
private String share_num;
private String gift_num;
private String hot_num;
private String create_time;
private String ai_content;
private String is_delete;
private String user_name;
private String user_avatar;
private String is_anchor;
private String is_live;
private String is_attention;
private String user_id;
private String talk_name;
private String is_love;
public ActiveOtherBean() {
}
protected ActiveOtherBean(Parcel in) {
id = in.readString();
img_or_video = in.readString();
img_json = in.readString();
video = in.readString();
content = in.readString();
talk_id = in.readString();
love_num = in.readString();
comment_num = in.readString();
share_num = in.readString();
gift_num = in.readString();
hot_num = in.readString();
create_time = in.readString();
ai_content = in.readString();
is_delete = in.readString();
user_name = in.readString();
user_avatar = in.readString();
is_anchor = in.readString();
is_live = in.readString();
is_attention = in.readString();
user_id = in.readString();
talk_name = in.readString();
is_love = in.readString();
}
public static final Creator<ActiveOtherBean> CREATOR = new Creator<ActiveOtherBean>() {
@Override
public ActiveOtherBean createFromParcel(Parcel in) {
return new ActiveOtherBean(in);
}
@Override
public ActiveOtherBean[] newArray(int size) {
return new ActiveOtherBean[size];
}
};
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getImg_or_video() {
return img_or_video;
}
public void setImg_or_video(String img_or_video) {
this.img_or_video = img_or_video;
}
public String getImg_json() {
return img_json;
}
public void setImg_json(String img_json) {
this.img_json = img_json;
}
public String getVideo() {
return video;
}
public void setVideo(String video) {
this.video = video;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTalk_id() {
return talk_id;
}
public void setTalk_id(String talk_id) {
this.talk_id = talk_id;
}
public String getLove_num() {
return love_num;
}
public void setLove_num(String love_num) {
this.love_num = love_num;
}
public String getComment_num() {
return comment_num;
}
public void setComment_num(String comment_num) {
this.comment_num = comment_num;
}
public String getShare_num() {
return share_num;
}
public void setShare_num(String share_num) {
this.share_num = share_num;
}
public String getGift_num() {
return gift_num;
}
public void setGift_num(String gift_num) {
this.gift_num = gift_num;
}
public String getHot_num() {
return hot_num;
}
public void setHot_num(String hot_num) {
this.hot_num = hot_num;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getAi_content() {
return ai_content;
}
public void setAi_content(String ai_content) {
this.ai_content = ai_content;
}
public String getIs_delete() {
return is_delete;
}
public void setIs_delete(String is_delete) {
this.is_delete = is_delete;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_avatar() {
return user_avatar;
}
public void setUser_avatar(String user_avatar) {
this.user_avatar = user_avatar;
}
public String getIs_anchor() {
return is_anchor;
}
public void setIs_anchor(String is_anchor) {
this.is_anchor = is_anchor;
}
public String getIs_live() {
return is_live;
}
public void setIs_live(String is_live) {
this.is_live = is_live;
}
public String getIs_attention() {
return is_attention;
}
public void setIs_attention(String is_attention) {
this.is_attention = is_attention;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getTalk_name() {
return talk_name;
}
public void setTalk_name(String talk_name) {
this.talk_name = talk_name;
}
public String getIs_love() {
return is_love;
}
public void setIs_love(String is_love) {
this.is_love = is_love;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(img_or_video);
dest.writeString(img_json);
dest.writeString(video);
dest.writeString(content);
dest.writeString(talk_id);
dest.writeString(love_num);
dest.writeString(comment_num);
dest.writeString(share_num);
dest.writeString(gift_num);
dest.writeString(hot_num);
dest.writeString(create_time);
dest.writeString(ai_content);
dest.writeString(is_delete);
dest.writeString(user_name);
dest.writeString(user_avatar);
dest.writeString(is_anchor);
dest.writeString(is_live);
dest.writeString(is_attention);
dest.writeString(user_id);
dest.writeString(talk_name);
dest.writeString(is_love);
}
}

View File

@ -0,0 +1,238 @@
package com.yunbao.common.bean;
import java.util.List;
/**
* 社區动态
*/
public class CommentBean extends BaseModel {
private String id;
private String dynamic_id;
private String uid;
private String to_comment_id;
private String content;
private String create_time;
private String status;
private String is_dynamic_user;
private String user_name;
private String user_id;
private String user_avatar;
private List<ReplyComment> child;
public List<ReplyComment> getChild() {
return child;
}
public void setChild(List<ReplyComment> child) {
this.child = child;
}
private boolean isShow;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDynamic_id() {
return dynamic_id;
}
public void setDynamic_id(String dynamic_id) {
this.dynamic_id = dynamic_id;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getTo_comment_id() {
return to_comment_id;
}
public void setTo_comment_id(String to_comment_id) {
this.to_comment_id = to_comment_id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getIs_dynamic_user() {
return is_dynamic_user;
}
public void setIs_dynamic_user(String is_dynamic_user) {
this.is_dynamic_user = is_dynamic_user;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getUser_avatar() {
return user_avatar;
}
public void setUser_avatar(String user_avatar) {
this.user_avatar = user_avatar;
}
public List<ReplyComment> getReplyCommentList() {
return child;
}
public void setReplyCommentList(List<ReplyComment> replyCommentList) {
this.child = replyCommentList;
}
public boolean isShow() {
return isShow;
}
public void setShow(boolean show) {
isShow = show;
}
public static class ReplyComment {
private String id;
private String dynamic_id;
private String uid;
private String to_comment_id;
private String content;
private String create_time;
private String status;
private String is_dynamic_user;
private String user_name;
private String user_id;
private String user_avatar;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDynamic_id() {
return dynamic_id;
}
public void setDynamic_id(String dynamic_id) {
this.dynamic_id = dynamic_id;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getTo_comment_id() {
return to_comment_id;
}
public void setTo_comment_id(String to_comment_id) {
this.to_comment_id = to_comment_id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getIs_dynamic_user() {
return is_dynamic_user;
}
public void setIs_dynamic_user(String is_dynamic_user) {
this.is_dynamic_user = is_dynamic_user;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getUser_avatar() {
return user_avatar;
}
public void setUser_avatar(String user_avatar) {
this.user_avatar = user_avatar;
}
}
}

View File

@ -0,0 +1,137 @@
package com.yunbao.common.bean;
import java.util.List;
public class HomeUserExhibitInfoBean extends BaseModel {
public UserHomeTopInfo userHomeTopInfo;
public List<GiftAlreadyWall> giftAlreadyWall;
public List<GiftAlreadyWall> getGiftAlreadyWall() {
return giftAlreadyWall;
}
public void setGiftAlreadyWall(List<GiftAlreadyWall> giftAlreadyWall) {
this.giftAlreadyWall = giftAlreadyWall;
}
public UserHomeTopInfo getUserHomeTopInfo() {
return userHomeTopInfo;
}
public void setUserHomeTopInfo(UserHomeTopInfo userHomeTopInfo) {
this.userHomeTopInfo = userHomeTopInfo;
}
public class UserHomeTopInfo {
Fans fans;
public Fans getFans() {
return fans;
}
public void setFans(Fans fans) {
this.fans = fans;
}
public class Fans {
public List<AvatarList> list;
public String fans_name;
public String getFans_name() {
return fans_name;
}
public void setFans_name(String fans_name) {
this.fans_name = fans_name;
}
public List<AvatarList> getList() {
return list;
}
public void setList(List<AvatarList> list) {
this.list = list;
}
public class AvatarList {
String avatar;
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
}
}
public class Guard {
String avatar;
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
}
public class Dress {
String display_src;
public String getDisplay_src() {
return display_src;
}
public void setDisplay_src(String display_src) {
this.display_src = display_src;
}
}
}
public class GiftAlreadyWall {
private String gift_wall_lighten_number;
private String gift_wall_lighten_total;
private List<GiftWall> gift_wall;
public String getGift_wall_lighten_number() {
return gift_wall_lighten_number;
}
public void setGift_wall_lighten_number(String gift_wall_lighten_number) {
this.gift_wall_lighten_number = gift_wall_lighten_number;
}
public String getGift_wall_lighten_total() {
return gift_wall_lighten_total;
}
public void setGift_wall_lighten_total(String gift_wall_lighten_total) {
this.gift_wall_lighten_total = gift_wall_lighten_total;
}
public List<GiftWall> getGift_wall() {
return gift_wall;
}
public void setGift_wall(List<GiftWall> gift_wall) {
this.gift_wall = gift_wall;
}
public class GiftWall {
private String gifticon;
public String getGifticon() {
return gifticon;
}
public void setGifticon(String gifticon) {
this.gifticon = gifticon;
}
}
}
}

View File

@ -0,0 +1,255 @@
package com.yunbao.common.bean;
import java.util.List;
public class HomeUserInfoBean extends BaseModel {
public UserHomeTopInfo userHomeTopInfo;
public List<CheckBlack> checkBlack;
public UserHomeTopInfo getUserHomeTopInfo() {
return userHomeTopInfo;
}
public void setUserHomeTopInfo(UserHomeTopInfo userHomeTopInfo) {
this.userHomeTopInfo = userHomeTopInfo;
}
public List<CheckBlack> getCheckBlack() {
return checkBlack;
}
public void setCheckBlack(List<CheckBlack> checkBlack) {
this.checkBlack = checkBlack;
}
public class UserHomeTopInfo {
private long user_id;
private String user_name;
private String user_avatar;
private String user_signature;
private int user_sex;
private String user_level;
private String user_level_anchor;
private String user_goodnum;
private String user_level_img;
private String user_level_anchor_img;
private String user_president_name;
private int user_fans_num;
private int user_love_num;
private List<String> user_home_banner;
private int is_live;
private int is_anchor;
private String fans_name;
private int is_attention;
private String user_avatar_frame;
private List<String> cn_label;
private List<String> en_label;
public List<String> getCn_label() {
return cn_label;
}
public void setCn_label(List<String> cn_label) {
this.cn_label = cn_label;
}
public List<String> getEn_label() {
return en_label;
}
public void setEn_label(List<String> en_label) {
this.en_label = en_label;
}
public void setUser_id(long user_id) {
this.user_id = user_id;
}
public long getUser_id() {
return user_id;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_name() {
return user_name;
}
public void setUser_avatar(String user_avatar) {
this.user_avatar = user_avatar;
}
public String getUser_avatar() {
return user_avatar;
}
public void setUser_signature(String user_signature) {
this.user_signature = user_signature;
}
public String getUser_signature() {
return user_signature;
}
public void setUser_sex(int user_sex) {
this.user_sex = user_sex;
}
public int getUser_sex() {
return user_sex;
}
public void setUser_level(String user_level) {
this.user_level = user_level;
}
public String getUser_level() {
return user_level;
}
public void setUser_level_anchor(String user_level_anchor) {
this.user_level_anchor = user_level_anchor;
}
public String getUser_level_anchor() {
return user_level_anchor;
}
public void setUser_goodnum(String user_goodnum) {
this.user_goodnum = user_goodnum;
}
public String getUser_goodnum() {
return user_goodnum;
}
public void setUser_level_img(String user_level_img) {
this.user_level_img = user_level_img;
}
public String getUser_level_img() {
return user_level_img;
}
public void setUser_level_anchor_img(String user_level_anchor_img) {
this.user_level_anchor_img = user_level_anchor_img;
}
public String getUser_level_anchor_img() {
return user_level_anchor_img;
}
public void setUser_president_name(String user_president_name) {
this.user_president_name = user_president_name;
}
public String getUser_president_name() {
return user_president_name;
}
public void setUser_fans_num(int user_fans_num) {
this.user_fans_num = user_fans_num;
}
public int getUser_fans_num() {
return user_fans_num;
}
public void setUser_love_num(int user_love_num) {
this.user_love_num = user_love_num;
}
public int getUser_love_num() {
return user_love_num;
}
public void setUser_home_banner(List<String> user_home_banner) {
this.user_home_banner = user_home_banner;
}
public List<String> getUser_home_banner() {
return user_home_banner;
}
public void setIs_live(int is_live) {
this.is_live = is_live;
}
public int getIs_live() {
return is_live;
}
public void setIs_anchor(int is_anchor) {
this.is_anchor = is_anchor;
}
public int getIs_anchor() {
return is_anchor;
}
public void setFans_name(String fans_name) {
this.fans_name = fans_name;
}
public String getFans_name() {
return fans_name;
}
public void setIs_attention(int is_attention) {
this.is_attention = is_attention;
}
public int getIs_attention() {
return is_attention;
}
public void setUser_avatar_frame(String user_avatar_frame) {
this.user_avatar_frame = user_avatar_frame;
}
public String getUser_avatar_frame() {
return user_avatar_frame;
}
}
public class CheckBlack {
private String uidIsAuth;
private String touidIsAuth;
private String u2t;
private String t2u;
public String getUidIsAuth() {
return uidIsAuth;
}
public void setUidIsAuth(String uidIsAuth) {
this.uidIsAuth = uidIsAuth;
}
public String getTouidIsAuth() {
return touidIsAuth;
}
public void setTouidIsAuth(String touidIsAuth) {
this.touidIsAuth = touidIsAuth;
}
public String getU2t() {
return u2t;
}
public void setU2t(String u2t) {
this.u2t = u2t;
}
public String getT2u() {
return t2u;
}
public void setT2u(String t2u) {
this.t2u = t2u;
}
}
}

View File

@ -0,0 +1,128 @@
package com.yunbao.common.bean;
import java.util.ArrayList;
import java.util.List;
public class LabelBean extends BaseModel {
private int id;
private int pid;
private String cn_title;
private String en_title;
private List<Children> children;
public static class Children {
private int id;
private int pid;
private String cn_title;
private String en_title;
private List<Children> children;
private boolean isSelect;
public boolean isSelect() {
return isSelect;
}
public void setSelect(boolean select) {
isSelect = select;
}
public Children() {
}
public Children(int id, String cn_title) {
this.id = id;
this.cn_title = cn_title;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getCn_title() {
return cn_title;
}
public void setCn_title(String cn_title) {
this.cn_title = cn_title;
}
public String getEn_title() {
return en_title;
}
public void setEn_title(String en_title) {
this.en_title = en_title;
}
public List<Children> getChildren() {
return children;
}
public void setChildren(List<Children> children) {
this.children = children;
}
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getCn_title() {
return cn_title;
}
public void setCn_title(String cn_title) {
this.cn_title = cn_title;
}
public String getEn_title() {
return en_title;
}
public void setEn_title(String en_title) {
this.en_title = en_title;
}
public List<Children> getChildren() {
return children;
}
public List<String> getStringChildren() {
List<String> stringList = new ArrayList<>();
for (int i = 0; i < children.size(); i++) {
stringList.add(children.get(i).getCn_title());
}
return stringList;
}
public void setChildren(List<Children> children) {
this.children = children;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,492 @@
package com.yunbao.common.custom;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.yunbao.common.R;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ClassicsHeaderNew;
import java.util.List;
/**
* Created by cxf on 2018/6/7.
*/
public class CommonRefreshWaterfallView extends FrameLayout implements View.OnClickListener {
private Context mContext;
private DataHelper mDataHelper;
private int mLayoutRes;
private View mContentView;
private SmartRefreshLayout mSmartRefreshLayout;
private ClassicsHeaderNew mHeader;
private ClassicsFooter mFooter;
public RecyclerView mRecyclerView;
private FrameLayout mEmptyLayout;//没有数据的View
private View mLoadFailureView;//加载失败View
private boolean mRefreshEnable;//下拉刷新是否可用
private boolean mLoadMoreEnable;//上拉加载是否可用
private int mPageCount;//页数
private int mItemCount;//每页的Item个数
public CommonRefreshWaterfallView(Context context) {
this(context, null);
}
public CommonRefreshWaterfallView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CommonRefreshWaterfallView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.CommonRefreshView);
mRefreshEnable = ta.getBoolean(R.styleable.CommonRefreshView_crv_refreshEnable, true);
mLoadMoreEnable = ta.getBoolean(R.styleable.CommonRefreshView_crv_loadMoreEnable, true);
mLayoutRes = ta.getResourceId(R.styleable.CommonRefreshView_crv_layout, R.layout.view_refresh_default);
mItemCount = ta.getInteger(R.styleable.CommonRefreshView_crv_itemCount, 20);
ta.recycle();
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(mLayoutRes, this, false);
mContentView = view;
addView(view);
mSmartRefreshLayout = (SmartRefreshLayout) view.findViewById(R.id.refreshLayout);
mSmartRefreshLayout.setEnableLoadMoreWhenContentNotFull(false);//是否在列表不满一页时候开启上拉加载功能
mSmartRefreshLayout.setEnableFooterFollowWhenLoadFinished(true);//是否在全部加载结束之后Footer跟随内容
mSmartRefreshLayout.setEnableOverScrollBounce(false);//设置是否开启越界回弹功能默认true
mEmptyLayout = (FrameLayout) view.findViewById(R.id.no_data_container);
mLoadFailureView = view.findViewById(R.id.load_failure);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
mRecyclerView.setHasFixedSize(true);
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(staggeredGridLayoutManager);
((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
mSmartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
refresh();
}
});
mSmartRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull RefreshLayout refreshlayout) {
Log.i("t2", "来了哦");
loadMore();
}
});
mSmartRefreshLayout.setEnableRefresh(mRefreshEnable);
mSmartRefreshLayout.setEnableLoadMore(mLoadMoreEnable);
View btnReload = view.findViewById(R.id.btn_reload);
if (btnReload != null) {
btnReload.setOnClickListener(this);
}
int textColor = ContextCompat.getColor(mContext, R.color.textColor);
mHeader = findViewById(R.id.header);
mHeader.setAccentColor(textColor);
mFooter = findViewById(R.id.footer);
mFooter.setAccentColor(textColor);
mFooter.setTextSizeTitle(14);
}
/**
* 设置头部字体颜色
*
* @param textColor
*/
public void setHeaderTextColor(int textColor) {
mHeader.setAccentColor(textColor);
}
private HttpCallback mRefreshCallback = new HttpCallback() {
private int mDataCount;
@Override
public void onSuccess(int code, String msg, String[] info) {
if (mDataHelper == null) {
return;
}
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == View.VISIBLE) {
mLoadFailureView.setVisibility(View.INVISIBLE);
}
RefreshAdapter adapter = null;
RecyclerView.Adapter recyclerViewAdapter = mRecyclerView.getAdapter();
if (recyclerViewAdapter != null && recyclerViewAdapter instanceof RefreshAdapter) {
adapter = (RefreshAdapter) recyclerViewAdapter;
} else {
adapter = mDataHelper.getAdapter();
if (adapter == null) {
return;
}
mRecyclerView.setAdapter(adapter);
}
if (code != 0) {
ToastUtil.show(msg);
return;
}
if (info != null) {
List list = mDataHelper.processData(info);
if (list == null) {
return;
}
mDataCount = list.size();
if (mDataCount > 0) {
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == View.VISIBLE) {
mEmptyLayout.setVisibility(View.INVISIBLE);
}
adapter.refreshData(list);
} else {
adapter.clearData();
if (mEmptyLayout != null && mEmptyLayout.getVisibility() != View.VISIBLE) {
mEmptyLayout.setVisibility(View.VISIBLE);
}
}
} else {
if (adapter != null) {
adapter.clearData();
}
if (mEmptyLayout != null && mEmptyLayout.getVisibility() != View.VISIBLE) {
mEmptyLayout.setVisibility(View.VISIBLE);
}
}
mDataHelper.onRefreshSuccess(adapter.getList(), adapter.getItemCount());
}
@Override
public void onError() {
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == View.VISIBLE) {
mEmptyLayout.setVisibility(View.INVISIBLE);
}
if (mLoadFailureView != null) {
if (mLoadFailureView.getVisibility() != View.VISIBLE) {
if (mRecyclerView != null) {
RecyclerView.Adapter adapter = mRecyclerView.getAdapter();
if (adapter != null && adapter.getItemCount() > 0) {
ToastUtil.show(mContext.getString(R.string.load_failure));
} else {
mLoadFailureView.setVisibility(View.VISIBLE);
}
} else {
mLoadFailureView.setVisibility(View.VISIBLE);
}
} else {
ToastUtil.show(mContext.getString(R.string.load_failure));
}
}
if (mDataHelper != null) {
mDataHelper.onRefreshFailure();
}
}
@Override
public void onFinish() {
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.finishRefresh(true);
if (mDataCount < mItemCount) {
mSmartRefreshLayout.finishLoadMore(true);
}
}
}
};
private HttpCallback mLoadMoreCallback = new HttpCallback() {
private int mDataCount;
@Override
public void onSuccess(int code, String msg, String[] info) {
if (mDataHelper == null) {
mPageCount--;
return;
}
if (code != 0) {
ToastUtil.show(msg);
mPageCount--;
return;
}
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == View.VISIBLE) {
mLoadFailureView.setVisibility(View.INVISIBLE);
}
if (info != null) {
List list = mDataHelper.processData(info);
if (list == null) {
mPageCount--;
return;
}
mDataCount = list.size();
RefreshAdapter adapter = mDataHelper.getAdapter();
if (mDataCount > 0) {
if (adapter != null) {
adapter.insertList(list);
}
} else {
mPageCount--;
}
mDataHelper.onLoadMoreSuccess(list, mDataCount);
} else {
mPageCount--;
}
}
@Override
public void onError() {
super.onError();
mPageCount--;
if (mDataHelper != null) {
mDataHelper.onLoadMoreFailure();
}
}
@Override
public void onFinish() {
Log.i("t2", "更多");
if (mSmartRefreshLayout != null) {
if (mDataCount <= 0) {
mSmartRefreshLayout.finishLoadMoreWithNoMoreData();
} else {
mSmartRefreshLayout.finishLoadMore(true);
}
}
}
};
public void onFinish() {
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == View.VISIBLE) {
mLoadFailureView.setVisibility(View.INVISIBLE);
}
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == View.VISIBLE) {
mEmptyLayout.setVisibility(View.INVISIBLE);
}
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.finishRefresh(true);
}
}
public <T> void setDataHelper(DataHelper<T> dataHelper) {
mDataHelper = dataHelper;
}
public void setLayoutManager(RecyclerView.LayoutManager layoutManager) {
mRecyclerView.setLayoutManager(layoutManager);
}
public void setItemDecoration(ItemDecoration itemDecoration) {
mRecyclerView.addItemDecoration(itemDecoration);
}
/**
* 手动设置没有更多数据
* 因为日榜/周榜接口没有分页参数会导致一直读取重复数据
*/
public void setNotLoadMore() {
mSmartRefreshLayout.finishLoadMoreWithNoMoreData();
}
public void showLoading() {
mPageCount = 1;
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.autoRefreshAnimationOnly();
}
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == VISIBLE) {
mEmptyLayout.setVisibility(INVISIBLE);
}
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == VISIBLE) {
mLoadFailureView.setVisibility(INVISIBLE);
}
}
public void showRefreshBar() {
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.autoRefresh(100);//延迟400毫秒后自动刷新
}
}
public void showEmpty() {
if (mEmptyLayout != null && mEmptyLayout.getVisibility() != VISIBLE) {
mEmptyLayout.setVisibility(VISIBLE);
}
}
public void hideEmpty() {
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == VISIBLE) {
mEmptyLayout.setVisibility(INVISIBLE);
}
}
public void hideLoadFailure() {
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == VISIBLE) {
mLoadFailureView.setVisibility(INVISIBLE);
}
}
public void initData() {
Log.i("t2", "AAAs1212");
refresh();
}
private void refresh() {
if (mDataHelper != null) {
Log.i("t2", "AAAs");
mPageCount = 1;
mDataHelper.loadData(mPageCount, mRefreshCallback);
}
if (dataHelperNew != null) {
dataHelperNew.refresh();
}
}
private void loadMore() {
Log.i("t2", "来了哦111");
if (mDataHelper != null) {
Log.i("t2", "来了哦12121");
mPageCount++;
mDataHelper.loadData(mPageCount, mLoadMoreCallback);
}
if (dataHelperNew != null) {
dataHelperNew.loadData(mPageCount);
}
}
public int getPageCount() {
return mPageCount;
}
public void setPageCount(int pageCount) {
mPageCount = pageCount;
}
public int getItemCount() {
return mItemCount;
}
public void setItemCount(int itemCount) {
mItemCount = itemCount;
}
public void setRefreshEnable(boolean enable) {
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.setEnableRefresh(enable);
}
}
public void setLoadMoreEnable(boolean enable) {
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.setEnableLoadMore(enable);
}
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.btn_reload) {
refresh();
}
}
public interface DataHelperNew {
void loadData(int p);
void refresh();
}
private DataHelperNew dataHelperNew;
public CommonRefreshWaterfallView setDataHelperNew(DataHelperNew dataHelperNew) {
this.dataHelperNew = dataHelperNew;
return this;
}
public interface DataHelper<T> {
RefreshAdapter<T> getAdapter();
void loadData(int p, HttpCallback callback);
List<T> processData(String[] info);
/**
* 下拉刷新成功
*
* @param list Adapter的全部数据的List
* @param listCount Adapter的全部数据的个数
*/
void onRefreshSuccess(List<T> list, int listCount);
/**
* 下拉刷新失败
*/
void onRefreshFailure();
/**
* 上拉加载成功
*
* @param loadItemList 本次加载到的数据
* @param loadItemCount 加载到的数据个数
*/
void onLoadMoreSuccess(List<T> loadItemList, int loadItemCount);
/**
* 加载失败
*/
void onLoadMoreFailure();
}
/**
* 空数据的布局
*/
public void setEmptyLayoutId(int noDataLayoutId) {
if (mEmptyLayout != null) {
mEmptyLayout.removeAllViews();
View v = LayoutInflater.from(mContext).inflate(noDataLayoutId, mEmptyLayout, false);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) v.getLayoutParams();
params.gravity = Gravity.CENTER;
v.setLayoutParams(params);
mEmptyLayout.addView(v);
}
}
public View getContentView() {
return mContentView;
}
public void setRecyclerViewAdapter(RefreshAdapter adapter) {
if (mRecyclerView != null) {
mRecyclerView.setAdapter(adapter);
}
}
}

View File

@ -0,0 +1,160 @@
package com.yunbao.common.dialog;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.ImagePreviewAdapter;
import com.yunbao.common.utils.StringUtil;
/**
* Created by Martin on 2024/3/15.
* 图片预览弹窗
*/
public class ImagePreviewDialog extends AbsDialogFragment implements View.OnClickListener {
private View mBg;
private RecyclerView mRecyclerView;
private ValueAnimator mAnimator;
private int mPosition;
private int mPageCount;
private ActionListener mActionListener;
private TextView mCount;
private ImagePreviewAdapter mAdapter;
private boolean mNeedDelete;
@Override
protected int getLayoutId() {
return R.layout.view_preview_image;
}
@Override
protected int getDialogStyle() {
return R.style.dialog2;
}
@Override
protected boolean canCancel() {
return true;
}
@Override
protected void setWindowAttributes(Window window) {
WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mBg = mRootView.findViewById(R.id.bg);
mCount = (TextView) findViewById(R.id.count);
findViewById(R.id.btn_close).setOnClickListener(this);
if (mNeedDelete) {
View btnDelete = findViewById(R.id.btn_delete);
btnDelete.setVisibility(View.VISIBLE);
btnDelete.setOnClickListener(this);
}
mRecyclerView = mRootView.findViewById(R.id.recyclerView);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
mAnimator = ValueAnimator.ofFloat(0, 1);
mAnimator.setDuration(150);
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float v = (float) animation.getAnimatedValue();
mBg.setAlpha(v);
}
});
mAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (mRecyclerView != null && mPageCount > 0) {
ImagePreviewAdapter adapter = new ImagePreviewAdapter(mContext, mPageCount);
mAdapter = adapter;
adapter.setActionListener(new ImagePreviewAdapter.ActionListener() {
@Override
public void onPageChanged(int position) {
if (mCount != null) {
mCount.setText(StringUtil.contact(String.valueOf(position + 1), "/", String.valueOf(mPageCount)));
}
}
@Override
public void loadImage(ImageView imageView, int position) {
if (mActionListener != null) {
mActionListener.loadImage(imageView, position);
}
}
});
mRecyclerView.setAdapter(adapter);
if (mPosition >= 0 && mPosition < mPageCount) {
adapter.setCurPosition(mPosition);
mRecyclerView.scrollToPosition(mPosition);
}
}
}
});
mAnimator.start();
}
public void setImageInfo(int pageCount, int position, boolean needDelete, ActionListener actionListener) {
mActionListener = actionListener;
mPageCount = pageCount;
mPosition = position;
mNeedDelete = needDelete;
}
@Override
public void onDestroy() {
if (mAnimator != null) {
mAnimator.cancel();
}
mContext = null;
mActionListener = null;
super.onDestroy();
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.btn_close) {
dismiss();
} else if (i == R.id.btn_delete) {
delete();
}
}
private void delete() {
if (mAdapter != null && mActionListener != null) {
mActionListener.onDeleteClick(mAdapter.getCurPosition());
}
dismiss();
}
public interface ActionListener {
void loadImage(ImageView imageView, int position);
void onDeleteClick(int position);
}
}

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@ -60,7 +61,6 @@ public class ProcessFragment extends Fragment {
mPermissionCallback = null;
}
/**
* 判断申请的权限有没有被允许
*/
@ -119,7 +119,7 @@ public class ProcessFragment extends Fragment {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
try {
RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(null);
}catch (Exception e){
} catch (Exception e) {
}
if (mActivityResultCallback != null) {
@ -131,8 +131,8 @@ public class ProcessFragment extends Fragment {
}
}
public void release(){
mPermissionCallback=null;
mActivityResultCallback=null;
public void release() {
mPermissionCallback = null;
mActivityResultCallback = null;
}
}

View File

@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.Callback;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.request.PostRequest;
@ -338,7 +339,7 @@ public class CommonHttpUtil {
*/
public static void getBalance(HttpCallback callback) {
String isGoogle;
if (CommonAppConfig.IS_GOOGLE_PLAY==1) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
isGoogle = "1";
} else {
isGoogle = "-1";
@ -495,6 +496,151 @@ public class CommonHttpUtil {
// .execute(callback);
// }
/**
* 发送动态
*
* @param isImgOrVideo
* @param content
* @param talkId
* @param fileAry
* @param createAt
* @param callback
*/
public static void pushCommunity(boolean isImgOrVideo, String content, String talkId, String fileAry, String createAt, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.sendDynamic", CommonHttpConsts.GET_USER_BASEINFO)
.params("img_or_video", isImgOrVideo ? 1 : 2)
.params("content", content)
.params("talk_id", talkId)
.params("file_name_ary", fileAry)
.params("created_at", createAt)
.execute(callback);
}
/**
* 获取动态列表-热门
*
* @param callback
*/
public static void getCommunityHotList(int p, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.getFindDynamicList", "Pdlcommunity.getFindDynamicList")
.params("p", p)
.execute(callback);
}
/**
* 获取动态列表-热门
*
* @param callback
*/
public static void getCommunityDetails(String dynamic_id, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.getDynamicInfo", "Pdlcommunity.getDynamicInfo")
.params("dynamic_id", dynamic_id)
.execute(callback);
}
/**
* 获取动态列表-评论
*
* @param callback
*/
public static void getCommunityComment(String dynamic_id, String dynamic_uid, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.getDynamicCommentList", "Pdlcommunity.getDynamicCommentList")
.params("dynamic_id", dynamic_id)
.params("dynamic_uid", dynamic_uid)
.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);
}
public static void getOtherDynamicList(String toUid, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.getOtherDynamicList", "Pdlcommunity.getOtherDynamicList")
.params("tuid", toUid)
.execute(callback);
}
/**
* 动态-删除
*/
public static void delCom(String comment_id, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.delComment", "Pdlcommunity.delComment")
.params("comment_id", comment_id)
.execute(callback);
}
/**
* 动态-不感兴趣
*/
public static void noInterest(String uid, HttpCallback callback) {
HttpClient.getInstance().get("User.setBlack", "User.setBlack")
.params("touid", uid)
.execute(callback);
}
/**
* 用户主页-用户数据
*/
public static void getUserInfoTop(String uid, HttpCallback callback) {
HttpClient.getInstance().get("Pdluserhome.getUserHomeTopInfo", "Pdluserhome.getUserHomeTopInfo")
.params("select_uid", uid)
.execute(callback);
}
}

View File

@ -351,6 +351,7 @@ public class LiveHttpUtil {
.params("p", p)
.execute(callback);
}
public static void getContactMsg(int page, HttpCallback callback) {
HttpClient.getInstance().get("Live.getContactMsg", "getContactMsg")
.params("p", page)
@ -645,6 +646,7 @@ public class LiveHttpUtil {
.params("appVersion", CommonAppConfig.getInstance().getVersion())
.execute(callback);
}
/**
* 观众给主播送礼物 - 包裹
*
@ -662,6 +664,7 @@ public class LiveHttpUtil {
.params("appVersion", CommonAppConfig.getInstance().getVersion())
.execute(callback);
}
/**
* 观众给主播送礼物 - 粉丝团
*
@ -679,6 +682,7 @@ public class LiveHttpUtil {
.params("appVersion", CommonAppConfig.getInstance().getVersion())
.execute(callback);
}
public static void sendBlindBoxTicket(String by, String liveUid, String stream, int giftId, HttpCallback callback) {
HttpClient.getInstance().get("Live.sendBlindBoxTicket", LiveHttpConsts.SEND_GIFT)
.params("liveuid", liveUid)
@ -1040,10 +1044,9 @@ public class LiveHttpUtil {
/**
* 获取短剧Url
*/
public static void getCoolydrama(HttpCallback callback){
public static void getCoolydrama(HttpCallback callback) {
HttpClient.getInstance().get("cool.register", "Home.getFollow")
.params("lang", WordUtil.isNewZh()?"zh_CN":"en")
.params("lang", WordUtil.isNewZh() ? "zh_CN" : "en")
.execute(callback);
}
}

View File

@ -27,6 +27,8 @@ import com.yunbao.common.bean.GiftGuideModel;
import com.yunbao.common.bean.GiftNamingInfoModel;
import com.yunbao.common.bean.GiftWallGiftDetail;
import com.yunbao.common.bean.GiftWallModel;
import com.yunbao.common.bean.HomeUserExhibitInfoBean;
import com.yunbao.common.bean.HomeUserInfoBean;
import com.yunbao.common.bean.HourRank;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.IMLoginModel;
@ -1252,4 +1254,11 @@ public interface PDLiveApi {
@GET("/api/public/?service=Pdlmsg.getTips")
Observable<ResponseModel<MessageSayHiStartBean>> getMessageSayHiStartTimer(
);
@GET("/api/public/?service=Userhome.getUserHomeBanner")
Observable<ResponseModel<List<String>>> getUserHomeBanner(@Query("select_uid") String tuid);
@GET("/api/public/?service=Pdluserhome.getUserHomeTopInfo")
Observable<ResponseModel<HomeUserInfoBean>> getUserHomeInfo(@Query("select_uid") String tuid);
@GET("/api/public/?service=Pdluserhome.getUserHomeInfo")
Observable<ResponseModel<HomeUserExhibitInfoBean>> getUserHomeExhibitInfo(@Query("select_uid") String tuid);
}

View File

@ -30,6 +30,8 @@ import com.yunbao.common.bean.GiftGuideModel;
import com.yunbao.common.bean.GiftNamingInfoModel;
import com.yunbao.common.bean.GiftWallGiftDetail;
import com.yunbao.common.bean.GiftWallModel;
import com.yunbao.common.bean.HomeUserExhibitInfoBean;
import com.yunbao.common.bean.HomeUserInfoBean;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LinkMicUserBean;
@ -2787,7 +2789,7 @@ public class LiveNetManager {
}).isDisposed();
}
public void addChatCount(String stream, HttpCallback<HttpCallbackModel> callback) {
public void addChatCount(String stream,HttpCallback<HttpCallbackModel> callback) {
API.get().pdLiveApi(mContext)
.addChatCount(stream)
.subscribeOn(Schedulers.io())
@ -3333,11 +3335,79 @@ public class LiveNetManager {
}).isDisposed();
}
public void getUserHomeBanner(String search, HttpCallback<List<String>> callback) {
API.get().pdLiveApi(mContext)
.getUserHomeBanner(search)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(roomMicStatusModelResponseModel -> {
if (callback != null) {
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void getUserHomeInfo(String touid, HttpCallback<HomeUserInfoBean> callback) {
API.get().pdLiveApi(mContext)
.getUserHomeInfo(touid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<HomeUserInfoBean>>() {
@Override
public void accept(ResponseModel<HomeUserInfoBean> messageUserInfoBeanResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(messageUserInfoBeanResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void getUserExhibitInfoInfo(String touid, HttpCallback<HomeUserExhibitInfoBean> callback) {
API.get().pdLiveApi(mContext)
.getUserHomeExhibitInfo(touid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<HomeUserExhibitInfoBean>>() {
@Override
public void accept(ResponseModel<HomeUserExhibitInfoBean> messageUserInfoBeanResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(messageUserInfoBeanResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
private MultipartBody.Part createUploadFile(File file) {
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
}
/**
* 直播间取消网络请求
*/

View File

@ -0,0 +1,12 @@
package com.yunbao.common.interfaces;
import java.util.HashMap;
public abstract class PermissionCallback {
public abstract void onAllGranted();
public void onResult(HashMap<String, Boolean> resultMap) {
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,208 @@
package com.yunbao.common.utils;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveImageBean;
import com.yunbao.common.glide.ImgLoader;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class ActiveImageAdapter extends RecyclerView.Adapter {
private Context mContext;
private List<ActiveImageBean> mList;
private LayoutInflater mInflater;
private View.OnClickListener mOnClickListener;
private View.OnClickListener mODelListener;
private ActionListener mActionListener;
public ActiveImageAdapter(Context context) {
mContext = context;
mList = new ArrayList<>();
mInflater = LayoutInflater.from(context);
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag == null) {
return;
}
int position = (int) tag;
ActiveImageBean bean = mList.get(position);
if (bean.getImageFile() == null) {
if (mActionListener != null) {
mActionListener.onAddClick();
}
} else {
if (mActionListener != null) {
mActionListener.onItemClick(position);
}
}
}
};
mODelListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag == null) {
return;
}
int position = (int) tag;
ActiveImageBean bean = mList.get(position);
if (bean.getImageFile() == null) {
if (mActionListener != null) {
mActionListener.onAddClick();
}
} else {
if (mActionListener != null) {
mActionListener.onDel(position);
}
}
}
};
}
public void setActionListener(ActionListener actionListener) {
mActionListener = actionListener;
}
public void insertList(List<String> imagePathList) {
int index = 0;
for (ActiveImageBean bean : mList) {
if (bean.getImageFile() == null) {
bean.setImageFile(new File(imagePathList.get(index)));
index++;
}
}
int moreCount = 9 - mList.size();
if (moreCount > 0) {
moreCount = Math.min(moreCount, imagePathList.size() - index);
for (int i = 0; i < moreCount; i++) {
mList.add(new ActiveImageBean(new File(imagePathList.get(index + i))));
}
}
if (mList.size() < 9) {
mList.add(new ActiveImageBean());
}
notifyDataSetChanged();
}
public void deleteItem(int position) {
if (mList == null) {
return;
}
if (position >= 0 && position < mList.size()) {
mList.remove(position);
}
int size = mList.size();
ActiveImageBean bean = mList.get(size - 1);
if (bean.getImageFile() != null) {
mList.add(new ActiveImageBean());
} else {
if (size == 1) {
mList.clear();
}
}
notifyDataSetChanged();
if (mList.size() == 0 && mActionListener != null) {
mActionListener.onDeleteAll();
}
}
public List<File> getImageFileList() {
List<File> list = null;
for (ActiveImageBean bean : mList) {
File file = bean.getImageFile();
if (file != null && file.exists()) {
if (list == null) {
list = new ArrayList<>();
}
list.add(file);
}
}
return list;
}
public int getImageFileCount() {
int count = 0;
for (ActiveImageBean bean : mList) {
File file = bean.getImageFile();
if (file != null && file.exists()) {
count++;
}
}
return count;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int position) {
return new Vh(mInflater.inflate(R.layout.item_active_image, viewGroup, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
((Vh) vh).setData(mList.get(position), position);
}
@Override
public int getItemCount() {
return mList.size();
}
class Vh extends RecyclerView.ViewHolder {
View mIconAdd;
ImageView mImg;
ImageView del;
public Vh(@NonNull View itemView) {
super(itemView);
mIconAdd = itemView.findViewById(R.id.icon_add);
mImg = itemView.findViewById(R.id.img);
del = itemView.findViewById(R.id.del);
itemView.setOnClickListener(mOnClickListener);
del.setOnClickListener(mODelListener);
}
void setData(ActiveImageBean bean, int position) {
itemView.setTag(position);
if (bean.getImageFile() == null) {
mImg.setImageDrawable(null);
if (mIconAdd.getVisibility() != View.VISIBLE) {
mIconAdd.setVisibility(View.VISIBLE);
}
if (del.getVisibility() != View.VISIBLE) {
del.setVisibility(View.VISIBLE);
}
} else {
if (mIconAdd.getVisibility() == View.VISIBLE) {
mIconAdd.setVisibility(View.INVISIBLE);
}
if (del.getVisibility() == View.VISIBLE) {
del.setVisibility(View.GONE);
}
ImgLoader.display(mContext, bean.getImageFile(), mImg);
}
}
}
public interface ActionListener {
void onAddClick();
void onItemClick(int position);
void onDeleteAll();
void onDel(int position);
}
}

View File

@ -1,7 +1,5 @@
package com.yunbao.common.utils;
import com.yunbao.common.http.Data;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -36,6 +34,13 @@ public class DateFormatUtil {
return formattedDate;
}
public static String getTimeStrings(long time) {
Date date = new Date(time); // 创建Date对象并传入时间戳参数
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // 设置日期格式
String formattedDate = sdf.format(date); // 格式化日期字符串
return formattedDate;
}
public static String getVideoCurTimeString() {
return sFormat2.format(new Date());

View File

@ -24,7 +24,7 @@ public class RouteUtil {
//Intent隐式启动 action
public static final String PATH_LAUNCHER = "/app/LauncherActivity";
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_REWARD = "/main/RewardActivity";
public static final String PATH_EDITPROFILE = "/main/EditProfileActivity";
@ -46,6 +46,10 @@ public class RouteUtil {
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_USER = "/main/RedPacketUsersActivity";
public static final String PATH_SELECT_AVATAR = "/main/UserAvatarSelectActivity";
public static final String PATH_BattlePassActivity = "/main/BattlePassActivity";
public static final String PATH_SudGameActivity = "/live/SudGameActivity";
public static final String PATH_COMMUNITY_Activity = "/main/MainHomeCommunityActivity";
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
public static final String PATH_SudGameActivity="/live/SudGameActivity";
@ -57,11 +61,13 @@ public class RouteUtil {
ARouter.getInstance().build(PATH_COMMUNITY_Activity)
.navigation();
}
public static void forwardFansActivity(String uid) {
ARouter.getInstance().build(PATH_FANSACTIVITY)
.withString(Constants.TO_UID, uid)
.navigation();
}
public static void forwardSudGameActivity(String CreateSudRoom) {
ARouter.getInstance().build(PATH_SudGameActivity)
.withString("CreateSudRoom", CreateSudRoom)
@ -296,6 +302,19 @@ public class RouteUtil {
.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登录
*/

View File

@ -0,0 +1,114 @@
package com.yunbao.common.views;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import com.yunbao.common.R;
import com.yunbao.common.utils.ScreenDimenUtil;
/**
* Created by cxf on 2018/10/15.
*/
public abstract class AbsUserPageViewHolder extends AbsViewHolder implements View.OnClickListener {
protected ObjectAnimator mEnterAnimator;
protected ObjectAnimator mOutAnimator;
protected boolean mLoad;
protected boolean mShowed;
protected boolean mAnimating;
public AbsUserPageViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
public AbsUserPageViewHolder(Context context, ViewGroup parentView, Object... args) {
super(context, parentView, args);
}
@Override
public void init() {
int screenWidth = ScreenDimenUtil.getInstance().getScreenWdith();
Interpolator interpolator = new AccelerateDecelerateInterpolator();
mEnterAnimator = ObjectAnimator.ofFloat(mContentView, "translationX", screenWidth, 0);
mEnterAnimator.setDuration(200);
mEnterAnimator.setInterpolator(interpolator);
mEnterAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimating = false;
mShowed = true;
onShow();
loadData();
}
});
mOutAnimator = ObjectAnimator.ofFloat(mContentView, "translationX", 0, screenWidth);
mOutAnimator.setDuration(200);
mOutAnimator.setInterpolator(interpolator);
mOutAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimating = false;
mShowed = false;
onHide();
}
});
findViewById(R.id.btn_back).setOnClickListener(this);
}
public abstract void loadData();
public void show() {
if (!mAnimating) {
mAnimating = true;
mEnterAnimator.start();
}
}
public void hide() {
if (!mAnimating) {
mAnimating = true;
mOutAnimator.start();
}
}
public void onShow() {
}
public void onHide() {
}
public boolean isShowed() {
return mShowed;
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.btn_back) {
hide();
}
}
public void release() {
if (mEnterAnimator != null) {
mEnterAnimator.cancel();
}
mEnterAnimator = null;
if (mOutAnimator != null) {
mOutAnimator.cancel();
}
mEnterAnimator = null;
}
}

View File

@ -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");
}
}
}

View File

@ -0,0 +1,46 @@
package com.yunbao.common.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.yunbao.common.R;
/**
* Created by cxf on 2018/9/27.
*/
public class MyFrameLayout2 extends FrameLayout {
private float mRatio;
private float mOffestY;
public MyFrameLayout2(@NonNull Context context) {
this(context, null);
}
public MyFrameLayout2(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public MyFrameLayout2(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.MyFrameLayout2);
mRatio = ta.getFloat(R.styleable.MyFrameLayout2_mfl_ratio, 1);
mOffestY = ta.getDimension(R.styleable.MyFrameLayout2_mfl_offestY, 0);
ta.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) (widthSize * mRatio + mOffestY), MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,216 @@
package com.yunbao.common.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import java.util.ArrayList;
import java.util.List;
public class NineGridLayout extends FrameLayout {
private Context mContext;
private int mWidth1;
private int mWidth2;
private int mWidth3;
private int mDividerWidth;
private int mCornerRadius;
private List<RoundedImageView> mViewList;
private ActionListener mActionListener;
private LayoutParams mLayoutParams00;
private LayoutParams mLayoutParams10;
private LayoutParams mLayoutParams11;
private LayoutParams[] mLayoutParamsArray;
private OnClickListener mOnClickListener;
private List<?> mDataList;
public NineGridLayout(Context context) {
this(context, null);
}
public NineGridLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public NineGridLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
int space = 0;
int dividerWidth = 0;
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.NineGridLayout);
space = (int) ta.getDimension(R.styleable.NineGridLayout_ngl_space, 0);
dividerWidth = (int) ta.getDimension(R.styleable.NineGridLayout_ngl_divider_width, 0);
mCornerRadius = (int) ta.getDimension(R.styleable.NineGridLayout_ngl_corner_radius, 0);
ta.recycle();
mContext = context;
mViewList = new ArrayList<>();
DisplayMetrics dm = context.getResources().getDisplayMetrics();
float scale = dm.density;
int width = dm.widthPixels - space;
mDividerWidth = dividerWidth;
mWidth1 = (int) (scale * 220 + 0.5f);
mWidth2 = (width - dividerWidth) / 2;
mWidth3 = (width - dividerWidth * 2) / 3;
mOnClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
if (mActionListener != null) {
for (int i = 0, size = mViewList.size(); i < size; i++) {
if (v == mViewList.get(i)) {
mActionListener.onItemClick(mDataList, i);
break;
}
}
}
}
};
}
public void setData(List<?> list) {
if (list == null) {
hideItem(0);
return;
}
int dataSize = list.size();
if (dataSize == 0) {
hideItem(0);
return;
}
mDataList = list;
int viewSize = mViewList.size();
if (viewSize < dataSize) {
for (int i = 0, size = dataSize - viewSize; i < size; i++) {
addItem();
}
} else if (viewSize > dataSize) {
hideItem(dataSize);
}
if (dataSize == 1) {
RoundedImageView imageView = mViewList.get(0);
if (mLayoutParams00 == null) {
mLayoutParams00 = new LayoutParams(mWidth1, mWidth1);
}
if (imageView.getLayoutParams() != mLayoutParams00) {
imageView.setLayoutParams(mLayoutParams00);
}
if (imageView.getVisibility() != VISIBLE) {
imageView.setVisibility(VISIBLE);
}
setHeight(mWidth1);
if (mActionListener != null) {
mActionListener.displayImage(list.get(0), imageView);
}
} else if (dataSize == 2) {
RoundedImageView imageView0 = mViewList.get(0);
RoundedImageView imageView1 = mViewList.get(1);
if (mLayoutParams10 == null) {
mLayoutParams10 = new LayoutParams(mWidth2, mWidth2);
}
if (mLayoutParams11 == null) {
mLayoutParams11 = new LayoutParams(mWidth2, mWidth2);
mLayoutParams11.gravity = Gravity.RIGHT;
}
if (imageView0.getLayoutParams() != mLayoutParams10) {
imageView0.setLayoutParams(mLayoutParams10);
}
if (imageView1.getLayoutParams() != mLayoutParams11) {
imageView1.setLayoutParams(mLayoutParams11);
}
if (imageView0.getVisibility() != VISIBLE) {
imageView0.setVisibility(VISIBLE);
}
if (imageView1.getVisibility() != VISIBLE) {
imageView1.setVisibility(VISIBLE);
}
setHeight(mWidth2);
if (mActionListener != null) {
mActionListener.displayImage(list.get(0), imageView0);
mActionListener.displayImage(list.get(1), imageView1);
}
} else {
if (mLayoutParamsArray == null) {
mLayoutParamsArray = new LayoutParams[9];
}
int rowCount = dataSize / 3;
if (dataSize % 3 != 0) {
rowCount++;
}
setHeight(mWidth3 * rowCount + mDividerWidth * (rowCount - 1));
for (int i = 0; i < dataSize; i++) {
RoundedImageView imageView = mViewList.get(i);
if (mLayoutParamsArray[i] == null) {
mLayoutParamsArray[i] = new LayoutParams(mWidth3, mWidth3);
int row = i / 3;//
int col = i % 3;//
int margin = mWidth3 + mDividerWidth;
mLayoutParamsArray[i].leftMargin = margin * col;
mLayoutParamsArray[i].topMargin = margin * row;
}
if (imageView.getLayoutParams() != mLayoutParamsArray[i]) {
imageView.setLayoutParams(mLayoutParamsArray[i]);
}
if (imageView.getVisibility() != VISIBLE) {
imageView.setVisibility(VISIBLE);
}
if (mActionListener != null) {
mActionListener.displayImage(list.get(i), imageView);
}
}
}
}
private void setHeight(int height) {
ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (height != layoutParams.height) {
layoutParams.height = height;
requestLayout();
}
}
private void hideItem(int fromIndex) {
for (int i = 0, size = mViewList.size(); i < size; i++) {
if (i >= fromIndex) {
RoundedImageView imageView = mViewList.get(i);
imageView.setImageDrawable(null);
if (imageView.getVisibility() == VISIBLE) {
imageView.setVisibility(INVISIBLE);
}
}
}
}
private void addItem() {
RoundedImageView imageView = new RoundedImageView(mContext);
imageView.setCornerRadius(mCornerRadius);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setOnClickListener(mOnClickListener);
mViewList.add(imageView);
addView(imageView);
}
public void setActionListener(ActionListener actionListener) {
mActionListener = actionListener;
}
public interface ActionListener {
void onItemClick(List<?> dataList, int position);
void displayImage(Object path, ImageView imageView);
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="45dp" />
<solid android:color="#FEF8F8" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FFF6E8" />
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<solid android:color="#F7F9FB"/>
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FEF8F8" />
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="-45"
android:endColor="#FE629D"
android:startColor="#FA5180" />
<corners
android:bottomLeftRadius="90dp"
android:bottomRightRadius="90dp"
android:topLeftRadius="90dp"
android:topRightRadius="90dp" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="-45"
android:endColor="#EB6FFF"
android:startColor="#FF83C6" />
<corners
android:bottomLeftRadius="90dp"
android:bottomRightRadius="90dp"
android:topLeftRadius="90dp"
android:topRightRadius="90dp" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="-45"
android:endColor="#DFDFDF"
android:startColor="#DFDFDF" />
<corners
android:bottomLeftRadius="90dp"
android:bottomRightRadius="90dp"
android:topLeftRadius="90dp"
android:topRightRadius="90dp" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#E5ECFF" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="25dp"
android:topRightRadius="25dp" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="45dp" />
<solid android:color="#EB6FFF" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="15dp" />
<solid android:color="@color/white" />
</shape>

View File

@ -0,0 +1,256 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/main_bg"
android:orientation="vertical"
android:paddingTop="15dp">
<include layout="@layout/view_title_new" />
<com.yunbao.common.views.MyScrollview
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/userLayout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="68dp"
android:layout_height="68dp"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="20dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="栗子栗子🌰zzz"
android:textColor="#333333"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="02 - 11发布"
android:textColor="#AAAAAA"
android:textSize="12dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/followLayout"
android:layout_width="78dp"
android:layout_height="36dp"
android:background="@drawable/bg_main_com_type"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/followIcon"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_like_follow" />
<TextView
android:id="@+id/followName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="关注"
android:textColor="@color/white"
android:textSize="14dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="哇这里我也太想去了!真是太漂亮了 请问一下路边结冰了吗?会不会封路?"
android:textColor="#333333" />
<com.yunbao.common.views.NineGridLayout
android:id="@+id/nine_grid_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
app:ngl_corner_radius="5dp"
app:ngl_divider_width="6dp"
app:ngl_space="30dp" />
<RelativeLayout
android:id="@+id/videoLayout"
android:layout_width="match_parent"
android:layout_height="400dp"
android:visibility="gone">
<ImageView
android:id="@+id/videoImage"
android:layout_width="match_parent"
android:layout_height="400dp" />
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/icon_play" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<ImageView
android:id="@+id/like"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_like" />
<TextView
android:id="@+id/likeCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="105人觉得很赞"
android:textColor="#333333"
android:textSize="12dp" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_share_new" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="15dp"
android:background="#FFE9F6" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/replyCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="评论0"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/icon_comment" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
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>
</com.yunbao.common.views.MyScrollview>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingRight="20dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/userAvatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginBottom="10dp"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="20dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="15dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@drawable/bg_community_comment"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginLeft="10dp"
android:src="@mipmap/icon_edit_new" />
<EditText
android:id="@+id/comment"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:background="@color/transparent"
android:hint="说点什么..."
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textSize="14dp" />
</LinearLayout>
<ImageView
android:id="@+id/send"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:src="@mipmap/icon_send" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,250 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/view_title2" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/main_community_send_edit_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center_vertical">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@mipmap/icon_community_edit" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入200字以内的文字"
android:textColor="#333333" />
</LinearLayout>
<EditText
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
android:background="@color/white"
android:gravity="start"
android:hint="写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么..."
android:maxEms="200"
android:maxLength="200"
android:textSize="14dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/videoViewLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginBottom="20dp"
android:visibility="visible">
<VideoView
android:id="@+id/videoView"
android:layout_width="200dp"
android:layout_height="200dp" />
<ImageView
android:id="@+id/delVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/videoView"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:src="@mipmap/icon_close" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="30dp"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/imgTextLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/icon_community_img_text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="图文"
android:textColor="#333333"
android:textSize="14dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/videoLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/icon_community_video" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="视频"
android:textColor="#333333"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="15dp"
android:background="@drawable/main_community_send_edit_bg"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingEnd="15dp"
android:paddingBottom="10dp">
<LinearLayout
android:id="@+id/talkLayout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_community_talk" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="选择话题"
android:textColor="#333333"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="@+id/talkContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="立即发表"
android:textColor="#333333"
android:textSize="12dp"
android:visibility="invisible" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@mipmap/icon_right_new" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#FFE9F6" />
<LinearLayout
android:id="@+id/timeLayout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_community_time" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="选择时间"
android:textColor="#333333"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="@+id/chooseTime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="立即发表"
android:textColor="#333333"
android:textSize="12dp" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@mipmap/icon_right_new" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -0,0 +1,148 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/userLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_data_empty"
app:riv_oval="true" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="栗子栗子🌰zzz"
android:textColor="#333333"
android:textSize="13dp"
android:textStyle="bold" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="02 - 11发布"
android:textColor="#777777"
android:textSize="11dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="15dp"
android:text=""
android:textColor="#333333" />
<com.yunbao.common.views.NineGridLayout
android:id="@+id/nine_grid_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="15dp"
app:ngl_corner_radius="5dp"
app:ngl_divider_width="6dp"
app:ngl_space="30dp" />
<RelativeLayout
android:id="@+id/videoLayout"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_marginLeft="50dp"
android:visibility="gone">
<ImageView
android:id="@+id/videoImage"
android:layout_width="match_parent"
android:layout_height="400dp" />
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/icon_play" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="right"
android:orientation="horizontal">
<ImageView
android:id="@+id/iconLike"
android:layout_width="20dp"
android:layout_height="20dp"
android:padding="4dp"
android:src="@mipmap/icon_com_like" />
<TextView
android:id="@+id/likeCount"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="0"
android:textSize="11dp" />
<ImageView
android:id="@+id/comIcon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginLeft="5dp"
android:padding="4dp"
android:src="@mipmap/icon_com_com" />
<TextView
android:id="@+id/comCount"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="0"
android:textSize="11dp" />
<ImageView
android:id="@+id/shareIcon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginLeft="5dp"
android:padding="4dp"
android:src="@mipmap/icon_com_share" />
<TextView
android:id="@+id/shareCount"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="0"
android:textSize="11dp" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,750 @@
<?xml version="1.0" encoding="utf-8"?>
<com.yunbao.common.views.MyScrollview xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/main_bg"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent"
android:fadingEdge="none"
app:elevation="0dp"
app:layout_behavior="com.yunbao.common.custom.FixAppBarLayoutBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="65dp"
android:orientation="vertical"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="380dp"
android:background="@color/gray1">
<com.ms.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/temp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/imgsRecyclerView"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="35dp"
android:paddingStart="10dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-20dp"
android:background="@drawable/bg_user_home_bottom"
android:orientation="vertical"
android:padding="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="centerCrop"
android:src="@mipmap/temp"
app:riv_corner_radius="20dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text=""
android:textColor="#333333"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/fansCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="粉丝"
android:textColor="#777777"
android:textSize="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/likeCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="获赞"
android:textColor="#777777"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/followLayout"
android:layout_width="80dp"
android:layout_height="35dp"
android:background="@drawable/bg_main_com_type"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/followIcon"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_like_follow" />
<TextView
android:id="@+id/followName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="关注"
android:textColor="@color/white"
android:textSize="14dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="15dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/userId"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="ID:"
android:textColor="#777777"
android:textSize="12dp" />
<TextView
android:id="@+id/userStatus"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:gravity="center_vertical"
android:text="在线"
android:textColor="#777777"
android:textSize="10dp" />
<ImageView
android:id="@+id/userStatusIcon"
android:layout_width="5dp"
android:layout_height="5dp"
android:layout_gravity="top"
android:layout_marginStart="2dp"
android:src="@mipmap/icon_green" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/user_sex"
android:layout_width="30dp"
android:layout_height="20dp"
android:src="@mipmap/icon_wumen" />
<RelativeLayout
android:id="@+id/authorLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:gravity="center_vertical"
android:visibility="gone">
<ImageView
android:id="@+id/authorlIcon"
android:layout_width="56dp"
android:layout_height="20dp"
android:layout_marginLeft="5dp" />
<TextView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="25dp"
android:gravity="center_vertical"
android:text="Lv 42"
android:textColor="@color/white"
android:textSize="12dp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/levelLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="5dp"
android:gravity="center_vertical"
android:visibility="gone">
<ImageView
android:id="@+id/levelIcon"
android:layout_width="56dp"
android:layout_height="20dp"
android:layout_marginLeft="5dp" />
<TextView
android:id="@+id/level"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="27dp"
android:gravity="center_vertical"
android:text="Lv 42"
android:textColor="@color/white"
android:textSize="12dp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/userPresidentLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:gravity="center_vertical"
android:visibility="gone">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/icon_trade_union" />
<TextView
android:id="@+id/userPresidentName"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="27dp"
android:gravity="center_vertical"
android:text="工会"
android:textColor="#F65BBB"
android:textSize="12dp" />
</RelativeLayout>
<LinearLayout
android:id="@+id/authenticationLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:visibility="gone">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginLeft="10dp"
android:src="@mipmap/icon_auth_suc" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="真人认证"
android:textColor="#333333"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
<com.xuexiang.xui.widget.flowlayout.FlowTagLayout
android:id="@+id/myFlowTag"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
app:ftl_check_mode="none" />
<TextView
android:id="@+id/signature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text=""
android:textColor="#777777"
android:textSize="12dp" />
<LinearLayout
android:id="@+id/itemLayout01"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginTop="10dp"
android:background="@mipmap/bg_user_home_01"
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主播粉絲團"
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="粉絲團名稱"
android:textColor="#777777"
android:textSize="14dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|right"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="50dp"
android:layout_height="50dp">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/img_no1" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/fansImg1"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="50dp"
android:layout_height="50dp">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/img_no2" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/fansImg2"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="50dp"
android:layout_height="50dp">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/img_no3" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/fansImg3"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:src="@mipmap/icon_gray_new_right" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/itemLayout02"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginTop="10dp"
android:background="@mipmap/bg_user_home_02"
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="主播守護團"
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|right"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/img_no1" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/img_no2" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/img_no3" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:src="@mipmap/icon_gray_new_right" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/itemLayout03"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_user_home_04"
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="礼物墙"
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="0/36"
android:textColor="#777777"
android:textSize="14dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|right"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:src="@mipmap/icon_gray_new_right" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/itemLayout04"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginTop="10dp"
android:background="@mipmap/bg_user_home_03"
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="榮譽墻"
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|right"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/img_honor_default" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:src="@mipmap/icon_gray_new_right" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/moreLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center">
<TextView
android:id="@+id/moreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="查看更多"
android:textColor="#FF4874"
android:textSize="13dp"
android:textStyle="bold" />
<ImageView
android:id="@+id/moreIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/icon_down" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="#FFE9F6" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginTop="10dp"
android:src="@mipmap/icon_index_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="个人动态"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/communityRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/appBarLayout"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@android:color/transparent"
android:clickable="true"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingTop="40dp"
android:paddingRight="20dp">
<ImageView
android:id="@+id/back"
android:layout_width="34dp"
android:layout_height="30dp"
android:src="@mipmap/icon_left" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="用户名称"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold"
android:visibility="invisible" />
<ImageView
android:id="@+id/setting"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@mipmap/icon_right_gray" />
</LinearLayout>
</RelativeLayout>
</com.yunbao.common.views.MyScrollview>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_tag"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/bg_flow_tag"
android:paddingStart="15dp"
android:paddingTop="5dp"
android:paddingEnd="15dp"
android:paddingBottom="5dp"
android:text="标签"
android:textColor="@color/black2" />
</LinearLayout>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<com.yunbao.common.views.MyFrameLayout2 xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_item_active_img">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/icon_add"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:src="@mipmap/icon_active_add"
android:visibility="invisible" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:riv_corner_radius="5dp" />
<ImageView
android:id="@+id/del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:src="@mipmap/icon_close" />
</RelativeLayout>
</com.yunbao.common.views.MyFrameLayout2>

View File

@ -0,0 +1,102 @@
<?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="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/bg_item_comment"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar01"
android:layout_width="23dp"
android:layout_height="23dp"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="20dp" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text=""
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="10dp"
android:background="@drawable/bg_main_com_author"
android:gravity="center"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="作者"
android:textColor="@color/white"
android:textSize="12dp"
android:visibility="gone" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="删除"
android:textColor="#777777"
android:textSize="11dp"
android:visibility="gone" />
<TextView
android:id="@+id/report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:padding="10dp"
android:text="举报"
android:textColor="#333333"
android:textSize="11dp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/replyContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:text=""
android:textColor="#777777"
android:textSize="12dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="20dp"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,218 @@
<?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="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@mipmap/icon_data_empty"
app:riv_oval="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="栗子栗子🌰zzz"
android:textColor="#777777"
android:textSize="12dp" />
<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="栗子栗子🌰zzz"
android:textColor="#333333"
android:textSize="12dp" />
</LinearLayout>
<TextView
android:id="@+id/author"
android:layout_width="45dp"
android:layout_height="17dp"
android:layout_marginLeft="10dp"
android:background="@drawable/bg_main_com_author"
android:gravity="center"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="作者"
android:textColor="@color/white"
android:textSize="10dp"
android:visibility="gone" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:padding="10dp"
android:text="删除"
android:textColor="#777777"
android:textSize="11dp"
android:visibility="gone" />
<TextView
android:id="@+id/replyTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:padding="10dp"
android:text="回复"
android:textColor="#777777"
android:textSize="11dp" />
<TextView
android:id="@+id/report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:padding="10dp"
android:text="举报"
android:textColor="#333333"
android:textSize="11dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/replyLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/bg_item_comment"
android:orientation="vertical"
android:padding="10dp"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar01"
android:layout_width="23dp"
android:layout_height="23dp"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="20dp" />
<TextView
android:id="@+id/firstName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text=""
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:id="@+id/isAuth"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="10dp"
android:background="@drawable/bg_main_com_author"
android:gravity="center"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="作者"
android:textColor="@color/white"
android:textSize="11dp"
android:visibility="gone" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/del1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="删除"
android:textColor="#777777"
android:textSize="11dp"
android:visibility="visible" />
<TextView
android:id="@+id/report1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:padding="10dp"
android:text="举报"
android:textColor="#333333"
android:textSize="11dp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/replyContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="5dp"
android:text=""
android:textColor="#777777"
android:textSize="11dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<TextView
android:id="@+id/expand"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="5dp"
android:text="共4条回复>"
android:textColor="#FF4874"
android:textSize="12dp"
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:background="#FFE9F6" />
</LinearLayout>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:background="#000"
/>

View File

@ -0,0 +1,28 @@
<?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:id="@+id/itemLayout"
android:layout_width="65dp"
android:layout_height="70dp"
android:gravity="center"
android:orientation="vertical"
tools:ignore="MissingDefaultResource">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar01"
android:layout_width="42dp"
android:layout_height="42dp"
android:scaleType="centerCrop"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="15dp" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar02"
android:layout_width="60dp"
android:layout_height="60dp"
android:scaleType="centerCrop"
android:src="@mipmap/icon_data_empty"
android:visibility="gone"
app:riv_corner_radius="15dp" />
</LinearLayout>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:background="#000" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
android:id="@+id/titleView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/preview"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/btn_close"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:padding="9dp"
android:src="@mipmap/icon_back"
app:tint="@color/white" />
<TextView
android:id="@+id/count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:padding="5dp"
android:textColor="@color/white"
android:textSize="14sp" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="40dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/btn_delete"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:background="#000"
android:gravity="center"
android:text="@string/delete"
android:textColor="@color/white"
android:textSize="15sp"
android:visibility="gone" />
</LinearLayout>
</FrameLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="#F5F5F5"
@ -27,7 +28,7 @@
android:onClick="backClick"
android:padding="9dp"
android:src="@mipmap/icon_back"
android:tint="@color/textColor" />
app:tint="@color/textColor" />
<ImageView
android:id="@+id/img_more"
@ -37,20 +38,38 @@
android:layout_centerVertical="true"
android:padding="9dp"
android:src="@mipmap/btn_more_black"
android:tint="@color/textColor"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/textColor" />
<TextView
android:id="@+id/rView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginRight="25dp"
android:gravity="center"
android:text="@string/not_received"
android:textColor="@color/textColor"
android:textSize="13sp"
android:layout_marginRight="25dp"
android:text="@string/not_received"
android:visibility="gone"
android:textStyle="bold" />
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:background="@drawable/main_community_send"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingRight="15dp"
android:paddingBottom="10dp"
android:text="发布"
android:textColor="@color/white"
android:textSize="16dp"
android:visibility="gone" />
</RelativeLayout>
</FrameLayout>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@android:color/transparent"
android:paddingTop="24dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/titleView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textColor="@color/textColor"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:onClick="backClick"
android:padding="9dp"
android:src="@mipmap/icon_back"
app:tint="@color/textColor" />
<ImageView
android:id="@+id/img_more"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:padding="9dp"
android:src="@mipmap/btn_more_black"
android:visibility="gone"
app:tint="@color/textColor" />
<TextView
android:id="@+id/rView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginRight="25dp"
android:gravity="center"
android:text="@string/not_received"
android:textColor="@color/textColor"
android:textSize="13sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:background="@drawable/main_community_send"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingRight="15dp"
android:paddingBottom="10dp"
android:text="发布"
android:textColor="@color/white"
android:textSize="16dp"
android:visibility="gone" />
<ImageView
android:id="@+id/setting"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:background="@mipmap/icon_setting"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingRight="15dp"
android:paddingBottom="10dp"
android:textColor="@color/white"
android:textSize="16dp"
android:visibility="gone" />
</RelativeLayout>
</FrameLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Some files were not shown because too many files have changed in this diff Show More