视频播放UI

动态页面UI
This commit is contained in:
hch 2024-03-12 18:30:02 +08:00
parent 409e38e304
commit aa1db981e8
44 changed files with 3271 additions and 540 deletions

View File

@ -223,5 +223,11 @@ dependencies {
//
api 'com.wuxiaolong.pullloadmorerecyclerview:library:1.1.2'
//
api 'com.contrarywind:Android-PickerView:4.1.9'
//-https://github.com/yangchong211/YCVideoPlayer
api 'cn.yc:VideoPlayer:3.1.0'
api 'cn.yc:VideoCache:3.0.5'
api 'cn.yc:VideoKernel:3.0.6'
}

View File

@ -71,7 +71,8 @@
<activity
android:name=".activity.CommunityDetailsActivity"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
</application>

View File

@ -1,22 +1,58 @@
package com.yunbao.common.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
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.custom.ItemDecoration;
import com.yunbao.common.adapter.CommentAdapter;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.CommentBean;
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.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 {
private RecyclerView mRecyclerViewImage;
private LinearLayout imgTextLayout;
private LinearLayout videoLayout;
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;
@Override
protected int getLayoutId() {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
return R.layout.activity_community_details;
}
@ -33,13 +69,129 @@ public class CommunityDetailsActivity extends AbsActivity {
@Override
protected void main() {
activeBean = getIntent().getParcelableExtra("active");
initView();
initData();
getReply();
}
mRecyclerViewImage = findViewById(R.id.recyclerView);
mRecyclerViewImage.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false));
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 15, 15);
decoration.setOnlySetItemOffsetsButNoDraw(true);
mRecyclerViewImage.addItemDecoration(decoration);
private void initView() {
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) {
}
@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) {
if (activeBean.getIs_love().equals("1")) {
} else {
}
}
});
findViewById(R.id.setting).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
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);
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() + "人觉得很赞");
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

View File

@ -1,52 +1,171 @@
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.ToastUtil;
import com.yunbao.common.utils.WordUtil;
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 create() {
super.create();
}
@Override
protected void onPause() {
super.onPause();
OpenAdManager.getInstance().dismiss();
}
@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);
imgTextLayout.setOnClickListener(new View.OnClickListener() {
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);
}
}
});
@ -55,11 +174,174 @@ public class CommunitySendActivity extends AbsActivity {
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
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
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,117 @@
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.R;
import com.yunbao.common.bean.CommentBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.views.TopGradual;
import java.util.List;
public class CommentAdapter extends RecyclerView.Adapter {
private List<CommentBean> commentBeanList;
private Context mContext;
public CommentAdapter(Context content, List<CommentBean> commentBeanList) {
this.mContext = content;
this.commentBeanList = commentBeanList;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_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 RoundedImageView mAvatar01;
private RoundedImageView mAvatar02;
private TextView replyContent;
private TextView replyCount;
private RecyclerView recyclerView;
private LinearLayout replyLayout;
public CommentViewHolder(@NonNull View itemView) {
super(itemView);
mAvatar = itemView.findViewById(R.id.avatar);
name = itemView.findViewById(R.id.name);
content = itemView.findViewById(R.id.content);
report = itemView.findViewById(R.id.report);
mAvatar01 = itemView.findViewById(R.id.avatar01);
mAvatar02 = itemView.findViewById(R.id.avatar02);
replyContent = itemView.findViewById(R.id.replyContent);
replyCount = itemView.findViewById(R.id.expand);
replyLayout = itemView.findViewById(R.id.replyLayout);
recyclerView = itemView.findViewById(R.id.recyclerView);
}
@SuppressLint("SetTextI18n")
public void setData(CommentBean bean) {
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar);
name.setText(bean.getUser_name());
content.setText(bean.getContent());
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);
ImgLoader.display(itemView.getContext(), bean.getReplyCommentList().get(0).getUser_avatar(), mAvatar02);
replyLayout.setVisibility(View.VISIBLE);
} else if (bean.getReplyCommentList().size() > 1) {
replyCount.setVisibility(View.VISIBLE);
replyLayout.setVisibility(View.VISIBLE);
} else {
replyLayout.setVisibility(View.GONE);
replyCount.setVisibility(View.GONE);
}
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
recyclerView.addItemDecoration(new TopGradual());
CommentReplyAdapter commentReplyAdapter = new CommentReplyAdapter(mContext, bean.getReplyCommentList());
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());
}
});
}
}
}
}

View File

@ -0,0 +1,69 @@
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.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;
public CommentReplyAdapter(Context content, List<CommentBean.ReplyComment> commentBeanList) {
this.mContext = content;
this.commentBeanList = commentBeanList;
}
@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 RoundedImageView mAvatar02;
private TextView replyContent;
public CommentViewHolder(@NonNull View itemView) {
super(itemView);
name = itemView.findViewById(R.id.name);
mAvatar01 = itemView.findViewById(R.id.avatar01);
mAvatar02 = itemView.findViewById(R.id.avatar02);
replyContent = itemView.findViewById(R.id.replyContent);
}
@SuppressLint("SetTextI18n")
public void setData(CommentBean.ReplyComment bean) {
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar01);
ImgLoader.display(itemView.getContext(), bean.getUser_avatar(), mAvatar02);
name.setText(bean.getUser_name());
replyContent.setText(bean.getContent());
}
}
}

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,229 @@
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;
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,93 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.utils.StringUtil;
public class MessageChatUserBean extends UserBean{
private String type;
private int modelType;
@SerializedName("user_nicename")
protected String userNiceName;
@SerializedName("isAttention")
private int attention;//isAttention 1被关注 2已关注 3互相关注
public String getType() {
return type;
}
public void setType(int type){
this.type=type+"";
}
public int getTypeInt(){
if(StringUtil.isEmpty(type)){
return 0;
}
return Integer.parseInt(type);
}
@Override
public String getUserNiceName() {
return userNiceName;
}
public int getModelType() {
return modelType;
}
public void setModelType(int modelType) {
this.modelType = modelType;
}
@Override
public void setUserNiceName(String userNiceName) {
this.userNiceName = userNiceName;
}
public int getAttention() {
return attention;
}
public void setAttention(int attention) {
this.attention = attention;
}
@Override
public String toString() {
return "MessageChatUserBean{" +
"type='" + type + '\'' +
", modelType='" + modelType + '\'' +
", userNiceName='" + userNiceName + '\'' +
", id='" + id + '\'' +
", userNiceName='" + userNiceName + '\'' +
", avatar='" + avatar + '\'' +
", avatarThumb='" + avatarThumb + '\'' +
", sex=" + sex +
", signature='" + signature + '\'' +
", coin='" + coin + '\'' +
", gold='" + gold + '\'' +
", votes='" + votes + '\'' +
", consumption='" + consumption + '\'' +
", votestotal='" + votestotal + '\'' +
", province='" + province + '\'' +
", city='" + city + '\'' +
", location='" + location + '\'' +
", birthday='" + birthday + '\'' +
", level=" + level +
", levelAnchor=" + levelAnchor +
", lives=" + lives +
", follows=" + follows +
", fans=" + fans +
", vip=" + vip +
", liang=" + liang +
", car=" + car +
", medal_level=" + medal_level +
", medal_name='" + medal_name + '\'' +
", Dress=" + Dress +
", noble_id='" + noble_id + '\'' +
", yuanbao='" + yuanbao + '\'' +
", typeMic=" + typeMic +
'}';
}
}

