From fcb27eaa761933d717294a83e99bbb7de8895408 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A2=81=E5=B0=8F=E6=B1=9F?= <461355754@qq.com>
Date: Fri, 30 May 2025 19:01:54 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E8=AF=AD=E5=9C=88=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=EF=BC=8C=20=E9=A1=B5=E9=9D=A2=E5=9F=BA=E6=9C=AC?=
=?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=8C=E8=AF=84=E8=AE=BA=E5=AE=8C=E6=88=90?=
=?UTF-8?q?=E4=B8=80=E5=8D=8A=EF=BC=8C=E9=9C=80=E8=A6=81=E5=86=8D=E8=B0=83?=
=?UTF-8?q?=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/build.gradle | 2 +-
moduleUtil/build.gradle | 3 +
moduleUtil/src/main/AndroidManifest.xml | 6 +-
.../activity/BaseAppCompatActivity.java | 2 +-
.../activity/news/NewsContacts.java | 22 ++
.../activity/news/NewsPresenter.java | 60 +++++
.../activity/news/OfficialNoticeActivity.java | 95 +++++++
.../moduleutil/adapter/CirleListAdapter.java | 100 ++++++--
.../moduleutil/adapter/CommentAdapter.java | 99 +++++++
.../moduleutil/adapter/GiftTwoAdapter.java | 184 +++++++++++++
.../adapter/GiftTwoDetailsFragment.java | 96 +++++++
.../qxcm/moduleutil/adapter/ReplyAdapter.java | 64 +++++
.../moduleutil/adapter/RewardUserAdapter.java | 4 +
.../adapter/UserPhotoWallAdapter.java | 44 ++--
.../base/BaseMvpDialogFragment.java | 138 ++++++++++
.../moduleutil/base/CommonAppContext.java | 31 +++
.../com/qxcm/moduleutil/bean/AlbumBean.java | 32 +++
.../qxcm/moduleutil/bean/CircleListBean.java | 27 +-
.../com/qxcm/moduleutil/bean/CommentBean.java | 40 +++
.../moduleutil/bean/ExpandColumnBean.java | 23 ++
.../qxcm/moduleutil/bean/GiftLabelBean.java | 9 +
.../com/qxcm/moduleutil/bean/GiftNumBean.java | 35 +++
.../com/qxcm/moduleutil/bean/HeatedBean.java | 17 +-
.../qxcm/moduleutil/bean/NewsDataBean.java | 15 ++
.../qxcm/moduleutil/bean/RewardUserBean.java | 12 +
.../qxcm/moduleutil/bean/RoonGiftModel.java | 34 +++
.../com/qxcm/moduleutil/http/ApiServer.java | 58 +++++
.../com/qxcm/moduleutil/http/BaseModel.java | 4 +
.../qxcm/moduleutil/http/BaseObserver.java | 26 ++
.../moduleutil/http/DefaultTransformer.java | 40 ++-
.../qxcm/moduleutil/http/RetrofitClient.java | 183 ++++++++++++-
.../moduleutil/presenter/CommentContacts.java | 20 ++
.../presenter/CommentPresenter.java | 46 ++++
.../presenter/RewardGiftContacts.java | 32 +++
.../presenter/RewardGiftPresenter.java | 106 ++++++++
.../com/qxcm/moduleutil/utils/ImageUtils.java | 41 +++
.../qxcm/moduleutil/utils/LocationUtils.java | 112 ++++++++
.../com/qxcm/moduleutil/utils/MeHeadView.java | 29 ++-
.../utils/location/GmsLocationProvider.java | 98 +++++++
.../utils/location/IpLocationProvider.java | 65 +++++
.../utils/location/LocationProvider.java | 21 ++
.../location/LocationServiceFactory.java | 24 ++
.../location/SystemLocationProvider.java | 135 ++++++++++
.../com/qxcm/moduleutil/widget/Constants.java | 14 +
.../widget/CustomRefreshHeader.java | 118 +++++++++
.../moduleutil/widget/MarqueeTextView.java | 63 +++++
.../widget/dialog/CommentDialogFragment.java | 107 ++++++++
.../widget/dialog/KeyboardPopupWindow.java | 240 +++++++++++++++++
.../dialog/RewardGiftDialogFragment.java | 179 +++++++++++++
.../widget/dialog/SelectGiftNumAdapter.java | 41 +++
.../dialog/SelectGiftNumPopupWindow.java | 54 ++++
.../moduleutil/widget/dialog/ShareDialog.java | 70 +++++
.../src/main/res/layout/item_cirle_list.xml | 47 +++-
.../res/layout/me_view_decoration_head.xml | 15 +-
moduleUtil/src/main/res/values/colors.xml | 3 +-
moduleUtil/src/main/res/values/strings.xml | 2 +
.../activity/ReleaseActivity.java | 241 ++++++++++++++----
.../adapter/CircleCategoryAdapter.java | 7 +-
.../adapter/ExpandColumnAdapter.java | 136 ++++------
.../modulecircle/contacts/CircleContacts.java | 14 +-
.../contacts/ReleaseContract.java | 12 +
.../dialog/MultiSelectAdapter.java | 13 +-
.../fragment/CircleCategoryFragment.java | 64 ++++-
.../modulecircle/fragment/CircleFragment.java | 11 +
.../fragment/ExpandColumnFragment.java | 54 +++-
.../presenter/CirclePresenter.java | 109 +++++---
.../presenter/ReleasePresenter.java | 67 +++++
.../src/main/res/layout/activity_release.xml | 198 +++++++-------
.../res/layout/fragment_expand_column.xml | 14 +-
.../main/res/layout/item_circle_category.xml | 3 +-
.../main/res/layout/item_expand_column.xml | 77 ++++--
modulenews/build.gradle | 2 +
modulenews/src/main/AndroidManifest.xml | 4 +-
.../modulenews/contacts/NewsContacts.java | 6 +
.../modulenews/fragment/NewsFragment.java | 5 +
.../modulenews/presenter/NewsPresenter.java | 51 ++++
modulenews/src/main/res/values/strings.xml | 3 +-
modulevocal/src/main/AndroidManifest.xml | 3 +
.../activity/CreateAlbumActivity.java | 137 ++++++++++
.../adapter/MyAlbumListAdapter.java | 57 +++++
.../modulevocal/conacts/MyAlbumConacts.java | 28 ++
.../modulevocal/fragment/MyAlbumFragment.java | 104 ++++++++
.../fragment/UserHomepageFragment.java | 5 +-
.../presenter/MyAlbumPresenter.java | 120 +++++++++
.../presenter/UserHomepagePresenter.java | 42 +--
.../main/res/layout/activity_create_album.xml | 76 ++++++
.../src/main/res/layout/fragment_my_album.xml | 19 ++
.../main/res/layout/fragment_user_hompage.xml | 15 +-
.../src/main/res/layout/item_album_list.xml | 56 ++++
.../page/TUIConversationFragment$7.class | Bin 1123 -> 2543 bytes
.../page/TUIConversationFragment.java | 54 +++-
.../res/layout/convesation_list_header.xml | 2 +
92 files changed, 4554 insertions(+), 442 deletions(-)
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/NewsContacts.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/NewsPresenter.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/OfficialNoticeActivity.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CommentAdapter.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/GiftTwoAdapter.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/GiftTwoDetailsFragment.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/ReplyAdapter.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/RewardUserAdapter.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/base/BaseMvpDialogFragment.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/bean/AlbumBean.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CommentBean.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/bean/ExpandColumnBean.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/bean/GiftLabelBean.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/bean/GiftNumBean.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/bean/NewsDataBean.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/bean/RewardUserBean.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/bean/RoonGiftModel.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/CommentContacts.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/CommentPresenter.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/RewardGiftContacts.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/RewardGiftPresenter.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/utils/LocationUtils.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/GmsLocationProvider.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/IpLocationProvider.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/LocationProvider.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/LocationServiceFactory.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/SystemLocationProvider.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/widget/CustomRefreshHeader.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/widget/MarqueeTextView.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/CommentDialogFragment.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/KeyboardPopupWindow.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/RewardGiftDialogFragment.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/SelectGiftNumAdapter.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/SelectGiftNumPopupWindow.java
create mode 100644 moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/ShareDialog.java
create mode 100644 modulevocal/src/main/java/com/example/modulevocal/activity/CreateAlbumActivity.java
create mode 100644 modulevocal/src/main/java/com/example/modulevocal/adapter/MyAlbumListAdapter.java
create mode 100644 modulevocal/src/main/java/com/example/modulevocal/conacts/MyAlbumConacts.java
create mode 100644 modulevocal/src/main/java/com/example/modulevocal/fragment/MyAlbumFragment.java
create mode 100644 modulevocal/src/main/java/com/example/modulevocal/presenter/MyAlbumPresenter.java
create mode 100644 modulevocal/src/main/res/layout/activity_create_album.xml
create mode 100644 modulevocal/src/main/res/layout/fragment_my_album.xml
create mode 100644 modulevocal/src/main/res/layout/item_album_list.xml
diff --git a/app/build.gradle b/app/build.gradle
index bf5d2168..b1583828 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -5,7 +5,7 @@ plugins {
android {
namespace 'com.qxcm.qxlive'
- compileSdk 35
+ compileSdk 34
defaultConfig {
applicationId "com.qxcm.qxlive"
diff --git a/moduleUtil/build.gradle b/moduleUtil/build.gradle
index 19371bcb..2a26e758 100644
--- a/moduleUtil/build.gradle
+++ b/moduleUtil/build.gradle
@@ -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')
diff --git a/moduleUtil/src/main/AndroidManifest.xml b/moduleUtil/src/main/AndroidManifest.xml
index a98f53fb..68056176 100644
--- a/moduleUtil/src/main/AndroidManifest.xml
+++ b/moduleUtil/src/main/AndroidManifest.xml
@@ -1,8 +1,12 @@
+
+
-
+
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/BaseAppCompatActivity.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/BaseAppCompatActivity.java
index d1db0c2c..b001d333 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/BaseAppCompatActivity.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/BaseAppCompatActivity.java
@@ -33,7 +33,7 @@ public abstract class BaseAppCompatActivity 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);
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/NewsContacts.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/NewsContacts.java
new file mode 100644
index 00000000..8cc884d9
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/NewsContacts.java
@@ -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 {
+
+ void getOfficialNoticeList(List newsDataBeans);
+
+ }
+ public interface IHomePre extends IPresenter {
+
+ void getOfficialNotice(String page,String page_limit,String type);
+ }
+
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/NewsPresenter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/NewsPresenter.java
new file mode 100644
index 00000000..5bf0101c
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/NewsPresenter.java
@@ -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 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>() {
+// @Override
+// public void onSubscribe(Disposable d) {
+// addDisposable(d);
+// }
+//
+// @Override
+// public void onNext(List newsDataBeans) {
+// MvpRef.get().getOfficialNoticeList(newsDataBeans);
+// }
+// });
+
+ List 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);
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/OfficialNoticeActivity.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/OfficialNoticeActivity.java
new file mode 100644
index 00000000..8fbe4b34
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/news/OfficialNoticeActivity.java
@@ -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 implements NewsContacts.View {
+
+ private int page = 1;
+ private BaseQuickAdapter 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(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 newsDataBeans) {
+ mAdapter.setNewData(newsDataBeans);
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CirleListAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CirleListAdapter.java
index 52d0717d..df01a716 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CirleListAdapter.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CirleListAdapter.java
@@ -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 {
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 {
+ 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 {
+
+ private List commentList;
+
+ public CommentAdapter(List commentList) {
+ this.commentList = commentList;
+ }
+ public void updateData(List 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
+ }
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/GiftTwoAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/GiftTwoAdapter.java
new file mode 100644
index 00000000..6218aab9
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/GiftTwoAdapter.java
@@ -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 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 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 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;
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/GiftTwoDetailsFragment.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/GiftTwoDetailsFragment.java
new file mode 100644
index 00000000..0395dd23
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/GiftTwoDetailsFragment.java
@@ -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 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 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 rewardUserBeanList) {
+
+ }
+
+ @Override
+ public void getGiftLabel(List giftLabelBeans) {
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/ReplyAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/ReplyAdapter.java
new file mode 100644
index 00000000..e11ebfe1
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/ReplyAdapter.java
@@ -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 {
+
+ private List replyList;
+
+ public ReplyAdapter(List replyList) {
+ this.replyList = replyList;
+ }
+
+ public void updateData(List 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());
+ }
+ }
+}
+
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/RewardUserAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/RewardUserAdapter.java
new file mode 100644
index 00000000..19763d15
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/RewardUserAdapter.java
@@ -0,0 +1,4 @@
+package com.qxcm.moduleutil.adapter;
+
+public class RewardUserAdapter {
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/UserPhotoWallAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/UserPhotoWallAdapter.java
index cc8db03f..03fde97c 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/UserPhotoWallAdapter.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/UserPhotoWallAdapter.java
@@ -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 {
+public class UserPhotoWallAdapter extends BaseQuickAdapter {
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 extends DialogFragment implements IView {
+ 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();
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/base/CommonAppContext.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/base/CommonAppContext.java
index 8c53b1d0..84f2c24d 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/base/CommonAppContext.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/base/CommonAppContext.java
@@ -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;
+ }
+ });
+ }
+
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/AlbumBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/AlbumBean.java
new file mode 100644
index 00000000..0b615b45
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/AlbumBean.java
@@ -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 image_list;
+ @Data
+ public class ImageList{
+ private String id; //图片id
+ private String image; //图片地址
+ private String content; //图片描述
+ private String createtime; //图片创建时间
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CircleListBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CircleListBean.java
index eb7d19a9..0f4980c7 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CircleListBean.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CircleListBean.java
@@ -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 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;//话题
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CommentBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CommentBean.java
new file mode 100644
index 00000000..5e7bdf3f
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CommentBean.java
@@ -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 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;
+
+ @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;
+ }
+
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/ExpandColumnBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/ExpandColumnBean.java
new file mode 100644
index 00000000..b6141a2a
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/ExpandColumnBean.java
@@ -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 icon;
+
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/GiftLabelBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/GiftLabelBean.java
new file mode 100644
index 00000000..cd990311
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/GiftLabelBean.java
@@ -0,0 +1,9 @@
+package com.qxcm.moduleutil.bean;
+
+import lombok.Data;
+
+@Data
+public class GiftLabelBean {
+ private String label;
+ private String name;
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/GiftNumBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/GiftNumBean.java
new file mode 100644
index 00000000..a626d579
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/GiftNumBean.java
@@ -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;
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/HeatedBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/HeatedBean.java
index 2687d396..4036a5fd 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/HeatedBean.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/HeatedBean.java
@@ -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
+
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/NewsDataBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/NewsDataBean.java
new file mode 100644
index 00000000..8d48f55a
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/NewsDataBean.java
@@ -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;
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/RewardUserBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/RewardUserBean.java
new file mode 100644
index 00000000..ca0a23a9
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/RewardUserBean.java
@@ -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;
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/RoonGiftModel.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/RoonGiftModel.java
new file mode 100644
index 00000000..e0f090b0
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/RoonGiftModel.java
@@ -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");
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/ApiServer.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/ApiServer.java
index ee24bc07..2336a283 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/ApiServer.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/ApiServer.java
@@ -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> realName(@Field("real_name") String real_name, @Field("card_number") String card_number);
+ @FormUrlEncoded
+ @POST(Constants.GET_EXPAND_COLUMN)
+ Observable>> getExpandColumn(@Field("type") String type);
+
+ @FormUrlEncoded
+ @POST(Constants.GET_OFFICIAL_NOTICE)
+ Observable>> getOfficialNotice( @Field("page") String page, @Field("page_limit") String page_limit,@Field("type") String type);
+
+ @FormUrlEncoded
+ @POST(Constants.GET_ALBUM_LIST)
+ Observable>> getAlbumList(@Field("page") String page, @Field("page_limit") String page_limit);
+ @FormUrlEncoded
+ @POST(Constants.CREATE_ALBUM)
+ Call > createAlbum(@Field("name") String name, @Field("image") String image);
+
+ @FormUrlEncoded
+ @POST(Constants.GET_REWARD_LIST)
+ Observable>> getRewardList(@Field("id") String id, @Field("page") int page, @Field("page_limit") int page_limit);
+
+ @GET(Constants.GET_GIFT_LABEL)
+ Observable>> getGiftLabel(@Query("have_hot") String have_hot);
+
+ @GET(Constants.GIFT_LIST)//获取礼物列表
+ Observable>> getGiftList(@Query("label") int label);
+
+ @GET(Constants.TOPIC_LIST)//获取话题
+ Observable>> topicList(@Query("page") String page, @Query("page_limit") String page_limit);
+ @FormUrlEncoded
+ @POST(Constants.PUBLISH_ZONE)
+ Call> 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>> getCategories();
+
+ @GET(Constants.GET_CIRCLE_LIST)
+ Observable>> getCircleList(@Query("page") String page, @Query("page_limit") String page_limit);
+
+ @FormUrlEncoded
+ @POST(Constants.LIKE_ZONE)
+ Call> likeZone(@Field("id") String zone_id);
+
+ @FormUrlEncoded
+ @POST(Constants.GET_COMMENT_LIST)
+ Observable> getCommentList(@Field("id") String id, @Field("page") String page, @Field("page_limit") String page_limit);
+
+ @FormUrlEncoded
+ @POST(Constants.COMMENT_ZONE)
+ Call> commentZone(@Field("id") String id, @Field("content") String content, @Field("pid") String pid, @Field("reply_to") String reply_to);
// @FormUrlEncoded
// @POST(Constant.URL.ADDBANK)
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseModel.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseModel.java
index ba2b053f..24be2435 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseModel.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseModel.java
@@ -38,6 +38,10 @@ public class BaseModel implements Parcelable {
public boolean isSuccess() {
return code == 1; // 根据实际业务码判断是否成功
}
+
+ public boolean isTokenExpired() {
+ return code == 301; // token过期码
+ }
@Override
public int describeContents() {
return 0;
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseObserver.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseObserver.java
index 63857117..1f0d1d37 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseObserver.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseObserver.java
@@ -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 implements Observer {
Logger.i("onComplete");
}
+
+// @Override
+// public void onNext(BaseModel 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();
+// }
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/DefaultTransformer.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/DefaultTransformer.java
index 0e845493..fbf697cd 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/DefaultTransformer.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/DefaultTransformer.java
@@ -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, R>
- implements ObservableTransformer {
+public class DefaultTransformer implements ObservableTransformer, T> {
+
+// @Override
+// public ObservableSource apply(Observable upstream) {
+// return upstream.compose(SchedulerTransformer.create())
+// .compose(new ErrorCheckerTransformer());
+// }
@Override
- public ObservableSource apply(Observable upstream) {
- return upstream.compose(SchedulerTransformer.create())
- .compose(new ErrorCheckerTransformer());
+ public ObservableSource apply(Observable> 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());
}
}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/RetrofitClient.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/RetrofitClient.java
index 2758adf8..d1355f1e 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/RetrofitClient.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/RetrofitClient.java
@@ -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 observer){
sApiServer.realName(real_name,card_number).compose(new DefaultTransformer<>()).subscribe(observer);
}
+ //获取扩列数据
+ public void getExpandColumn(String type,String page,String page_limit,BaseObserver> 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> observer){
+ sApiServer.getOfficialNotice(page,page_limit,type).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void getAlbumList(String page,String page_limit,BaseObserver> observer){
+ sApiServer.getAlbumList(page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void createAlbum(String name,String image,BaseObserver observer) {
+ sApiServer.createAlbum(name,image).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ if (response.code()==200){
+ BaseModel 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> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void getRewardList(String id, int page, int page_limit,BaseObserver > observer){
+ sApiServer.getRewardList(id,page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
+
+ }
+
+ public void getGiftLabel(String have_hot,BaseObserver> observer){
+ sApiServer.getGiftLabel(have_hot).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void getGiftList( int type, BaseObserver> observer){
+ sApiServer.getGiftList(type).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void topicList(String page,String page_limit,BaseObserver> 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 observer){
+
+ sApiServer.publishZone(images,content,topic_id,room_id,ip).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ if (response.code()==200){
+ BaseModel 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> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void getCategories(BaseObserver> observer){//动态顶部热门话题
+ sApiServer.getCategories().compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void getCircleList(String page,String page_limit,BaseObserver> observer){//动态列表
+ sApiServer.getCircleList(page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void likeZone(String zone_id,BaseObserver observer){
+ sApiServer.likeZone(zone_id).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ if (response.code()==200){
+ BaseModel 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> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void getCommentList(String id, String page, String page_limit, BaseObserver 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 observer){
+ sApiServer.commentZone(id,content,pid,reply_to).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ if (response.code()==200){
+ BaseModel 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> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/CommentContacts.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/CommentContacts.java
new file mode 100644
index 00000000..3005d758
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/CommentContacts.java
@@ -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 {
+ 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);
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/CommentPresenter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/CommentPresenter.java
new file mode 100644
index 00000000..6ea90047
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/CommentPresenter.java
@@ -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 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() {
+
+ @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() {
+
+ @Override
+ public void onSubscribe(Disposable d) {
+ addDisposable(d);
+ }
+
+ @Override
+ public void onNext(String s) {
+ MvpRef.get().commentZone();
+ }
+ });
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/RewardGiftContacts.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/RewardGiftContacts.java
new file mode 100644
index 00000000..3ef71d49
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/RewardGiftContacts.java
@@ -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 {
+ void getRewardList(List rewardUserBeanList);
+ void getGiftLabel(List giftLabelBeans);
+
+ void setGiftList(List roonGiftModels);
+
+
+ }
+
+ public interface IIndexPre extends IPresenter {
+ void getRewardList(String id, int page, int page_limit);
+
+ void getGiftLabel(String have_hot);
+
+ void getGiftList(String id);
+
+
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/RewardGiftPresenter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/RewardGiftPresenter.java
new file mode 100644
index 00000000..de184b8b
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/presenter/RewardGiftPresenter.java
@@ -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 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>() {
+// @Override
+// public void onSubscribe(Disposable d) {
+// addDisposable(d);
+// }
+//
+// @Override
+// public void onNext(List rewardUserBeans) {
+// MvpRef.get().getRewardList(rewardUserBeans);
+// }
+// });
+
+ List 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>() {
+// @Override
+// public void onSubscribe(Disposable d) {
+// addDisposable(d);
+// }
+//
+// @Override
+// public void onNext(List giftLabelBeans) {
+// MvpRef.get().getGiftLabel(giftLabelBeans);
+// }
+// });
+
+ List 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>() {
+//
+// @Override
+// public void onSubscribe(Disposable d) {
+// addDisposable(d);
+// }
+//
+// @Override
+// public void onNext(List roonGiftModels) {
+// MvpRef.get().setGiftList(roonGiftModels);
+// }
+// });
+ List 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);
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/ImageUtils.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/ImageUtils.java
index a8611375..2d852660 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/ImageUtils.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/ImageUtils.java
@@ -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() {
+ @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回调
*/
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/LocationUtils.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/LocationUtils.java
new file mode 100644
index 00000000..559e3100
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/LocationUtils.java
@@ -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 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 "未知城市";
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/MeHeadView.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/MeHeadView.java
index b7084a9d..d75635b8 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/MeHeadView.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/MeHeadView.java
@@ -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);
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/GmsLocationProvider.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/GmsLocationProvider.java
new file mode 100644
index 00000000..82005d82
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/GmsLocationProvider.java
@@ -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 addresses = geocoder.getFromLocation(latitude, longitude, 1);
+ if (addresses != null && !addresses.isEmpty()) {
+ return addresses.get(0).getLocality();
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "地理编码失败", e);
+ }
+ return "未知城市";
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/IpLocationProvider.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/IpLocationProvider.java
new file mode 100644
index 00000000..5462d60e
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/IpLocationProvider.java
@@ -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 {
+ 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 定位失败");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/LocationProvider.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/LocationProvider.java
new file mode 100644
index 00000000..d11676c7
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/LocationProvider.java
@@ -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);
+// }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/LocationServiceFactory.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/LocationServiceFactory.java
new file mode 100644
index 00000000..d7bb64d3
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/LocationServiceFactory.java
@@ -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;
+ }
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/SystemLocationProvider.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/SystemLocationProvider.java
new file mode 100644
index 00000000..f06734ea
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/location/SystemLocationProvider.java
@@ -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 addresses = geocoder.getFromLocation(latitude, longitude, 1);
+ if (addresses != null && !addresses.isEmpty()) {
+ return addresses.get(0).getLocality();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return "未知城市";
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/Constants.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/Constants.java
index f3c8b10f..58621d32 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/Constants.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/Constants.java
@@ -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";//评论列表
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/CustomRefreshHeader.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/CustomRefreshHeader.java
new file mode 100644
index 00000000..01d6e70d
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/CustomRefreshHeader.java
@@ -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) {
+
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/MarqueeTextView.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/MarqueeTextView.java
new file mode 100644
index 00000000..e60d0d15
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/MarqueeTextView.java
@@ -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;
+ }
+
+
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/CommentDialogFragment.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/CommentDialogFragment.java
new file mode 100644
index 00000000..8d34c85d
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/CommentDialogFragment.java
@@ -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 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");
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/KeyboardPopupWindow.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/KeyboardPopupWindow.java
new file mode 100644
index 00000000..92e90ad6
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/KeyboardPopupWindow.java
@@ -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 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 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);//输入完成
+ }
+}
+
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/RewardGiftDialogFragment.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/RewardGiftDialogFragment.java
new file mode 100644
index 00000000..becc48d5
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/RewardGiftDialogFragment.java
@@ -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 implements RewardGiftContacts.View {
+
+ private BaseQuickAdapter adapter;
+ private SelectGiftNumPopupWindow mSelectGiftNumPopupWindow;
+ private KeyboardPopupWindow mKeyboardPopupWindow;
+ private List 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(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 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 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 giftLabelBeans) {
+ mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans));
+ mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
+ mBinding.slidingTabLayout.setCurrentTab(0);
+ }
+
+ @Override
+ public void setGiftList(List roonGiftModels) {
+
+ }
+
+ private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
+
+ private List list;
+
+
+ public MyFragmentPagerAdapter(FragmentManager fm, List 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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/SelectGiftNumAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/SelectGiftNumAdapter.java
new file mode 100644
index 00000000..cdb0cd34
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/SelectGiftNumAdapter.java
@@ -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 {
+
+ 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);
+ }
+
+ }
+}
+
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/SelectGiftNumPopupWindow.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/SelectGiftNumPopupWindow.java
new file mode 100644
index 00000000..20b25f18
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/SelectGiftNumPopupWindow.java
@@ -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 data) {
+ if (selectGiftNumAdapter != null) {
+ selectGiftNumAdapter.setNewData(data);
+ }
+ }
+
+
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/ShareDialog.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/ShareDialog.java
new file mode 100644
index 00000000..fb2fb572
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/widget/dialog/ShareDialog.java
@@ -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 {
+
+
+ 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();
+ }
+
+}
diff --git a/moduleUtil/src/main/res/layout/item_cirle_list.xml b/moduleUtil/src/main/res/layout/item_cirle_list.xml
index 3782bfbe..8d73aba6 100644
--- a/moduleUtil/src/main/res/layout/item_cirle_list.xml
+++ b/moduleUtil/src/main/res/layout/item_cirle_list.xml
@@ -198,15 +198,50 @@
android:textSize="12sp" />
-
+
+
+
+
+
+
+
+
+
+
+
+ android:background="@drawable/bg_r43_9999"
+ android:paddingHorizontal="5dp"
+ android:layout_marginEnd="10dp">
+
+
+
+
+
+
+ android:layout_height="match_parent"
+ xmlns:tools="http://schemas.android.com/tools">
+ />
#61C8FD
#FEE6E3
#C4EBFF
-
+ #FF9249FF
+ #212121
\ No newline at end of file
diff --git a/moduleUtil/src/main/res/values/strings.xml b/moduleUtil/src/main/res/values/strings.xml
index 854b0c01..8567e307 100644
--- a/moduleUtil/src/main/res/values/strings.xml
+++ b/moduleUtil/src/main/res/values/strings.xml
@@ -102,6 +102,8 @@
支付方式
微信支付
支付宝支付
+
+ Hello blank fragment
\ No newline at end of file
diff --git a/modulecircle/src/main/java/com/example/modulecircle/activity/ReleaseActivity.java b/modulecircle/src/main/java/com/example/modulecircle/activity/ReleaseActivity.java
index d696138e..aae02cce 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/activity/ReleaseActivity.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/activity/ReleaseActivity.java
@@ -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 implements ReleaseContract.View {
UserPhotoWallAdapter mUserPhotoWallAdapter;
- List list;
+ List list=new ArrayList<>();
+ private List uploadedUrls = new ArrayList<>();//真实图片地址
final int maxNum = 1200;
+ private List topicId=new ArrayList<>();
+ private String city1;
@Override
protected void initData() {
@@ -84,15 +99,23 @@ public class ReleaseActivity extends BaseMvpActivity();
- 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 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 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 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 localMediaList = PictureSelector.obtainMultipleResult(data);
+
+ if (localMediaList != null && !localMediaList.isEmpty()) {
+ List imageFiles = new ArrayList<>();
+ for (LocalMedia media : localMediaList) {
+ String path = media.isCompressed() ? media.getCompressPath() : media.getRealPath();
+ imageFiles.add(new File(path));
}
-// MvpPre.uploadFile(new File(url), 0);
+
+ // 开始批量上传
+ 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 localMedia1 = PictureSelector.obtainMultipleResult(data);
@@ -205,4 +257,91 @@ public class ReleaseActivity extends BaseMvpActivity list) {
+ // 示例数据
+// List topics = Arrays.asList("话题1", "话题2", "话题3", "话题4");
+
+ List 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 selectedTopics = adapter.getSelectedItems();
+ // 返回结果给调用页面(可使用接口或 onActivityResult 等方式)
+ Log.d("Selected Topics", selectedTopics.toString());
+ List 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();
+ }
+ });
+ }
+ }
+
}
\ No newline at end of file
diff --git a/modulecircle/src/main/java/com/example/modulecircle/adapter/CircleCategoryAdapter.java b/modulecircle/src/main/java/com/example/modulecircle/adapter/CircleCategoryAdapter.java
index eafac64d..d7922004 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/adapter/CircleCategoryAdapter.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/adapter/CircleCategoryAdapter.java
@@ -37,11 +37,11 @@ public class CircleCategoryAdapter extends RecyclerView.Adapter {
+import java.util.List;
+
+public class ExpandColumnAdapter extends BaseQuickAdapter {
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 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);
+ }
+
+
}
}
diff --git a/modulecircle/src/main/java/com/example/modulecircle/contacts/CircleContacts.java b/modulecircle/src/main/java/com/example/modulecircle/contacts/CircleContacts.java
index 0da4eedf..5795d06f 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/contacts/CircleContacts.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/contacts/CircleContacts.java
@@ -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 {
-// void setBanners(List list);
-
-// void myInfoSuccess(MyInfoResp data);
void setCategories(List list);
void setCircleList(List list);
+
+ void setExpandColumn(List 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);
}
}
diff --git a/modulecircle/src/main/java/com/example/modulecircle/contacts/ReleaseContract.java b/modulecircle/src/main/java/com/example/modulecircle/contacts/ReleaseContract.java
index cb8e908f..b59589c6 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/contacts/ReleaseContract.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/contacts/ReleaseContract.java
@@ -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 {
+ void topicList(List 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);
}
}
diff --git a/modulecircle/src/main/java/com/example/modulecircle/dialog/MultiSelectAdapter.java b/modulecircle/src/main/java/com/example/modulecircle/dialog/MultiSelectAdapter.java
index 8104877f..23da1857 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/dialog/MultiSelectAdapter.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/dialog/MultiSelectAdapter.java
@@ -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 {
- private List options;
+ private List options;
private SparseBooleanArray selectedPositions = new SparseBooleanArray();
- public MultiSelectAdapter(List options) {
+ public MultiSelectAdapter(List options) {
this.options = options;
}
@@ -32,8 +33,8 @@ public class MultiSelectAdapter extends RecyclerView.Adapter {
@@ -52,8 +53,8 @@ public class MultiSelectAdapter extends RecyclerView.Adapter getSelectedItems() {
- List selected = new ArrayList<>();
+ public List getSelectedItems() {
+ List selected = new ArrayList<>();
for (int i = 0; i < options.size(); i++) {
if (selectedPositions.get(i)) {
selected.add(options.get(i));
diff --git a/modulecircle/src/main/java/com/example/modulecircle/fragment/CircleCategoryFragment.java b/modulecircle/src/main/java/com/example/modulecircle/fragment/CircleCategoryFragment.java
index fc501400..12722cdc 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/fragment/CircleCategoryFragment.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/fragment/CircleCategoryFragment.java
@@ -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 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 list) {
+
+ }
+
+ @Override
+ public void setLikeZone() {
+ ToastUtils.show("点赞成功");
+ MvpPre.getCircleList(page+"", "10");
+ }
+
// 拆分函数
private List> splitListIntoChunks(List list, int chunkSize) {
List> chunks = new ArrayList<>();
diff --git a/modulecircle/src/main/java/com/example/modulecircle/fragment/CircleFragment.java b/modulecircle/src/main/java/com/example/modulecircle/fragment/CircleFragment.java
index 2a8bbb9d..86d16cdb 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/fragment/CircleFragment.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/fragment/CircleFragment.java
@@ -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 list) {
+
+ }
+
+ @Override
+ public void setLikeZone() {
+
+ }
+
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
private List list;
diff --git a/modulecircle/src/main/java/com/example/modulecircle/fragment/ExpandColumnFragment.java b/modulecircle/src/main/java/com/example/modulecircle/fragment/ExpandColumnFragment.java
index 6c72bac0..490a4f42 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/fragment/ExpandColumnFragment.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/fragment/ExpandColumnFragment.java
@@ -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 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 list) {
}
+
+ @Override
+ public void setExpandColumn(List list) {
+ expandColumnAdapter.setNewData(list);
+ }
+
+ @Override
+ public void setLikeZone() {
+
+ }
}
\ No newline at end of file
diff --git a/modulecircle/src/main/java/com/example/modulecircle/presenter/CirclePresenter.java b/modulecircle/src/main/java/com/example/modulecircle/presenter/CirclePresenter.java
index 85c2f6aa..baeceb90 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/presenter/CirclePresenter.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/presenter/CirclePresenter.java
@@ -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 implements CircleContacts.IIndexPre {
public CirclePresenter(CircleContacts.View view, Context context) {
@@ -20,41 +24,84 @@ public class CirclePresenter extends BasePresenter implemen
@Override
public void getCategories() {
- List 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>() {
+ @Override
+ public void onSubscribe(Disposable d) {
+ addDisposable(d);
+ }
+
+ @Override
+ public void onNext(List heatedBeanList) {
+ MvpRef.get().setCategories(heatedBeanList);
+ }
+ });
}
@Override
- public void getCircleList() {
- List 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 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);
+ public void getCircleList(String page, String page_limit) {
+ api.getCircleList(page,page_limit,new BaseObserver>() {
+ @Override
+ public void onSubscribe(Disposable d) {
+ addDisposable(d);
+ }
+
+ @Override
+ public void onNext(List circleListBeans) {
+ MvpRef.get().setCircleList(circleListBeans);
+ }
+ });
+ }
+
+ //获取扩列数据
+ @Override
+ public void getExpandColumn(String type, String page, String page_limit) {
+ api.getExpandColumn(type, page, page_limit, new BaseObserver>() {
+ @Override
+ public void onSubscribe(Disposable d) {
+ addDisposable(d);
+ }
+
+ @Override
+ public void onNext(List expandColumnBeans) {
+ MvpRef.get().setExpandColumn(expandColumnBeans);
+
+ }
+ });
+
+// List 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 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() {
+ @Override
+ public void onSubscribe(Disposable d) {
+ addDisposable(d);
+ }
+
+ @Override
+ public void onNext(String s) {
+ MvpRef.get().setLikeZone();
+ }
+ });
}
}
diff --git a/modulecircle/src/main/java/com/example/modulecircle/presenter/ReleasePresenter.java b/modulecircle/src/main/java/com/example/modulecircle/presenter/ReleasePresenter.java
index 6030f49b..26ca3592 100644
--- a/modulecircle/src/main/java/com/example/modulecircle/presenter/ReleasePresenter.java
+++ b/modulecircle/src/main/java/com/example/modulecircle/presenter/ReleasePresenter.java
@@ -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 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>() {
+ @Override
+ public void onSubscribe(Disposable d) {
+ addDisposable(d);
+ }
+
+ @Override
+ public void onNext(List heatedBeanList) {
+ MvpRef.get().topicList(heatedBeanList);
+ }
+ });
+ }
+
+ public void batchUploadFiles(List 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() {
+
+ @Override
+ public void onSubscribe(Disposable d) {
+ addDisposable(d);
+ }
+
+ @Override
+ public void onNext(String s) {
+ MvpRef.get().publishSuccess();
+ }
+ });
+ }
}
diff --git a/modulecircle/src/main/res/layout/activity_release.xml b/modulecircle/src/main/res/layout/activity_release.xml
index 889c8170..c05c1f38 100644
--- a/modulecircle/src/main/res/layout/activity_release.xml
+++ b/modulecircle/src/main/res/layout/activity_release.xml
@@ -8,108 +8,116 @@
-
+ android:layout_height="wrap_content">
-
+ android:layout_height="match_parent"
+ android:background="@color/color_FFF8F8F8">
-
-
-
-
-
-
-
-
+ android:background="@color/white"
+ app:layout_constraintTop_toTopOf="parent" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+ android:id="@+id/tv_fb"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_42"
+ android:layout_marginStart="@dimen/dp_38"
+ android:layout_marginTop="@dimen/dp_20"
+ android:layout_marginEnd="@dimen/dp_38"
+ android:background="@drawable/cs"
+ android:gravity="center"
+ android:text="立即发布"
+ android:textColor="@color/color_FF333333"
+ android:textSize="@dimen/sp_14"
+ app:layout_constraintTop_toBottomOf="@+id/rv_photo_wall" />
+
+
\ No newline at end of file
diff --git a/modulecircle/src/main/res/layout/fragment_expand_column.xml b/modulecircle/src/main/res/layout/fragment_expand_column.xml
index 5f1c82bb..65a8bc9c 100644
--- a/modulecircle/src/main/res/layout/fragment_expand_column.xml
+++ b/modulecircle/src/main/res/layout/fragment_expand_column.xml
@@ -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"
/>
+
+ android:paddingBottom="@dimen/dp_12" />
+
\ No newline at end of file
diff --git a/modulecircle/src/main/res/layout/item_circle_category.xml b/modulecircle/src/main/res/layout/item_circle_category.xml
index 482e4fee..eacb6a37 100644
--- a/modulecircle/src/main/res/layout/item_circle_category.xml
+++ b/modulecircle/src/main/res/layout/item_circle_category.xml
@@ -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"
/>
diff --git a/modulecircle/src/main/res/layout/item_expand_column.xml b/modulecircle/src/main/res/layout/item_expand_column.xml
index 37351757..49e15479 100644
--- a/modulecircle/src/main/res/layout/item_expand_column.xml
+++ b/modulecircle/src/main/res/layout/item_expand_column.xml
@@ -16,26 +16,27 @@
android:paddingTop="@dimen/dp_10"
android:paddingRight="15sp">
-
-
-
+ android:layout_width="@dimen/dp_60"
+ android:layout_height="@dimen/dp_60"
+ android:layout_alignParentStart="true"
+ android:layout_centerInParent="true"/>
+
@@ -43,47 +44,79 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
- android:orientation="vertical">
+ android:orientation="horizontal">
+ android:textSize="18sp" />
+
+
+
+
+
+
+
+
+
+
+
+ android:textColor="@color/color_FF666666"
+ android:textSize="@dimen/sp_12" />
+
+
-
-
+
+ android:theme="@style/Theme.QxLive">
+
+
\ No newline at end of file
diff --git a/modulenews/src/main/java/com/example/modulenews/contacts/NewsContacts.java b/modulenews/src/main/java/com/example/modulenews/contacts/NewsContacts.java
index c0b744d5..a6076a7e 100644
--- a/modulenews/src/main/java/com/example/modulenews/contacts/NewsContacts.java
+++ b/modulenews/src/main/java/com/example/modulenews/contacts/NewsContacts.java
@@ -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 {
+ void getOfficialNoticeList(List newsDataBeans);
+
}
public interface IHomePre extends IPresenter {
+ void getOfficialNotice(String page,String page_limit,String type);
}
}
diff --git a/modulenews/src/main/java/com/example/modulenews/fragment/NewsFragment.java b/modulenews/src/main/java/com/example/modulenews/fragment/NewsFragment.java
index a33b95c0..9d8725bb 100644
--- a/modulenews/src/main/java/com/example/modulenews/fragment/NewsFragment.java
+++ b/modulenews/src/main/java/com/example/modulenews/fragment/NewsFragment.java
@@ -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 newsDataBeans) {
+
+ }
}
\ No newline at end of file
diff --git a/modulenews/src/main/java/com/example/modulenews/presenter/NewsPresenter.java b/modulenews/src/main/java/com/example/modulenews/presenter/NewsPresenter.java
index e5fa5db1..d28e6c48 100644
--- a/modulenews/src/main/java/com/example/modulenews/presenter/NewsPresenter.java
+++ b/modulenews/src/main/java/com/example/modulenews/presenter/NewsPresenter.java
@@ -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 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>() {
+// @Override
+// public void onSubscribe(Disposable d) {
+// addDisposable(d);
+// }
+//
+// @Override
+// public void onNext(List newsDataBeans) {
+// MvpRef.get().getOfficialNoticeList(newsDataBeans);
+// }
+// });
+
+ List 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);
+ }
+ }
+ }
}
diff --git a/modulenews/src/main/res/values/strings.xml b/modulenews/src/main/res/values/strings.xml
index e5f8fdc2..73862c41 100644
--- a/modulenews/src/main/res/values/strings.xml
+++ b/modulenews/src/main/res/values/strings.xml
@@ -1,2 +1 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/modulevocal/src/main/AndroidManifest.xml b/modulevocal/src/main/AndroidManifest.xml
index 7977fbca..a6ca1b17 100644
--- a/modulevocal/src/main/AndroidManifest.xml
+++ b/modulevocal/src/main/AndroidManifest.xml
@@ -7,6 +7,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/BaseAppTheme">
+
diff --git a/modulevocal/src/main/java/com/example/modulevocal/activity/CreateAlbumActivity.java b/modulevocal/src/main/java/com/example/modulevocal/activity/CreateAlbumActivity.java
new file mode 100644
index 00000000..6900226f
--- /dev/null
+++ b/modulevocal/src/main/java/com/example/modulevocal/activity/CreateAlbumActivity.java
@@ -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 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 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 = 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 localMedia1 = PictureSelector.obtainMultipleResult(data);
+ if (localMedia1 != null && localMedia1.size() != 0) {
+ LocalMedia imgMedia = localMedia1.get(0);
+ MvpPre.uploadFile(new File(imgMedia.getRealPath()), 3);
+ }
+ break;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modulevocal/src/main/java/com/example/modulevocal/adapter/MyAlbumListAdapter.java b/modulevocal/src/main/java/com/example/modulevocal/adapter/MyAlbumListAdapter.java
new file mode 100644
index 00000000..43d4a5ab
--- /dev/null
+++ b/modulevocal/src/main/java/com/example/modulevocal/adapter/MyAlbumListAdapter.java
@@ -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 {
+ 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;
+ }
+}
\ No newline at end of file
diff --git a/modulevocal/src/main/java/com/example/modulevocal/conacts/MyAlbumConacts.java b/modulevocal/src/main/java/com/example/modulevocal/conacts/MyAlbumConacts.java
new file mode 100644
index 00000000..c1f99cf0
--- /dev/null
+++ b/modulevocal/src/main/java/com/example/modulevocal/conacts/MyAlbumConacts.java
@@ -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 {
+ void getAlbumList(List 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);
+ }
+}
diff --git a/modulevocal/src/main/java/com/example/modulevocal/fragment/MyAlbumFragment.java b/modulevocal/src/main/java/com/example/modulevocal/fragment/MyAlbumFragment.java
new file mode 100644
index 00000000..d3ef92ac
--- /dev/null
+++ b/modulevocal/src/main/java/com/example/modulevocal/fragment/MyAlbumFragment.java
@@ -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 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 data) {
+ mAdapter.setNewData(data);
+ }
+
+ @Override
+ public void upLoadSuccess(String url, int type) {
+
+ }
+
+ @Override
+ public void sendCodeSuccess() {
+
+ }
+}
\ No newline at end of file
diff --git a/modulevocal/src/main/java/com/example/modulevocal/fragment/UserHomepageFragment.java b/modulevocal/src/main/java/com/example/modulevocal/fragment/UserHomepageFragment.java
index e2d373d3..a6e1dec3 100644
--- a/modulevocal/src/main/java/com/example/modulevocal/fragment/UserHomepageFragment.java
+++ b/modulevocal/src/main/java/com/example/modulevocal/fragment/UserHomepageFragment.java
@@ -58,6 +58,7 @@ public class UserHomepageFragment extends BaseMvpFragment();
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 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>() {
+// @Override
+// public void onSubscribe(Disposable d) {
+// addDisposable(d);
+// }
+//
+// @Override
+// public void onNext(List albumBeans) {
+// MvpRef.get().getAlbumList(albumBeans);
+// }
+// });
+
+ List 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() {
+//
+// @Override
+// public void onSubscribe(Disposable d) {
+// addDisposable(d);
+// }
+//
+// @Override
+// public void onNext(String s) {
+// MvpRef.get().sendCodeSuccess();
+// }
+// });
+
+ api.createAlbum(name, image, new BaseObserver(){
+
+ @Override
+ public void onSubscribe(Disposable d) {
+ addDisposable(d);
+ }
+
+ @Override
+ public void onNext(String s) {
+ MvpRef.get().sendCodeSuccess();
+ }
+ });
+ }
+}
diff --git a/modulevocal/src/main/java/com/example/modulevocal/presenter/UserHomepagePresenter.java b/modulevocal/src/main/java/com/example/modulevocal/presenter/UserHomepagePresenter.java
index 1950323f..681f33cc 100644
--- a/modulevocal/src/main/java/com/example/modulevocal/presenter/UserHomepagePresenter.java
+++ b/modulevocal/src/main/java/com/example/modulevocal/presenter/UserHomepagePresenter.java
@@ -82,27 +82,27 @@ public class UserHomepagePresenter extends BasePresenter 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 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 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 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);
}
}
diff --git a/modulevocal/src/main/res/layout/activity_create_album.xml b/modulevocal/src/main/res/layout/activity_create_album.xml
new file mode 100644
index 00000000..e5a29533
--- /dev/null
+++ b/modulevocal/src/main/res/layout/activity_create_album.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modulevocal/src/main/res/layout/fragment_my_album.xml b/modulevocal/src/main/res/layout/fragment_my_album.xml
new file mode 100644
index 00000000..eb280dba
--- /dev/null
+++ b/modulevocal/src/main/res/layout/fragment_my_album.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modulevocal/src/main/res/layout/fragment_user_hompage.xml b/modulevocal/src/main/res/layout/fragment_user_hompage.xml
index e6aca09e..7e574f41 100644
--- a/modulevocal/src/main/res/layout/fragment_user_hompage.xml
+++ b/modulevocal/src/main/res/layout/fragment_user_hompage.xml
@@ -38,17 +38,18 @@
\ No newline at end of file
diff --git a/modulevocal/src/main/res/layout/item_album_list.xml b/modulevocal/src/main/res/layout/item_album_list.xml
new file mode 100644
index 00000000..4e295f36
--- /dev/null
+++ b/modulevocal/src/main/res/layout/item_album_list.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tuiconversation/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/tencent/qcloud/tuikit/tuiconversation/classicui/page/TUIConversationFragment$7.class b/tuiconversation/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/tencent/qcloud/tuikit/tuiconversation/classicui/page/TUIConversationFragment$7.class
index d0d19e81ff54b6adf6d5ea4f0024451a7fd60bcb..5fcb36a0eb2c090c22498dd32701e531ac4b772a 100644
GIT binary patch
literal 2543
zcmcImZC4vb6n-YeEQF=Rv_*?xTaB8el|}m!Wf2Q$(a?lYLcy=Y?ii*dvvFVG_(%L7
zo@3Ga!Q&@C=wI@9ypyC!K*#}4n{zgE_s-mB?tSjPGyCU1zy1c`F1{H<3?l~OCf-1T
zVbk%NRw$GsRA_zYG`z^Q!btARP!Eo$4ul`@P%!W4S}G1qull^+
zB#=yjArbD$ATv+sy0Xb3wA6B7n5
znV3Y1A@z(OaI3*p-Ky?B6HZ7WE=ncCC5Dk~ZaaxIE*rRF;wq*XHePkm3`y=dA_y|~
z=ZRG}dw~GYmo+n|KE^43~~iQ`~hyG+fP=x|Rd%*aqHZ
zSQ)~CY|>;?*Ob?6c}mwFciKg^;k7D4Ma%8CBxZ5L#7(@%Fh%=yw8e&W_O*{f37?^w
z%?+bt=vJoyQs5bUVBkX&A0f-|`2U7+3O2)prv~&CRkqY2evrOSLFG-{!tH+Q3p(|!
z*OGd!T;G$fbtqk8*`gdotsSXc?~poS4wiv=6QAf#m_BR$+A>pJ!e~a%nNRuvm4sUF8U+VX+GOkZbhOG;1eZGdy6l{jEnyf1x
zMm}vn?)7P8xSK7X&A8p0J0SioodmnIrh`kgxKGW>FwTgNo3BFCQK4%@^6tF;|lYDZ?{rDHZ8U|Bm(nw55p
zT6%~_?O1KB;wwT}A43%zG-`w=
T*di%SI?b#8-NRGtB*y*)Od$L(
delta 362
zcmZWj%}T>S7@RLnvdMNE(^R8It*u6p=ute0c<`p!dhii~SDh5dHs+nHfLTJN5G`<%Q0*v8sezBVL0_ySU)4yAV~4FXIFgbGb4
zLSNrGeLb?*?G|B6x9ucOdxL|bJTJ=fs3?c|AipG>Zs=R*MCZRMkD%-s;=aCp7+|q_NX61of&oV`1G-Tn!7%EG%M)UmF41
R=rW3UXUdrqVFjt{e*reTF&+Q_
diff --git a/tuiconversation/src/main/java/com/tencent/qcloud/tuikit/tuiconversation/classicui/page/TUIConversationFragment.java b/tuiconversation/src/main/java/com/tencent/qcloud/tuikit/tuiconversation/classicui/page/TUIConversationFragment.java
index f8a17bca..07c57b31 100644
--- a/tuiconversation/src/main/java/com/tencent/qcloud/tuikit/tuiconversation/classicui/page/TUIConversationFragment.java
+++ b/tuiconversation/src/main/java/com/tencent/qcloud/tuikit/tuiconversation/classicui/page/TUIConversationFragment.java
@@ -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,16 +110,26 @@ 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 (conversationInfo.isMarkFold()) {
- mConversationLayout.clearUnreadStatusOfFoldItem();
- startFoldedConversationActivity();
- } else {
- TUIConversationUtils.startChatActivity(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();
+ } else {
+ TUIConversationUtils.startChatActivity(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);
+ }
+ });
+ }
}
/**
diff --git a/tuiconversation/src/main/res/layout/convesation_list_header.xml b/tuiconversation/src/main/res/layout/convesation_list_header.xml
index 9cc753af..f8df0b18 100644
--- a/tuiconversation/src/main/res/layout/convesation_list_header.xml
+++ b/tuiconversation/src/main/res/layout/convesation_list_header.xml
@@ -14,6 +14,7 @@
app:layout_constraintTop_toTopOf="parent">