对接语圈接口,
页面基本完成,评论完成一半,需要再调试
This commit is contained in:
@@ -5,7 +5,7 @@ plugins {
|
||||
|
||||
android {
|
||||
namespace 'com.qxcm.qxlive'
|
||||
compileSdk 35
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.qxcm.qxlive"
|
||||
|
||||
@@ -121,6 +121,9 @@ dependencies {
|
||||
//下拉框 https://gitcode.com/gh_mirrors/ni/nice-spinner?utm_source=csdn_blog_hover&isLogin=1
|
||||
api(libs.com.github.arcadefire.nice.spinner)
|
||||
|
||||
//定位
|
||||
api('com.google.android.gms:play-services-location:21.0.1')
|
||||
|
||||
//腾讯im
|
||||
// api project(':tuiconversation')
|
||||
// api project(':tuichat')
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<application
|
||||
android:allowBackup="true">
|
||||
|
||||
<activity
|
||||
android:name="com.qxcm.moduleutil.activity.news.OfficialNoticeActivity"
|
||||
android:exported="false" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -33,7 +33,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().getDecorView().setBackgroundResource(R.mipmap.log_bj);
|
||||
getWindow().getDecorView().setBackgroundResource(R.mipmap.activity_bj);
|
||||
setContentView(getLayoutId());
|
||||
mBinding = DataBindingUtil.setContentView(this, getLayoutId());
|
||||
mBinding.setLifecycleOwner(this);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.qxcm.moduleutil.activity.news;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NewsContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
void getOfficialNoticeList(List<NewsDataBean> newsDataBeans);
|
||||
|
||||
}
|
||||
public interface IHomePre extends IPresenter {
|
||||
|
||||
void getOfficialNotice(String page,String page_limit,String type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.qxcm.moduleutil.activity.news;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NewsPresenter extends BasePresenter<NewsContacts.View> implements NewsContacts.IHomePre {
|
||||
public NewsPresenter(NewsContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOfficialNotice(String page, String page_limit, String type) {
|
||||
// api.getOfficialNotice(page, page_limit, type, new BaseObserver<List<NewsDataBean>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(List<NewsDataBean> newsDataBeans) {
|
||||
// MvpRef.get().getOfficialNoticeList(newsDataBeans);
|
||||
// }
|
||||
// });
|
||||
|
||||
List<NewsDataBean> newsDataBeans= new ArrayList<>();
|
||||
if (type.equals("1")){
|
||||
for (int i = 0; i < 5; i++) {
|
||||
NewsDataBean newsDataBean = new NewsDataBean();
|
||||
newsDataBean.setId(i+"");
|
||||
newsDataBean.setTitle("系统消息"+i);
|
||||
newsDataBean.setContent("系统消息"+i);
|
||||
newsDataBean.setType("1");
|
||||
newsDataBean.setSource_id("1");
|
||||
newsDataBean.setIs_read("1");
|
||||
newsDataBean.setCreatetime("2019-09-09");
|
||||
newsDataBean.setImage("");
|
||||
newsDataBeans.add(newsDataBean);
|
||||
}
|
||||
}else {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
NewsDataBean newsDataBean = new NewsDataBean();
|
||||
newsDataBean.setId(i+"");
|
||||
newsDataBean.setTitle("官方公告"+i);
|
||||
newsDataBean.setContent("官方公告"+i);
|
||||
newsDataBean.setType("2");
|
||||
newsDataBean.setSource_id("1");
|
||||
newsDataBean.setIs_read("1");
|
||||
newsDataBean.setCreatetime("2019-09-09");
|
||||
newsDataBean.setImage("");
|
||||
newsDataBeans.add(newsDataBean);
|
||||
}
|
||||
}
|
||||
MvpRef.get().getOfficialNoticeList(newsDataBeans);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.qxcm.moduleutil.activity.news;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
import com.qxcm.moduleutil.databinding.ActivityOfficialNoticeBinding;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, ActivityOfficialNoticeBinding> implements NewsContacts.View {
|
||||
|
||||
private int page = 1;
|
||||
private BaseQuickAdapter<NewsDataBean, BaseViewHolder> mAdapter;
|
||||
private String type;
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
type=getIntent().getStringExtra("type");
|
||||
if (type.equals("1")){
|
||||
mBinding.topBar.setTitle("系统消息");
|
||||
}else {
|
||||
mBinding.topBar.setTitle("官方公告");
|
||||
}
|
||||
// mBinding.smartRefreshLayout.autoRefresh();
|
||||
|
||||
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.getOfficialNotice(page+"", "10",type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
MvpPre.getOfficialNotice(page+"", "10",type);
|
||||
}
|
||||
});
|
||||
mBinding.recycleView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mAdapter = new BaseQuickAdapter<NewsDataBean, BaseViewHolder>(R.layout.news_rv_item_system_news) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, NewsDataBean item) {
|
||||
helper.setText(R.id.tv_sys_time, item.getCreatetime() );
|
||||
helper.setText(R.id.tv_sys_con, Html.fromHtml(item.getTitle()));
|
||||
if (item.getType().equals("1")){
|
||||
helper.getView(R.id.ll_system_official).setVisibility(GONE);
|
||||
}else if (item.getType().equals("2")){
|
||||
helper.getView(R.id.tv_sys_con).setVisibility(GONE);
|
||||
helper.getView(R.id.ll_system_official).setVisibility(VISIBLE);
|
||||
}else {
|
||||
helper.getView(R.id.ll_system_official).setVisibility(GONE);
|
||||
}
|
||||
ImageUtils.loadHeadCC(item.getImage(), helper.getView(R.id.image));
|
||||
helper.getView(R.id.image).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
mBinding.recycleView.setAdapter(mAdapter);
|
||||
MvpPre.getOfficialNotice("1","10",type);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_official_notice;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NewsPresenter bindPresenter() {
|
||||
return new NewsPresenter(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOfficialNoticeList(List<NewsDataBean> newsDataBeans) {
|
||||
mAdapter.setNewData(newsDataBeans);
|
||||
}
|
||||
}
|
||||
@@ -6,26 +6,47 @@ import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.TimeUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.generated.callback.OnClickListener;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
import com.qxcm.moduleutil.widget.MyGridView;
|
||||
import com.qxcm.moduleutil.widget.img.FullScreenUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewHolder> {
|
||||
public CirleListAdapter() {
|
||||
super(R.layout.item_cirle_list);
|
||||
}
|
||||
public interface OnItemClickListener {
|
||||
void onDianzanClick(CircleListBean item);
|
||||
void onHeadImageClick(CircleListBean item);
|
||||
void onZsClick(CircleListBean item);
|
||||
|
||||
void onDiandianClick(CircleListBean item);
|
||||
|
||||
void onPinglunClick(CircleListBean item);
|
||||
}
|
||||
private OnItemClickListener mListener;
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, CircleListBean item) {
|
||||
helper.addOnClickListener(R.id.dianzan)
|
||||
helper.addOnClickListener(com.qxcm.moduleutil.R.id.dianzan)
|
||||
.addOnClickListener(R.id.dy_lookmore_tv)
|
||||
.addOnClickListener(R.id.dy_head_image)
|
||||
.addOnClickListener(R.id.dy_more_image)
|
||||
.addOnClickListener(R.id.dy_oneimage_iv);
|
||||
.addOnClickListener(R.id.dy_oneimage_iv)
|
||||
.addOnClickListener(R.id.diandian)
|
||||
.addOnClickListener(R.id.pinglun)
|
||||
.addOnClickListener(com.qxcm.moduleutil.R.id.zs);
|
||||
|
||||
//先让单图,多图,音频的布局显示
|
||||
helper.getView(R.id.dy_oneimage_iv).setVisibility(View.VISIBLE);
|
||||
@@ -36,11 +57,33 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
|
||||
// ARouter.getInstance().build(AroutUtil.COMMUNITY_JUBAO).withString("uid", item.getUid() + "").navigation();
|
||||
}
|
||||
});
|
||||
|
||||
// 设置点击回调
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dianzan).setOnClickListener(v -> {
|
||||
if (mListener != null) mListener.onDianzanClick(item);
|
||||
});
|
||||
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_head_image).setOnClickListener(v -> {
|
||||
if (mListener != null) mListener.onHeadImageClick(item);
|
||||
});
|
||||
|
||||
helper.getView(com.qxcm.moduleutil.R.id.zs).setOnClickListener(v -> {
|
||||
if (mListener != null) mListener.onZsClick(item);
|
||||
});
|
||||
|
||||
helper.getView(R.id.diandian).setOnClickListener(v -> {
|
||||
if (mListener != null) mListener.onDiandianClick(item);
|
||||
});
|
||||
|
||||
helper.getView(R.id.pinglun).setOnClickListener(v->{
|
||||
if (mListener != null) mListener.onPinglunClick(item);
|
||||
});
|
||||
|
||||
//昵称
|
||||
helper.setText(R.id.dy_name_text, item.getUserNickName());
|
||||
helper.setText(R.id.dy_name_text, item.getNickname());
|
||||
|
||||
//头像
|
||||
ImageUtils.loadHeadCC(item.getUserAvatar(), (ImageView) helper.getView(R.id.dy_head_image));
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), (ImageView) helper.getView(R.id.dy_head_image));
|
||||
|
||||
//动态内容以富文本展示
|
||||
String content = item.getContent();
|
||||
@@ -76,39 +119,46 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
|
||||
TextView view = helper.getView(R.id.dy_content_tv);
|
||||
view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
if (item.getTitle() != null) {
|
||||
helper.setVisible(R.id.dy_more_tv, true);
|
||||
helper.setText(R.id.dy_more_tv, item.getTitle().replace("#", ""));
|
||||
}else {
|
||||
helper.setVisible(R.id.dy_more_tv, false);
|
||||
}
|
||||
//点赞
|
||||
helper.setText(R.id.dy_fabulous, item.getLike());
|
||||
// if (item.is_praise() == 1) {
|
||||
// TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
|
||||
// dy_fabulous.setTextColor(mContext.getResources().getColor(R.color.dianzan2));
|
||||
// helper.setImageResource(R.id.dianzan_image, R.drawable.dongtai_hudong_yidianzan);
|
||||
// } else {
|
||||
// TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
|
||||
// dy_fabulous.setTextColor(mContext.getResources().getColor(R.color.dianzan1));
|
||||
// helper.setImageResource(R.id.dianzan_image, R.drawable.dongtai_hudong_dianzan);
|
||||
// }
|
||||
helper.setText(R.id.dy_fabulous, item.getLike_num());
|
||||
if (item.getIs_like() == 1) {
|
||||
TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
|
||||
helper.setImageResource(R.id.dianzan_image, R.mipmap.dongtai_hudong_yidianzan);
|
||||
} else {
|
||||
TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
|
||||
helper.setImageResource(R.id.dianzan_image, com.qxcm.moduleutil.R.mipmap.dongtai_hudong_dianzan);
|
||||
}
|
||||
|
||||
if (item.getIs_room()!=null && item.getIs_room().equals("0")){
|
||||
helper.setVisible(R.id.gensui,false);
|
||||
}else {
|
||||
helper.setVisible(R.id.gensui,true);
|
||||
}
|
||||
//分享数
|
||||
helper.setText(R.id.dy_zs, item.getIsShare());
|
||||
helper.setText(R.id.dy_zs, item.getRewards_num()!=null ? item.getRewards_num() : "0");
|
||||
//评论数
|
||||
helper.setText(R.id.dy_comment, item.getComment() + "");
|
||||
|
||||
helper.setText(R.id.dy_comment, item.getComment_num() + "");
|
||||
|
||||
//时间
|
||||
|
||||
if (!item.getTime().isEmpty()) {
|
||||
if (!item.getCreatetime().isEmpty()) {
|
||||
try {
|
||||
helper.setText(R.id.dy_time_text, item.getTime());
|
||||
helper.setText(R.id.dy_time_text, "发布于:"+TimeUtils.millis2String(Long.parseLong(item.getCreatetime()) * 1000));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (item.getImages().size() != 0) {
|
||||
String[] arrIv = item.getImages().toArray(new String[item.getImages().size()]);
|
||||
if (item.getImages()!=null) {
|
||||
|
||||
String[] arrIv = item.getImages().split(",");
|
||||
// String[] arrIv = Arrays.asList(item.getImages().split(",")).toArray(new String[item.getImages().size()]);
|
||||
int length = arrIv.length;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.qxcm.moduleutil.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.CommentBean;
|
||||
import com.qxcm.moduleutil.utils.MeHeadView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentViewHolder> {
|
||||
|
||||
private List<CommentBean.CommentDetailsBean> commentList;
|
||||
|
||||
public CommentAdapter(List<CommentBean.CommentDetailsBean> commentList) {
|
||||
this.commentList = commentList;
|
||||
}
|
||||
public void updateData(List<CommentBean.CommentDetailsBean> newReplyList) {
|
||||
commentList.clear();
|
||||
commentList.addAll(newReplyList);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public CommentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_comment, parent, false);
|
||||
return new CommentViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CommentViewHolder holder, int position) {
|
||||
CommentBean.CommentDetailsBean comment = commentList.get(position);
|
||||
holder.bind(comment);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return commentList.size();
|
||||
}
|
||||
|
||||
static class CommentViewHolder extends RecyclerView.ViewHolder {
|
||||
private MeHeadView ivAvatar;
|
||||
private TextView tvNickname;
|
||||
private TextView tvContent;
|
||||
private RecyclerView rvReplies;
|
||||
private TextView btnReply;
|
||||
|
||||
public CommentViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
ivAvatar = itemView.findViewById(R.id.iv_avatar);
|
||||
tvNickname = itemView.findViewById(R.id.tv_nickname);
|
||||
tvContent = itemView.findViewById(R.id.tv_content);
|
||||
// rvReplies = itemView.findViewById(R.id.rv_replies);
|
||||
btnReply = itemView.findViewById(R.id.btn_reply);
|
||||
|
||||
// 设置子评论的适配器
|
||||
// LinearLayoutManager layoutManager = new LinearLayoutManager(itemView.getContext());
|
||||
// rvReplies.setLayoutManager(layoutManager);
|
||||
// ReplyAdapter replyAdapter = new ReplyAdapter(new ArrayList<>());
|
||||
// rvReplies.setAdapter(replyAdapter);
|
||||
}
|
||||
|
||||
public void bind(CommentBean.CommentDetailsBean comment) {
|
||||
// 绑定主评论数据
|
||||
tvNickname.setText(comment.getNickname());
|
||||
tvContent.setText(comment.getContent());
|
||||
ivAvatar.setData(comment.getAvatar(), "","");
|
||||
// 加载用户头像(使用 Glide 或其他图片加载库)
|
||||
// Glide.with(itemView).load(comment.getAvatar()).into(ivAvatar);
|
||||
|
||||
// 绑定子评论数据
|
||||
// ReplyAdapter replyAdapter = (ReplyAdapter) rvReplies.getAdapter();
|
||||
// if (replyAdapter != null) {
|
||||
// replyAdapter.updateData(comment.getReplies());
|
||||
// }
|
||||
|
||||
// 点击回复按钮
|
||||
btnReply.setOnClickListener(v -> {
|
||||
// 弹出输入框让用户输入回复内容
|
||||
showReplyDialog(comment.getId());
|
||||
});
|
||||
}
|
||||
|
||||
private void showReplyDialog(int commentId) {
|
||||
// 调用弹窗逻辑,传递 commentId 和 FragmentManager
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.qxcm.moduleutil.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.RoonGiftModel;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
public class GiftTwoAdapter extends BaseAdapter {
|
||||
private final List<RoonGiftModel> mDatas;
|
||||
private final LayoutInflater inflater;
|
||||
private final Context mContext;
|
||||
private final MyGestureDetector gestureDetector;
|
||||
private final String type;
|
||||
/**
|
||||
* 页数下标,从0开始(当前是第几页)
|
||||
*/
|
||||
private final int curIndex;
|
||||
/**
|
||||
* 每一页显示的个数
|
||||
*/
|
||||
private final int pageSize = 100;
|
||||
|
||||
public GiftTwoAdapter(Context context, List<RoonGiftModel> mDatas, int curIndex, String type) {
|
||||
inflater = LayoutInflater.from(context);
|
||||
this.mDatas = mDatas;
|
||||
this.curIndex = curIndex;
|
||||
this.mContext = context;
|
||||
this.type = type;
|
||||
this.gestureDetector = new MyGestureDetector(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 先判断数据集的大小是否足够显示满本页?mDatas.size() > (curIndex+1)*pageSize,
|
||||
* 如果够,则直接返回每一页显示的最大条目个数pageSize,
|
||||
* 如果不够,则有几项返回几,(mDatas.size() - curIndex * pageSize);(也就是最后一页的时候就显示剩余item)
|
||||
*/
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mDatas.size() > (curIndex + 1) * pageSize ? pageSize : (mDatas.size() - curIndex * pageSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoonGiftModel getItem(int position) {
|
||||
return mDatas.get(position + curIndex * pageSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position + (long) curIndex * pageSize;
|
||||
}
|
||||
|
||||
private static class MyGestureDetector extends GestureDetector {
|
||||
private static WeakReference<GiftTwoAdapter> sAdapter = new WeakReference<>(null);
|
||||
private static RoonGiftModel sGiftModel;
|
||||
|
||||
public void setGiftModel(GiftTwoAdapter adapter, RoonGiftModel gift) {
|
||||
sAdapter = new WeakReference<>(adapter);
|
||||
sGiftModel = gift;
|
||||
}
|
||||
|
||||
private static final SimpleOnGestureListener sSimpleOnGestureListener = new SimpleOnGestureListener() {
|
||||
@Override
|
||||
public boolean onSingleTapConfirmed(MotionEvent e) {
|
||||
Log.d("@@", "sGiftModel"+sGiftModel.toString());
|
||||
// EventBus.getDefault().post(new RoomGiftClickEvent(sAdapter.get(), sGiftModel, 1));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDoubleTap(MotionEvent e) {
|
||||
Log.d("@@", "sGiftModel"+sGiftModel.toString());
|
||||
// EventBus.getDefault().post(new RoomGiftClickEvent(sAdapter.get(), sGiftModel, 2));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public MyGestureDetector(Context context) {
|
||||
super(context, sSimpleOnGestureListener);
|
||||
setOnDoubleTapListener(sSimpleOnGestureListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint({"SetTextI18n", "ClickableViewAccessibility"})
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder viewHolder;
|
||||
if (convertView == null) {
|
||||
convertView = inflater.inflate(R.layout.room_gv_gift_item, parent, false);
|
||||
viewHolder = new ViewHolder();
|
||||
viewHolder.tv_gift_name = (TextView) convertView.findViewById(R.id.tv_gift_name);
|
||||
viewHolder.tv_gift_price = (TextView) convertView.findViewById(R.id.tv_gift_price);
|
||||
viewHolder.iv_gift_pic = (ImageView) convertView.findViewById(R.id.iv_gift_pic);
|
||||
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
|
||||
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on);
|
||||
viewHolder.cl_iv_down_on = (ConstraintLayout) convertView.findViewById(R.id.cl_iv_down_on);
|
||||
// viewHolder.tv_gift_num = convertView.findViewById(R.id.tv_gift_num);
|
||||
// viewHolder.tv_gift_change_love_values = convertView.findViewById(R.id.tv_gift_change_love_values);
|
||||
viewHolder.item_layout.setOnTouchListener((v, event) -> {
|
||||
// gestureDetector.setGiftModel(GiftTwoAdapter.this, (RoonGiftModel) v.getTag(R.id.id_gift_tag));
|
||||
// gestureDetector.onTouchEvent(event);
|
||||
|
||||
return true;
|
||||
});
|
||||
convertView.setTag(viewHolder);
|
||||
} else {
|
||||
viewHolder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
/*
|
||||
* 在给View绑定显示的数据时,计算正确的position = position + curIndex * pageSize,
|
||||
*/
|
||||
// viewHolder.tv_gift_num.setVisibility(type.equals("1") ? View.VISIBLE : View.INVISIBLE);
|
||||
// viewHolder.tv_gift_change_love_values.setVisibility(View.GONE);
|
||||
|
||||
RoonGiftModel giftModel = getItem(position);
|
||||
//设置礼物名字
|
||||
viewHolder.tv_gift_name.setText(giftModel.getName());
|
||||
//设置礼物价格
|
||||
String surplusTxt = giftModel.getPrice();
|
||||
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(surplusTxt);
|
||||
//ForegroundColorSpan 为文字前景色,BackgroundColorSpan为文字背景色
|
||||
ForegroundColorSpan redSpan = new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_FFA9A9A9));
|
||||
stringBuilder.setSpan(redSpan, surplusTxt.length(), surplusTxt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);//修改最后两个字体的颜色
|
||||
viewHolder.tv_gift_price.setText(stringBuilder);
|
||||
// viewHolder.item_layout.setTag(R.id.id_gift_tag, giftModel);
|
||||
|
||||
//加载礼物图片
|
||||
ImageUtils.loadImageView(giftModel.getPicture(), viewHolder.iv_gift_pic);
|
||||
//设置选中后的样式
|
||||
|
||||
if (giftModel.isChecked()) {//被选中
|
||||
viewHolder.cl_iv_down_on.setBackgroundResource(R.drawable.gift_x);
|
||||
viewHolder.ivDownOn.setVisibility(View.GONE);
|
||||
} else {
|
||||
viewHolder.ivDownOn.setVisibility(View.GONE);
|
||||
viewHolder.cl_iv_down_on.setBackgroundResource(0);
|
||||
}
|
||||
//设置
|
||||
// //设置礼物心动值
|
||||
// if (giftModel.getCardiac().equals("0")) {
|
||||
// viewHolder.tv_gift_change_love_values.setBackgroundResource(R.mipmap.room_gift_xin_dong_reduce);
|
||||
// viewHolder.tv_gift_change_love_values.setText(String.format("%s", giftModel.getCardiac()));
|
||||
// } else {
|
||||
// viewHolder.tv_gift_change_love_values.setBackgroundResource(R.mipmap.room_gift_xin_dong_add);
|
||||
// viewHolder.tv_gift_change_love_values.setText(String.format("+%s", giftModel.getCardiac()));
|
||||
// }
|
||||
if (giftModel.isManghe()) {
|
||||
viewHolder.tv_gift_change_love_values.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
static class ViewHolder {
|
||||
public ConstraintLayout item_layout;
|
||||
public TextView tv_gift_name, tv_gift_price, tv_gift_num;
|
||||
public ImageView iv_gift_pic;
|
||||
public TextView tv_gift_change_love_values;
|
||||
public ImageView ivDownOn;
|
||||
public ConstraintLayout cl_iv_down_on;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.qxcm.moduleutil.adapter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.GiftLabelBean;
|
||||
import com.qxcm.moduleutil.bean.RewardUserBean;
|
||||
import com.qxcm.moduleutil.bean.RoonGiftModel;
|
||||
import com.qxcm.moduleutil.databinding.RoomVpGiftBinding;
|
||||
import com.qxcm.moduleutil.presenter.RewardGiftContacts;
|
||||
import com.qxcm.moduleutil.presenter.RewardGiftPresenter;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter, RoomVpGiftBinding> implements RewardGiftContacts.View {
|
||||
private String id;
|
||||
private GiftTwoAdapter mAdapter;
|
||||
private String tag;
|
||||
private int pageSize = 100;//一页显示的礼物个数
|
||||
private int pageCount;//页数
|
||||
|
||||
public static GiftTwoDetailsFragment newInstance(String type) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString("id", type);
|
||||
GiftTwoDetailsFragment fragment = new GiftTwoDetailsFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
id = arguments.getString("id");
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
// EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RewardGiftPresenter bindPresenter() {
|
||||
return new RewardGiftPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getGiftList(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_vp_gift;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> data) {
|
||||
|
||||
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
|
||||
for (int j = 0; j < pageCount; j++) {
|
||||
mAdapter = new GiftTwoAdapter(getActivity(), data, j, "0");
|
||||
mBinding.rvGift.setAdapter(mAdapter);
|
||||
}
|
||||
// EventBus.getDefault().post(new RoomGiftEvent(data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.qxcm.moduleutil.adapter;
|
||||
|
||||
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.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.CommentBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ReplyAdapter extends RecyclerView.Adapter<ReplyAdapter.ReplyViewHolder> {
|
||||
|
||||
private List<CommentBean.CommentDetailsBean.Replies> replyList;
|
||||
|
||||
public ReplyAdapter(List<CommentBean.CommentDetailsBean.Replies> replyList) {
|
||||
this.replyList = replyList;
|
||||
}
|
||||
|
||||
public void updateData(List<CommentBean.CommentDetailsBean.Replies> newReplyList) {
|
||||
replyList.clear();
|
||||
replyList.addAll(newReplyList);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ReplyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_reply, parent, false);
|
||||
return new ReplyViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ReplyViewHolder holder, int position) {
|
||||
CommentBean.CommentDetailsBean.Replies reply = replyList.get(position);
|
||||
holder.bind(reply);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return replyList.size();
|
||||
}
|
||||
|
||||
static class ReplyViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView tvNickname;
|
||||
private TextView tvContent;
|
||||
|
||||
public ReplyViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
// tvNickname = itemView.findViewById(R.id.tv_reply_nickname);
|
||||
// tvContent = itemView.findViewById(R.id.tv_reply_content);
|
||||
}
|
||||
|
||||
public void bind(CommentBean.CommentDetailsBean.Replies reply) {
|
||||
tvNickname.setText(reply.getNickname());
|
||||
tvContent.setText(reply.getContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.qxcm.moduleutil.adapter;
|
||||
|
||||
public class RewardUserAdapter {
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.qxcm.moduleutil.adapter;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.UserImgList;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
|
||||
public class UserPhotoWallAdapter extends BaseQuickAdapter<UserImgList, BaseViewHolder> {
|
||||
public class UserPhotoWallAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
|
||||
private boolean b = false;
|
||||
public static final String ADD_PHOTO = "ADD_PHOTO";
|
||||
private int longClickPos = -1;
|
||||
|
||||
public UserPhotoWallAdapter() {
|
||||
@@ -15,24 +17,32 @@ public class UserPhotoWallAdapter extends BaseQuickAdapter<UserImgList, BaseView
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, UserImgList item) {
|
||||
if (helper.getAdapterPosition() == 5) {
|
||||
helper.setVisible(R.id.riv_user_head, false);
|
||||
helper.setVisible(R.id.iv_close, false);
|
||||
} else {
|
||||
helper.setVisible(R.id.riv_user_head, true);
|
||||
if (!"0".equals(item.getId())) {
|
||||
ImageUtils.loadCenterCrop(item.getUrl(), helper.getView(R.id.riv_user_head));
|
||||
if (longClickPos == helper.getAdapterPosition()) {
|
||||
helper.setVisible(R.id.iv_close, true);
|
||||
} else {
|
||||
helper.setVisible(R.id.iv_close, false);
|
||||
}
|
||||
} else {
|
||||
helper.setImageResource(R.id.riv_user_head, com.qxcm.moduleutil.R.mipmap.add_img);
|
||||
protected void convert(BaseViewHolder helper, String item) {
|
||||
helper.setGone(R.id.iv_close, false);
|
||||
if (item.equals(ADD_PHOTO)) {
|
||||
// 显示加号图片
|
||||
helper.setImageResource(R.id.riv_user_head, com.qxcm.moduleutil.R.mipmap.add_img);
|
||||
} else {
|
||||
ImageUtils.loadCenterCrop(item, helper.getView(R.id.riv_user_head));
|
||||
}
|
||||
}
|
||||
|
||||
// if (helper.getAdapterPosition() == 5) {
|
||||
// helper.setVisible(R.id.riv_user_head, false);
|
||||
// helper.setVisible(R.id.iv_close, false);
|
||||
// } else {
|
||||
// helper.setVisible(R.id.riv_user_head, true);
|
||||
// if (!"0".equals(item.getId())) {
|
||||
// ImageUtils.loadCenterCrop(item.getUrl(), helper.getView(R.id.riv_user_head));
|
||||
// if (longClickPos == helper.getAdapterPosition()) {
|
||||
// helper.setVisible(R.id.iv_close, true);
|
||||
// } else {
|
||||
// helper.setVisible(R.id.iv_close, false);
|
||||
// }
|
||||
// } else {
|
||||
// helper.setImageResource(R.id.riv_user_head, com.qxcm.moduleutil.R.mipmap.add_img);
|
||||
// helper.setGone(R.id.iv_close, false);
|
||||
// }
|
||||
// }
|
||||
helper.addOnClickListener(R.id.iv_close);
|
||||
helper.addOnClickListener(R.id.riv_user_head);
|
||||
helper.addOnLongClickListener(R.id.riv_user_head);
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.qxcm.moduleutil.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ViewDataBinding;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.activity.BaseAppCompatActivity;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/29
|
||||
*@description: dialogFragement基类
|
||||
*/
|
||||
public abstract class BaseMvpDialogFragment<P extends IPresenter, VDM extends ViewDataBinding> extends DialogFragment implements IView<Activity> {
|
||||
protected VDM mBinding;
|
||||
|
||||
protected P MvpPre;
|
||||
|
||||
protected abstract P bindPresenter();
|
||||
|
||||
protected boolean setDialogWH = true;
|
||||
protected boolean isAnimation = true;
|
||||
protected boolean mGravityBOTTOM;
|
||||
|
||||
@Override
|
||||
public Activity getSelfActivity() {
|
||||
return getActivity();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// ARouter.getInstance().inject(this);
|
||||
mBinding = DataBindingUtil.inflate(inflater, getLayoutId(), container, false);
|
||||
mBinding.setLifecycleOwner(this);
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
MvpPre = bindPresenter();
|
||||
if (getArguments() != null) {
|
||||
initArgs(getArguments());
|
||||
}
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
|
||||
public void initArgs(Bundle arguments) {
|
||||
|
||||
}
|
||||
|
||||
protected abstract void initData();
|
||||
|
||||
protected abstract void initView();
|
||||
|
||||
protected abstract int getLayoutId();
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getDialog() != null && setDialogWH) {
|
||||
Window window = getDialog().getWindow();
|
||||
if (mGravityBOTTOM) {
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
if (isAnimation) {
|
||||
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||
}
|
||||
// window.getDecorView().setPadding(0, 0, 0, 0);
|
||||
initDialogStyle(window);
|
||||
}
|
||||
}
|
||||
|
||||
protected void initDialogStyle(Window window) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLoadings() {
|
||||
if (!isAdded() || getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
if (getActivity() instanceof BaseAppCompatActivity) {
|
||||
((BaseAppCompatActivity) getActivity()).showLoading("加载中...");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLoadings(String content) {
|
||||
if (!isAdded() || getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
if (getActivity() instanceof BaseAppCompatActivity) {
|
||||
((BaseAppCompatActivity) getActivity()).showLoading(content);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disLoadings() {
|
||||
if (getActivity() instanceof BaseAppCompatActivity) {
|
||||
((BaseAppCompatActivity) getActivity()).disLoading();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if (mBinding != null) {
|
||||
mBinding.unbind();
|
||||
}
|
||||
if (MvpPre != null) {
|
||||
MvpPre.detachView();
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,14 @@ import com.qxcm.moduleutil.utils.config.EnvironmentEnum;
|
||||
import com.qxcm.moduleutil.utils.config.EnvironmentPrefs;
|
||||
import com.qxcm.moduleutil.widget.CommonAppConfig;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
import com.qxcm.moduleutil.widget.CustomRefreshHeader;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
|
||||
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshFooter;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshHeader;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
@@ -299,4 +307,27 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
return false; //未安装支付宝
|
||||
}
|
||||
}
|
||||
|
||||
//static 代码段可以防止内存泄露
|
||||
static {
|
||||
//设置全局的Header构建器
|
||||
SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
|
||||
@Override
|
||||
public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
|
||||
return new CustomRefreshHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header,默认是 贝塞尔雷达Header
|
||||
}
|
||||
});
|
||||
//设置全局的Footer构建器
|
||||
SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() {
|
||||
@Override
|
||||
public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
|
||||
ClassicsFooter classicsFooter = new ClassicsFooter(context);
|
||||
classicsFooter.setDrawableSize(20);
|
||||
classicsFooter.setFinishDuration(0);
|
||||
//指定为经典Footer,默认是 BallPulseFooter
|
||||
return classicsFooter;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/29
|
||||
*@description: 相册列表
|
||||
*/
|
||||
@Data
|
||||
public class AlbumBean {
|
||||
private String id;//相册id
|
||||
|
||||
private String name; //相册名称
|
||||
|
||||
private String image; //相册封面
|
||||
|
||||
private String pwd; //相册密码
|
||||
|
||||
private String read_num; //相册阅读数
|
||||
|
||||
private List<ImageList> image_list;
|
||||
@Data
|
||||
public class ImageList{
|
||||
private String id; //图片id
|
||||
private String image; //图片地址
|
||||
private String content; //图片描述
|
||||
private String createtime; //图片创建时间
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,22 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CircleListBean {
|
||||
private String id;
|
||||
private String userNickName;
|
||||
private String userAvatar;
|
||||
private String time;
|
||||
private String content;
|
||||
private List<String> images;
|
||||
private String type;
|
||||
private String comment;
|
||||
private String like;
|
||||
private String isShare;
|
||||
private int id;//语圈ID
|
||||
private int user_id;//用户ID
|
||||
private String nickname;//用户昵称
|
||||
private String avatar;//用户头像
|
||||
private int is_like;//是否点赞(0没有,1点赞)
|
||||
private int sex;//性别 1男2女
|
||||
private String content;//内容
|
||||
private String like_num;//点赞数
|
||||
private String rewards_num; //打赏金额
|
||||
private String is_room;//作者是否在房间中(1在,0不在)
|
||||
private String room_id;//作者所在房间ID (is_room =0 此值小于0 )
|
||||
private String comment_num;//评论数
|
||||
private int is_recommend;//1非推荐2推荐
|
||||
private String ip;//活跃地址
|
||||
private String images;////图片 JSON字符串 封面获取第一张
|
||||
private String createtime;//时间
|
||||
private String title;//话题
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description:评论实体
|
||||
*/
|
||||
@Data
|
||||
public class CommentBean {
|
||||
|
||||
private int total;//评论总数
|
||||
private List<CommentDetailsBean> list;
|
||||
@Data
|
||||
public static class CommentDetailsBean {
|
||||
private int id;
|
||||
private int zone_id;
|
||||
private String content;
|
||||
private int createtime;
|
||||
private int user_id;
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
private int is_author;
|
||||
private List<Replies> replies;
|
||||
|
||||
@Data
|
||||
public static class Replies {
|
||||
private int zone_id;
|
||||
private String content;
|
||||
private int createtime;
|
||||
private int user_id;
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
private int pid;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/29
|
||||
*@description: 扩列数据
|
||||
*/
|
||||
@Data
|
||||
public class ExpandColumnBean {
|
||||
private String id;
|
||||
private String sex;
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
private String birthday;
|
||||
private String loginip;
|
||||
private String home_bgimages;
|
||||
private int room_id;//房间id,当有参数的时候,就显示跟随,当没有的时候,就显示私信控件
|
||||
private List<String> icon;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GiftLabelBean {
|
||||
private String label;
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description: 礼物打赏数量
|
||||
*/
|
||||
public class GiftNumBean {
|
||||
private String number;
|
||||
private String text;
|
||||
|
||||
public GiftNumBean() {
|
||||
}
|
||||
|
||||
public GiftNumBean(String number, String text) {
|
||||
this.number = number;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,19 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description: 话题实体
|
||||
*/
|
||||
@Data
|
||||
public class HeatedBean {
|
||||
private String title;
|
||||
private String title_pictrue;
|
||||
private String type;
|
||||
private String title_content;
|
||||
private String title;//话题
|
||||
private String topic_id;//话题id
|
||||
private String count;//引用数量
|
||||
private String pic; //图片
|
||||
private String content;//内容
|
||||
private String id;//话题id
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NewsDataBean {
|
||||
private String id; //id
|
||||
private String title; //标题
|
||||
private String content; //内容
|
||||
private String type; //类型1系统消息 2官方公告 3活动中心
|
||||
private String source_id; //来源id
|
||||
private String is_read; //是否已读
|
||||
private String createtime;//创建时间
|
||||
private String image;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RewardUserBean {
|
||||
private String user_id;
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
private String is_online;
|
||||
private String total_price;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoonGiftModel {
|
||||
private String id;
|
||||
private String name;
|
||||
private String title;
|
||||
private String all_room_push;
|
||||
private String picture;
|
||||
private String price;
|
||||
private String special;
|
||||
private String sort;
|
||||
private String type;
|
||||
private String child_type;
|
||||
private String sold;
|
||||
private String cardiac;
|
||||
private boolean isChecked;
|
||||
|
||||
private boolean can_send_self;//是否能送自己
|
||||
|
||||
public boolean isCan_send_self() {
|
||||
if ( isManghe()) {
|
||||
return true;
|
||||
}
|
||||
return can_send_self;
|
||||
}
|
||||
|
||||
public boolean isManghe() {
|
||||
return type.equals("4") || type.equals("5") || type.equals("13");
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,16 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.bean.AlbumBean;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.bean.CommentBean;
|
||||
import com.qxcm.moduleutil.bean.ExpandColumnBean;
|
||||
import com.qxcm.moduleutil.bean.GiftLabelBean;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
import com.qxcm.moduleutil.bean.RealNameBean;
|
||||
import com.qxcm.moduleutil.bean.RewardUserBean;
|
||||
import com.qxcm.moduleutil.bean.RoonGiftModel;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
|
||||
@@ -16,6 +25,7 @@ import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ApiServer {
|
||||
|
||||
@@ -72,6 +82,54 @@ public interface ApiServer {
|
||||
@POST(Constants.REAL_NAME)
|
||||
Observable<BaseModel<RealNameBean>> realName(@Field("real_name") String real_name, @Field("card_number") String card_number);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.GET_EXPAND_COLUMN)
|
||||
Observable<BaseModel<List<ExpandColumnBean>>> getExpandColumn(@Field("type") String type);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.GET_OFFICIAL_NOTICE)
|
||||
Observable<BaseModel<List<NewsDataBean>>> getOfficialNotice( @Field("page") String page, @Field("page_limit") String page_limit,@Field("type") String type);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.GET_ALBUM_LIST)
|
||||
Observable<BaseModel<List<AlbumBean>>> getAlbumList(@Field("page") String page, @Field("page_limit") String page_limit);
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.CREATE_ALBUM)
|
||||
Call<BaseModel<String> > createAlbum(@Field("name") String name, @Field("image") String image);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.GET_REWARD_LIST)
|
||||
Observable<BaseModel<List<RewardUserBean>>> getRewardList(@Field("id") String id, @Field("page") int page, @Field("page_limit") int page_limit);
|
||||
|
||||
@GET(Constants.GET_GIFT_LABEL)
|
||||
Observable<BaseModel<List<GiftLabelBean>>> getGiftLabel(@Query("have_hot") String have_hot);
|
||||
|
||||
@GET(Constants.GIFT_LIST)//获取礼物列表
|
||||
Observable<BaseModel<List<RoonGiftModel>>> getGiftList(@Query("label") int label);
|
||||
|
||||
@GET(Constants.TOPIC_LIST)//获取话题
|
||||
Observable<BaseModel<List<HeatedBean>>> topicList(@Query("page") String page, @Query("page_limit") String page_limit);
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.PUBLISH_ZONE)
|
||||
Call<BaseModel<String>> publishZone(@Field("images") String images, @Field("content") String content, @Field("topic_id") String topic_id, @Field("room_id") String room_id,@Field("ip") String ip);
|
||||
|
||||
@GET(Constants.GET_CATEGORIES)
|
||||
Observable<BaseModel<List<HeatedBean>>> getCategories();
|
||||
|
||||
@GET(Constants.GET_CIRCLE_LIST)
|
||||
Observable<BaseModel<List<CircleListBean>>> getCircleList(@Query("page") String page, @Query("page_limit") String page_limit);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.LIKE_ZONE)
|
||||
Call<BaseModel<String>> likeZone(@Field("id") String zone_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.GET_COMMENT_LIST)
|
||||
Observable<BaseModel<CommentBean>> getCommentList(@Field("id") String id, @Field("page") String page, @Field("page_limit") String page_limit);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.COMMENT_ZONE)
|
||||
Call<BaseModel<String>> commentZone(@Field("id") String id, @Field("content") String content, @Field("pid") String pid, @Field("reply_to") String reply_to);
|
||||
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.ADDBANK)
|
||||
|
||||
@@ -38,6 +38,10 @@ public class BaseModel<T> implements Parcelable {
|
||||
public boolean isSuccess() {
|
||||
return code == 1; // 根据实际业务码判断是否成功
|
||||
}
|
||||
|
||||
public boolean isTokenExpired() {
|
||||
return code == 301; // token过期码
|
||||
}
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.text.TextUtils;
|
||||
import com.blankj.utilcode.util.ThreadUtils;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.event.LogOutEvent;
|
||||
import com.qxcm.moduleutil.utils.DialogUtils;
|
||||
import com.qxcm.moduleutil.utils.logger.Logger;
|
||||
@@ -18,6 +19,7 @@ import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/11/22.
|
||||
@@ -86,4 +88,28 @@ public abstract class BaseObserver<T> implements Observer<T> {
|
||||
Logger.i("onComplete");
|
||||
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onNext(BaseModel<T> response) {
|
||||
// if (response.isSuccess()) {
|
||||
// onSuccess(response.getData());
|
||||
// } else if (response.isTokenExpired()) {
|
||||
// // 触发退出登录
|
||||
// handleTokenExpired();
|
||||
// } else {
|
||||
// onError(response.getMsg());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// protected abstract void onSuccess(T data);
|
||||
// protected abstract void onError(String msg);
|
||||
// protected abstract void onFail(String error);
|
||||
//
|
||||
// @SneakyThrows
|
||||
// private void handleTokenExpired() {
|
||||
// // 退出登录逻辑
|
||||
// ToastUtils.show("登录已过期,请重新登录");
|
||||
// // 示例:跳转到登录页
|
||||
// CommonAppContext.getInstance().clearLoginInfo();
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -2,16 +2,46 @@ package com.qxcm.moduleutil.http;
|
||||
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.ObservableTransformer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class DefaultTransformer<T extends BaseModel<R>, R>
|
||||
implements ObservableTransformer<T, R> {
|
||||
public class DefaultTransformer<T> implements ObservableTransformer<BaseModel<T>, T> {
|
||||
|
||||
// @Override
|
||||
// public ObservableSource<R> apply(Observable<T> upstream) {
|
||||
// return upstream.compose(SchedulerTransformer.<T>create())
|
||||
// .compose(new ErrorCheckerTransformer<T, R>());
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ObservableSource<R> apply(Observable<T> upstream) {
|
||||
return upstream.compose(SchedulerTransformer.<T>create())
|
||||
.compose(new ErrorCheckerTransformer<T, R>());
|
||||
public ObservableSource<T> apply(Observable<BaseModel<T>> upstream) {
|
||||
return upstream
|
||||
.map(response -> {
|
||||
if (response.isTokenExpired()) {
|
||||
// 触发登出事件(EventBus)
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
throw new APIException(-1, "登录已过期");
|
||||
}
|
||||
|
||||
if (!response.isSuccess()) {
|
||||
throw new APIException(response.getCode(), response.getMsg());
|
||||
}
|
||||
|
||||
return response.getData();
|
||||
})
|
||||
.onErrorResumeNext(throwable -> {
|
||||
// 可以在这里统一处理异常
|
||||
if (throwable instanceof APIException && ((APIException) throwable).getCode() == -1) {
|
||||
// 已经触发过登出事件
|
||||
}
|
||||
return Observable.error(throwable);
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,23 @@ import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.franmontiel.persistentcookiejar.ClearableCookieJar;
|
||||
import com.franmontiel.persistentcookiejar.PersistentCookieJar;
|
||||
import com.franmontiel.persistentcookiejar.cache.SetCookieCache;
|
||||
import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.bean.AlbumBean;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.bean.CommentBean;
|
||||
import com.qxcm.moduleutil.bean.ExpandColumnBean;
|
||||
import com.qxcm.moduleutil.bean.GiftLabelBean;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
import com.qxcm.moduleutil.bean.RealNameBean;
|
||||
import com.qxcm.moduleutil.bean.RewardUserBean;
|
||||
import com.qxcm.moduleutil.bean.RoonGiftModel;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.utils.SystemUtils;
|
||||
import com.qxcm.moduleutil.utils.logger.DataLogger;
|
||||
import com.qxcm.moduleutil.utils.logger.DataLoggingInterceptor;
|
||||
@@ -31,9 +40,11 @@ import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
|
||||
@@ -105,7 +116,8 @@ public class RetrofitClient {
|
||||
|
||||
private Retrofit provideRetrofit(OkHttpClient client) {
|
||||
return new Retrofit.Builder()
|
||||
.addConverterFactory(MyConverterFactory.create())
|
||||
.addConverterFactory(MyConverterFactory.create())/**/
|
||||
// .addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.baseUrl(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl())
|
||||
.client(client)
|
||||
@@ -200,4 +212,169 @@ public class RetrofitClient {
|
||||
public void realName(String real_name, String card_number,BaseObserver<RealNameBean> observer){
|
||||
sApiServer.realName(real_name,card_number).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
//获取扩列数据
|
||||
public void getExpandColumn(String type,String page,String page_limit,BaseObserver<List<ExpandColumnBean>> observer){
|
||||
sApiServer.getExpandColumn(type).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
//获取官方公告数据或者系统消息,根据type区分 type=1是系统消息,type=2是官方公告
|
||||
public void getOfficialNotice(String page,String page_limit,String type,BaseObserver<List<NewsDataBean>> observer){
|
||||
sApiServer.getOfficialNotice(page,page_limit,type).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void getAlbumList(String page,String page_limit,BaseObserver<List<AlbumBean>> observer){
|
||||
sApiServer.getAlbumList(page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void createAlbum(String name,String image,BaseObserver<String> observer) {
|
||||
sApiServer.createAlbum(name,image).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code()==200){
|
||||
BaseModel<String> string=response.body();
|
||||
if (string!=null){
|
||||
int code=string.getCode();
|
||||
if (code==1){
|
||||
observer.onNext(string.getMsg());
|
||||
}else if (code==301){
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
com.blankj.utilcode.util.ToastUtils.showShort(string.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getRewardList(String id, int page, int page_limit,BaseObserver<List<RewardUserBean> > observer){
|
||||
sApiServer.getRewardList(id,page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
|
||||
}
|
||||
|
||||
public void getGiftLabel(String have_hot,BaseObserver<List<GiftLabelBean>> observer){
|
||||
sApiServer.getGiftLabel(have_hot).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void getGiftList( int type, BaseObserver<List<RoonGiftModel>> observer){
|
||||
sApiServer.getGiftList(type).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void topicList(String page,String page_limit,BaseObserver<List<HeatedBean>> observer){
|
||||
sApiServer.topicList(page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void publishZone(String images, String content, String topic_id, String room_id,String ip,BaseObserver<String> observer){
|
||||
|
||||
sApiServer.publishZone(images,content,topic_id,room_id,ip).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code()==200){
|
||||
BaseModel<String> string=response.body();
|
||||
if (string!=null){
|
||||
int code=string.getCode();
|
||||
if (code==1){
|
||||
observer.onNext(string.getMsg());
|
||||
}else if (code==301){
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
com.blankj.utilcode.util.ToastUtils.showShort(string.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getCategories(BaseObserver<List<HeatedBean>> observer){//动态顶部热门话题
|
||||
sApiServer.getCategories().compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void getCircleList(String page,String page_limit,BaseObserver<List<CircleListBean>> observer){//动态列表
|
||||
sApiServer.getCircleList(page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void likeZone(String zone_id,BaseObserver<String> observer){
|
||||
sApiServer.likeZone(zone_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code()==200){
|
||||
BaseModel<String> string=response.body();
|
||||
if (string!=null){
|
||||
int code=string.getCode();
|
||||
if (code==1){
|
||||
observer.onNext(string.getMsg());
|
||||
}else if (code==301){
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
com.blankj.utilcode.util.ToastUtils.showShort(string.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getCommentList(String id, String page, String page_limit, BaseObserver<CommentBean> observer){
|
||||
sApiServer.getCommentList(id,page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void commentZone(String id, String content, String pid, String reply_to,BaseObserver<String> observer){
|
||||
sApiServer.commentZone(id,content,pid,reply_to).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code()==200){
|
||||
BaseModel<String> string=response.body();
|
||||
if (string!=null){
|
||||
int code=string.getCode();
|
||||
if (code==1){
|
||||
observer.onNext(string.getMsg());
|
||||
}else if (code==301){
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
com.blankj.utilcode.util.ToastUtils.showShort(string.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
ToastUtils.showShort("评论失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.qxcm.moduleutil.presenter;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.CommentBean;
|
||||
|
||||
public class CommentContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void getCommentList(CommentBean commentBean);
|
||||
|
||||
void commentZone();
|
||||
|
||||
}
|
||||
public interface IIndexPre extends IPresenter {
|
||||
void getCommentList(String id,String page,String page_limit);
|
||||
void commentZone(String id,String content,String pid,String reply_to);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.qxcm.moduleutil.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.qxcm.moduleutil.bean.CommentBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class CommentPresenter extends BasePresenter<CommentContacts.View> implements CommentContacts.IIndexPre{
|
||||
public CommentPresenter(CommentContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCommentList(String id, String page, String page_limit) {
|
||||
api.getCommentList(id, page, page_limit, new BaseObserver<CommentBean>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(CommentBean commentBean) {
|
||||
MvpRef.get().getCommentList(commentBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commentZone(String id, String content, String pid, String reply_to) {
|
||||
api.commentZone(id, content, pid, reply_to, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().commentZone();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.qxcm.moduleutil.presenter;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.GiftLabelBean;
|
||||
import com.qxcm.moduleutil.bean.RewardUserBean;
|
||||
import com.qxcm.moduleutil.bean.RoonGiftModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RewardGiftContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void getRewardList(List<RewardUserBean> rewardUserBeanList);
|
||||
void getGiftLabel(List<GiftLabelBean> giftLabelBeans);
|
||||
|
||||
void setGiftList(List<RoonGiftModel> roonGiftModels);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface IIndexPre extends IPresenter {
|
||||
void getRewardList(String id, int page, int page_limit);
|
||||
|
||||
void getGiftLabel(String have_hot);
|
||||
|
||||
void getGiftList(String id);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.qxcm.moduleutil.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.GiftLabelBean;
|
||||
import com.qxcm.moduleutil.bean.RewardUserBean;
|
||||
import com.qxcm.moduleutil.bean.RoonGiftModel;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View> implements RewardGiftContacts.IIndexPre {
|
||||
|
||||
public RewardGiftPresenter(RewardGiftContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRewardList(String id, int page, int page_limit) {
|
||||
// api.getRewardList(id, page, page_limit, new BaseObserver<List<RewardUserBean>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(List<RewardUserBean> rewardUserBeans) {
|
||||
// MvpRef.get().getRewardList(rewardUserBeans);
|
||||
// }
|
||||
// });
|
||||
|
||||
List<RewardUserBean> rewardUserBeans = new ArrayList<>();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
RewardUserBean rewardUserBean = new RewardUserBean();
|
||||
rewardUserBean.setUser_id(i + "");
|
||||
rewardUserBean.setNickname("用户" + i);
|
||||
rewardUserBean.setAvatar("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3043859018,3877962510&fm=26&gp=0.jpg");
|
||||
rewardUserBean.setIs_online("1");
|
||||
rewardUserBean.setTotal_price("0.01");
|
||||
rewardUserBeans.add(rewardUserBean);
|
||||
}
|
||||
MvpRef.get().getRewardList(rewardUserBeans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(String have_hot) {
|
||||
// api.getGiftLabel(have_hot, new BaseObserver<List<GiftLabelBean>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(List<GiftLabelBean> giftLabelBeans) {
|
||||
// MvpRef.get().getGiftLabel(giftLabelBeans);
|
||||
// }
|
||||
// });
|
||||
|
||||
List<GiftLabelBean> giftLabelBeans = new ArrayList<>();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
GiftLabelBean giftLabelBean = new GiftLabelBean();
|
||||
giftLabelBean.setLabel(i + "");
|
||||
giftLabelBean.setName("标签" + i);
|
||||
giftLabelBeans.add(giftLabelBean);
|
||||
}
|
||||
MvpRef.get().getGiftLabel(giftLabelBeans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftList(String id) {
|
||||
// api.getGiftList(Integer.parseInt(id), new BaseObserver<List<RoonGiftModel>>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(List<RoonGiftModel> roonGiftModels) {
|
||||
// MvpRef.get().setGiftList(roonGiftModels);
|
||||
// }
|
||||
// });
|
||||
List<RoonGiftModel> roonGiftModels = new ArrayList<>();
|
||||
for (int i = 0; i < 4; i++){
|
||||
RoonGiftModel roonGiftModel = new RoonGiftModel();
|
||||
roonGiftModel.setId(i+"");
|
||||
roonGiftModel.setName("礼物"+i);
|
||||
roonGiftModel.setTitle("礼物"+i);
|
||||
roonGiftModel.setPicture("");
|
||||
roonGiftModel.setPrice(i+"");
|
||||
roonGiftModel.setSpecial("");
|
||||
roonGiftModel.setSort(i+"");
|
||||
roonGiftModel.setType("");
|
||||
roonGiftModel.setChild_type("");
|
||||
roonGiftModel.setSold(i+"");
|
||||
roonGiftModel.setCardiac(i+"");
|
||||
roonGiftModel.setCan_send_self(i%2==0);
|
||||
roonGiftModels.add(roonGiftModel);
|
||||
}
|
||||
MvpRef.get().setGiftList(roonGiftModels);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import static android.view.View.GONE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
@@ -326,6 +327,46 @@ public class ImageUtils {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载网络图片并高斯模糊,失败时加载默认图片并同样模糊
|
||||
*/
|
||||
public static void loadBlurredImageWithDefault(String url, ImageView imageView, int defaultResId, int radius) {
|
||||
if (imageView == null) return;
|
||||
|
||||
Glide.with(imageView.getContext())
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.error(defaultResId) // 加载失败时显示默认图片
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
// 对网络图或默认图都进行模糊处理
|
||||
Bitmap blurred = com.blankj.utilcode.util.ImageUtils.stackBlur(resource, radius);
|
||||
imageView.setImageBitmap(blurred);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
// 如果 errorDrawable 不为空,也可以直接用它生成 Bitmap
|
||||
if (errorDrawable instanceof BitmapDrawable) {
|
||||
Bitmap bitmap = ((BitmapDrawable) errorDrawable).getBitmap();
|
||||
Bitmap blurred = com.blankj.utilcode.util.ImageUtils.stackBlur(bitmap, radius);
|
||||
imageView.setImageBitmap(blurred);
|
||||
} else {
|
||||
// 如果不是 BitmapDrawable,尝试从资源中加载 Bitmap
|
||||
Bitmap defaultBitmap = BitmapFactory.decodeResource(imageView.getResources(), defaultResId);
|
||||
if (defaultBitmap != null) {
|
||||
Bitmap blurred = com.blankj.utilcode.util.ImageUtils.stackBlur(defaultBitmap, radius);
|
||||
imageView.setImageBitmap(blurred);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 加载bitmap回调
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.qxcm.moduleutil.utils;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Address;
|
||||
import android.location.Geocoder;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||
import com.google.android.gms.location.LocationCallback;
|
||||
import com.google.android.gms.location.LocationRequest;
|
||||
import com.google.android.gms.location.LocationResult;
|
||||
import com.google.android.gms.location.LocationServices;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class LocationUtils {
|
||||
private static final String TAG = "LocationUtils";
|
||||
private FusedLocationProviderClient fusedLocationClient;
|
||||
|
||||
public interface LocationCallbackInterface {
|
||||
void onLocationReceived(double latitude, double longitude, String city);
|
||||
void onFailed(String errorMessage);
|
||||
}
|
||||
|
||||
public LocationUtils(Context context) {
|
||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(context);
|
||||
|
||||
}
|
||||
|
||||
private void getLastLocation() {
|
||||
}
|
||||
|
||||
public void getLastLocation(Context context,LocationCallbackInterface callback) {
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
// 请求定位权限
|
||||
ActivityCompat.requestPermissions(
|
||||
(Activity) context,
|
||||
new String[]{
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
},
|
||||
1001 // 自定义常量,比如 1001
|
||||
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
fusedLocationClient.getLastLocation()
|
||||
.addOnSuccessListener(location -> {
|
||||
if (location != null) {
|
||||
// 获取城市名称
|
||||
String city = getCityName(context, location.getLatitude(), location.getLongitude());
|
||||
callback.onLocationReceived(location.getLatitude(), location.getLongitude(), city);
|
||||
} else {
|
||||
callback.onFailed("无法获取位置");
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(e -> callback.onFailed("定位失败:" + e.getMessage()));
|
||||
}
|
||||
|
||||
public void requestLocationUpdates(Context context,LocationCallbackInterface callback) {
|
||||
LocationRequest locationRequest = LocationRequest.create();
|
||||
locationRequest.setInterval(10000); // 每10秒更新一次
|
||||
locationRequest.setFastestInterval(5000);
|
||||
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||
|
||||
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
callback.onFailed("定位权限未授予");
|
||||
return;
|
||||
}
|
||||
|
||||
fusedLocationClient.requestLocationUpdates(locationRequest, new LocationCallback() {
|
||||
@Override
|
||||
public void onLocationResult(@NonNull LocationResult locationResult) {
|
||||
if (locationResult == null) {
|
||||
callback.onFailed("无位置更新");
|
||||
return;
|
||||
}
|
||||
|
||||
for (android.location.Location location : locationResult.getLocations()) {
|
||||
String city = getCityName(context, location.getLatitude(), location.getLongitude());
|
||||
callback.onLocationReceived(location.getLatitude(), location.getLongitude(), city);
|
||||
}
|
||||
}
|
||||
}, Looper.getMainLooper());
|
||||
}
|
||||
|
||||
private String getCityName(Context context, double latitude, double longitude) {
|
||||
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
|
||||
try {
|
||||
List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
|
||||
if (addresses != null && !addresses.isEmpty()) {
|
||||
Address address = addresses.get(0);
|
||||
return address.getLocality(); // 城市名
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "地理编码失败", e);
|
||||
}
|
||||
return "未知城市";
|
||||
}
|
||||
}
|
||||
@@ -47,20 +47,21 @@ public class MeHeadView extends ConstraintLayout {
|
||||
if (!TextUtils.isEmpty(headPicture)) {
|
||||
ImageUtils.loadHeadCC(headPicture, mRiv);
|
||||
}
|
||||
// if (TextUtils.isEmpty(framePicture)) {
|
||||
// mIvSex.setVisibility(VISIBLE);
|
||||
// if (!TextUtils.isEmpty(sex)) {
|
||||
// if (UserBean.MALE.equals(sex)) {
|
||||
// mIvSex.setBackgroundResource(R.mipmap.common_ic_headportriat_boy);
|
||||
// } else {
|
||||
// mIvSex.setBackgroundResource(R.mipmap.common_ic_headportriat_girl);
|
||||
// }
|
||||
// } else {
|
||||
// mIvSex.setBackgroundResource(R.drawable.common_bg_head_white);
|
||||
// }
|
||||
// } else {
|
||||
// mIvSex.setVisibility(GONE);
|
||||
// }
|
||||
if (TextUtils.isEmpty(framePicture)) {
|
||||
mIvSex.setVisibility(VISIBLE);
|
||||
if (!TextUtils.isEmpty(sex)) {
|
||||
if (sex.equals("1")){
|
||||
mIvSex.setBackgroundResource(R.mipmap.nan);
|
||||
}else {
|
||||
mIvSex.setBackgroundResource(R.mipmap.nv);
|
||||
}
|
||||
|
||||
} else {
|
||||
mIvSex.setVisibility(GONE);
|
||||
}
|
||||
} else {
|
||||
mIvSex.setVisibility(GONE);
|
||||
}
|
||||
ImageUtils.loadImageView(framePicture, mIvFrame);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.qxcm.moduleutil.utils.location;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.location.Address;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||
import com.google.android.gms.location.LocationCallback;
|
||||
import com.google.android.gms.location.LocationRequest;
|
||||
import com.google.android.gms.location.LocationResult;
|
||||
import com.google.android.gms.location.LocationServices;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class GmsLocationProvider implements LocationProvider {
|
||||
|
||||
private static final String TAG = "GmsLocationProvider";
|
||||
private FusedLocationProviderClient fusedLocationClient;
|
||||
private LocationCallback locationCallback;
|
||||
|
||||
public GmsLocationProvider(Context context) {
|
||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(context);
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@Override
|
||||
public void getLastKnownLocation(Context context, LocationCallback callback) {
|
||||
fusedLocationClient.getLastLocation()
|
||||
.addOnSuccessListener(location -> {
|
||||
if (location != null) {
|
||||
String city = getCityName(context, location.getLatitude(), location.getLongitude());
|
||||
callback.onLocationReceived(location.getLatitude(), location.getLongitude(), city);
|
||||
} else {
|
||||
callback.onFailed("无法获取位置");
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(e -> callback.onFailed("Google Play 定位失败:" + e.getMessage()));
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@Override
|
||||
public void requestLocationUpdates(Context context, LocationCallback callback) {
|
||||
this.locationCallback = new LocationCallback() {
|
||||
@Override
|
||||
public void onLocationReceived(double latitude, double longitude, String city) {
|
||||
// for (android.location.Location location : locationResult.getLocations()) {
|
||||
String city1 = getCityName(context, latitude, longitude);
|
||||
callback.onLocationReceived(latitude, longitude, city1);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorMessage) {
|
||||
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onLocationResult(@NonNull LocationResult locationResult) {
|
||||
// for (android.location.Location location : locationResult.getLocations()) {
|
||||
// String city = getCityName(context, location.getLatitude(), location.getLongitude());
|
||||
// callback.onLocationReceived(location.getLatitude(), location.getLongitude(), city);
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
LocationRequest locationRequest = LocationRequest.create();
|
||||
locationRequest.setInterval(10000)
|
||||
.setFastestInterval(5000)
|
||||
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||
|
||||
fusedLocationClient.requestLocationUpdates(locationRequest, (com.google.android.gms.location.LocationCallback) locationCallback, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopLocationUpdates() {
|
||||
if (locationCallback != null) {
|
||||
fusedLocationClient.removeLocationUpdates((com.google.android.gms.location.LocationCallback) locationCallback);
|
||||
}
|
||||
}
|
||||
|
||||
private String getCityName(Context context, double latitude, double longitude) {
|
||||
android.location.Geocoder geocoder = new android.location.Geocoder(context, Locale.getDefault());
|
||||
try {
|
||||
List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
|
||||
if (addresses != null && !addresses.isEmpty()) {
|
||||
return addresses.get(0).getLocality();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "地理编码失败", e);
|
||||
}
|
||||
return "未知城市";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.qxcm.moduleutil.utils.location;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
public class IpLocationProvider implements LocationProvider {
|
||||
|
||||
@Override
|
||||
public void getLastKnownLocation(Context context, LocationCallback callback) {
|
||||
new FetchIpLocationTask(callback).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestLocationUpdates(Context context, LocationCallback callback) {
|
||||
getLastKnownLocation(context, callback); // 单次定位即可
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopLocationUpdates() {}
|
||||
|
||||
private static class FetchIpLocationTask extends AsyncTask<Void, Void, String> {
|
||||
private final LocationCallback callback;
|
||||
|
||||
FetchIpLocationTask(LocationCallback callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... voids) {
|
||||
try {
|
||||
URL url = new URL("https://ip-api.com/json/");
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
StringBuilder json = new StringBuilder();
|
||||
String line;
|
||||
|
||||
while ((line = reader.readLine()) != null) {
|
||||
json.append(line);
|
||||
}
|
||||
|
||||
JSONObject obj = new JSONObject(Boolean.parseBoolean(json.toString()));
|
||||
return obj.getString("city");
|
||||
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String city) {
|
||||
if (city != null && !city.isEmpty()) {
|
||||
callback.onLocationReceived(0, 0, city);
|
||||
} else {
|
||||
callback.onFailed("IP 定位失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.qxcm.moduleutil.utils.location;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public interface LocationProvider {
|
||||
void getLastKnownLocation(Context context, LocationCallback callback);
|
||||
|
||||
void requestLocationUpdates(Context context, LocationCallback callback);
|
||||
|
||||
void stopLocationUpdates();
|
||||
|
||||
interface LocationCallback {
|
||||
void onLocationReceived(double latitude, double longitude, String city);
|
||||
void onFailed(String errorMessage);
|
||||
}
|
||||
|
||||
// interface LocationCallback {
|
||||
// void onLocationReceived(double latitude, double longitude, String city);
|
||||
// void onFailed(String errorMessage);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.qxcm.moduleutil.utils.location;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class LocationServiceFactory {
|
||||
public static LocationProvider createBestProvider(Context context) {
|
||||
if (false) {
|
||||
return new GmsLocationProvider(context);
|
||||
} else {
|
||||
return new SystemLocationProvider();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isGooglePlayServicesAvailable(Context context) {
|
||||
// 实现判断逻辑,例如使用 GoogleApiAvailability
|
||||
// 或者简单尝试加载类是否存在
|
||||
try {
|
||||
Class.forName("com.google.android.gms.common.GoogleApiAvailability");
|
||||
return true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.qxcm.moduleutil.utils.location;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Address;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class SystemLocationProvider implements LocationProvider {
|
||||
|
||||
private LocationManager locationManager;
|
||||
|
||||
@Override
|
||||
public void getLastKnownLocation(@NonNull Context context, @NonNull LocationCallback callback) {
|
||||
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
if (locationManager == null) {
|
||||
callback.onFailed("无法获取定位服务");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
locationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(@NonNull Location location) {
|
||||
String city = getCityName(context, location.getLatitude(), location.getLongitude());
|
||||
callback.onLocationReceived(location.getLatitude(), location.getLongitude(), city);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(@NonNull String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(@NonNull String provider) {
|
||||
fallbackToNetwork(callback, context);
|
||||
}
|
||||
}, null);
|
||||
} else if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
|
||||
locationManager.requestSingleUpdate(LocationManager.NETWORK_PROVIDER, new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(@NonNull Location location) {
|
||||
String city = getCityName(context, location.getLatitude(), location.getLongitude());
|
||||
callback.onLocationReceived(location.getLatitude(), location.getLongitude(), city);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(@NonNull String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(@NonNull String provider) {
|
||||
callback.onFailed("网络定位不可用");
|
||||
}
|
||||
}, null);
|
||||
} else {
|
||||
callback.onFailed("GPS 和 网络定位均未启用");
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
callback.onFailed("缺少定位权限:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void fallbackToNetwork(LocationCallback callback, Context context) {
|
||||
if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
|
||||
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
// TODO: Consider calling
|
||||
// ActivityCompat#requestPermissions
|
||||
// here to request the missing permissions, and then overriding
|
||||
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||
// int[] grantResults)
|
||||
// to handle the case where the user grants the permission. See the documentation
|
||||
// for ActivityCompat#requestPermissions for more details.
|
||||
return;
|
||||
}
|
||||
locationManager.requestSingleUpdate(LocationManager.NETWORK_PROVIDER, new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(@NonNull Location location) {
|
||||
String city = getCityName(context, location.getLatitude(), location.getLongitude());
|
||||
callback.onLocationReceived(location.getLatitude(), location.getLongitude(), city);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(@NonNull String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(@NonNull String provider) {
|
||||
callback.onFailed("网络定位不可用");
|
||||
}
|
||||
}, null);
|
||||
} else {
|
||||
callback.onFailed("GPS 不可用且网络定位也未启用");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestLocationUpdates(Context context, LocationCallback callback) {
|
||||
// 可扩展为持续监听
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopLocationUpdates() {
|
||||
// 可扩展为停止监听
|
||||
}
|
||||
|
||||
private String getCityName(Context context, double latitude, double longitude) {
|
||||
android.location.Geocoder geocoder = new android.location.Geocoder(context, Locale.getDefault());
|
||||
try {
|
||||
List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
|
||||
if (addresses != null && !addresses.isEmpty()) {
|
||||
return addresses.get(0).getLocality();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "未知城市";
|
||||
}
|
||||
}
|
||||
@@ -363,5 +363,19 @@ public class Constants {
|
||||
|
||||
public static final String REAL_NAME = "/api/UserData/real_name";//调用实名认证接口
|
||||
public static final String REAL_NAME_RESULT = "/api/UserData/real_name_result";//调用实名认证接口
|
||||
public static final String GET_EXPAND_COLUMN = "/api/UserZone/expand_zone";//扩列获取数据接口
|
||||
public static final String GET_OFFICIAL_NOTICE = "/api/UserMessage/get_user_message_list";//获取消息信息
|
||||
public static final String GET_ALBUM_LIST = "/api/User/get_album_list";//相册列表
|
||||
public static final String CREATE_ALBUM = "/api/User/create_album";//创建相册
|
||||
public static final String GET_REWARD_LIST = "/api/UserZone/reward_list";//动态打赏列表
|
||||
public static final String GET_GIFT_LABEL = "/api/Gift/get_gift_label";//礼物标签
|
||||
public static final String GIFT_LIST = "/api/Gift/get_gift_list";//礼物标签
|
||||
public static final String TOPIC_LIST = "/api/UserZone/topic_list";//获取话题列表
|
||||
public static final String PUBLISH_ZONE = "/api/UserZone/publish_zone";//发布动态
|
||||
public static final String GET_CATEGORIES = "/api/UserZone/get_zone_topic";//动态引用的四条话题
|
||||
public static final String GET_CIRCLE_LIST = "/api/UserZone/zone_list";//语圈列表
|
||||
public static final String LIKE_ZONE = "/api/UserZone/like_zone";//语圈列表
|
||||
public static final String GET_COMMENT_LIST = "/api/UserZone/get_comment_list";//评论列表
|
||||
public static final String COMMENT_ZONE = "/api/UserZone/comment_zone";//评论列表
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.qxcm.moduleutil.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.utils.logger.Logger;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshHeader;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshKernel;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.constant.RefreshState;
|
||||
import com.scwang.smartrefresh.layout.constant.SpinnerStyle;
|
||||
|
||||
/**
|
||||
* 项目名称 qipao-android
|
||||
* 包名:com.qpyy.module.index.widget
|
||||
* 创建人 王欧
|
||||
* 创建时间 2020/6/30 3:55 PM
|
||||
* 描述 describe
|
||||
*/
|
||||
public class CustomRefreshHeader extends ConstraintLayout implements RefreshHeader {
|
||||
ImageView mImageView;
|
||||
AnimationDrawable mAnimationDrawable;
|
||||
|
||||
public CustomRefreshHeader(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public CustomRefreshHeader(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LayoutInflater.from(context).inflate(R.layout.index_header_custom_refresh, this);
|
||||
mImageView = findViewById(R.id.image);
|
||||
mAnimationDrawable = (AnimationDrawable) mImageView.getBackground();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public SpinnerStyle getSpinnerStyle() {
|
||||
return SpinnerStyle.Translate;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void setPrimaryColors(int... colors) {
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void onInitialized(@NonNull RefreshKernel kernel, int height, int maxDragHeight) {
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void onMoving(boolean isDragging, float percent, int offset, int height, int maxDragHeight) {
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void onReleased(@NonNull RefreshLayout refreshLayout, int height, int maxDragHeight) {
|
||||
Logger.e("onReleased");
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void onStartAnimator(@NonNull RefreshLayout refreshLayout, int height, int maxDragHeight) {
|
||||
Logger.e("onStartAnimator");
|
||||
//判断是否在运行
|
||||
if (!mAnimationDrawable.isRunning()) {
|
||||
//开启帧动画
|
||||
mAnimationDrawable.start();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public int onFinish(@NonNull RefreshLayout refreshLayout, boolean success) {
|
||||
if (mAnimationDrawable.isRunning()) {
|
||||
//开启帧动画
|
||||
mAnimationDrawable.stop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void onHorizontalDrag(float percentX, int offsetX, int offsetMax) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupportHorizontalDrag() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.qxcm.moduleutil.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
|
||||
public class MarqueeTextView extends AppCompatTextView {
|
||||
|
||||
public MarqueeTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public MarqueeTextView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
// 设置单行
|
||||
setSingleLine();
|
||||
// setMaxLines(1);
|
||||
//设置 Ellipsize,setMaxLines(1) 和 setEllipsize 冲突
|
||||
setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
||||
//获取焦距
|
||||
setFocusable(true);
|
||||
//走马灯的重复次数,-1代表无限重复
|
||||
setMarqueeRepeatLimit(-1);
|
||||
//强制获得焦点
|
||||
setFocusableInTouchMode(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于 EditText 存在时抢占焦点
|
||||
*/
|
||||
@Override
|
||||
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
|
||||
if (focused) {
|
||||
super.onFocusChanged(focused, direction, previouslyFocusedRect);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Window与Window间焦点发生改变时的回调
|
||||
* 解决 Dialog 抢占焦点问题
|
||||
*
|
||||
* @param hasWindowFocus
|
||||
*/
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||
if (hasWindowFocus) {
|
||||
super.onWindowFocusChanged(hasWindowFocus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused() {//必须重写,且返回值是true,表示始终获取焦点
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.qxcm.moduleutil.widget.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.adapter.CommentAdapter;
|
||||
import com.qxcm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.qxcm.moduleutil.bean.CommentBean;
|
||||
import com.qxcm.moduleutil.databinding.FragmentCommentDialogBinding;
|
||||
import com.qxcm.moduleutil.presenter.CommentContacts;
|
||||
import com.qxcm.moduleutil.presenter.CommentPresenter;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description: 评论弹框
|
||||
*/
|
||||
public class CommentDialogFragment extends BaseMvpDialogFragment<CommentPresenter, FragmentCommentDialogBinding> implements CommentContacts.View {
|
||||
private int page;
|
||||
private CommentAdapter commentAdapter;
|
||||
@Override
|
||||
protected CommentPresenter bindPresenter() {
|
||||
return new CommentPresenter(this, getActivity());
|
||||
}
|
||||
public static void show(String id, FragmentManager fragmentManager) {
|
||||
CommentDialogFragment dialogFragment = new CommentDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("id", id); // 可选:传递参数
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "CommentDialogFragment");
|
||||
}
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getCommentList(getArguments().getString("id"), "1", "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
mBinding.srl.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.getCommentList(getArguments().getString("id"), page+"", "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
MvpPre.getCommentList(getArguments().getString("id"), page+"", "10");
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.tvSend.setOnClickListener(this::onClick);
|
||||
|
||||
mBinding.rvComment.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
commentAdapter = new CommentAdapter(new ArrayList<>());
|
||||
mBinding.rvComment.setAdapter(commentAdapter);
|
||||
}
|
||||
|
||||
private void onClick(View view) {
|
||||
if (view.getId()==R.id.tv_send){
|
||||
if (mBinding.etInput.getText().toString().isEmpty()){
|
||||
ToastUtils.showShort("请输入评论内容");
|
||||
return;
|
||||
}
|
||||
MvpPre.commentZone(getArguments().getString("id"), mBinding.etInput.getText().toString(), "0", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_comment_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCommentList(CommentBean commentBean) {
|
||||
if (commentBean!=null){
|
||||
mBinding.tvNum.setText("全部评论("+commentBean.getTotal()+")");
|
||||
commentAdapter.updateData(commentBean.getList()); // 假设 CommentBean 包含评论列表
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commentZone() {
|
||||
ToastUtils.showShort("评论成功");
|
||||
MvpPre.getCommentList(getArguments().getString("id"), "1", "10");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.qxcm.moduleutil.widget.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 项目名称 qipao-android
|
||||
* 包名:com.qpyy.room.widget
|
||||
* 创建人 黄强
|
||||
* 创建时间 2020/8/6 16:55
|
||||
* 描述 自定义数字键盘
|
||||
*/
|
||||
|
||||
public class KeyboardPopupWindow extends PopupWindow {
|
||||
private static final String TAG = "KeyboardPopupWindow";
|
||||
private Context context;
|
||||
private View anchorView;
|
||||
private View parentView;
|
||||
private EditText editText;
|
||||
private boolean isRandomSort = false;//数字是否随机排序
|
||||
private List<Integer> list = new ArrayList<>();
|
||||
private int[] commonButtonIds = new int[]{R.id.bt_keyboard1, R.id.bt_keyboard2, R.id.bt_keyboard3, R.id.bt_keyboard4,
|
||||
R.id.bt_keyboard5, R.id.bt_keyboard6, R.id.bt_keyboard7, R.id.bt_keyboard8, R.id.bt_keyboard9, R.id.bt_keyboard0};
|
||||
|
||||
private KeyboardCompleteListener mListener;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param anchorView
|
||||
* @param
|
||||
* @param
|
||||
*/
|
||||
public KeyboardPopupWindow(Context context, View anchorView) {
|
||||
this.context = context;
|
||||
this.anchorView = anchorView;
|
||||
this.isRandomSort = isRandomSort;
|
||||
if (context == null || anchorView == null) {
|
||||
return;
|
||||
}
|
||||
initConfig();
|
||||
initView();
|
||||
Log.d(TAG, "KeyboardPopupWindow: =====================打开了自定义键盘");
|
||||
}
|
||||
|
||||
|
||||
private void initConfig() {
|
||||
setOutsideTouchable(false);
|
||||
setFocusable(false);
|
||||
setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
forbidDefaultSoftKeyboard();
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁止系统默认的软键盘弹出
|
||||
*/
|
||||
private void forbidDefaultSoftKeyboard() {
|
||||
if (editText == null) {
|
||||
return;
|
||||
}
|
||||
if (android.os.Build.VERSION.SDK_INT > 10) {//4.0以上,使用反射的方式禁止系统自带的软键盘弹出
|
||||
try {
|
||||
Class<EditText> cls = EditText.class;
|
||||
Method setShowSoftInputOnFocus;
|
||||
setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus", boolean.class);
|
||||
setShowSoftInputOnFocus.setAccessible(true);
|
||||
setShowSoftInputOnFocus.invoke(editText, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新自定义的popupwindow是否outside可触摸反应:如果是不可触摸的,则显示该软键盘view
|
||||
*
|
||||
* @param isTouchable
|
||||
*/
|
||||
public void refreshKeyboardOutSideTouchable(boolean isTouchable) {
|
||||
setOutsideTouchable(isTouchable);
|
||||
if (!isTouchable) {
|
||||
show();
|
||||
} else {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
parentView = LayoutInflater.from(context).inflate(R.layout.room_custom_num_keyboard, null);
|
||||
initKeyboardView(parentView);
|
||||
setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
setContentView(parentView);
|
||||
this.setBackgroundDrawable(new BitmapDrawable());
|
||||
this.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
this.setFocusable(true);
|
||||
this.setOutsideTouchable(true);
|
||||
this.setTouchable(true);
|
||||
this.setAnimationStyle(R.style.mypopwindow_anim_style);
|
||||
}
|
||||
|
||||
private void initKeyboardView(View view) {
|
||||
//初始化编辑框
|
||||
editText = view.findViewById(R.id.et_keyboard_input);
|
||||
editText.setFocusable(false);//禁止编辑框获取焦点
|
||||
//①给数字键设置点击监听
|
||||
for (int i = 0; i < commonButtonIds.length; i++) {
|
||||
final Button button = view.findViewById(commonButtonIds[i]);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int curSelection = editText.getSelectionStart();
|
||||
int length = editText.getText().toString().length();
|
||||
if (curSelection < length) {
|
||||
String content = editText.getText().toString();
|
||||
editText.setText(content.substring(0, curSelection) + button.getText() + content.subSequence(curSelection, length));
|
||||
editText.setSelection(curSelection + 1);
|
||||
} else {
|
||||
if (length == 0 && button.getText().toString().equals("0") || equals("")) {
|
||||
return;
|
||||
}
|
||||
editText.setText(editText.getText().toString() + button.getText());
|
||||
editText.setSelection(editText.getText().toString().length());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//③给叉按键设置点击监听
|
||||
view.findViewById(R.id.rl_keyboard_cross).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int length = editText.getText().toString().length();
|
||||
int curSelection = editText.getSelectionStart();
|
||||
if (length > 0 && curSelection > 0 && curSelection <= length) {
|
||||
String content = editText.getText().toString();
|
||||
editText.setText(content.substring(0, curSelection - 1) + content.subSequence(curSelection, length));
|
||||
editText.setSelection(curSelection - 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//③给叉按键设置点击监听
|
||||
view.findViewById(R.id.iv_keyboard_cross).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int length = editText.getText().toString().length();
|
||||
int curSelection = editText.getSelectionStart();
|
||||
if (length > 0 && curSelection > 0 && curSelection <= length) {
|
||||
String content = editText.getText().toString();
|
||||
editText.setText(content.substring(0, curSelection - 1) + content.subSequence(curSelection, length));
|
||||
editText.setSelection(curSelection - 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//确定
|
||||
view.findViewById(R.id.bt_keyboard_ok).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d(TAG, "onClick: 您输入的数量是:" + editText.getText().toString());
|
||||
mListener.inputComplete(editText.getText().toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void show() {
|
||||
if (!isShowing() && anchorView != null) {
|
||||
// doRandomSortOp();
|
||||
this.showAtLocation(anchorView, Gravity.BOTTOM, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机分布数字
|
||||
*/
|
||||
private void doRandomSortOp() {
|
||||
if (parentView == null) {
|
||||
return;
|
||||
}
|
||||
if (!isRandomSort) {
|
||||
for (int i = 0; i < commonButtonIds.length; i++) {
|
||||
final Button button = parentView.findViewById(commonButtonIds[i]);
|
||||
button.setText("" + i);
|
||||
}
|
||||
} else {
|
||||
list.clear();
|
||||
Random ran = new Random();
|
||||
while (list.size() < commonButtonIds.length) {
|
||||
int n = ran.nextInt(commonButtonIds.length);
|
||||
if (!list.contains(n))
|
||||
list.add(n);
|
||||
}
|
||||
for (int i = 0; i < commonButtonIds.length; i++) {
|
||||
final Button button = parentView.findViewById(commonButtonIds[i]);
|
||||
button.setText("" + list.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void releaseResources() {
|
||||
this.dismiss();
|
||||
context = null;
|
||||
anchorView = null;
|
||||
if (list != null) {
|
||||
list.clear();
|
||||
list = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addRoomPasswordListener(KeyboardCompleteListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public interface KeyboardCompleteListener {
|
||||
|
||||
void inputComplete(String inputContent);//输入完成
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.qxcm.moduleutil.widget.dialog;
|
||||
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.adapter.GiftTwoDetailsFragment;
|
||||
import com.qxcm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.qxcm.moduleutil.bean.GiftLabelBean;
|
||||
import com.qxcm.moduleutil.bean.GiftNumBean;
|
||||
import com.qxcm.moduleutil.bean.RewardUserBean;
|
||||
import com.qxcm.moduleutil.bean.RoonGiftModel;
|
||||
import com.qxcm.moduleutil.databinding.FragmentRewardGiftDialogBinding;
|
||||
import com.qxcm.moduleutil.presenter.RewardGiftContacts;
|
||||
import com.qxcm.moduleutil.presenter.RewardGiftPresenter;
|
||||
import com.qxcm.moduleutil.utils.DialogUtils;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/5/29
|
||||
* @description: 打赏礼物的fragment
|
||||
*/
|
||||
public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPresenter, FragmentRewardGiftDialogBinding> implements RewardGiftContacts.View {
|
||||
|
||||
private BaseQuickAdapter<RewardUserBean, BaseViewHolder> adapter;
|
||||
private SelectGiftNumPopupWindow mSelectGiftNumPopupWindow;
|
||||
private KeyboardPopupWindow mKeyboardPopupWindow;
|
||||
private List<GiftNumBean> mGiftNumList;
|
||||
@Override
|
||||
protected RewardGiftPresenter bindPresenter() {
|
||||
return new RewardGiftPresenter(this, getActivity());
|
||||
}
|
||||
public static void show(String id, FragmentManager fragmentManager) {
|
||||
RewardGiftDialogFragment dialogFragment = new RewardGiftDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("circle_id", id); // 可选:传递参数
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RewardGiftDialogFragment");
|
||||
}
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getRewardList("1", 1, 10);
|
||||
MvpPre.getGiftLabel("1");
|
||||
|
||||
mGiftNumList=new ArrayList<>();
|
||||
mGiftNumList.add(new GiftNumBean("20", "x20"));
|
||||
mGiftNumList.add(new GiftNumBean("15", "x15"));
|
||||
mGiftNumList.add(new GiftNumBean("10", "x10"));
|
||||
mGiftNumList.add(new GiftNumBean("5", "x5"));
|
||||
mGiftNumList.add(new GiftNumBean("1", "x1"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.recycleView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
adapter = new BaseQuickAdapter<RewardUserBean, BaseViewHolder>(R.layout.item_reward, null) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RewardUserBean item) {
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.im_reward));
|
||||
}
|
||||
};
|
||||
|
||||
mBinding.tvGiveCoinNum.setOnClickListener(this::onClisk);
|
||||
|
||||
}
|
||||
|
||||
private void onClisk(View view1) {
|
||||
if (view1.getId()==R.id.tv_give_coin_num){
|
||||
if (mSelectGiftNumPopupWindow == null) {
|
||||
|
||||
mSelectGiftNumPopupWindow = new SelectGiftNumPopupWindow(getSelfActivity(), (adapter, view, position) -> {
|
||||
GiftNumBean giftNumBean = (GiftNumBean) adapter.getItem(position);
|
||||
if ("0".equals(giftNumBean.getNumber())) {//自定义
|
||||
mKeyboardPopupWindow = new KeyboardPopupWindow(getSelfActivity(), getView());
|
||||
mKeyboardPopupWindow.refreshKeyboardOutSideTouchable(false);//false开启键盘 ,true关闭键盘
|
||||
mKeyboardPopupWindow.addRoomPasswordListener(new KeyboardPopupWindow.KeyboardCompleteListener() {//监听自定键盘的完成
|
||||
@Override
|
||||
public void inputComplete(String inputContent) {
|
||||
mBinding.tvGiveCoinNum.setText(inputContent);
|
||||
mKeyboardPopupWindow.releaseResources();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mBinding.tvGiveCoinNum.setText(giftNumBean.getNumber());
|
||||
}
|
||||
mSelectGiftNumPopupWindow.dismiss();
|
||||
});
|
||||
}
|
||||
mSelectGiftNumPopupWindow.setData(mGiftNumList);
|
||||
mSelectGiftNumPopupWindow.showAtLocation(mBinding.tvGiveCoinNum, Gravity.BOTTOM | Gravity.RIGHT, 100, 230);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_reward_gift_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {
|
||||
if (rewardUserBeanList != null && !rewardUserBeanList.isEmpty()) {
|
||||
mBinding.recycleView.setVisibility(View.VISIBLE);
|
||||
mBinding.tvRewardNum.setVisibility(View.VISIBLE);
|
||||
mBinding.tvRewardTitle.setVisibility(View.INVISIBLE);
|
||||
mBinding.tvRewardNum.setText("已有" + String.valueOf(rewardUserBeanList.size()) + "个人打赏");
|
||||
int limit = Math.min(rewardUserBeanList.size(), 6);
|
||||
List<RewardUserBean> limitedList = rewardUserBeanList.subList(0, limit);
|
||||
adapter.setNewData(limitedList);
|
||||
} else {
|
||||
adapter.setNewData(null);
|
||||
mBinding.recycleView.setVisibility(View.INVISIBLE);
|
||||
mBinding.tvRewardNum.setVisibility(View.INVISIBLE);
|
||||
mBinding.tvRewardTitle.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans));
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||
mBinding.slidingTabLayout.setCurrentTab(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> roonGiftModels) {
|
||||
|
||||
}
|
||||
|
||||
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private List<GiftLabelBean> list;
|
||||
|
||||
|
||||
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list) {
|
||||
super(fm);
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
GiftLabelBean model = list.get(position);
|
||||
return GiftTwoDetailsFragment.newInstance(model.getLabel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
GiftLabelBean model = list.get(position);
|
||||
return model.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.qxcm.moduleutil.widget.dialog;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.GiftNumBean;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description: 展示礼物打赏数量的适配器
|
||||
*/
|
||||
public class SelectGiftNumAdapter extends BaseQuickAdapter<GiftNumBean, BaseViewHolder> {
|
||||
|
||||
public SelectGiftNumAdapter() {
|
||||
super(R.layout.room_rv_item_gift_num_windows);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, GiftNumBean item) {
|
||||
// helper.setText(R.id.tv_gift_mum, item.getNumber())
|
||||
helper.setText(R.id.tv_gift_name, item.getText());
|
||||
if ("0".equals(item.getNumber())) {
|
||||
// helper.setText(R.id.tv_custom, item.getText());
|
||||
// helper.setVisible(R.id.tv_custom,true);
|
||||
// helper.setVisible(R.id.tv_gift_mum, false).
|
||||
helper.setVisible(R.id.tv_gift_name, false);
|
||||
}else {
|
||||
// helper.setVisible(R.id.tv_custom,false);
|
||||
// helper.setVisible(R.id.tv_gift_mum, false)
|
||||
helper.setVisible(R.id.tv_gift_name, true);
|
||||
}
|
||||
if("1".equals(item.getNumber())){
|
||||
helper.getView(R.id.iv_split).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.qxcm.moduleutil.widget.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.GiftNumBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description: 选择礼物数量窗口
|
||||
*/
|
||||
public class SelectGiftNumPopupWindow extends PopupWindow {
|
||||
private View rootView;
|
||||
private SelectGiftNumAdapter selectGiftNumAdapter;
|
||||
|
||||
public SelectGiftNumPopupWindow(Context context, BaseQuickAdapter.OnItemClickListener onItemClickListener) {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
rootView = inflater.inflate(R.layout.room_window_pop_gift, null);
|
||||
RecyclerView recyclerView = rootView.findViewById(R.id.rv_gift_num_window);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||
recyclerView.setAdapter(selectGiftNumAdapter = new SelectGiftNumAdapter());
|
||||
|
||||
selectGiftNumAdapter.setOnItemClickListener(onItemClickListener);
|
||||
setContentView(rootView);
|
||||
this.setBackgroundDrawable(new BitmapDrawable());
|
||||
this.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
this.setFocusable(true);
|
||||
this.setOutsideTouchable(true);
|
||||
this.setTouchable(true);
|
||||
this.setAnimationStyle(R.style.mypopwindow_anim_style);
|
||||
}
|
||||
|
||||
|
||||
public void setData(List<GiftNumBean> data) {
|
||||
if (selectGiftNumAdapter != null) {
|
||||
selectGiftNumAdapter.setNewData(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.qxcm.moduleutil.widget.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.databinding.RoomDialogShareBinding;
|
||||
import com.qxcm.moduleutil.utils.BaseBottomSheetDialog;
|
||||
|
||||
|
||||
/**
|
||||
* 房间分享弹窗
|
||||
*/
|
||||
public class ShareDialog extends BaseBottomSheetDialog<RoomDialogShareBinding> {
|
||||
|
||||
|
||||
private static final String TAG = "ShareDialog";
|
||||
|
||||
public ShareDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
Log.i(TAG, "(Start)启动了===========================ShareDialog");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayout() {
|
||||
return R.layout.room_dialog_share;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
Window window = getWindow();
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.4f;
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
mBinding.tvQq.setOnClickListener(this::onClick);
|
||||
mBinding.tvWeixin.setOnClickListener(this::onClick);
|
||||
mBinding.tvClean.setOnClickListener(this::onClick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
String appName = CommonAppContext.getInstance().getResources().getString(R.string.app_name);
|
||||
if (R.id.tv_qq == id) {
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.D0108, "share_way", "QQ分享");
|
||||
// ShareUtil.shareWeb((Activity) view.getContext(), URLConstants.SHARE, String.format("我在%s玩呢,大家都在玩,快来展示您的精彩", appName)
|
||||
// , appName, "", R.mipmap.ic_launcher_new, SHARE_MEDIA.QQ);
|
||||
} else if (R.id.tv_weixin == id) {
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.D0108, "share_way", "微信分享");
|
||||
// ShareUtil.shareWeb((Activity) view.getContext(), URLConstants.SHARE, String.format("我在%s玩呢,大家都在玩,快来展示您的精彩", appName)
|
||||
// , appName, "", R.mipmap.ic_launcher_new, SHARE_MEDIA.WEIXIN);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -198,15 +198,50 @@
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/dy_more_image"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_weight="1.7"-->
|
||||
<!-- android:paddingHorizontal="5dp"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_gravity="right"-->
|
||||
<!-- android:src="@mipmap/mx"-->
|
||||
<!-- android:visibility="visible" />-->
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.9"
|
||||
android:layout_gravity="right"
|
||||
android:background="@drawable/bg_r43_9999"
|
||||
android:paddingHorizontal="5dp"
|
||||
android:layout_marginEnd="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dy_more_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1.7"
|
||||
android:paddingHorizontal="5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:src="@mipmap/mx"
|
||||
android:layout_width="@dimen/dp_14"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/hua"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dy_more_tv"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="萌新驾到"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="12sp"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="2"
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<com.qxcm.moduleutil.widget.GifAvatarOvalView
|
||||
android:id="@+id/riv"
|
||||
@@ -14,20 +15,20 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.70154"
|
||||
app:layout_constraintWidth_percent="0.90154"
|
||||
android:src="@mipmap/default_avatar"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sex"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@mipmap/common_ic_headportriat_boy"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:background="@mipmap/nan"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="@id/riv"
|
||||
app:layout_constraintEnd_toEndOf="@id/riv"
|
||||
app:layout_constraintStart_toStartOf="@id/riv"
|
||||
app:layout_constraintTop_toTopOf="@id/riv" />
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_frame"
|
||||
|
||||
@@ -278,5 +278,6 @@
|
||||
<color name="color_caifu">#61C8FD</color>
|
||||
<color name="color_meili1">#FEE6E3</color>
|
||||
<color name="color_caifu1">#C4EBFF</color>
|
||||
|
||||
<color name="dianzan2">#FF9249FF</color>
|
||||
<color name="dianzan1">#212121</color>
|
||||
</resources>
|
||||
@@ -102,6 +102,8 @@
|
||||
<string name="payment_method">支付方式</string>
|
||||
<string name="wechat_payment">微信支付</string>
|
||||
<string name="alipay_payment">支付宝支付</string>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.example.modulecircle.activity;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
@@ -9,10 +12,14 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
@@ -20,6 +27,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.example.modulecircle.R;
|
||||
import com.example.modulecircle.contacts.ReleaseContract;
|
||||
@@ -33,9 +41,13 @@ import com.luck.picture.lib.config.PictureMimeType;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.adapter.UserPhotoWallAdapter;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
import com.qxcm.moduleutil.bean.UserImgList;
|
||||
import com.qxcm.moduleutil.utils.GlideEngine;
|
||||
import com.qxcm.moduleutil.utils.LocationUtils;
|
||||
import com.qxcm.moduleutil.utils.MyPictureParameterStyle;
|
||||
import com.qxcm.moduleutil.utils.location.LocationProvider;
|
||||
import com.qxcm.moduleutil.utils.location.LocationServiceFactory;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
|
||||
import java.io.File;
|
||||
@@ -50,8 +62,11 @@ import java.util.List;
|
||||
*/
|
||||
public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityReleaseBinding> implements ReleaseContract.View {
|
||||
UserPhotoWallAdapter mUserPhotoWallAdapter;
|
||||
List<UserImgList> list;
|
||||
List<String> list=new ArrayList<>();
|
||||
private List<String> uploadedUrls = new ArrayList<>();//真实图片地址
|
||||
final int maxNum = 1200;
|
||||
private List<String> topicId=new ArrayList<>();
|
||||
private String city1;
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
@@ -84,15 +99,23 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
||||
mUserPhotoWallAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
||||
@Override
|
||||
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
int id = view.getId();
|
||||
UserImgList item = mUserPhotoWallAdapter.getItem(position);
|
||||
if (id == com.qxcm.moduleutil.R.id.iv_close) {
|
||||
// MvpPre.deletePhoto(item.getId(), position);
|
||||
String item = list.get(position);
|
||||
if (item.equals(UserPhotoWallAdapter.ADD_PHOTO)) {
|
||||
// 点击的是“+”号,启动图片选择
|
||||
startChoosePhoto(PictureMimeType.ofImage(), PictureConfig.CHOOSE_REQUEST, false, 9);
|
||||
} else {
|
||||
if ("0".equals(item.getId())) {
|
||||
startChoosePhoto(PictureMimeType.ofImage(), PictureConfig.REQUEST_CAMERA, true, 9);
|
||||
}
|
||||
// 查看大图或其他操作
|
||||
}
|
||||
|
||||
// int id = view.getId();
|
||||
// UserImgList item = mUserPhotoWallAdapter.getItem(position);
|
||||
// if (id == com.qxcm.moduleutil.R.id.iv_close) {
|
||||
//// MvpPre.deletePhoto(item.getId(), position);
|
||||
// } else {
|
||||
// if ("0".equals(item.getId())) {
|
||||
// startChoosePhoto(PictureMimeType.ofImage(), PictureConfig.REQUEST_CAMERA, true, 9);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
});
|
||||
mUserPhotoWallAdapter.setOnItemChildLongClickListener(new BaseQuickAdapter.OnItemChildLongClickListener() {
|
||||
@@ -102,53 +125,70 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
updateAdapterData(); // 初始化时更新适配器数据
|
||||
list = new ArrayList<>();
|
||||
UserImgList userImgList = new UserImgList("0", "");
|
||||
list.add(userImgList);
|
||||
list.add("ADD_PHOTO"); // 最后一项是“添加图片”
|
||||
mUserPhotoWallAdapter.setNewData(list);
|
||||
mUserPhotoWallAdapter.setDelete(true);
|
||||
|
||||
mBinding.rl1.setOnClickListener(this::onClick);
|
||||
mBinding.tvFb.setOnClickListener(this::onClick);
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
// 请求定位权限
|
||||
ActivityCompat.requestPermissions(
|
||||
(Activity) this,
|
||||
new String[]{
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
},
|
||||
1001 // 自定义常量,比如 1001
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
LocationProvider provider = LocationServiceFactory.createBestProvider(this);
|
||||
provider.getLastKnownLocation(this, new LocationProvider.LocationCallback() {
|
||||
@Override
|
||||
public void onLocationReceived(double latitude, double longitude, String city) {
|
||||
Toast.makeText(ReleaseActivity.this, "当前位置:" + city, Toast.LENGTH_SHORT).show();
|
||||
city1=city;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorMessage) {
|
||||
Toast.makeText(ReleaseActivity.this, "定位失败:" + errorMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
//更新适配器数据的方法
|
||||
private void updateAdapterData() {
|
||||
list.clear();
|
||||
list.addAll(uploadedUrls); // 添加真实图片
|
||||
list.add(UserPhotoWallAdapter.ADD_PHOTO); // 最后加上 ADD_PHOTO
|
||||
mUserPhotoWallAdapter.setNewData(list);
|
||||
}
|
||||
private void onClick(View view) {
|
||||
if (view.getId() == R.id.rl_1) {
|
||||
dialog();
|
||||
}else if (view.getId()==R.id.tv_fb){
|
||||
if (mBinding.etG.getText().toString().isEmpty()){
|
||||
ToastUtils.showShort("请输入发布内容");
|
||||
return;
|
||||
}
|
||||
if (topicId.size()==0){
|
||||
ToastUtils.showShort("请选择话题");
|
||||
return;
|
||||
}
|
||||
|
||||
MvpPre.publishZone(TextUtils.join(",", uploadedUrls),mBinding.etG.getText().toString(),TextUtils.join(",", topicId),"",city1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void dialog() {
|
||||
|
||||
// 示例数据
|
||||
List<String> topics = Arrays.asList("话题1", "话题2", "话题3", "话题4");
|
||||
|
||||
BottomSheetDialog dialog = new BottomSheetDialog(this);
|
||||
dialog.setContentView(R.layout.bottom_sheet_recyclerview);
|
||||
|
||||
RecyclerView recyclerView = dialog.findViewById(R.id.rv_options);
|
||||
Button btnCancel = dialog.findViewById(R.id.btn_cancel);
|
||||
Button btnConfirm = dialog.findViewById(R.id.btn_confirm);
|
||||
|
||||
assert recyclerView != null;
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
MultiSelectAdapter adapter = new MultiSelectAdapter(topics);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
btnCancel.setOnClickListener(v -> dialog.dismiss());
|
||||
|
||||
btnConfirm.setOnClickListener(v -> {
|
||||
List<String> selectedTopics = adapter.getSelectedItems();
|
||||
// 返回结果给调用页面(可使用接口或 onActivityResult 等方式)
|
||||
Log.d("Selected Topics", selectedTopics.toString());
|
||||
// 示例:更新 UI
|
||||
((TextView)findViewById(R.id.tv_ht)).setText("已选:" + TextUtils.join(",", selectedTopics));
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
|
||||
MvpPre.topicList("1","30");
|
||||
}
|
||||
|
||||
private void startChoosePhoto(int mimeType, int requestCode, boolean isVideo, int type) {
|
||||
@@ -173,17 +213,29 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
switch (requestCode) {
|
||||
case PictureConfig.CHOOSE_REQUEST:
|
||||
List<LocalMedia> localMedia = PictureSelector.obtainMultipleResult(data);
|
||||
if (localMedia != null && localMedia.size() != 0) {
|
||||
LocalMedia imgMedia = localMedia.get(0);
|
||||
String url;
|
||||
if (imgMedia.isCompressed()) {
|
||||
url = imgMedia.getCompressPath();
|
||||
} else {
|
||||
url = imgMedia.getRealPath();
|
||||
List<LocalMedia> localMediaList = PictureSelector.obtainMultipleResult(data);
|
||||
|
||||
if (localMediaList != null && !localMediaList.isEmpty()) {
|
||||
List<File> imageFiles = new ArrayList<>();
|
||||
for (LocalMedia media : localMediaList) {
|
||||
String path = media.isCompressed() ? media.getCompressPath() : media.getRealPath();
|
||||
imageFiles.add(new File(path));
|
||||
}
|
||||
|
||||
// 开始批量上传
|
||||
MvpPre.batchUploadFiles(imageFiles, 0); // 第二个参数是你原来的 type
|
||||
|
||||
}
|
||||
// if (localMedia != null && localMedia.size() != 0) {
|
||||
// LocalMedia imgMedia = localMedia.get(0);
|
||||
// String url;
|
||||
// if (imgMedia.isCompressed()) {
|
||||
// url = imgMedia.getCompressPath();
|
||||
// } else {
|
||||
// url = imgMedia.getRealPath();
|
||||
// }
|
||||
// MvpPre.uploadFile(new File(url), 0);
|
||||
}
|
||||
// }
|
||||
break;
|
||||
case PictureConfig.REQUEST_CAMERA:
|
||||
List<LocalMedia> localMedia1 = PictureSelector.obtainMultipleResult(data);
|
||||
@@ -205,4 +257,91 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
||||
protected ReleasePresenter bindPresenter() {
|
||||
return new ReleasePresenter(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void topicList(List<HeatedBean> list) {
|
||||
// 示例数据
|
||||
// List<String> topics = Arrays.asList("话题1", "话题2", "话题3", "话题4");
|
||||
|
||||
List<String> topics = new ArrayList<>();
|
||||
for (HeatedBean bean : list) {
|
||||
topics.add(bean.getTitle());
|
||||
}
|
||||
|
||||
|
||||
BottomSheetDialog dialog = new BottomSheetDialog(this);
|
||||
dialog.setContentView(R.layout.bottom_sheet_recyclerview);
|
||||
|
||||
RecyclerView recyclerView = dialog.findViewById(R.id.rv_options);
|
||||
Button btnCancel = dialog.findViewById(R.id.btn_cancel);
|
||||
Button btnConfirm = dialog.findViewById(R.id.btn_confirm);
|
||||
|
||||
assert recyclerView != null;
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
MultiSelectAdapter adapter = new MultiSelectAdapter(list);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
btnCancel.setOnClickListener(v -> dialog.dismiss());
|
||||
|
||||
btnConfirm.setOnClickListener(v -> {
|
||||
topicId=new ArrayList<>();
|
||||
List<HeatedBean> selectedTopics = adapter.getSelectedItems();
|
||||
// 返回结果给调用页面(可使用接口或 onActivityResult 等方式)
|
||||
Log.d("Selected Topics", selectedTopics.toString());
|
||||
List<String> selectedTopicIds = new ArrayList<>();
|
||||
for (HeatedBean topic : selectedTopics) {
|
||||
selectedTopicIds.add(topic.getTitle());
|
||||
}
|
||||
|
||||
for (HeatedBean topic : selectedTopics){
|
||||
topicId.add(topic.getId());
|
||||
}
|
||||
// 示例:更新 UI
|
||||
((TextView)findViewById(R.id.tv_ht)).setText("已选:" + TextUtils.join(",", selectedTopicIds));
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upLoadSuccess(String url, int type, int index, int total) {
|
||||
if (index >= 0 && index < uploadedUrls.size()) {
|
||||
uploadedUrls.add(index, url); // 插入到对应位置
|
||||
} else {
|
||||
uploadedUrls.add(url); // 添加到最后
|
||||
}
|
||||
|
||||
if (uploadedUrls.size() == total) {
|
||||
updateAdapterData(); // 所有图片上传完成,更新适配器数据
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishSuccess() {
|
||||
ToastUtils.showShort("发布成功,待审核");
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
if (requestCode == 1001) {
|
||||
LocationProvider provider = LocationServiceFactory.createBestProvider(this);
|
||||
provider.getLastKnownLocation(this, new LocationProvider.LocationCallback() {
|
||||
@Override
|
||||
public void onLocationReceived(double latitude, double longitude, String city) {
|
||||
Toast.makeText(ReleaseActivity.this, "当前位置:" + city, Toast.LENGTH_SHORT).show();
|
||||
city1=city;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorMessage) {
|
||||
Toast.makeText(ReleaseActivity.this, "定位失败:" + errorMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,11 +37,11 @@ public class CircleCategoryAdapter extends RecyclerView.Adapter<CircleCategoryA
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
HeatedBean model = dataList.get(position);
|
||||
holder.tvTitle.setText(model.getTitle());
|
||||
holder.tvTitleContent.setText(model.getTitle_content());
|
||||
if (model.getTitle_pictrue().isEmpty()){
|
||||
holder.tvTitleContent.setText(model.getCount()+"条动态");
|
||||
if (model.getPic()==null){
|
||||
holder.ivIcon.setImageResource(com.qxcm.moduleutil.R.mipmap.default_avatar);
|
||||
}else {
|
||||
ImageUtils.loadHeadCC(model.getTitle_pictrue(), holder.ivIcon);
|
||||
ImageUtils.loadHeadCC(model.getPic(), holder.ivIcon);
|
||||
// 加载图片等逻辑
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class CircleCategoryAdapter extends RecyclerView.Adapter<CircleCategoryA
|
||||
ImageView ivIcon;
|
||||
TextView tvTitleContent;
|
||||
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvTitle = itemView.findViewById(R.id.tvTitle);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
@@ -11,110 +12,51 @@ import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.modulecircle.R;
|
||||
import com.qxcm.moduleutil.adapter.OneImageYuanJiaoAdapter;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.bean.ExpandColumnBean;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
import com.qxcm.moduleutil.utils.MeHeadView;
|
||||
import com.qxcm.moduleutil.widget.MyGridView;
|
||||
import com.qxcm.moduleutil.widget.img.FullScreenUtil;
|
||||
|
||||
public class ExpandColumnAdapter extends BaseQuickAdapter<CircleListBean, BaseViewHolder> {
|
||||
import java.util.List;
|
||||
|
||||
public class ExpandColumnAdapter extends BaseQuickAdapter<ExpandColumnBean, BaseViewHolder> {
|
||||
public ExpandColumnAdapter() {
|
||||
super(R.layout.item_expand_column);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, CircleListBean item) {
|
||||
helper.addOnClickListener(com.qxcm.moduleutil.R.id.dianzan)
|
||||
.addOnClickListener(com.qxcm.moduleutil.R.id.dy_lookmore_tv)
|
||||
.addOnClickListener(com.qxcm.moduleutil.R.id.dy_head_image)
|
||||
.addOnClickListener(com.qxcm.moduleutil.R.id.dy_more_image)
|
||||
.addOnClickListener(com.qxcm.moduleutil.R.id.dy_oneimage_iv);
|
||||
protected void convert(BaseViewHolder helper, ExpandColumnBean item) {
|
||||
helper.addOnClickListener(R.id.dy_head_image)
|
||||
.addOnClickListener(R.id.dy_oneimage_iv);
|
||||
|
||||
//先让单图,多图,音频的布局显示
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_oneimage_iv).setVisibility(View.VISIBLE);
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_image_recyc).setVisibility(View.VISIBLE);
|
||||
helper.getView(com.qxcm.moduleutil.R.id.iv_jubao).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// ARouter.getInstance().build(AroutUtil.COMMUNITY_JUBAO).withString("uid", item.getUid() + "").navigation();
|
||||
}
|
||||
});
|
||||
helper.getView(R.id.dy_oneimage_iv).setVisibility(View.VISIBLE);
|
||||
helper.getView(R.id.dy_image_recyc).setVisibility(View.VISIBLE);
|
||||
|
||||
//昵称
|
||||
helper.setText(com.qxcm.moduleutil.R.id.dy_name_text, item.getUserNickName());
|
||||
helper.setText(R.id.dy_name_text, item.getNickname());
|
||||
helper.setText(R.id.tv_address, item.getLoginip());
|
||||
|
||||
if (item.getRoom_id()!=0){
|
||||
helper.getView(R.id.gensui).setBackgroundResource(com.qxcm.moduleutil.R.mipmap.gsui);
|
||||
}else {
|
||||
helper.getView(R.id.gensui).setBackgroundResource(com.qxcm.moduleutil.R.mipmap.six);
|
||||
}
|
||||
|
||||
//头像
|
||||
ImageUtils.loadHeadCC(item.getUserAvatar(), (ImageView) helper.getView(com.qxcm.moduleutil.R.id.dy_head_image));
|
||||
// ImageUtils.loadHeadCC(item.getAvatar(), (ImageView) helper.getView(R.id.dy_head_image));
|
||||
MeHeadView headView = helper.getView(R.id.dy_head_image);
|
||||
headView.setData(item.getAvatar(), "", item.getSex());
|
||||
|
||||
//动态内容以富文本展示
|
||||
String content = item.getContent();
|
||||
if (content == null || content.length() == 0) {
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_lookmore_tv).setVisibility(View.GONE);
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_content_tv).setVisibility(View.GONE);
|
||||
} else {
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_lookmore_tv).setVisibility(View.VISIBLE);
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_content_tv).setVisibility(View.VISIBLE);
|
||||
}
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_lookmore_tv).getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||
@Override
|
||||
public boolean onPreDraw() {
|
||||
//这个回调会调用多次,获取完行数记得注销监听
|
||||
TextView view = helper.getView(com.qxcm.moduleutil.R.id.dy_content_tv);
|
||||
int lineCount = view.getLineCount();
|
||||
if (lineCount >= 7) {
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_lookmore_tv).setVisibility(View.VISIBLE);
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_content_tv).getViewTreeObserver().removeOnPreDrawListener(this);//销毁
|
||||
} else {
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_lookmore_tv).setVisibility(View.GONE);
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_content_tv).getViewTreeObserver().removeOnPreDrawListener(this);//销毁
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
helper.setText(com.qxcm.moduleutil.R.id.dy_content_tv, content);
|
||||
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
TextView view = helper.getView(com.qxcm.moduleutil.R.id.dy_content_tv);
|
||||
view.setVisibility(View.GONE);
|
||||
} else {
|
||||
TextView view = helper.getView(com.qxcm.moduleutil.R.id.dy_content_tv);
|
||||
view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
//点赞
|
||||
helper.setText(com.qxcm.moduleutil.R.id.dy_fabulous, item.getLike());
|
||||
// if (item.is_praise() == 1) {
|
||||
// TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
|
||||
// dy_fabulous.setTextColor(mContext.getResources().getColor(R.color.dianzan2));
|
||||
// helper.setImageResource(R.id.dianzan_image, R.drawable.dongtai_hudong_yidianzan);
|
||||
// } else {
|
||||
// TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
|
||||
// dy_fabulous.setTextColor(mContext.getResources().getColor(R.color.dianzan1));
|
||||
// helper.setImageResource(R.id.dianzan_image, R.drawable.dongtai_hudong_dianzan);
|
||||
// }
|
||||
|
||||
//分享数
|
||||
helper.setText(com.qxcm.moduleutil.R.id.dy_zs, item.getIsShare());
|
||||
//评论数
|
||||
helper.setText(com.qxcm.moduleutil.R.id.dy_comment, item.getComment() + "");
|
||||
|
||||
|
||||
//时间
|
||||
|
||||
if (!item.getTime().isEmpty()) {
|
||||
try {
|
||||
helper.setText(com.qxcm.moduleutil.R.id.dy_time_text, item.getTime());
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (item.getImages().size() != 0) {
|
||||
String[] arrIv = item.getImages().toArray(new String[item.getImages().size()]);
|
||||
if (item.getHome_bgimages()!=null) {
|
||||
// String[] arrIv = item.getHome_bgimages().toArray(new String[item.getHome_bgimages().size()]);
|
||||
String[] arrIv= item.getHome_bgimages().split(",");
|
||||
int length = arrIv.length;
|
||||
|
||||
|
||||
OneImageYuanJiaoAdapter oneImageYuanJiaoAdapter = new OneImageYuanJiaoAdapter(mContext);
|
||||
MyGridView recyclerView = helper.getView(com.qxcm.moduleutil.R.id.dy_image_recyc);
|
||||
MyGridView recyclerView = helper.getView(R.id.dy_image_recyc);
|
||||
recyclerView.setNumColumns(3);
|
||||
recyclerView.setAdapter(oneImageYuanJiaoAdapter);
|
||||
oneImageYuanJiaoAdapter.getList_adapter().clear();
|
||||
@@ -122,7 +64,7 @@ public class ExpandColumnAdapter extends BaseQuickAdapter<CircleListBean, BaseVi
|
||||
for (int j = 0; j < arrIv.length; j++) {
|
||||
oneImageYuanJiaoAdapter.getList_adapter().add(arrIv[j]);
|
||||
}
|
||||
helper.getView(com.qxcm.moduleutil.R.id.dy_oneimage_iv).setVisibility(View.GONE);
|
||||
helper.getView(R.id.dy_oneimage_iv).setVisibility(View.GONE);
|
||||
|
||||
oneImageYuanJiaoAdapter.notifyDataSetChanged();
|
||||
|
||||
@@ -131,5 +73,27 @@ public class ExpandColumnAdapter extends BaseQuickAdapter<CircleListBean, BaseVi
|
||||
});
|
||||
}
|
||||
|
||||
LinearLayout llContainer = helper.getView(R.id.ll_image_container);
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
|
||||
List<String> images = item.getIcon(); // 获取图片列表
|
||||
|
||||
for (String url : images) {
|
||||
ImageView imageView = new ImageView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
mContext.getResources().getDimensionPixelSize(com.qxcm.moduleutil.R.dimen.dp_37),
|
||||
mContext.getResources().getDimensionPixelSize(com.qxcm.moduleutil.R.dimen.dp_15)
|
||||
);
|
||||
params.setMargins(0, 0, mContext.getResources().getDimensionPixelSize(com.qxcm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
// 使用 Glide 加载图片
|
||||
ImageUtils.loadHeadCC(url, imageView);
|
||||
|
||||
llContainer.addView(imageView);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.app.Activity;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.bean.ExpandColumnBean;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
|
||||
import java.util.List;
|
||||
@@ -13,18 +14,23 @@ public class CircleContacts {
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
// void setBanners(List<BannerResp> list);
|
||||
|
||||
// void myInfoSuccess(MyInfoResp data);
|
||||
|
||||
void setCategories(List<HeatedBean> list);
|
||||
|
||||
void setCircleList(List<CircleListBean> list);
|
||||
|
||||
void setExpandColumn(List<ExpandColumnBean> list);
|
||||
|
||||
void setLikeZone();
|
||||
}
|
||||
|
||||
public interface IIndexPre extends IPresenter {
|
||||
void getCategories();
|
||||
|
||||
void getCircleList();
|
||||
void getCircleList(String page,String page_limit);
|
||||
|
||||
void getExpandColumn(String type,String page,String page_limit);//获取扩列数据
|
||||
|
||||
void likeZone(String zone_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,24 @@ import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class ReleaseContract {
|
||||
public interface View extends IView<Activity> {
|
||||
void topicList(List<HeatedBean> list);
|
||||
void upLoadSuccess(String url, int type, int index, int total);
|
||||
|
||||
void publishSuccess();
|
||||
}
|
||||
|
||||
public interface IIndexPre extends IPresenter {
|
||||
void topicList(String page, String page_limit);
|
||||
|
||||
void uploadFile(File file, int type,int index,int sice);
|
||||
|
||||
void publishZone(String images,String content,String topic_id,String room_id,String ip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,15 +11,16 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.modulecircle.R;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MultiSelectAdapter extends RecyclerView.Adapter<MultiSelectAdapter.ViewHolder> {
|
||||
private List<String> options;
|
||||
private List<HeatedBean> options;
|
||||
private SparseBooleanArray selectedPositions = new SparseBooleanArray();
|
||||
|
||||
public MultiSelectAdapter(List<String> options) {
|
||||
public MultiSelectAdapter(List<HeatedBean> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@@ -32,8 +33,8 @@ public class MultiSelectAdapter extends RecyclerView.Adapter<MultiSelectAdapter.
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
String item = options.get(position);
|
||||
holder.tvOption.setText(item);
|
||||
HeatedBean item = options.get(position);
|
||||
holder.tvOption.setText(item.getTitle());
|
||||
holder.cbOption.setChecked(selectedPositions.get(position, false));
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
@@ -52,8 +53,8 @@ public class MultiSelectAdapter extends RecyclerView.Adapter<MultiSelectAdapter.
|
||||
return options.size();
|
||||
}
|
||||
|
||||
public List<String> getSelectedItems() {
|
||||
List<String> selected = new ArrayList<>();
|
||||
public List<HeatedBean> getSelectedItems() {
|
||||
List<HeatedBean> selected = new ArrayList<>();
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
if (selectedPositions.get(i)) {
|
||||
selected.add(options.get(i));
|
||||
|
||||
@@ -2,10 +2,14 @@ package com.example.modulecircle.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
||||
import com.example.modulecircle.R;
|
||||
import com.example.modulecircle.adapter.CirleCategoryBannerAdapter;
|
||||
import com.qxcm.moduleutil.adapter.CirleListAdapter;
|
||||
@@ -16,7 +20,13 @@ import com.hjq.toast.ToastUtils;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.BaseListData;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.bean.ExpandColumnBean;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
import com.qxcm.moduleutil.widget.dialog.CommentDialogFragment;
|
||||
import com.qxcm.moduleutil.widget.dialog.RewardGiftDialogFragment;
|
||||
import com.qxcm.moduleutil.widget.dialog.ShareDialog;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.zhpan.bannerview.indicator.DrawableIndicator;
|
||||
import com.zhpan.indicator.base.IIndicator;
|
||||
import com.zhpan.indicator.enums.IndicatorSlideMode;
|
||||
@@ -30,6 +40,7 @@ import java.util.List;
|
||||
public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, FragmentCircleCategoryBinding> implements CircleContacts.View {
|
||||
CirleCategoryBannerAdapter cirleCategoryBannerAdapter;
|
||||
CirleListAdapter cirleListAdapter;
|
||||
private int page;
|
||||
public static CircleCategoryFragment newInstance() {
|
||||
return new CircleCategoryFragment();
|
||||
}
|
||||
@@ -38,7 +49,7 @@ public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, Fra
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MvpPre.getCategories();
|
||||
MvpPre.getCircleList();
|
||||
MvpPre.getCircleList("1", "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,6 +89,46 @@ public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, Fra
|
||||
mBinding.recycleView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
cirleListAdapter = new CirleListAdapter();
|
||||
mBinding.recycleView.setAdapter(cirleListAdapter);
|
||||
cirleListAdapter.setOnItemClickListener(new CirleListAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onDianzanClick(CircleListBean item) {
|
||||
MvpPre.likeZone(item.getId()+"");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadImageClick(CircleListBean item) {
|
||||
Toast.makeText(getContext(), "查看主页:" + item.getNickname(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onZsClick(CircleListBean item) {
|
||||
RewardGiftDialogFragment.show(String.valueOf(item.getId()), getChildFragmentManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDiandianClick(CircleListBean item) {
|
||||
new ShareDialog(getActivity()).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPinglunClick(CircleListBean item) {
|
||||
CommentDialogFragment.show(String.valueOf(item.getId()), getChildFragmentManager());
|
||||
}
|
||||
});
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.getCircleList(page+"", "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
MvpPre.getCircleList(page+"", "10");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
private IIndicator getVectorDrawableIndicator() {
|
||||
@@ -116,6 +167,17 @@ public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, Fra
|
||||
cirleListAdapter.setNewData(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpandColumn(List<ExpandColumnBean> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLikeZone() {
|
||||
ToastUtils.show("点赞成功");
|
||||
MvpPre.getCircleList(page+"", "10");
|
||||
}
|
||||
|
||||
// 拆分函数
|
||||
private <T> List<List<T>> splitListIntoChunks(List<T> list, int chunkSize) {
|
||||
List<List<T>> chunks = new ArrayList<>();
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.example.modulecircle.presenter.CirclePresenter;
|
||||
import com.qxcm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.bean.ExpandColumnBean;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
import com.qxcm.moduleutil.bean.MyBagBean;
|
||||
import com.qxcm.moduleutil.bean.RoomTypeModel;
|
||||
@@ -83,6 +84,16 @@ public class CircleFragment extends BaseMvpFragment<CirclePresenter, FragmentCir
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpandColumn(List<ExpandColumnBean> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLikeZone() {
|
||||
|
||||
}
|
||||
|
||||
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private List<MyBagBean> list;
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.example.modulecircle.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -10,13 +12,18 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.example.modulecircle.R;
|
||||
import com.example.modulecircle.adapter.ExpandColumnAdapter;
|
||||
import com.example.modulecircle.contacts.CircleContacts;
|
||||
import com.example.modulecircle.databinding.FragmentCircleBinding;
|
||||
import com.example.modulecircle.databinding.FragmentExpandColumnBinding;
|
||||
import com.example.modulecircle.presenter.CirclePresenter;
|
||||
import com.qxcm.moduleutil.adapter.CirleListAdapter;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.bean.ExpandColumnBean;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
|
||||
import org.angmarch.views.NiceSpinner;
|
||||
import org.angmarch.views.OnSpinnerItemSelectedListener;
|
||||
@@ -32,7 +39,9 @@ import java.util.List;
|
||||
*/
|
||||
public class ExpandColumnFragment extends BaseMvpFragment<CirclePresenter, FragmentExpandColumnBinding> implements CircleContacts.View {
|
||||
|
||||
|
||||
private ExpandColumnAdapter expandColumnAdapter;
|
||||
private String type="2";
|
||||
private int page;
|
||||
@Override
|
||||
protected CirclePresenter bindPresenter() {
|
||||
return new CirclePresenter(this,getActivity());
|
||||
@@ -53,13 +62,44 @@ public class ExpandColumnFragment extends BaseMvpFragment<CirclePresenter, Fragm
|
||||
String item = (String) parent.getItemAtPosition(position);
|
||||
LogUtils.e("@@@",item);
|
||||
mBinding.niceSpinner.setText(item);
|
||||
if (item.equals("只看女生")){
|
||||
type="2";
|
||||
}else if (item.equals("只看男生")){
|
||||
type="1";
|
||||
}else {
|
||||
type="0";
|
||||
}
|
||||
MvpPre.getExpandColumn(type,"1", "10");
|
||||
// mBinding.niceSpinner.getItemAtPosition(position);
|
||||
}
|
||||
});
|
||||
mBinding.niceSpinner.setText("只看女生");
|
||||
mBinding.niceSpinner.setBackground(null);
|
||||
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
expandColumnAdapter = new ExpandColumnAdapter();
|
||||
mBinding.recyclerView.setAdapter(expandColumnAdapter);
|
||||
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.getExpandColumn(type,page + "", "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
MvpPre.getExpandColumn(type,page+"", "10");
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MvpPre.getExpandColumn(type,"1", "10");
|
||||
}
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
@@ -79,4 +119,14 @@ public class ExpandColumnFragment extends BaseMvpFragment<CirclePresenter, Fragm
|
||||
public void setCircleList(List<CircleListBean> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpandColumn(List<ExpandColumnBean> list) {
|
||||
expandColumnAdapter.setNewData(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLikeZone() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,17 @@ import android.content.Context;
|
||||
|
||||
import com.example.modulecircle.contacts.CircleContacts;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.bean.ExpandColumnBean;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.scwang.smartrefresh.header.waterdrop.Circle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class CirclePresenter extends BasePresenter<CircleContacts.View> implements CircleContacts.IIndexPre {
|
||||
|
||||
public CirclePresenter(CircleContacts.View view, Context context) {
|
||||
@@ -20,41 +24,84 @@ public class CirclePresenter extends BasePresenter<CircleContacts.View> implemen
|
||||
@Override
|
||||
public void getCategories() {
|
||||
|
||||
List<HeatedBean> list=new ArrayList<>();
|
||||
for (int i = 0; i < 7; i++){
|
||||
HeatedBean bean=new HeatedBean();
|
||||
bean.setTitle("#萌新驾到"+i);
|
||||
bean.setTitle_pictrue("");
|
||||
bean.setTitle_content("3.24W条动态");
|
||||
list.add(bean);
|
||||
}
|
||||
MvpRef.get().setCategories(list);
|
||||
api.getCategories(new BaseObserver<List<HeatedBean>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCircleList() {
|
||||
List<String> images=new ArrayList<>();
|
||||
images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
List<CircleListBean> list=new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++){
|
||||
CircleListBean bean=new CircleListBean();
|
||||
bean.setId(""+i);
|
||||
bean.setUserNickName("萌新驾到"+i);
|
||||
bean.setUserAvatar("");
|
||||
bean.setTime("发布于 12:5"+i);
|
||||
bean.setContent("任何关系,都需要谦逊谨慎");
|
||||
bean.setImages(images);
|
||||
bean.setType("1");
|
||||
bean.setComment(""+i);
|
||||
bean.setLike(""+i);
|
||||
bean.setIsShare(""+i);
|
||||
list.add(bean);
|
||||
public void onNext(List<HeatedBean> heatedBeanList) {
|
||||
MvpRef.get().setCategories(heatedBeanList);
|
||||
}
|
||||
MvpRef.get().setCircleList(list);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCircleList(String page, String page_limit) {
|
||||
|
||||
api.getCircleList(page,page_limit,new BaseObserver<List<CircleListBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<CircleListBean> circleListBeans) {
|
||||
MvpRef.get().setCircleList(circleListBeans);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取扩列数据
|
||||
@Override
|
||||
public void getExpandColumn(String type, String page, String page_limit) {
|
||||
api.getExpandColumn(type, page, page_limit, new BaseObserver<List<ExpandColumnBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<ExpandColumnBean> expandColumnBeans) {
|
||||
MvpRef.get().setExpandColumn(expandColumnBeans);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// List<String> images=new ArrayList<>();
|
||||
// images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
// images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
// images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
// images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
// List<ExpandColumnBean> expandColumnBeans=new ArrayList<>();
|
||||
// for (int i = 0; i < 10; i++){
|
||||
// ExpandColumnBean bean=new ExpandColumnBean();
|
||||
// bean.setId(""+i);
|
||||
// bean.setSex(i % 2 == 0 ? "2" : "1");
|
||||
// bean.setNickname("萌新驾到"+i);
|
||||
// bean.setAvatar("");
|
||||
// bean.setBirthday("2023-05-05");
|
||||
// bean.setLoginip("西安市");
|
||||
// bean.setHome_bgimages(images);
|
||||
// expandColumnBeans.add(bean);
|
||||
// }
|
||||
// MvpRef.get().setExpandColumn(expandColumnBeans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void likeZone(String zone_id) {
|
||||
api.likeZone(zone_id, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().setLikeZone();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,77 @@ package com.example.modulecircle.presenter;
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.modulecircle.contacts.ReleaseContract;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.qxcm.moduleutil.bean.HeatedBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.utils.oss.OSSOperUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class ReleasePresenter extends BasePresenter<ReleaseContract.View> implements ReleaseContract.IIndexPre {
|
||||
public ReleasePresenter(ReleaseContract.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void topicList(String page, String page_limit) {
|
||||
api.topicList(page, page_limit, new BaseObserver<List<HeatedBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<HeatedBean> heatedBeanList) {
|
||||
MvpRef.get().topicList(heatedBeanList);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void batchUploadFiles(List<File> files, int type) {
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
uploadFile(files.get(i), type, i, files.size());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadFile(File file, int type,int index,int size) {
|
||||
// MvpRef.get().showLoadings("上传中...");
|
||||
String url = OSSOperUtils.getPath(file, type);
|
||||
OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type, index, size);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
if (isViewAttach()) {
|
||||
ToastUtils.show("上传失败");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishZone(String images, String content, String topic_id, String room_id,String ip) {
|
||||
api.publishZone(images, content, topic_id, room_id,ip, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().publishSuccess();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
</data>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -18,28 +22,30 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:background="@drawable/bg_r16_ffeff2f8"
|
||||
app:layout_constraintTop_toBottomOf="@+id/top_bar">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ht"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_9"
|
||||
android:layout_marginBottom="@dimen/dp_9"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:gravity="center"
|
||||
android:text="选择话题"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
@@ -53,16 +59,16 @@
|
||||
android:id="@+id/rl_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rl_1"
|
||||
android:background="@drawable/bg_r10_white">
|
||||
android:background="@drawable/bg_r10_white"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rl_1">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_g"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_7"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
@@ -80,9 +86,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="bottom"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
android:layout_below="@+id/et_g"
|
||||
android:gravity="bottom"
|
||||
android:text="0/1200"
|
||||
android:textColor="@color/color_FF666666"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
@@ -92,24 +99,25 @@
|
||||
android:id="@+id/rv_photo_wall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rl_2"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16" />
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rl_2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_fb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:background="@drawable/cs"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rv_photo_wall"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_38"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_38"
|
||||
android:text="立即发布"
|
||||
android:background="@drawable/cs"
|
||||
android:gravity="center"
|
||||
android:text="立即发布"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rv_photo_wall" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
</layout>
|
||||
@@ -32,21 +32,27 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/transparent"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:arrowDrawable="@mipmap/up_x"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/smart_refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:srlEnableLoadMore="false"
|
||||
app:srlEnableRefresh="true">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="@dimen/dp_12"
|
||||
android:paddingTop="@dimen/dp_12"
|
||||
/>
|
||||
android:paddingBottom="@dimen/dp_12" />
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
@@ -3,7 +3,7 @@
|
||||
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="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/dp_12"
|
||||
android:paddingStart="@dimen/dp_12"
|
||||
@@ -61,7 +61,6 @@
|
||||
android:ellipsize="none"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
app:layout_constraintStart_toEndOf="@id/item_ry"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvTitle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
@@ -16,26 +16,27 @@
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingRight="15sp">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<com.qxcm.moduleutil.widget.CircularImage
|
||||
<com.qxcm.moduleutil.utils.MeHeadView
|
||||
android:id="@+id/dy_head_image"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp" />
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:src="@mipmap/shequ_dongtai_gengduo" />
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerInParent="true"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/l_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_toRightOf="@+id/dy_head_image"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginStart="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
@@ -43,47 +44,79 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dy_name_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#212121"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textStyle="bold"
|
||||
android:text="萌新驾到"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="18sp" />
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/im_dj"-->
|
||||
<!-- android:layout_width="@dimen/dp_37"-->
|
||||
<!-- android:layout_height="@dimen/dp_15"-->
|
||||
<!-- android:layout_marginStart="@dimen/dp_9"-->
|
||||
<!-- />-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_image_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginStart="@dimen/dp_9"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_agree"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="25"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/color_FF666666"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dy_time_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="发布于12:52"
|
||||
android:text="·IP属地:"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="#999999"
|
||||
android:textSize="11sp" />
|
||||
android:textColor="@color/color_FF666666"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="西安市"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/color_FF666666"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignBottom="@+id/l_1"
|
||||
android:layout_gravity="right|center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
|
||||
<TextView
|
||||
@@ -104,7 +137,7 @@
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/aaa"
|
||||
|
||||
@@ -35,6 +35,8 @@ dependencies {
|
||||
|
||||
implementation libs.appcompat
|
||||
implementation libs.material
|
||||
implementation libs.activity
|
||||
implementation libs.constraintlayout
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.QxLive" />
|
||||
android:theme="@style/Theme.QxLive">
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -4,13 +4,19 @@ import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NewsContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
void getOfficialNoticeList(List<NewsDataBean> newsDataBeans);
|
||||
|
||||
}
|
||||
public interface IHomePre extends IPresenter {
|
||||
|
||||
void getOfficialNotice(String page,String page_limit,String type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.example.modulenews.databinding.FragmentNewsBinding;
|
||||
import com.example.modulenews.presenter.NewsPresenter;
|
||||
import com.qxcm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuicore.TUICore;
|
||||
@@ -89,4 +90,8 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getOfficialNoticeList(List<NewsDataBean> newsDataBeans) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,61 @@ package com.example.modulenews.presenter;
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.modulenews.contacts.NewsContacts;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class NewsPresenter extends BasePresenter<NewsContacts.View> implements NewsContacts.IHomePre {
|
||||
public NewsPresenter(NewsContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOfficialNotice(String page, String page_limit, String type) {
|
||||
// api.getOfficialNotice(page, page_limit, type, new BaseObserver<List<NewsDataBean>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(List<NewsDataBean> newsDataBeans) {
|
||||
// MvpRef.get().getOfficialNoticeList(newsDataBeans);
|
||||
// }
|
||||
// });
|
||||
|
||||
List<NewsDataBean> newsDataBeans= new ArrayList<>();
|
||||
if (type.equals("1")){
|
||||
for (int i = 0; i < 5; i++) {
|
||||
NewsDataBean newsDataBean = new NewsDataBean();
|
||||
newsDataBean.setId(i+"");
|
||||
newsDataBean.setTitle("系统消息"+i);
|
||||
newsDataBean.setContent("系统消息"+i);
|
||||
newsDataBean.setType("1");
|
||||
newsDataBean.setSource_id("1");
|
||||
newsDataBean.setIs_read("1");
|
||||
newsDataBean.setCreatetime("2019-09-09");
|
||||
newsDataBean.setImage("");
|
||||
newsDataBeans.add(newsDataBean);
|
||||
}
|
||||
}else {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
NewsDataBean newsDataBean = new NewsDataBean();
|
||||
newsDataBean.setId(i+"");
|
||||
newsDataBean.setTitle("官方公告"+i);
|
||||
newsDataBean.setContent("官方公告"+i);
|
||||
newsDataBean.setType("2");
|
||||
newsDataBean.setSource_id("1");
|
||||
newsDataBean.setIs_read("1");
|
||||
newsDataBean.setCreatetime("2019-09-09");
|
||||
newsDataBean.setImage("");
|
||||
newsDataBeans.add(newsDataBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
<resources>
|
||||
</resources>
|
||||
<resources></resources>
|
||||
@@ -7,6 +7,9 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/BaseAppTheme">
|
||||
<activity
|
||||
android:name=".activity.CreateAlbumActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".activity.RealName1Activity"
|
||||
android:exported="false" />
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.example.modulevocal.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.example.modulevocal.R;
|
||||
import com.example.modulevocal.conacts.MyAlbumConacts;
|
||||
import com.example.modulevocal.databinding.ActivityCreateAlbumBinding;
|
||||
import com.example.modulevocal.presenter.MyAlbumPresenter;
|
||||
import com.luck.picture.lib.PictureSelector;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
import com.luck.picture.lib.config.PictureMimeType;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.AlbumBean;
|
||||
import com.qxcm.moduleutil.bean.UserImgList;
|
||||
import com.qxcm.moduleutil.utils.GlideEngine;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
import com.qxcm.moduleutil.utils.MyPictureParameterStyle;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CreateAlbumActivity extends BaseMvpActivity<MyAlbumPresenter, ActivityCreateAlbumBinding> implements MyAlbumConacts.View{
|
||||
|
||||
private String imageUrl="";
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
mBinding.topBar.setTitle("新建相册");
|
||||
mBinding.rivAlbum.setOnClickListener(this::onClick);
|
||||
mBinding.tvCancel.setOnClickListener(this::onClick);
|
||||
mBinding.tvConfirm.setOnClickListener(this::onClick);
|
||||
|
||||
}
|
||||
|
||||
private void onClick(View view) {
|
||||
if (view.getId() == R.id.riv_album) {
|
||||
startChoosePhoto(PictureMimeType.ofImage(), PictureConfig.CHOOSE_REQUEST, false, 1);
|
||||
} else if (view.getId() ==R.id.tv_cancel) {
|
||||
finish();
|
||||
}else if (view.getId() ==R.id.tv_confirm) {
|
||||
if (!Objects.requireNonNull(mBinding.edAlbumName.getText()).toString().trim().isEmpty() || !imageUrl.equals("")){
|
||||
MvpPre.createAlbum(mBinding.edAlbumName.getText().toString().trim(),imageUrl);
|
||||
}else {
|
||||
ToastUtils.showShort("请输入相册名称并选择相册封面");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_create_album;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MyAlbumPresenter bindPresenter() {
|
||||
return new MyAlbumPresenter(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlbumList(List<AlbumBean> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upLoadSuccess(String url, int type) {
|
||||
imageUrl=url;
|
||||
if (type == 1) {
|
||||
ImageUtils.loadHeadCC(url, mBinding.rivAlbum);
|
||||
} else {
|
||||
// list.add(new UserImgList("1", url));
|
||||
// mUserPhotoWallAdapter.setNewData(list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess() {
|
||||
finish();
|
||||
}
|
||||
|
||||
private void startChoosePhoto(int mimeType, int requestCode, boolean isVideo, int type) {
|
||||
|
||||
PictureSelector.create(this)
|
||||
.openGallery(mimeType)
|
||||
.isGif(isVideo)
|
||||
.imageEngine(GlideEngine.createGlideEngine())
|
||||
.maxSelectNum(type)
|
||||
.isPreviewImage(true)
|
||||
.isCamera(true)
|
||||
.setOutputCameraPath(Constants.FILE_PATH)
|
||||
.isCompress(true)
|
||||
.setPictureStyle(MyPictureParameterStyle.Companion.selectPicture())
|
||||
.forResult(requestCode); //结果回调onActivityResult code
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
switch (requestCode) {
|
||||
case PictureConfig.CHOOSE_REQUEST:
|
||||
List<LocalMedia> localMedia = PictureSelector.obtainMultipleResult(data);
|
||||
if (localMedia != null && localMedia.size() != 0) {
|
||||
LocalMedia imgMedia = localMedia.get(0);
|
||||
String url;
|
||||
if (imgMedia.isCompressed()) {
|
||||
url = imgMedia.getCompressPath();
|
||||
} else {
|
||||
url = imgMedia.getRealPath();
|
||||
}
|
||||
MvpPre.uploadFile(new File(url), 1);
|
||||
}
|
||||
break;
|
||||
case PictureConfig.REQUEST_CAMERA:
|
||||
List<LocalMedia> localMedia1 = PictureSelector.obtainMultipleResult(data);
|
||||
if (localMedia1 != null && localMedia1.size() != 0) {
|
||||
LocalMedia imgMedia = localMedia1.get(0);
|
||||
MvpPre.uploadFile(new File(imgMedia.getRealPath()), 3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.example.modulevocal.adapter;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.modulevocal.R;
|
||||
import com.qxcm.moduleutil.bean.AlbumBean;
|
||||
import com.qxcm.moduleutil.bean.UserImgList;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
|
||||
public class MyAlbumListAdapter extends BaseQuickAdapter<AlbumBean, BaseViewHolder> {
|
||||
private boolean b = false;
|
||||
private int longClickPos = -1;
|
||||
|
||||
public MyAlbumListAdapter() {
|
||||
super(R.layout.item_album_list);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, AlbumBean item) {
|
||||
|
||||
if (!"0".equals(item.getId())) {
|
||||
ImageUtils.loadHeadCC(item.getImage(), helper.getView(R.id.riv_album));
|
||||
helper.setVisible(R.id.tv_album_name, true);
|
||||
helper.setVisible(R.id.tv_album_count, true);
|
||||
if (!item.getPwd().isEmpty()){
|
||||
ImageUtils.loadBlurredImageWithDefault(item.getImage(), helper.getView(R.id.riv_album), com.qxcm.moduleutil.R.mipmap.default_avatar, 25);
|
||||
helper.setVisible(R.id.iv_album_suo,true);
|
||||
}
|
||||
helper.setText(R.id.tv_album_name, item.getName());
|
||||
helper.setText(R.id.tv_album_count, item.getRead_num());
|
||||
} else {
|
||||
helper.setImageResource(R.id.riv_album, com.qxcm.moduleutil.R.mipmap.create_album);
|
||||
helper.setVisible(R.id.tv_album_name, false);
|
||||
helper.setVisible(R.id.tv_album_count, false);
|
||||
helper.setVisible(R.id.iv_album_suo,false);
|
||||
}
|
||||
|
||||
helper.setVisible(R.id.riv_album, true);
|
||||
helper.addOnClickListener(R.id.riv_album);
|
||||
// helper.addOnLongClickListener(R.id.riv_album);
|
||||
}
|
||||
|
||||
|
||||
public void setDelete(boolean b) {
|
||||
this.b = b;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setLongClickPos(int pos) {
|
||||
this.longClickPos = pos;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public boolean getDelete() {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.modulevocal.conacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.AlbumBean;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class MyAlbumConacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void getAlbumList(List<AlbumBean> data);
|
||||
|
||||
void upLoadSuccess(String url, int type);
|
||||
|
||||
void sendCodeSuccess();
|
||||
}
|
||||
|
||||
public interface IMePre extends IPresenter {
|
||||
void getAlbumList(String page, String page_limit);
|
||||
|
||||
void uploadFile(File file, int type);
|
||||
|
||||
void createAlbum(String name,String image);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.example.modulevocal.fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.example.modulevocal.R;
|
||||
import com.example.modulevocal.activity.CreateAlbumActivity;
|
||||
import com.example.modulevocal.adapter.MyAlbumListAdapter;
|
||||
import com.example.modulevocal.adapter.UserPhotoWallAdapter;
|
||||
import com.example.modulevocal.conacts.MyAlbumConacts;
|
||||
import com.example.modulevocal.databinding.FragmentMyAlbumBinding;
|
||||
import com.example.modulevocal.presenter.MyAlbumPresenter;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
import com.luck.picture.lib.config.PictureMimeType;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.AlbumBean;
|
||||
import com.qxcm.moduleutil.bean.UserImgList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/5/29
|
||||
* @description: 我的相册
|
||||
*/
|
||||
public class MyAlbumFragment extends BaseMvpFragment<MyAlbumPresenter, FragmentMyAlbumBinding> implements MyAlbumConacts.View {
|
||||
|
||||
private MyAlbumListAdapter mAdapter;
|
||||
|
||||
public static MyAlbumFragment newInstance(String userId) {
|
||||
MyAlbumFragment fragment = new MyAlbumFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("userId", userId);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MyAlbumPresenter bindPresenter() {
|
||||
return new MyAlbumPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getAlbumList("1", "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mAdapter = new MyAlbumListAdapter();
|
||||
mBinding.dyImageRecyc.setLayoutManager(new GridLayoutManager(getActivity(), 2));
|
||||
mBinding.dyImageRecyc.setAdapter(mAdapter);
|
||||
mAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
||||
@Override
|
||||
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
AlbumBean item = mAdapter.getItem(position);
|
||||
if ("0".equals(item.getId())) {
|
||||
// startChoosePhoto(PictureMimeType.ofImage(), PictureConfig.REQUEST_CAMERA, true, 6);
|
||||
startActivity(new Intent(getActivity(), CreateAlbumActivity.class));
|
||||
}
|
||||
else {
|
||||
if (!TextUtils.isEmpty(item.getPwd())) {
|
||||
|
||||
} else {
|
||||
// Intent intent = new Intent(getActivity(), AlbumDetailActivity.class);
|
||||
// intent.putExtra("album_id", item.getId());
|
||||
// startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_my_album;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlbumList(List<AlbumBean> data) {
|
||||
mAdapter.setNewData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upLoadSuccess(String url, int type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,7 @@ public class UserHomepageFragment extends BaseMvpFragment<UserHomepagePresenter,
|
||||
list=new ArrayList<>();
|
||||
list.add(new MyBagBean("动态", "1"));
|
||||
list.add(new MyBagBean("礼物墙", "2"));
|
||||
list.add(new MyBagBean("我的相册", "3"));
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), list,userId));
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||
mBinding.slidingTabLayout.setCurrentTab(0);
|
||||
@@ -90,8 +91,10 @@ public class UserHomepageFragment extends BaseMvpFragment<UserHomepagePresenter,
|
||||
MyBagBean model = list.get(position);
|
||||
if ("1".equals(model.getMyBagType())){
|
||||
return CirleListFragment.newInstance();
|
||||
}else {
|
||||
}else if ("2".equals(model.getMyBagType())){
|
||||
return UserGiftWallFragment.newInstance(userId);
|
||||
}else {
|
||||
return MyAlbumFragment.newInstance(userId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.example.modulevocal.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.modulevocal.conacts.MyAlbumConacts;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.bean.AlbumBean;
|
||||
import com.qxcm.moduleutil.http.AccessTokenInterceptor;
|
||||
import com.qxcm.moduleutil.http.ApiServer;
|
||||
import com.qxcm.moduleutil.http.BaseModel;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.utils.SystemUtils;
|
||||
import com.qxcm.moduleutil.utils.oss.OSSOperUtils;
|
||||
import com.tencent.cloud.huiyansdkface.okhttp3.Interceptor;
|
||||
import com.tencent.cloud.huiyansdkface.okhttp3.OkHttpClient;
|
||||
import com.tencent.cloud.huiyansdkface.okhttp3.Request;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import lombok.SneakyThrows;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class MyAlbumPresenter extends BasePresenter<MyAlbumConacts.View> implements MyAlbumConacts.IMePre {
|
||||
public MyAlbumPresenter(MyAlbumConacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlbumList(String page, String page_limit) {
|
||||
// api.getAlbumList(page, page_limit, new BaseObserver<List<AlbumBean>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(List<AlbumBean> albumBeans) {
|
||||
// MvpRef.get().getAlbumList(albumBeans);
|
||||
// }
|
||||
// });
|
||||
|
||||
List<AlbumBean> albumBeans = new ArrayList<>();
|
||||
AlbumBean albumBean1 = new AlbumBean();
|
||||
albumBean1.setId("0");
|
||||
albumBeans.add(albumBean1);
|
||||
for (int i = 1; i < 5; i++) {
|
||||
AlbumBean albumBean = new AlbumBean();
|
||||
albumBean.setId(i + "");
|
||||
albumBean.setName("相册" + i);
|
||||
albumBean.setImage("http://img.alicdn.com/tfs/TB1.XpjQFXXXXX_XpXXXXXXXXXX-1024-1024.png");
|
||||
albumBean.setPwd(i / 2 == 1 ? "123456" : "");
|
||||
albumBean.setRead_num("100");
|
||||
albumBeans.add(albumBean);
|
||||
}
|
||||
MvpRef.get().getAlbumList(albumBeans);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void uploadFile(File file, int type) {
|
||||
MvpRef.get().showLoadings("上传中...");
|
||||
String url = OSSOperUtils.getPath(file, type);
|
||||
OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().disLoadings();
|
||||
MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
if (isViewAttach()) {
|
||||
ToastUtils.show("上传失败");
|
||||
MvpRef.get().disLoadings();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAlbum(String name, String image) {
|
||||
// api.createAlbum(name, image, new BaseObserver<String>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
// MvpRef.get().sendCodeSuccess();
|
||||
// }
|
||||
// });
|
||||
|
||||
api.createAlbum(name, image, new BaseObserver<String>(){
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().sendCodeSuccess();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -82,27 +82,27 @@ public class UserHomepagePresenter extends BasePresenter<UserHomepageConacts.Vie
|
||||
|
||||
@Override
|
||||
public void getCircleList() {
|
||||
List<String> images=new ArrayList<>();
|
||||
images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
List<CircleListBean> list=new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++){
|
||||
CircleListBean bean=new CircleListBean();
|
||||
bean.setId(""+i);
|
||||
bean.setUserNickName("萌新驾到"+i);
|
||||
bean.setUserAvatar("");
|
||||
bean.setTime("发布于 12:5"+i);
|
||||
bean.setContent("任何关系,都需要谦逊谨慎");
|
||||
bean.setImages(images);
|
||||
bean.setType("1");
|
||||
bean.setComment(""+i);
|
||||
bean.setLike(""+i);
|
||||
bean.setIsShare(""+i);
|
||||
list.add(bean);
|
||||
}
|
||||
MvpRef.get().setCircleList(list);
|
||||
// List<String> images=new ArrayList<>();
|
||||
// images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
// images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
// images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
// images.add("https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&hs=0&pn=0&spn=0&di=7490230549689139201&pi=0&rn=1&tn=baiduimagedetail&is=2160705940%2C3901940110&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=2056927850%2C430353020&os=2160705940%2C3901940110&simid=3513174432%2C352671812&adpicid=0&lpn=0&ln=0&fm=&sme=&cg=girl&bdtype=0&oriquery=&objurl=https%3A%2F%2Fq4.itc.cn%2Fimages01%2F20240627%2Fd30dbf39840a4c0bbeb277a6d773db2f.jpeg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bf5i7_z%26e3Bv54AzdH3FwAzdH3F0blaabmca_8d8n8lbaa&gsm=&islist=&querylist=");
|
||||
// List<CircleListBean> list=new ArrayList<>();
|
||||
// for (int i = 0; i < 10; i++){
|
||||
// CircleListBean bean=new CircleListBean();
|
||||
// bean.setId(""+i);
|
||||
// bean.setUserNickName("萌新驾到"+i);
|
||||
// bean.setUserAvatar("");
|
||||
// bean.setTime("发布于 12:5"+i);
|
||||
// bean.setContent("任何关系,都需要谦逊谨慎");
|
||||
// bean.setImages(images);
|
||||
// bean.setType("1");
|
||||
// bean.setComment(""+i);
|
||||
// bean.setLike(""+i);
|
||||
// bean.setIsShare(""+i);
|
||||
// list.add(bean);
|
||||
// }
|
||||
// MvpRef.get().setCircleList(list);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
76
modulevocal/src/main/res/layout/activity_create_album.xml
Normal file
76
modulevocal/src/main/res/layout/activity_create_album.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout 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"
|
||||
tools:context=".activity.CreateAlbumActivity">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.qxcm.moduleutil.widget.CustomTopBar
|
||||
android:id="@+id/top_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.qxcm.moduleutil.widget.ClearEditText
|
||||
android:id="@+id/ed_album_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:background="@drawable/bg_r100_hui"
|
||||
android:gravity="center|left"
|
||||
android:hint="请输入相册名称"
|
||||
android:maxLength="10"
|
||||
android:paddingStart="@dimen/dp_12"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:singleLine="true"
|
||||
android:text=""
|
||||
android:textColor="#333333"
|
||||
android:textColorHint="#9B9B9B"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintTop_toBottomOf="@+id/top_bar" />
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/riv_album"
|
||||
android:layout_width="@dimen/dp_103"
|
||||
android:layout_height="@dimen/dp_103"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ed_album_name"
|
||||
app:riv_corner_radius="@dimen/dp_5"
|
||||
android:src="@mipmap/add_img" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="@dimen/dp_95"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:layout_marginStart="@dimen/dp_38"
|
||||
android:layout_marginTop="@dimen/dp_34"
|
||||
android:background="@mipmap/cancel"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/riv_album" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="@dimen/dp_188"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_34"
|
||||
android:layout_marginEnd="@dimen/dp_38"
|
||||
android:background="@mipmap/sure"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_cancel"
|
||||
app:layout_constraintTop_toBottomOf="@+id/riv_album" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
19
modulevocal/src/main/res/layout/fragment_my_album.xml
Normal file
19
modulevocal/src/main/res/layout/fragment_my_album.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".fragment.MyAlbumFragment">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/dy_image_recyc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
/>
|
||||
|
||||
</layout>
|
||||
@@ -38,17 +38,18 @@
|
||||
<com.example.moduletablayout.CustomSlidingTabLayout
|
||||
android:id="@+id/sliding_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_16"
|
||||
android:layout_marginRight="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:background="#f6f6f6"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
app:tl_indicator_corner_radius="@dimen/dp_3"
|
||||
app:tl_indicator_drawable="@drawable/index_bg_indicator"
|
||||
app:tl_indicator_height="@dimen/dp_6"
|
||||
app:tl_indicator_margin_bottom="@dimen/dp_3"
|
||||
app:tl_showCateIndicator="false"
|
||||
app:tl_indicator_width="@dimen/dp_28"
|
||||
app:tl_tab_width="@dimen/dp_50"
|
||||
app:tl_indicator_width="@dimen/dp_30"
|
||||
app:tl_tab_width="@dimen/dp_64"
|
||||
app:tl_textBold="SELECT"
|
||||
app:tl_textSelectColor="@color/color_2B2823"
|
||||
app:tl_textSelectedSize="@dimen/sp_16"
|
||||
@@ -62,8 +63,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_r16_f6f6f6"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginStart="@dimen/dp_14"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</layout>
|
||||
56
modulevocal/src/main/res/layout/item_album_list.xml
Normal file
56
modulevocal/src/main/res/layout/item_album_list.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
android:paddingLeft="@dimen/dp_6"
|
||||
android:paddingRight="@dimen/dp_6">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/riv_album"
|
||||
android:layout_width="@dimen/dp_165"
|
||||
android:layout_height="@dimen/dp_165"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:riv_corner_radius="@dimen/dp_5"
|
||||
tools:src="@mipmap/create_album" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_album_suo"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
app:layout_constraintTop_toTopOf="@+id/riv_album"
|
||||
app:layout_constraintEnd_toEndOf="@+id/riv_album"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/riv_album"
|
||||
app:layout_constraintStart_toStartOf="@+id/riv_album"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:src="@mipmap/suo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_album_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
app:layout_constraintTop_toBottomOf="@+id/riv_album"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:gravity="left|center"
|
||||
tools:text="我的相册"
|
||||
android:textColor="#333333"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
<TextView
|
||||
android:id="@+id/tv_album_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_album_name"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:gravity="left|center"
|
||||
tools:text="共0张"
|
||||
android:textColor="#999999"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Binary file not shown.
@@ -12,10 +12,13 @@ import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.moduleutil.activity.news.OfficialNoticeActivity;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuicore.TUICore;
|
||||
@@ -107,11 +110,20 @@ public class TUIConversationFragment extends Fragment {
|
||||
mConversationLayout.setPresenter(presenter);
|
||||
mConversationLayout.initDefault();
|
||||
assert mConversationLayout.getConversationList().getAdapter() != null;
|
||||
mConversationLayout.getConversationList().getAdapter().setSearchView( LayoutInflater.from(getContext()).inflate(R.layout.convesation_list_header, null));
|
||||
View searchHeaderView = LayoutInflater.from(getContext()).inflate(R.layout.convesation_list_header, null);
|
||||
mConversationLayout.getConversationList().getAdapter().setSearchView(searchHeaderView);
|
||||
|
||||
// mConversationLayout.getConversationList().getAdapter().setSearchView( LayoutInflater.from(getContext()).inflate(R.layout.convesation_list_header, null));
|
||||
mConversationLayout.getConversationList().setOnConversationAdapterListener(new OnConversationAdapterListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, int viewType, ConversationInfo conversationInfo) {
|
||||
|
||||
if (view.getId()==R.id.rl_official){
|
||||
ToastUtils.showShort("点击官方公告");
|
||||
} else if (view.getId()==R.id.rl_system) {
|
||||
ToastUtils.showShort("点击系统消息");
|
||||
}else {
|
||||
|
||||
if (conversationInfo.isMarkFold()) {
|
||||
mConversationLayout.clearUnreadStatusOfFoldItem();
|
||||
startFoldedConversationActivity();
|
||||
@@ -119,6 +131,7 @@ public class TUIConversationFragment extends Fragment {
|
||||
TUIConversationUtils.startChatActivity(conversationInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemLongClick(View view, ConversationInfo conversationInfo) {
|
||||
@@ -138,6 +151,33 @@ public class TUIConversationFragment extends Fragment {
|
||||
});
|
||||
|
||||
restoreConversationItemBackground();
|
||||
// 获取头部视图中的控件并设置点击事件
|
||||
RelativeLayout rl_official = searchHeaderView.findViewById(R.id.rl_official);
|
||||
RelativeLayout rl_system = searchHeaderView.findViewById(R.id.rl_system);
|
||||
|
||||
if (rl_official != null) {
|
||||
rl_official.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ToastUtils.showShort("点击官方公告");
|
||||
Intent intent = new Intent(getContext(), OfficialNoticeActivity.class);
|
||||
intent.putExtra("type", "2");
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (rl_system != null) {
|
||||
rl_system.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ToastUtils.showShort("点击系统消息");
|
||||
Intent intent = new Intent(getContext(), OfficialNoticeActivity.class);
|
||||
intent.putExtra("type", "1");
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_official"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_62"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
@@ -68,6 +69,7 @@
|
||||
android:background="@color/conversation_divide_line_color" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_system"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_62"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
|
||||
Reference in New Issue
Block a user