View File

@ -0,0 +1,449 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.utils.StringUtil;
import java.util.List;
public class MessageUserInfoBean extends BaseModel{
IMLoginModel user;
UserInfo info;
UserLevel level;
@SerializedName("gift_num")
int giftNum;
int status; //0 需要跳转到 编辑资料页面
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public MessageUserInfoBean() {
}
public IMLoginModel getUser() {
return user;
}
public void setUser(IMLoginModel user) {
this.user = user;
}
public UserInfo getInfo() {
return info;
}
public void setInfo(UserInfo info) {
this.info = info;
}
public UserLevel getLevel() {
return level;
}
public void setLevel(UserLevel level) {
this.level = level;
}
public int getGiftNum() {
return giftNum;
}
public void setGiftNum(int giftNum) {
this.giftNum = giftNum;
}
public static class UserInfo {
private int id;
private String label_id;
private List<String> cn_label;
private List<String> en_label;
private int first_mate;
private long create_time;
private long update_time;
private int sex;
private int b_y;
private int b_ym;
private String b_ymd;
private int name_auth;//1 未提交 2 已认证 3已提交 4被驳回
private long name_auth_time;
private String auth_front;
private String auth_back;
private String auth_remark;
private int sage_auth;//1 未提交 2 已认证 3已提交 4被驳回
private long sage_auth_time;
private int is_hot;
private String vodie_price;
private String price;
private int star;
private String area;
private int is_hello;
private String star_name;
public UserInfo() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getLabel_id() {
return label_id;
}
public void setLabel_id(String label_id) {
this.label_id = label_id;
}
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 int getFirst_mate() {
return first_mate;
}
public void setFirst_mate(int first_mate) {
this.first_mate = first_mate;
}
public long getCreate_time() {
return create_time;
}
public void setCreate_time(long create_time) {
this.create_time = create_time;
}
public long getUpdate_time() {
return update_time;
}
public void setUpdate_time(long update_time) {
this.update_time = update_time;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public int getB_y() {
return b_y;
}
public void setB_y(int b_y) {
this.b_y = b_y;
}
public int getB_ym() {
return b_ym;
}
public void setB_ym(int b_ym) {
this.b_ym = b_ym;
}
public String getB_ymd() {
return b_ymd;
}
public void setB_ymd(String b_ymd) {
this.b_ymd = b_ymd;
}
public int getName_auth() {
return name_auth;
}
public void setName_auth(int name_auth) {
this.name_auth = name_auth;
}
public long getName_auth_time() {
return name_auth_time;
}
public void setName_auth_time(long name_auth_time) {
this.name_auth_time = name_auth_time;
}
public String getAuth_front() {
return auth_front;
}
public void setAuth_front(String auth_front) {
this.auth_front = auth_front;
}
public String getAuth_back() {
return auth_back;
}
public void setAuth_back(String auth_back) {
this.auth_back = auth_back;
}
public String getAuth_remark() {
return auth_remark;
}
public void setAuth_remark(String auth_remark) {
this.auth_remark = auth_remark;
}
public int getSage_auth() {
return sage_auth;
}
public void setSage_auth(int sage_auth) {
this.sage_auth = sage_auth;
}
public long getSage_auth_time() {
return sage_auth_time;
}
public void setSage_auth_time(long sage_auth_time) {
this.sage_auth_time = sage_auth_time;
}
public int getIs_hot() {
return is_hot;
}
public void setIs_hot(int is_hot) {
this.is_hot = is_hot;
}
public String getVodie_price() {
return vodie_price;
}
public void setVodie_price(String vodie_price) {
this.vodie_price = vodie_price;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public int getStar() {
return star;
}
public void setStar(int star) {
this.star = star;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public int getIs_hello() {
return is_hello;
}
public void setIs_hello(int is_hello) {
this.is_hello = is_hello;
}
public String getStar_name() {
return star_name;
}
public void setStar_name(String star_name) {
this.star_name = star_name;
}
}
public static class UserLevel {
private int id;
private int wealth;
private int wealth_level;
private int charm;
private int charm_level;
private int level;
private int exp;
private long wealth_update;
private long wealth_level_update;
private long charm_update;
private long charm_level_update;
private long exp_update;
private long level_update;
private long create_time;
private String icon;
private String charm_icon;
private String wealth_icon;
public UserLevel() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getWealth() {
return wealth;
}
public void setWealth(int wealth) {
this.wealth = wealth;
}
public int getWealth_level() {
return wealth_level;
}
public void setWealth_level(int wealth_level) {
this.wealth_level = wealth_level;
}
public int getCharm() {
return charm;
}
public void setCharm(int charm) {
this.charm = charm;
}
public int getCharm_level() {
return charm_level;
}
public void setCharm_level(int charm_level) {
this.charm_level = charm_level;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getExp() {
return exp;
}
public void setExp(int exp) {
this.exp = exp;
}
public long getWealth_update() {
return wealth_update;
}
public void setWealth_update(long wealth_update) {
this.wealth_update = wealth_update;
}
public long getWealth_level_update() {
return wealth_level_update;
}
public void setWealth_level_update(long wealth_level_update) {
this.wealth_level_update = wealth_level_update;
}
public long getCharm_update() {
return charm_update;
}
public void setCharm_update(long charm_update) {
this.charm_update = charm_update;
}
public long getCharm_level_update() {
return charm_level_update;
}
public void setCharm_level_update(long charm_level_update) {
this.charm_level_update = charm_level_update;
}
public long getExp_update() {
return exp_update;
}
public void setExp_update(long exp_update) {
this.exp_update = exp_update;
}
public long getLevel_update() {
return level_update;
}
public void setLevel_update(long level_update) {
this.level_update = level_update;
}
public long getCreate_time() {
return create_time;
}
public void setCreate_time(long create_time) {
this.create_time = create_time;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getCharm_icon() {
return charm_icon;
}
public void setCharm_icon(String charm_icon) {
this.charm_icon = charm_icon;
}
public String getWealth_icon() {
return wealth_icon;
}
public void setWealth_icon(String wealth_icon) {
this.wealth_icon = wealth_icon;
}
}
}

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

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

@ -43,6 +43,8 @@ import com.yunbao.common.bean.LiveStetUpStatusModel;
import com.yunbao.common.bean.LiveTaskModel;
import com.yunbao.common.bean.LiveUserMailBoxModel;
import com.yunbao.common.bean.MedalAchievementModel;
import com.yunbao.common.bean.MessageChatUserBean;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.bean.MsgSwitchDetailModel;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.bean.NobleRankHideUserListModel;
@ -68,6 +70,7 @@ import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.bean.SudgameCodeModel;
import com.yunbao.common.bean.UserAreaBean;
import com.yunbao.common.bean.UserAvatarSelectBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.bean.WishListGiftConfModel;
import com.yunbao.common.bean.WishListModel;
@ -1162,4 +1165,17 @@ public interface PDLiveApi {
@GET("/api/public/?service=Sudgameserver.getRoomMicStatus")
Observable<ResponseModel<RoomMicStatusModel>> getRoomMicStatus();
@GET("/api/public/?service=Pdluser.friend")
Observable<ResponseModel<List<MessageChatUserBean>>> getPdluserFriend(@Query("p") int p);
@GET("/api/public/?service=Pdluser.follow")
Observable<ResponseModel<List<MessageChatUserBean>>> getPdluserFollow(@Query("p") int p);
@GET("/api/public/?service=Pdluser.fans")
Observable<ResponseModel<List<MessageChatUserBean>>> getPdluserFans(@Query("p") int p);
@GET("/api/public/?service=Pdluser.search")
Observable<ResponseModel<List<MessageChatUserBean>>> addressBookSearch(@Query("user_nicename") String key);
@GET("/api/public/?service=Pdlinfos.getOtherInfo")
Observable<ResponseModel<MessageUserInfoBean>> getOtherInfo(@Query("tuid") String tuid);
@GET("/api/public/?service=Userhome.getUserHomeBanner")
Observable<ResponseModel<List<String>>> getUserHomeBanner(@Query("select_uid") String tuid);
}

View File

@ -43,6 +43,8 @@ import com.yunbao.common.bean.LiveStetUpStatusModel;
import com.yunbao.common.bean.LiveTaskModel;
import com.yunbao.common.bean.LiveUserMailBoxModel;
import com.yunbao.common.bean.MedalAchievementModel;
import com.yunbao.common.bean.MessageChatUserBean;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.bean.NobleTrumpetModel;
import com.yunbao.common.bean.OpenAdModel;
@ -64,6 +66,7 @@ import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.bean.SudgameCodeModel;
import com.yunbao.common.bean.UserAreaBean;
import com.yunbao.common.bean.UserAvatarSelectBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.bean.WishListGiftConfModel;
import com.yunbao.common.bean.WishListModel;
@ -2770,7 +2773,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())
@ -2931,6 +2934,126 @@ public class LiveNetManager {
}
public void getPdluserFollow(int p, HttpCallback<List<MessageChatUserBean>> callback) {
API.get().pdLiveApi(mContext)
.getPdluserFollow(p)
.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 getOtherInfo(String touid, HttpCallback<MessageUserInfoBean> callback) {
API.get().pdLiveApi(mContext)
.getOtherInfo(touid)
.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 getPdluserFriend(int p, HttpCallback<List<MessageChatUserBean>> callback) {
API.get().pdLiveApi(mContext)
.getPdluserFriend(p)
.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 getPdluserFans(int p, HttpCallback<List<MessageChatUserBean>> callback) {
API.get().pdLiveApi(mContext)
.getPdluserFans(p)
.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 addressBookSearch(String search, HttpCallback<List<MessageChatUserBean>> callback) {
API.get().pdLiveApi(mContext)
.addressBookSearch(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 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();
}
/**
* 直播间取消网络请求
*/

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

@ -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,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="#DFDFDF"
android:startColor="#DFDFDF" />
<corners
android:bottomLeftRadius="90dp"
android:bottomRightRadius="90dp"
android:topLeftRadius="90dp"
android:topRightRadius="90dp" />
</shape>

View File

@ -1,9 +1,11 @@
<?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:orientation="vertical"
android:paddingTop="15dp">
<include layout="@layout/view_title_new" />
@ -14,7 +16,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
@ -22,14 +24,15 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@mipmap/icon_data_empty" />
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"
@ -39,6 +42,7 @@
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="栗子栗子🌰zzz"
@ -47,27 +51,32 @@
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:textColor="#AAAAAA"
android:textSize="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="80dp"
android:layout_height="40dp"
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"
@ -81,16 +90,41 @@
</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" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
<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" />
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"
@ -98,15 +132,17 @@
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:text="105人觉得很赞"
android:textColor="#333333"
android:textSize="12dp" />
@ -129,6 +165,7 @@
android:gravity="center_vertical">
<TextView
android:id="@+id/replyCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="评论123"
@ -145,6 +182,7 @@
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/commentListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
@ -155,22 +193,24 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="55dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingTop="20dp"
android:paddingRight="20dp"
android:paddingBottom="20dp">
android:paddingRight="20dp">
<ImageView
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/userAvatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/icon_data_empty" />
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"
@ -185,7 +225,7 @@
<EditText
android:id="@+id/comment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="@color/transparent"
android:hint="说点什么..."
@ -200,6 +240,7 @@
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:src="@mipmap/icon_send" />
</LinearLayout>

View File

@ -6,196 +6,245 @@
<include layout="@layout/view_title2" />
<LinearLayout
<ScrollView
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">
android:layout_height="wrap_content">
<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:layout_width="match_parent"
android:layout_height="180dp"
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:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="30dp"
android:gravity="center"
android:orientation="horizontal">
android:orientation="vertical">
<LinearLayout
android:id="@+id/imgTextLayout"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:layout_margin="15dp"
android:background="@drawable/main_community_send_edit_bg"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/icon_community_img_text" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center_vertical">
<TextView
<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_marginTop="10dp"
android:text="图文"
android:textColor="#333333"
android:textSize="16dp" />
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:id="@+id/videoLayout"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
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">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/icon_community_video" />
<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>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="视频"
android:textColor="#333333"
android:textSize="16dp" />
</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: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="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="选择话题"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold" />
<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: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="16dp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="立即发表"
android:textColor="#333333"
android:textSize="14dp" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@mipmap/icon_right_new" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</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,87 @@
<?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:background="@drawable/bg_item_comment"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="25dp"
android:layout_height="20dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar01"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="20dp" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar02"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="20dp" />
</RelativeLayout>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="A回复B"
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
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" />
</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="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="10dp"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,167 @@
<?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:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="35dp"
android:layout_height="35dp"
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_marginTop="10dp"
android:layout_weight="1"
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/reply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:padding="10dp"
android:text="回复"
android:textColor="#777777"
android:textSize="12dp" />
<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="12dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/replyLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/bg_item_comment"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="25dp"
android:layout_height="20dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar01"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="20dp" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar02"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:src="@mipmap/icon_data_empty"
app:riv_corner_radius="20dp" />
</RelativeLayout>
<TextView
android:id="@+id/firstName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="A回复B"
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
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" />
</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="12dp" />
<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>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -67,4 +67,11 @@
<attr name="cgl_arrow_height" format="dimension"/>
<attr name="cgl_arrow_offset_x" format="dimension"/>
</declare-styleable>
<declare-styleable name="NineGridLayout">
<attr name="ngl_space" format="dimension" />
<attr name="ngl_divider_width" format="dimension" />
<attr name="ngl_corner_radius" format="dimension" />
<attr name="ngl_item_width" format="dimension" />
<attr name="ngl_play_icon" format="reference" />
</declare-styleable>
</resources>

View File

@ -94,6 +94,7 @@
</LinearLayout>
<ImageView
android:id="@+id/isVideo"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentEnd="true"

View File

@ -12,35 +12,37 @@ 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.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.main.R;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cxf on 2018/9/26.
* 首页 直播
* 首页 社区
*/
public class MainHomeComAdapter extends RefreshAdapter<LiveBean> {
public class MainHomeComAdapter extends RefreshAdapter<ActiveBean> {
private Context mContext;
private View.OnClickListener mOnClickListener;
public void setmOnClickListener(View.OnClickListener mOnClickListener) {
this.mOnClickListener = mOnClickListener;
}
private List<Integer> heightList = new ArrayList<>();
public MainHomeComAdapter(Context context) {
super(context);
this.mContext = context;
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag != null && mOnItemClickListener != null) {
mOnItemClickListener.onItemClick((ActiveBean) tag, 0);
}
}
};
}
@NonNull
@ -60,13 +62,13 @@ public class MainHomeComAdapter extends RefreshAdapter<LiveBean> {
}
class Vh extends RecyclerView.ViewHolder {
TextView name;
TextView title;
TextView likeCount;
ImageView img;
ImageView author;
LinearLayout heightLayout;
ImageView isVideo;
public Vh(View itemView) {
super(itemView);
@ -76,16 +78,30 @@ public class MainHomeComAdapter extends RefreshAdapter<LiveBean> {
author = itemView.findViewById(R.id.author);
likeCount = itemView.findViewById(R.id.like_count);
heightLayout = itemView.findViewById(R.id.imgLayout);
isVideo = itemView.findViewById(R.id.isVideo);
itemView.setOnClickListener(mOnClickListener);
}
void setData(LiveBean bean, int position) {
void setData(ActiveBean bean, int position) {
itemView.setTag(bean);
//name.setText(bean.getCity());
//title.setText(bean.getCity());
likeCount.setText(bean.getNums());
ImgLoader.display(mContext, "https://img2.baidu.com/it/u=1540900496,2036305732&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", img);
ImgLoader.display(mContext, bean.getAvatar(), author);
if (bean.getImg_or_video().equals("1")) {
JSONArray jsonArray = (JSONArray) JSONArray.parse(bean.getImg_json());
if (jsonArray.size() != 0) {
ImgLoader.display(mContext, String.valueOf(jsonArray.get(0)), img);
}
isVideo.setVisibility(View.GONE);
} else {
ImgLoader.display(mContext, bean.getUser_avatar(), img);
isVideo.setVisibility(View.VISIBLE);
}
name.setText(bean.getUser_name());
JSONObject json = JSONObject.parseObject(bean.getContent());
if (json != null) {
String content = (String) json.get("msg");
title.setText(content);
}
likeCount.setText(bean.getLove_num());
ImgLoader.display(mContext, bean.getUser_avatar(), author);
if (position == 0) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();

View File

@ -8,7 +8,6 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.CommunitySendActivity;
import com.yunbao.common.event.FloatWarOrderEvent;
import com.yunbao.common.utils.RouteUtil;

View File

@ -4,6 +4,7 @@ import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@ -14,36 +15,36 @@ 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.umeng.analytics.MobclickAgent;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.CommunityDetailsActivity;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.bean.VideoBean;
import com.yunbao.common.custom.CommonRefreshWaterfallView;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.LiveClassManager;
import com.yunbao.common.manager.OpenAdManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.utils.LiveStorge;
import com.yunbao.live.views.LiveRoomViewHolder;
import com.yunbao.live.adapter.LiveAdminRoomAdapter;
import com.yunbao.live.bean.LiveAdminRoomBean;
import com.yunbao.live.views.LiveMyRoomViewHolder;
import com.yunbao.main.R;
import com.yunbao.main.adapter.MainHomeComAdapter;
import com.yunbao.main.adapter.MainHomeComClassAdapter;
import com.yunbao.main.http.MainHttpConsts;
import com.yunbao.main.http.MainHttpUtil;
import com.yunbao.video.activity.VideoPlayActivity;
import com.yunbao.video.http.VideoHttpUtil;
import com.yunbao.video.interfaces.VideoScrollDataHelper;
import com.yunbao.video.utils.VideoStorge;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -60,23 +61,18 @@ import java.util.Map;
* MainActivity 社区-热门
*/
public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<LiveBean> {
private View mShadow;
public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<ActiveBean> {
private View mBtnDismiss;
public static CommonRefreshWaterfallView mRefreshView;
private RecyclerView mClassRecyclerViewTop;
private MainHomeComAdapter mAdapter;
private ObjectAnimator mShowAnimator;
private ObjectAnimator mHideAnimator;
private boolean mBannerShowed;
private List<BannerBean> mBannerList;
private List<WeekListBean> mWeekListBean;
public static ImageView btnUseIco;
private int select = 0;
//是否是首頁
private int intoIndex = 0;
private List<LiveBean> new_data;
private boolean isHave = false;
private List<ActiveBean> new_data;
private Map<String, String> gotoRoomKey = new HashMap<>();
private Dialog mShowLoadingDialog;
private String typeHot;
@ -114,7 +110,6 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
typeHot = list.get(0).getEnglish();
select = list.get(0).getId();
}
mShadow = findViewById(R.id.shadow);
mBtnDismiss = findViewById(R.id.btn_dismiss);
mBtnDismiss.setOnClickListener(new View.OnClickListener() {
@Override
@ -134,22 +129,16 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_live);
EventBus.getDefault().register(this);
mAdapter = new MainHomeComAdapter(mContext);
mAdapter.setmOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext, CommunityDetailsActivity.class);
mContext.startActivity(intent);
}
});
mAdapter.setOnItemClickListener(MainHomeNewViewHolder.this);
mAdapter.setHasStableIds(true);//
mRefreshView.setLoadMoreEnable(true);
mRefreshView.setRecyclerViewAdapter(mAdapter);
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<LiveBean>() {
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<ActiveBean>() {
@Override
public RefreshAdapter<LiveBean> getAdapter() {
return null;
public RefreshAdapter<ActiveBean> getAdapter() {
if (mAdapter == null) {
mAdapter = new MainHomeComAdapter(mContext);
mAdapter.setOnItemClickListener(MainHomeNewViewHolder.this);
}
return mAdapter;
}
@Override
@ -157,26 +146,7 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
Log.i("t2", "aaa" + p);
if (TextUtils.equals(typeHot, "Hot") || TextUtils.equals(typeHot, "hot") || TextUtils.equals(typeHot, "熱門")) {
pp = 1;
LiveHttpUtil.getAnchorLastWeekList(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (mWeekListBean != null) {
mWeekListBean.clear();
}
if (code == 0 && info.length > 0) {
mWeekListBean = JSON.parseArray(Arrays.toString(info), WeekListBean.class);
} else {
mWeekListBean = null;
}
if (mWeekListBean != null && mWeekListBean.size() > 0) {
isHave = true;
} else {
isHave = false;
}
Constants.getWeekIntIndex = Constants.getWeekIntIndex + 1;
MainHttpUtil.getHot(p, callback);
}
});
CommonHttpUtil.getCommunityHotList(p, callback);
} else {
pp = 0;
MainHttpUtil.getClassLive(select, p, callback);
@ -184,46 +154,15 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
}
@Override
public List<LiveBean> processData(String[] info) {
public List<ActiveBean> processData(String[] info) {
new_data = new ArrayList<>();
if (info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]);
mBannerList = JSON.parseArray(obj.getString("slide"), BannerBean.class);
if (!obj.containsKey("list")) {
return new_data;
}
List<LiveBean> old_data = JSON.parseArray(obj.getString("list"), LiveBean.class);
LiveBean liveModel = null;
if (old_data == null) {
return new_data;
}
for (LiveBean model : old_data) {
//判断周星榜数据
if (TextUtils.equals(model.getIs_week(), "1")) {
if (mWeekListBean != null && mWeekListBean.size() > 0) {
model.setmWeekList(mWeekListBean);
} else {
liveModel = model;
}
}
}
//满足有周星榜字段但是没有周星榜数据的删掉
if (liveModel != null) {
old_data.remove(liveModel);
}
new_data.addAll(old_data);
}
new_data = JSON.parseArray(Arrays.toString(info), ActiveBean.class);
return new_data;
}
@Override
public void onRefreshSuccess(List<LiveBean> list, int count) {
if (CommonAppConfig.LIVE_ROOM_SCROLL) {
LiveStorge.getInstance().put(Constants.LIVE_HOME, list);
}
EventBus.getDefault().post(new AnchorRecommendModel());
public void onRefreshSuccess(List<ActiveBean> list, int count) {
}
@Override
@ -232,12 +171,10 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
}
@Override
public void onLoadMoreSuccess(List<LiveBean> loadItemList, int loadItemCount) {
public void onLoadMoreSuccess(List<ActiveBean> loadItemList, int loadItemCount) {
new_data = new ArrayList<>();
for (int j = 0; j < loadItemList.size(); j++) {
if (loadItemList.get(j).getUserNiceName() != null) {
new_data.add(loadItemList.get(j));
}
new_data.add(loadItemList.get(j));
}
if (loadItemList.size() > 0) {
mAdapter.insertList(new_data);
@ -295,7 +232,6 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
mRefreshView.initData();
topAdapter.choice = position;
topAdapter.notifyDataSetChanged();
}
});
if (mClassRecyclerViewTop != null) {
@ -305,39 +241,40 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
mRefreshView.initData();
}
private VideoScrollDataHelper mVideoScrollDataHelper;
private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override
public void onItemClick(ActiveBean bean, int position) {
Intent intent = new Intent(mContext, CommunityDetailsActivity.class);
intent.putExtra("active", (Parcelable) bean);
mContext.startActivity(intent);
/*if (bean.getImg_or_video().equals("2")) {
if (mVideoScrollDataHelper == null) {
mVideoScrollDataHelper = new VideoScrollDataHelper() {
@Override
public void loadData(int p, HttpCallback callback) {
VideoHttpUtil.getHomeVideoList(p, callback);
}
};
}
VideoStorge.getInstance().putDataHelper(Constants.VIDEO_HOME, mVideoScrollDataHelper);
VideoPlayActivity.forward(mContext, position, Constants.VIDEO_HOME, 1);
}*/
/*VideoHttpUtil.getHomeVideoList(1, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (liveBean == null) {
return;
if (code == 0) {
List<VideoBean> tempList = new ArrayList<>();
for (String s : info) {
VideoBean videoBean = JSONObject.parseObject(s, VideoBean.class);
tempList.add(videoBean);
}
intoIndex = 1;
if (gotoRoomKey != null && gotoRoomKey.isEmpty()) {
gotoRoomKey = null;
}
liveBean.setParams(gotoRoomKey);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else {
intoIndex = 1;
RouteUtil.forwardUserHome(mContext, live_id, 0);
VideoStorge.getInstance().put(Constants.VIDEO_HOME, tempList);
VideoPlayActivity.forward(mContext, position, Constants.VIDEO_HOME, 1);
}
}
});
});*/
}
/**
@ -348,58 +285,6 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
mShowLoadingDialog.show();
}
@Override
public void onItemClick(LiveBean bean, int position) {
if ("1".equals(bean.getIslive())) {
intoIndex = 1;
watchLive(bean, Constants.LIVE_HOME, position);
} else if (bean.getIs_week() != null && bean.getIs_week().equals("1")) {
String url = CommonAppConfig.HOST + bean.getUrl() + "?a=1";
LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (liveBean == null) {
return;
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
}
if (!"".endsWith(Constants.mStream)) {
if (MicStatusManager.getInstance().isMic(liveUid)) {
MicStatusManager.getInstance().showDownMicDialog(mContext);
return;
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
}
}
@Override
public void onCheckError(String contextError) {
}
});
} else {
ToastUtil.show(msg);
}
}
});
} else {
intoIndex = 1;
RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
}
}
@Override
public void loadData() {
}
@ -437,4 +322,5 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements
mShowLoadingDialog = null;
}
}
}

View File

@ -11,7 +11,7 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginTop="10dp"
android:layout_marginTop="20dp"
android:background="@android:color/transparent"
android:fadingEdge="none"
app:elevation="0dp"

View File

@ -70,10 +70,7 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
mVideoCover = findViewById(R.id.video_cover);
mPlayBtn = findViewById(R.id.btn_play);
//暂停按钮动画
mPlayBtnAnimator = ObjectAnimator.ofPropertyValuesHolder(mPlayBtn,
PropertyValuesHolder.ofFloat("scaleX", 4f, 0.8f, 1f),
PropertyValuesHolder.ofFloat("scaleY", 4f, 0.8f, 1f),
PropertyValuesHolder.ofFloat("alpha", 0f, 1f));
mPlayBtnAnimator = ObjectAnimator.ofPropertyValuesHolder(mPlayBtn, PropertyValuesHolder.ofFloat("scaleX", 4f, 0.8f, 1f), PropertyValuesHolder.ofFloat("scaleY", 4f, 0.8f, 1f), PropertyValuesHolder.ofFloat("alpha", 0f, 1f));
mPlayBtnAnimator.setDuration(150);
mPlayBtnAnimator.setInterpolator(new AccelerateInterpolator());
}
@ -87,9 +84,8 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
case TXLiveConstants.PLAY_EVT_PLAY_BEGIN://加载完成开始播放的回调
mStartPlay = true;
if (mActionListener != null) {
mActionListener.onPlayBegin();
mActionListener.onPlayBegin(txVodPlayer.getDuration());
}
break;
case TXLiveConstants.PLAY_EVT_PLAY_LOADING: //开始加载的回调
if (mActionListener != null) {
@ -116,6 +112,13 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
case TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION://获取到视频宽高回调
onVideoSizeChanged(bundle.getInt("EVT_PARAM1", 0), bundle.getInt("EVT_PARAM2", 0));
break;
case TXLiveConstants.PLAY_EVT_PLAY_PROGRESS:
if (mActionListener != null) {
int progress = bundle.getInt(TXLiveConstants.EVT_PLAY_PROGRESS_MS);
int duration = bundle.getInt(TXLiveConstants.EVT_PLAY_DURATION_MS);
mActionListener.onProgress(progress, duration);
}
break;
}
}
@ -289,11 +292,13 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
public interface ActionListener {
void onPlayBegin();
void onPlayBegin(float duration);
void onPlayLoading();
void onFirstFrame();
void onProgress(int progress, int duration);
}

View File

@ -4,18 +4,24 @@ import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.alibaba.android.arouter.utils.TextUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
@ -61,7 +67,10 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
private Drawable[] mLikeAnimDrawables;//点赞帧动画
private int mLikeAnimIndex;
private String mTag;
private TextView tv_video_report;
private SeekBar seekbar;
private LinearLayout progressTextLayout;
private TextView progressTextView;
private TextView progressCount;
public VideoPlayWrapViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
@ -75,27 +84,51 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
@Override
public void init() {
mTag = this.toString();
seekbar = (SeekBar) findViewById(R.id.seekbar);
progressTextLayout = (LinearLayout) findViewById(R.id.progressTextLayout);
progressTextView = (TextView) findViewById(R.id.progress);
progressCount = (TextView) findViewById(R.id.progressCount);
mVideoContainer = (ViewGroup) findViewById(R.id.video_container);
mCover = (ImageView) findViewById(R.id.cover);
mAvatar = (ImageView) findViewById(R.id.avatar2);
mAvatar = (ImageView) findViewById(R.id.avatar);
mName = (TextView) findViewById(R.id.name);
mTitle = (TextView) findViewById(R.id.title);
mBtnLike = (ImageView) findViewById(R.id.btn_like);
mLikeNum = (TextView) findViewById(R.id.like_num);
mCommentNum = (TextView) findViewById(R.id.comment_num);
mShareNum = (TextView) findViewById(R.id.share_num);
mBtnFollow = (ImageView) findViewById(R.id.btn_follow2);
mBtnFollow = (ImageView) findViewById(R.id.btn_follow);
tv_video_report = (TextView) findViewById(R.id.tv_video_report);
// mFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_video_follow_1);
mFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_video_follow_1);
mUnFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_video_follow_0);
mAvatar.setOnClickListener(this);
mBtnFollow.setOnClickListener(this);
mBtnLike.setOnClickListener(this);
findViewById(R.id.btn_comment).setOnClickListener(this);
findViewById(R.id.btn_share).setOnClickListener(this);
findViewById(R.id.tv_video_report).setOnClickListener(this);
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
progressTextLayout.setVisibility(View.VISIBLE);
} else {
progressTextLayout.setVisibility(View.GONE);
}
progressTextView.setText(String.valueOf(progress));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
/**
@ -181,11 +214,9 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
}
if (mBtnLike != null) {
if (bean.getLike() == 1) {
if (mLikeAnimDrawables != null && mLikeAnimDrawables.length > 0) {
mBtnLike.setImageDrawable(mLikeAnimDrawables[mLikeAnimDrawables.length - 1]);
}
mBtnLike.setImageResource(R.mipmap.icon_video_zan_new02);
} else {
mBtnLike.setImageResource(R.mipmap.icon_video_zan_01);
mBtnLike.setImageResource(R.mipmap.icon_video_zan_new01);
}
}
if (mLikeNum != null) {
@ -197,36 +228,36 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
if (mShareNum != null) {
mShareNum.setText(bean.getShareNum());
}
// if (u != null && mBtnFollow != null) {
// String toUid = u.getId();
// if (!TextUtils.isEmpty(toUid) && !toUid.equals(CommonAppConfig.getInstance().getUid())) {
// if (mBtnFollow.getVisibility() != View.VISIBLE) {
// mBtnFollow.setVisibility(View.VISIBLE);
// }
// if (bean.getAttent() == 1) {
// mBtnFollow.setImageDrawable(mFollowDrawable);
// } else {
// mBtnFollow.setImageDrawable(mUnFollowDrawable);
// }
// } else {
// if (mBtnFollow.getVisibility() == View.VISIBLE) {
// mBtnFollow.setVisibility(View.INVISIBLE);
// }
// }
// }
if (u != null && mBtnFollow != null) {
String toUid = u.getId();
if (!TextUtils.isEmpty(toUid) && !toUid.equals(CommonAppConfig.getInstance().getUid())) {
if (mBtnFollow.getVisibility() != View.VISIBLE) {
mBtnFollow.setVisibility(View.VISIBLE);
}
if (bean.getAttent() == 1) {
mBtnFollow.setImageDrawable(mFollowDrawable);
} else {
mBtnFollow.setImageDrawable(mUnFollowDrawable);
}
} else {
if (mBtnFollow.getVisibility() == View.VISIBLE) {
mBtnFollow.setVisibility(View.INVISIBLE);
}
}
}
if (!Constants.myUid.endsWith(bean.getUid())) {
// if (bean.getAttent() == 2) {
// mBtnFollow.setVisibility(View.VISIBLE);
// if (bean.getAttent() == 1) {
// mBtnFollow.setImageDrawable(mFollowDrawable);
// } else {
// mBtnFollow.setImageDrawable(mUnFollowDrawable);
// }
// } else {
// mBtnFollow.setVisibility(View.GONE);
// }
if (bean.getAttent() == 2) {
mBtnFollow.setVisibility(View.VISIBLE);
if (bean.getAttent() == 1) {
mBtnFollow.setImageDrawable(mFollowDrawable);
} else {
mBtnFollow.setImageDrawable(mUnFollowDrawable);
}
} else {
mBtnFollow.setVisibility(View.GONE);
}
} else {
// mBtnFollow.setVisibility(View.GONE);
mBtnFollow.setVisibility(View.GONE);
}
}
@ -278,6 +309,17 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
return mVideoBean;
}
public void setProgress(int progresss) {
if (progressTextView != null) {
progressTextView.setText(String.valueOf(progresss));
}
}
public void setDuration(int duration) {
if (progressCount != null) {
progressCount.setText(String.valueOf(duration));
}
}
/**
* 获取到视频首帧回调
@ -324,7 +366,7 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
return;
}
int i = v.getId();
if (i == R.id.btn_follow2) {
if (i == R.id.btn_follow) {
clickFollow();
} else if (i == R.id.btn_comment) {
clickComment();
@ -334,12 +376,12 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
clickLike();
} else if (i == R.id.avatar2) {
clickAvatar();
} else if (i == R.id.tv_video_report) {
} /*else if (i == R.id.tv_video_report) {
if (mVideoBean == null) {
return;
}
LiveReportActivity.forward2(mContext, mVideoBean.getId());
}
}*/
}
@ -376,15 +418,9 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
}
if (mBtnLike != null) {
if (like == 1) {
if (mLikeAnimtor == null) {
initLikeAnimtor();
}
mLikeAnimIndex = -1;
if (mLikeAnimtor != null) {
mLikeAnimtor.start();
}
mBtnLike.setImageResource(R.mipmap.icon_video_zan_new02);
} else {
mBtnLike.setImageResource(R.mipmap.icon_video_zan_01);
mBtnLike.setImageResource(R.mipmap.icon_video_zan_new01);
}
}
} else {
@ -409,6 +445,11 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
@Override
public void callback(Integer attent) {
mVideoBean.setAttent(attent);
if (attent == 1) {
mBtnFollow.setImageDrawable(mFollowDrawable);
} else {
mBtnFollow.setImageDrawable(mUnFollowDrawable);
}
if (mCurPageShowed) {
if (mFollowAnimation == null) {
initFollowAnimation();

View File

@ -1,9 +1,11 @@
package com.yunbao.video.views;
import android.content.Context;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
@ -34,9 +36,7 @@ import java.util.List;
* 视频滑动
*/
public class VideoScrollViewHolder extends AbsViewHolder implements
VideoScrollAdapter.ActionListener, SwipeRefreshLayout.OnRefreshListener,
VideoPlayViewHolder.ActionListener, View.OnClickListener {
public class VideoScrollViewHolder extends AbsViewHolder implements VideoScrollAdapter.ActionListener, SwipeRefreshLayout.OnRefreshListener, VideoPlayViewHolder.ActionListener, View.OnClickListener {
private VideoPlayViewHolder mVideoPlayViewHolder;
private View mPlayView;
@ -218,7 +218,7 @@ public class VideoScrollViewHolder extends AbsViewHolder implements
}
@Override
public void onPlayBegin() {
public void onPlayBegin(float duration) {
if (mVideoLoadingBar != null) {
mVideoLoadingBar.setLoading(false);
}
@ -238,6 +238,14 @@ public class VideoScrollViewHolder extends AbsViewHolder implements
}
}
@Override
public void onProgress(int progress, int duration) {
if (mVideoPlayWrapViewHolder != null) {
mVideoPlayWrapViewHolder.setProgress(progress);
mVideoPlayWrapViewHolder.setDuration(duration);
}
}
/**
* 关注发生变化
*/

View File

@ -10,7 +10,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/cover"
android:layout_width="match_parent"
@ -18,23 +17,18 @@
android:layout_centerInParent="true"
android:scaleType="centerCrop" />
<RelativeLayout
android:layout_width="60dp"
android:layout_height="42dp"
android:layout_alignParentRight="true"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="10dp"
android:layout_marginTop="48dp"
android:visibility="gone">
android:visibility="visible">
<TextView
android:id="@+id/tv_video_report"
<ImageView
android:id="@+id/back"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/report"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold" />
android:src="@mipmap/icon_video_back" />
</RelativeLayout>
<RelativeLayout
@ -43,8 +37,8 @@
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="8dp"
android:layout_marginBottom="70dp"
android:visibility="gone">
android:layout_marginBottom="120dp"
android:visibility="visible">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
@ -57,8 +51,8 @@
<ImageView
android:id="@+id/btn_follow"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="36dp"
android:padding="3dp"
@ -66,68 +60,73 @@
<ImageView
android:id="@+id/btn_like"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_below="@id/avatar"
android:layout_marginTop="20dp"
android:scaleX="1.16"
android:scaleY="1.16"
android:visibility="gone" />
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:padding="4dp"
android:visibility="visible" />
<TextView
android:id="@+id/like_num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/btn_like"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:gravity="center"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="13sp"
android:translationY="-5dp"
android:visibility="gone" />
android:textSize="10sp"
android:visibility="visible" />
<ImageView
android:id="@+id/btn_comment"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_below="@id/btn_like"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:padding="4dp"
android:src="@mipmap/icon_video_comment"
android:visibility="gone" />
android:src="@mipmap/icon_video_comment_new"
android:visibility="visible" />
<TextView
android:id="@+id/comment_num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/btn_comment"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:gravity="center"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="13sp"
android:translationY="-5dp" />
android:textSize="10sp" />
<ImageView
android:id="@+id/btn_share"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_below="@id/btn_comment"
android:layout_marginTop="18dp"
android:padding="2dp"
android:src="@mipmap/icon_video_share"
android:visibility="gone" />
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:padding="4dp"
android:src="@mipmap/icon_video_share_new"
android:visibility="visible" />
<TextView
android:id="@+id/share_num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/btn_share"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:gravity="center"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="13sp"
android:translationY="-5dp"
android:visibility="gone" />
android:textSize="10sp"
android:visibility="visible" />
</RelativeLayout>
@ -135,34 +134,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="18dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="120dp"
android:layout_marginBottom="30dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar2"
android:layout_width="45dp"
android:layout_height="45dp"
android:scaleType="centerCrop"
app:riv_border_color="@color/white"
app:riv_border_width="1dp"
app:riv_oval="true" />
<ImageView
android:id="@+id/btn_follow2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="36dp"
android:padding="3dp"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -191,4 +167,44 @@
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<LinearLayout
android:id="@+id/progressTextLayout"
android:layout_width="match_parent"
android:layout_height="25dp"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="00:15"
android:textColor="@color/white" />
<TextView
android:id="@+id/progressCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="/00:45"
android:textColor="@color/gray1" />
</LinearLayout>
<SeekBar
android:id="@+id/seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:min="0" />
</LinearLayout>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB