extends
// 可在此处添加针对旧版本的处理逻辑(如果需要)
}
+ // 动态判断是否包含 @Subscribe 注解的方法
+ boolean hasSubscribeMethods = false;
+ for (Method method : getClass().getDeclaredMethods()) {
+ if (method.isAnnotationPresent(Subscribe.class)) {
+ hasSubscribeMethods = true;
+ break;
+ }
+ }
+
+ if (hasSubscribeMethods) {
+ EventBus.getDefault().register(this);
+ }
+
}
@Override
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/BaseMvpActivity.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/BaseMvpActivity.java
index 3c7e71bf..0cb12e00 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/BaseMvpActivity.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/BaseMvpActivity.java
@@ -21,7 +21,11 @@ import com.blankj.utilcode.util.LogUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.bean.UserBean;
+import com.qxcm.moduleutil.bean.UserInfo;
import com.qxcm.moduleutil.utils.LanguageUtil;
+import com.tencent.imsdk.v2.V2TIMCallback;
+import com.tencent.imsdk.v2.V2TIMManager;
+import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import com.tencent.qcloud.tuicore.TUILogin;
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
@@ -75,10 +79,10 @@ public abstract class BaseMvpActivity {
+
+ public String title;
+ public String url;
+ @Override
+ protected void initData() {
+ WebSettings webSettings = mBinding.webView.getSettings();
+ webSettings.setUseWideViewPort(true);
+ webSettings.setLoadWithOverviewMode(true);
+ webSettings.setJavaScriptEnabled(true);
+ //增加JSBridge
+ mBinding.webView.addJavascriptInterface(new WebAppInterface(this), "Android");
+// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
+ webSettings.setBuiltInZoomControls(false);
+ webSettings.setSupportZoom(false);
+ webSettings.setDomStorageEnabled(true);
+ webSettings.setBlockNetworkImage(false);//解决图片不显示
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
+ }
+ webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
+ mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
+ mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
+ mBinding.webView.requestFocus();
+ mBinding.webView.loadUrl(url);
+
+
+ }
+ @Override
+ protected void initView() {
+ title = getIntent().getStringExtra("title");
+ url = getIntent().getStringExtra("url");
+ mBinding.topBar.setTitle(title);
+ }
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.activity_web_view;
+ }
+ public class WebAppInterface {
+ Context mContext;
+
+ WebAppInterface(Context c) {
+ mContext = c;
+ }
+
+ // 被 H5 调用的方法
+ @JavascriptInterface
+ public void showToast(String toast) {
+ Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
+ }
+ }
+}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/WebViewBridgeConfig.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/WebViewBridgeConfig.java
new file mode 100644
index 00000000..7373baa6
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/activity/WebViewBridgeConfig.java
@@ -0,0 +1,403 @@
+package com.qxcm.moduleutil.activity;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.text.TextUtils;
+import android.util.Log;
+import android.webkit.JavascriptInterface;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.blankj.utilcode.util.ActivityUtils;
+import com.blankj.utilcode.util.ThreadUtils;
+import com.qxcm.moduleutil.utils.logger.Logger;
+
+import org.json.JSONObject;
+
+import io.reactivex.disposables.Disposable;
+
+/**
+ * 项目名称 qipao-android
+ * 包名:com.yutang.xqipao.ui.h5
+ * 创建人 王欧
+ * 创建时间 2020/6/16 1:26 PM
+ * 描述 describe
+ */
+public class WebViewBridgeConfig {
+ public static final String NAME = "bridge";
+ public static final String TYPE_QQ_SERVICE = "qqService";
+ public static final String TYPE_FEEDBACK = "feedback";
+ public static final String TYPE_USER_ZONE = "userZone";
+ public static final String TYPE_RECHARGE = "recharge";
+ public static final String TYPE_BACK = "onBackPressed";
+
+ public static final String TYPE_GAME_RANK = "gameRank";//游戏排行榜
+ public static final String TYPE_GAME_SOUND = "gameSound";//游戏声音
+ public static final String TYPE_GAME_END = "gameEnd";//游戏结束
+ public static final String TYPE_GAME_PAUSE = "gamePause";//游戏暂停
+ public static final String TYPE_GAME_BEGIN = "gameBegin";//游戏开始
+ public static final String TYPE_GAME_NEXT = "gameNext";//游戏下一关
+
+ private static int gameCount = 0;//游戏次数
+ private String NextGame = "";//上次游戏名称
+ private String title = "";//标题
+ public static final String GAME_EL = "俄罗斯方块";//俄罗斯方块
+ public static final String GAME_XM = "消灭星星";//消灭星星
+ public static final String GAME_SB = "神步伐";//神步伐
+ public static final String GAME_XT = "线条冲刺";//线条冲刺
+ public static final String GAME_FK = "疯狂赛车";//疯狂赛车
+
+ public WebViewBridgeConfig(String title) {
+ this.title = title;
+ }
+ @JavascriptInterface
+ public void postMessage(String json) {
+ Logger.e(json);
+ try {
+ JSONObject jsonObject = new JSONObject(json);
+ String type = jsonObject.getString("type");
+ JSONObject object = jsonObject.getJSONObject("data");
+ switch (type) {
+ case TYPE_QQ_SERVICE:
+ serviceUser();
+ break;
+ case TYPE_FEEDBACK:
+// ActivityUtils.startActivity(FeedBackActivity.class);
+ break;
+ case TYPE_USER_ZONE:
+// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", object.getString("userId")).navigation();
+ break;
+ case TYPE_RECHARGE:
+// ARouter.getInstance().build(ARouters.ME_BALANCE).navigation();
+ break;
+ case TYPE_BACK:
+ try {
+ ActivityUtils.getTopActivity().onBackPressed();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ break;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ //跳转QQ客服
+ private void serviceUser() {
+// RemoteDataSource.getInstance().serviceUser(new BaseObserver() {
+// @Override
+// public void onSubscribe(Disposable d) {
+//
+// }
+//
+// @Override
+// public void onNext(String uin) {
+// try {
+// String qqUrl = "mqqwpa://im/chat?chat_type=wpa&uin=" + uin + "&version=1";
+// ActivityUtils.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(qqUrl)));
+// } catch (Exception e) {
+// ToastUtils.showShort("请先安装QQ");
+// }
+// }
+//
+// @Override
+// public void onComplete() {
+//
+// }
+// });
+ }
+
+
+ /**
+ * H5小游戏语音互动调用
+ *
+ * @param json
+ */
+ @JavascriptInterface
+ public void common(String json) {
+// ThreadUtils.runOnUiThread(new Runnable() {
+// @Override
+// public void run() {
+// Logger.e(json);
+// try {
+// JSONObject jsonObject = new JSONObject(json);
+// String type = jsonObject.getString("type");
+// JSONObject object = jsonObject.getJSONObject("params");
+// switch (type) {
+// case JOIN_LIVE_ROOM:
+// quitLiveRoom();
+// RtcManager.getInstance().setGame(true);
+// RtcManager.getInstance().leaveChannel();
+// //游戏时关闭房间
+// ActivityUtils.finishActivity(RoomActivity.class);
+// BaseApplication.getInstance().isPlaying = false;
+// BaseApplication.getInstance().isShow = false;
+// UserBean userBean = BaseApplication.getInstance().getUser();
+// RtcManager.getInstance().loginRoomGame(object.getString("roomId"), userBean.getUser_id(), userBean.getNickname(), "");
+// break;
+// case LEAVE_LIVE_ROOM:
+// RtcManager.getInstance().leaveChannel(object.getString("roomId"));
+// RtcManager.getInstance().setAudioUrl(null);
+// break;
+// case ROOM_START_PUBLISH_STREAM:
+// RtcManager.getInstance().applyWheat(String.format("%s_%s", object.getString("roomId"), object.getString("userId")));
+// break;
+// case ROOM_STOP_PUBLISH_STREAM:
+// RtcManager.getInstance().downWheat();
+// break;
+// case ROOM_MUTE_LOCAL:
+// RtcManager.getInstance().muteLocalAudioStream(object.getBoolean("mute"));
+// break;
+// case ROOM_MUTE_MICROPHONE:
+// RtcManager.getInstance().muteSpeaker(object.getBoolean("mute"));
+// break;
+// case ROOM_SHOW_MESSAGE_DIALOG:
+// DialogUtils.showDialogFragment(ARouter.getInstance().build(ARouteConstants.ROOM_MSG_DIALOG).navigation());
+// break;
+// case ON_CLOSE_BTN_CLICK:
+// RtcManager.getInstance().leaveChannel();
+// ActivityUtils.finishActivity(H5Activity.class);
+// break;
+// case TYPE_QQ_SERVICE:
+// serviceUser();
+// break;
+// case TYPE_FEEDBACK:
+// ActivityUtils.startActivity(FeedBackActivity.class);
+// break;
+// case TYPE_USER_ZONE:
+// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", object.getString("userId")).navigation();
+// break;
+// case TYPE_RECHARGE:
+// ARouter.getInstance().build(ARouters.ME_BALANCE).navigation();
+// break;
+// case TYPE_BACK:
+// try {
+// ActivityUtils.getTopActivity().onBackPressed();
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// break;
+// //游戏排行榜
+// case TYPE_GAME_RANK:
+// switch (title) {
+// case GAME_EL:
+// AppLogUtil.reportAppLog(AppLogEvent.A050303);
+// break;
+// case GAME_SB:
+// AppLogUtil.reportAppLog(AppLogEvent.A050403);
+// break;
+// case GAME_XM:
+// AppLogUtil.reportAppLog(AppLogEvent.A050503);
+// break;
+// case GAME_XT:
+// AppLogUtil.reportAppLog(AppLogEvent.A050603);
+// break;
+// case GAME_FK:
+// AppLogUtil.reportAppLog(AppLogEvent.A050703);
+// break;
+// }
+// break;
+// //游戏开始
+// case TYPE_GAME_BEGIN:
+// switch (title) {
+// case GAME_EL:
+// if (!TextUtils.isEmpty(NextGame) && GAME_EL.equals(NextGame)) {
+// gameCount++;
+// }
+// break;
+// case GAME_SB:
+// if (!TextUtils.isEmpty(NextGame) && GAME_SB.equals(NextGame)) {
+// gameCount++;
+// }
+// break;
+// case GAME_XM:
+// if (!TextUtils.isEmpty(NextGame) && GAME_XM.equals(NextGame)) {
+// gameCount++;
+// }
+// break;
+// case GAME_XT:
+// if (!TextUtils.isEmpty(NextGame) && GAME_XT.equals(NextGame)) {
+// gameCount++;
+// }
+// break;
+// case GAME_FK:
+// if (!TextUtils.isEmpty(NextGame) && GAME_FK.equals(NextGame)) {
+// gameCount++;
+// }
+// break;
+// }
+// if (gameCount == 0) {
+// gameCount = 1;
+// }
+// break;
+// //游戏结束
+// case TYPE_GAME_END:
+// switch (title) {
+// case GAME_EL:
+// AppLogUtil.reportAppLog(AppLogEvent.A050301, "game_count", String.valueOf(gameCount));
+// break;
+// case GAME_SB:
+// AppLogUtil.reportAppLog(AppLogEvent.A050401, "game_count", String.valueOf(gameCount));
+// break;
+// case GAME_XM:
+// AppLogUtil.reportAppLog(AppLogEvent.A050501, "game_count", String.valueOf(gameCount));
+// break;
+// case GAME_XT:
+// AppLogUtil.reportAppLog(AppLogEvent.A050601, "game_count", String.valueOf(gameCount));
+// break;
+// case GAME_FK:
+// AppLogUtil.reportAppLog(AppLogEvent.A050701, "game_count", String.valueOf(gameCount));
+// break;
+// }
+// break;
+// //游戏下一关
+// case TYPE_GAME_NEXT:
+// switch (title) {
+// case GAME_XM:
+// AppLogUtil.reportAppLog(AppLogEvent.A050504);
+// break;
+// case GAME_XT:
+// AppLogUtil.reportAppLog(AppLogEvent.A050604);
+// break;
+// }
+// break;
+// //游戏暂停
+// case TYPE_GAME_PAUSE:
+// break;
+// //游戏声音
+// case TYPE_GAME_SOUND:
+// switch (title) {
+// case GAME_EL:
+// if (!object.getBoolean("sound")) {
+// AppLogUtil.reportAppLog(AppLogEvent.A050302);
+// }
+// break;
+// case GAME_SB:
+// if (!object.getBoolean("sound")) {
+// AppLogUtil.reportAppLog(AppLogEvent.A050402);
+// }
+// break;
+// case GAME_XM:
+// if (!object.getBoolean("sound")) {
+// AppLogUtil.reportAppLog(AppLogEvent.A050502);
+// }
+// break;
+// case GAME_XT:
+// if (!object.getBoolean("sound")) {
+// AppLogUtil.reportAppLog(AppLogEvent.A050602);
+// }
+// break;
+// case GAME_FK:
+// if (!object.getBoolean("sound")) {
+// AppLogUtil.reportAppLog(AppLogEvent.A050702);
+// }
+// break;
+// }
+// break;
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+// });
+ }
+
+ private void quitLiveRoom() {
+// if (!TextUtils.isEmpty(BaseApplication.getInstance().playId)) {
+// NewApi.getInstance().quit(BaseApplication.getInstance().playId, new com.qpyy.libcommon.api.BaseObserver(false, false) {
+// @Override
+// public void onSubscribe(Disposable d) {
+//
+// }
+//
+// @Override
+// public void onNext(String s) {
+//
+// }
+//
+// @Override
+// public void onComplete() {
+//
+// }
+// });
+// }
+
+ }
+
+// 调用示例:
+// window.bridge.common('{"type":"joinStreamLiveRoom","params":{"roomId":"12445435","userId":"12323 ","mute":false}}');
+// 调用顺序:
+// 1、加入直播间 joinStreamLiveRoom
+// 2、开始推流 startPublishingStreamLiveRoom
+// 3、打开麦克风 muteMicrophoneLiveRoom
+
+ /*
+ 加入直播间 joinStreamLiveRoom
+ params :
+ {
+ "roomId":"房间id",
+ }
+ */
+ public static final String JOIN_LIVE_ROOM = "joinStreamLiveRoom";
+
+ /*
+ 离开流房间 推拉流 leaveStreamLiveRoom
+ params :
+ {
+ "roomId":"房间id",
+ }
+ */
+ public static final String LEAVE_LIVE_ROOM = "leaveStreamLiveRoom";
+
+ /*
+ 开始推流 startPublishingStreamLiveRoom
+ params :
+ {
+ "roomId":"房间id",
+ "userId":"用户ID"
+ }
+ */
+ public static final String ROOM_START_PUBLISH_STREAM = "startPublishingStreamLiveRoom";
+
+ /*
+ 停止推流 stopPublishingStreamLiveRoom
+ params :
+ {
+ "roomId":"房间id",
+ "userId":"用户ID"
+ }
+ */
+ public static final String ROOM_STOP_PUBLISH_STREAM = "stopPublishingStreamLiveRoom";
+
+ /*
+ 是否屏蔽远端所有声音 muteSpeakerLiveRoom
+ params :
+ {
+ mute:true // true为关闭,false为打开
+ }
+ */
+ public static final String ROOM_MUTE_LOCAL = "muteSpeakerLiveRoom";
+
+ /*
+ 是否静音(关闭)麦克风 muteMicrophoneLiveRoom
+ params :
+ {
+ mute:true // true为关闭,false为打开
+ }
+ */
+ public static final String ROOM_MUTE_MICROPHONE = "muteMicrophoneLiveRoom";
+
+
+ /*
+ 点击消息按钮 onMessageBtnClick
+ params :
+ {
+ }
+ */
+ public static final String ROOM_SHOW_MESSAGE_DIALOG = "onMessageBtnClick";
+
+
+ //关闭按钮
+ public static final String ON_CLOSE_BTN_CLICK = "onCloseBtnClick";
+
+}
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 df01a716..beaa11f8 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CirleListAdapter.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CirleListAdapter.java
@@ -1,18 +1,35 @@
package com.qxcm.moduleutil.adapter;
+import static android.view.View.GONE;
+import static android.view.View.VISIBLE;
+import static com.blankj.utilcode.util.ActivityUtils.startActivity;
+
+import android.content.Intent;
+import android.text.SpannableStringBuilder;
+import android.text.Spanned;
+import android.text.TextPaint;
import android.text.TextUtils;
+import android.text.method.LinkMovementMethod;
+import android.text.style.ClickableSpan;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.alibaba.android.arouter.launcher.ARouter;
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.bean.HeatedBean;
import com.qxcm.moduleutil.utils.ImageUtils;
+import com.qxcm.moduleutil.utils.MeHeadView;
+import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.moduleutil.widget.MyGridView;
import com.qxcm.moduleutil.widget.img.FullScreenUtil;
@@ -23,15 +40,21 @@ public class CirleListAdapter extends BaseQuickAdapter{
+ helper.getView(R.id.pinglun).setOnClickListener(v -> {
if (mListener != null) mListener.onPinglunClick(item);
});
+ helper.getView(R.id.rela).setOnClickListener(v -> {
+ if (mListener != null) mListener.onRelaClick(item);
+ });
+ // 为整个 item 设置点击事件
+ helper.itemView.setOnClickListener(v -> {
+ if (mListener != null) {
+ mListener.onPinglunClick(item); // 复用 onHeadImageClick 作为跳转逻辑
+ }
+ });
//昵称
helper.setText(R.id.dy_name_text, item.getNickname());
//头像
- ImageUtils.loadHeadCC(item.getAvatar(), (ImageView) helper.getView(R.id.dy_head_image));
-
+// ImageUtils.loadHeadCC(item.getAvatar(), 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(R.id.dy_lookmore_tv).setVisibility(View.GONE);
- helper.getView(R.id.dy_content_tv).setVisibility(View.GONE);
+ helper.getView(R.id.dy_lookmore_tv).setVisibility(GONE);
+ helper.getView(R.id.dy_content_tv).setVisibility(GONE);
} else {
- helper.getView(R.id.dy_lookmore_tv).setVisibility(View.VISIBLE);
- helper.getView(R.id.dy_content_tv).setVisibility(View.VISIBLE);
+ helper.getView(R.id.dy_lookmore_tv).setVisibility(VISIBLE);
+ helper.getView(R.id.dy_content_tv).setVisibility(VISIBLE);
}
helper.getView(R.id.dy_lookmore_tv).getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
@@ -101,67 +135,97 @@ public class CirleListAdapter extends BaseQuickAdapter= 7) {
- helper.getView(R.id.dy_lookmore_tv).setVisibility(View.VISIBLE);
+ helper.getView(R.id.dy_lookmore_tv).setVisibility(VISIBLE);
helper.getView(R.id.dy_content_tv).getViewTreeObserver().removeOnPreDrawListener(this);//销毁
} else {
- helper.getView(R.id.dy_lookmore_tv).setVisibility(View.GONE);
+ helper.getView(R.id.dy_lookmore_tv).setVisibility(GONE);
helper.getView(R.id.dy_content_tv).getViewTreeObserver().removeOnPreDrawListener(this);//销毁
}
return true;
}
});
- helper.setText(R.id.dy_content_tv, content);
+
if (TextUtils.isEmpty(content)) {
TextView view = helper.getView(R.id.dy_content_tv);
- view.setVisibility(View.GONE);
+ view.setVisibility(GONE);
} else {
TextView view = helper.getView(R.id.dy_content_tv);
- view.setVisibility(View.VISIBLE);
+ view.setVisibility(VISIBLE);
}
+// 创建 SpannableString 来拼接 title 并设置点击事件
+ SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
+ spannableStringBuilder.append(content).append(" "); // 添加原始内容
if (item.getTitle() != null) {
- helper.setVisible(R.id.dy_more_tv, true);
- helper.setText(R.id.dy_more_tv, item.getTitle().replace("#", ""));
- }else {
- helper.setVisible(R.id.dy_more_tv, false);
- }
- //点赞
- helper.setText(R.id.dy_fabulous, item.getLike_num());
- if (item.getIs_like() == 1) {
- TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
- helper.setImageResource(R.id.dianzan_image, R.mipmap.dongtai_hudong_yidianzan);
- } else {
- TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
- helper.setImageResource(R.id.dianzan_image, com.qxcm.moduleutil.R.mipmap.dongtai_hudong_dianzan);
+
+ for (int i = 0; i < item.getTitle().size(); i++) {
+ HeatedBean heatedBean = item.getTitle().get(i);
+ String title = heatedBean != null ? heatedBean.getTitle() : "";
+
+ // 添加 title 到 SpannableString
+ spannableStringBuilder.append(title);
+
+
+ // 创建点击事件和颜色
+ ClickableSpan clickableSpan = new ClickableSpan() {
+ @Override
+ public void onClick(View widget) {
+ // 处理点击事件,比如跳转
+// Intent intent = new Intent(mContext, TargetActivity.class);
+// intent.putExtra("url", item.getUrl()); // 传递 URL 或其他参数
+// mContext.startActivity(intent);
+ }
+
+ @Override
+ public void updateDrawState(TextPaint ds) {
+ super.updateDrawState(ds);
+ ds.setColor(ContextCompat.getColor(mContext, R.color.color_0DFFB9)); // 设置文字颜色
+ ds.setUnderlineText(false); // 去掉下划线
+ }
+ };
+
+ // 设置点击效果
+ spannableStringBuilder.setSpan(clickableSpan, spannableStringBuilder.length() - title.length(), spannableStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+ TextView textView = helper.getView(R.id.dy_content_tv);
+ textView.setMovementMethod(LinkMovementMethod.getInstance()); // 允许点击
+ textView.setHighlightColor(0); // 去掉点击时的背景色
+ textView.setText(spannableStringBuilder);
}
- if (item.getIs_room()!=null && item.getIs_room().equals("0")){
- helper.setVisible(R.id.gensui,false);
- }else {
- helper.setVisible(R.id.gensui,true);
+
+ if (item.getIs_like() == 1) {
+ helper.setImageResource(R.id.dianzan_image, R.mipmap.dongtai_hudong_yidianzan);
+ helper.setText(R.id.dy_fabulous, String.valueOf(Integer.parseInt(item.getLike_num()) + 1));
+ } else {
+ helper.setImageResource(R.id.dianzan_image, com.qxcm.moduleutil.R.mipmap.dongtai_hudong_dianzan);
+ helper.setText(R.id.dy_fabulous, item.getLike_num());
+ }
+
+ if (item.getIs_room() != null && item.getIs_room().equals("0")) {
+ helper.setVisible(R.id.gensui, false);
+ } else if (item.getIs_room() == null) {
+ helper.setVisible(R.id.gensui, false);
+ } else {
+ helper.setVisible(R.id.gensui, true);
}
//分享数
- helper.setText(R.id.dy_zs, item.getRewards_num()!=null ? item.getRewards_num() : "0");
+ helper.setText(R.id.dy_zs, item.getRewards_num() != null ? item.getRewards_num() : "0");
//评论数
helper.setText(R.id.dy_comment, item.getComment_num() + "");
//时间
if (!item.getCreatetime().isEmpty()) {
try {
- helper.setText(R.id.dy_time_text, "发布于:"+TimeUtils.millis2String(Long.parseLong(item.getCreatetime()) * 1000));
+ helper.setText(R.id.dy_time_text, "发布于:" + TimeUtils.millis2String(Long.parseLong(item.getCreatetime()) * 1000));
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
-
- if (item.getImages()!=null) {
-
+ //显示图片
+ if (item.getImages() != null && !item.getImages().isEmpty()) {
String[] arrIv = item.getImages().split(",");
-// String[] arrIv = Arrays.asList(item.getImages().split(",")).toArray(new String[item.getImages().size()]);
- int length = arrIv.length;
-
-
OneImageYuanJiaoAdapter oneImageYuanJiaoAdapter = new OneImageYuanJiaoAdapter(mContext);
MyGridView recyclerView = helper.getView(R.id.dy_image_recyc);
recyclerView.setNumColumns(3);
@@ -171,14 +235,25 @@ public class CirleListAdapter extends BaseQuickAdapter {
FullScreenUtil.showFullScreenDialog(mContext, position, oneImageYuanJiaoAdapter.getList_adapter());
});
}
+ if (item.getLike_list() == null){
+ helper.getView(R.id.rela).setVisibility(GONE);
+ helper.getView(R.id.view).setVisibility(VISIBLE);
+ }else {
+ helper.getView(R.id.rela).setVisibility(VISIBLE);
+ helper.getView(R.id.view).setVisibility(GONE);
+ RecyclerView recyclerView= helper.getView(R.id.recycle_view);
+ recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
+ LikeUserAdapter likeUserAdapter = new LikeUserAdapter();
+ recyclerView.setAdapter(likeUserAdapter);
+ likeUserAdapter.setNewData(item.getLike_list());
+ helper.setText(R.id.pinglun_tv, item.getLike_num()+"人点赞");
+ }
+
}
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CommentAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CommentAdapter.java
index c76eb085..ad1e5141 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CommentAdapter.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/CommentAdapter.java
@@ -1,34 +1,63 @@
package com.qxcm.moduleutil.adapter;
+import static android.view.View.GONE;
+import static android.view.View.VISIBLE;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.ImageView;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.PopupWindow;
import android.widget.TextView;
+import android.widget.Toast;
import androidx.annotation.NonNull;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.fragment.app.FragmentManager;
+import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+import com.blankj.utilcode.util.TimeUtils;
+import com.blankj.utilcode.util.ToastUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.CommentBean;
+import com.qxcm.moduleutil.dialog.ReplyDialogFragment;
import com.qxcm.moduleutil.utils.MeHeadView;
+import com.qxcm.moduleutil.utils.SpUtil;
import java.util.ArrayList;
import java.util.List;
public class CommentAdapter extends RecyclerView.Adapter {
+ public interface OnCommentInteractionListener {
+ void onInputBoxShow(int id,String s,int position,String replyTo);
+ void onDetaleClick(int id,int position);
+ // 新增长按回调
+ void onCommentLongClick(CommentBean.CommentDetailsBean comment, CommentBean.CommentDetailsBean.Replies reply, int position);
+
+ }
+ private OnCommentInteractionListener listener; // 新增监听器引用
+ public void setOnCommentInteractionListener(OnCommentInteractionListener listener) {
+ this.listener = listener;
+ }
private List commentList;
+ private static FragmentManager fragmentManager = null;
public CommentAdapter(List commentList) {
this.commentList = commentList;
}
public void updateData(List newReplyList) {
- commentList.clear();
- commentList.addAll(newReplyList);
- notifyDataSetChanged();
+ DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new CommentDiffCallback(this.commentList, newReplyList));
+ this.commentList.clear();
+ this.commentList.addAll(newReplyList);
+ diffResult.dispatchUpdatesTo(this);
}
@NonNull
@Override
@@ -40,7 +69,7 @@ public class CommentAdapter extends RecyclerView.Adapter());
-// rvReplies.setAdapter(replyAdapter);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(itemView.getContext());
+ rvReplies.setLayoutManager(layoutManager);
+ ReplyAdapter replyAdapter = new ReplyAdapter(new ArrayList<>());
+ rvReplies.setAdapter(replyAdapter);
}
- public void bind(CommentBean.CommentDetailsBean comment) {
+ public void bind(CommentBean.CommentDetailsBean comment, OnCommentInteractionListener listener, int position) {
// 绑定主评论数据
tvNickname.setText(comment.getNickname());
tvContent.setText(comment.getContent());
@@ -79,21 +117,108 @@ public class CommentAdapter extends RecyclerView.Adapter 0) {
+ rvReplies.setVisibility(VISIBLE);
+ replyAdapter.updateData(comment.getReplies());
+
+ // 控制“全部评论...”按钮的显示
+ btnShowAllReplies.setVisibility(comment.getReplies().size() > 2 ? VISIBLE : GONE);
+
+ btnShowAllReplies.setOnClickListener(v -> {
+ replyAdapter.setExpanded(true); // 展开所有评论
+ btnShowAllReplies.setVisibility(GONE); // 隐藏按钮
+ });
+
+ replyAdapter.setOnReplyClickListener((reply, position1) -> {
+ if (listener != null) {
+ // 构造回复内容(如 @用户名)
+ String replyContent = "@" + reply.getNickname() + " ";
+ listener.onInputBoxShow(reply.getPid(), replyContent, getAdapterPosition(),reply.getReply_to()+"");
+ }
+ });
+
+ replyAdapter.setOnReplyLongClickListener((reply, replyPosition) -> {
+ if (listener != null) {
+ // 转发到Activity
+ listener.onCommentLongClick(comment,reply, replyPosition);
+ }
+ });
+ }else {
+ rvReplies.setVisibility(GONE);
+ }
+ }
// 点击回复按钮
btnReply.setOnClickListener(v -> {
- // 弹出输入框让用户输入回复内容
- showReplyDialog(comment.getId());
+
+ if (listener != null) {
+ // 传递需要的参数
+ listener.onInputBoxShow(comment.getId(), "", position,"");
+ }
+
});
+ btnDetale.setOnClickListener(v -> {
+ if (listener != null) {
+ listener.onDetaleClick(comment.getId(), position); // 点击删除按钮
+ }
+ });
+
+ if (comment.getUser_id()!= SpUtil.getUserId()){
+ btnReply.setVisibility(GONE);
+ }else {
+ btnReply.setVisibility(VISIBLE);
+ }
+
+ // 添加长按监听
+ itemView.setOnLongClickListener(v -> {
+ if (listener != null) {
+ listener.onCommentLongClick(comment, null,position);
+ }
+ return true; // 消费事件
+ });
+
}
- private void showReplyDialog(int commentId) {
- // 调用弹窗逻辑,传递 commentId 和 FragmentManager
+ }
+
+ static class CommentDiffCallback extends DiffUtil.Callback {
+
+ private final List oldList;
+ private final List newList;
+
+ public CommentDiffCallback(List oldList, List newList) {
+ this.oldList = oldList;
+ this.newList = newList;
+ }
+
+ @Override
+ public int getOldListSize() {
+ return oldList.size();
+ }
+
+ @Override
+ public int getNewListSize() {
+ return newList.size();
+ }
+
+ @Override
+ public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
+ return oldList.get(oldItemPosition).getId() == newList.get(newItemPosition).getId();
+ }
+
+ @Override
+ public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
+ return oldList.get(oldItemPosition).equals(newList.get(newItemPosition));
}
}
+
}
\ No newline at end of file
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/LikeListAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/LikeListAdapter.java
new file mode 100644
index 00000000..5f01091f
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/LikeListAdapter.java
@@ -0,0 +1,24 @@
+package com.qxcm.moduleutil.adapter;
+
+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.utils.ImageUtils;
+
+public class LikeListAdapter extends BaseQuickAdapter {
+ public LikeListAdapter() {
+ super(R.layout.item_like_list);
+ }
+
+ @Override
+ protected void convert(BaseViewHolder helper, CircleListBean.LikeList item) {
+ ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.like_avatar));
+ helper.setText(R.id.tv_nickname, item.getNickname());
+ String s=item.getSex().equals("1")?"男":"女";
+ String age=item.getAge()+"岁";
+ String constellation=item.getConstellation();
+ String co=s+"/"+age+"/"+constellation;
+ helper.setText(R.id.tv_content, co);
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/LikeUserAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/LikeUserAdapter.java
new file mode 100644
index 00000000..0c6d3d76
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/LikeUserAdapter.java
@@ -0,0 +1,18 @@
+package com.qxcm.moduleutil.adapter;
+
+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.utils.ImageUtils;
+
+public class LikeUserAdapter extends BaseQuickAdapter {
+ public LikeUserAdapter() {
+ super(R.layout.item_like_user);
+ }
+
+ @Override
+ protected void convert(BaseViewHolder helper, CircleListBean.LikeList item) {
+ ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.user_icon));
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/MyFragmentPagerAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/MyFragmentPagerAdapter.java
index d3e7bc07..94a1796a 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/MyFragmentPagerAdapter.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/MyFragmentPagerAdapter.java
@@ -6,10 +6,11 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.fragment.app.FragmentStatePagerAdapter;
import java.util.List;
-public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
+public class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
private List fragmentList;
@@ -18,7 +19,6 @@ public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
super(fm);
this.fragmentList = list;
}
-
@Override
public Fragment getItem(int i) {
return fragmentList.get(i);
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/ReplyAdapter.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/ReplyAdapter.java
index e11ebfe1..c9ddb7a8 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/ReplyAdapter.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/adapter/ReplyAdapter.java
@@ -8,14 +8,34 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
+import com.blankj.utilcode.util.TimeUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.CommentBean;
import java.util.List;
public class ReplyAdapter extends RecyclerView.Adapter {
+ public interface OnReplyClickListener {
+ void onReplyClick(CommentBean.CommentDetailsBean.Replies reply, int position);
+ }
+ // 添加回调接口
+ public interface OnReplyLongClickListener {
+ void onReplyLongClick(CommentBean.CommentDetailsBean.Replies reply, int position);
+ }
+ private OnReplyLongClickListener longClickListener;
+
+ public void setOnReplyLongClickListener(OnReplyLongClickListener listener) {
+ this.longClickListener = listener;
+ }
+ private OnReplyClickListener listener;
+
+ // 设置监听器的方法
+ public void setOnReplyClickListener(OnReplyClickListener listener) {
+ this.listener = listener;
+ }
private List replyList;
+ private boolean isExpanded = false; // 是否展开显示所有评论
public ReplyAdapter(List replyList) {
this.replyList = replyList;
@@ -37,27 +57,60 @@ public class ReplyAdapter extends RecyclerView.Adapter= 2) {
+ return; // 不绑定数据
+ }
+ holder.bind(reply,position, listener,longClickListener);
+ }
+
+ public void setExpanded(boolean expanded) {
+ isExpanded = expanded;
+ notifyDataSetChanged(); // 刷新适配器
}
@Override
public int getItemCount() {
- return replyList.size();
+ return isExpanded ? replyList.size() : Math.min(2, replyList.size());
}
static class ReplyViewHolder extends RecyclerView.ViewHolder {
private TextView tvNickname;
private TextView tvContent;
+ private TextView btnReply;
+ private TextView tvTime;
public ReplyViewHolder(@NonNull View itemView) {
super(itemView);
-// tvNickname = itemView.findViewById(R.id.tv_reply_nickname);
-// tvContent = itemView.findViewById(R.id.tv_reply_content);
+ tvNickname = itemView.findViewById(R.id.tv_name);
+ tvContent = itemView.findViewById(R.id.tv_reply);
+ btnReply = itemView.findViewById(R.id.btn_reply);
+ tvTime = itemView.findViewById(R.id.tv_time);
}
- public void bind(CommentBean.CommentDetailsBean.Replies reply) {
- tvNickname.setText(reply.getNickname());
+ public void bind(CommentBean.CommentDetailsBean.Replies reply,int position, OnReplyClickListener listener,OnReplyLongClickListener longClickListener) {
+
+ tvNickname.setText(reply.getNickname()+":" +(reply.getReply_to_user()!=null?reply.getReply_to_user():""));
tvContent.setText(reply.getContent());
+ tvTime.setText(TimeUtils.millis2String(Long.parseLong(reply.getCreatetime()+"") * 1000));
+ btnReply.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ if (listener != null) {
+ listener.onReplyClick(reply, position);
+ }
+ }
+ });
+
+ // 添加长按监听
+ itemView.setOnLongClickListener(v -> {
+ if (longClickListener != null) {
+ longClickListener.onReplyLongClick(reply, position);
+ return true; // 消费事件
+ }
+ return false;
+ });
+
}
}
}
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 84f2c24d..acf33040 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/base/CommonAppContext.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/base/CommonAppContext.java
@@ -9,16 +9,22 @@ import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
+import android.media.MediaRouter;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Base64;
+import android.util.Log;
import android.webkit.WebView;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;
+import com.alibaba.android.arouter.facade.model.RouteMeta;
+import com.alibaba.android.arouter.facade.template.IRouteGroup;
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.blankj.utilcode.BuildConfig;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ProcessUtils;
@@ -49,6 +55,7 @@ import org.greenrobot.eventbus.EventBus;
import java.lang.reflect.Method;
import java.security.MessageDigest;
+import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -73,15 +80,17 @@ public class CommonAppContext extends MultiDexApplication {
public UserBean mUserBean;
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
private ScheduledExecutorService scheduledExecutorServiceRoom = null;
+
@Override
public void onCreate() {
super.onCreate();
sInstance = this;
- sMainThreadHandler=new Handler();
+ sMainThreadHandler = new Handler();
UtilConfig.init(this);
registerActivityLifecycleCallbacks();
initWebView();
if (ProcessUtils.isMainProcess()) {
+ initARouter();
if (SpUtil.isAgreePolicy()) {
checkInEmulator();
UtilConfig.checkInEmulator();
@@ -90,6 +99,16 @@ public class CommonAppContext extends MultiDexApplication {
EnvironmentPrefs prefs = new EnvironmentPrefs(this);
currentEnvironment = prefs.getSelectedEnvironment();
}
+
+ private void initARouter() {
+ if(BuildConfig.DEBUG) {
+ ARouter.openDebug();
+ ARouter.openLog();
+ }
+ ARouter.init(this);
+
+ }
+
private void initWebView() {
//Android P 以及之后版本不支持同时从多个进程使用具有相同数据目录的WebView
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
@@ -99,6 +118,7 @@ public class CommonAppContext extends MultiDexApplication {
}
}
}
+
public String getProcessName(Context context) {
if (context == null) return null;
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
@@ -109,6 +129,7 @@ public class CommonAppContext extends MultiDexApplication {
}
return null;
}
+
@Override
protected void attachBaseContext(Context base) {
MultiDex.install(this);
@@ -155,6 +176,7 @@ public class CommonAppContext extends MultiDexApplication {
public String getToken() {
return SpUtil.getToken();
}
+
private void registerActivityLifecycleCallbacks() {
registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() {
@Override
@@ -264,26 +286,28 @@ public class CommonAppContext extends MultiDexApplication {
return mFront;
}
- public void startInitSdk(){
+ public void startInitSdk() {
}
public void setUser(UserBean userBean) {
mUserBean = userBean;
SpUtil.saveUserId(userBean.getUser_id());
- SpUtil.saveUserInfo(userBean);
+ SpUtil.saveUserBean(userBean);
SpUtil.putToken(userBean.getToken());
}
public UserBean getUser() {
if (mUserBean == null) {
- mUserBean = SpUtil.getUserInfo();
+ mUserBean = SpUtil.getUserBean();
}
return mUserBean;
}
+
public void setUserBean(UserBean bean) {
mUserBean = bean;
}
+
public void clearLoginInfo() throws ClassNotFoundException {
// mUid = null;
// mToken = null;
@@ -292,14 +316,14 @@ public class CommonAppContext extends MultiDexApplication {
// );
mUserBean = null;
SpUtil.saveUserId(-1);
- SpUtil.saveUserInfo(new UserBean());
+ SpUtil.saveUserBean(new UserBean());
SpUtil.putToken("");
Intent intent = new Intent("com.example.action.LAUNCH_PAGE");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
}
- public static boolean isAlipayInstalled(Context context){
+ public static boolean isAlipayInstalled(Context context) {
try {
context.getPackageManager().getPackageInfo("com.eg.android.AlipayGphone", 0);
return true;//安装了支付宝
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/AlbumBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/AlbumBean.java
index 0b615b45..f780508b 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/AlbumBean.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/AlbumBean.java
@@ -1,5 +1,8 @@
package com.qxcm.moduleutil.bean;
+import com.chad.library.adapter.base.entity.MultiItemEntity;
+
+import java.io.Serializable;
import java.util.List;
import lombok.Data;
@@ -10,7 +13,8 @@ import lombok.Data;
*@description: 相册列表
*/
@Data
-public class AlbumBean {
+public class AlbumBean implements Serializable {
+ private static final long serialVersionUID = 1L;
private String id;//相册id
private String name; //相册名称
@@ -20,13 +24,26 @@ public class AlbumBean {
private String pwd; //相册密码
private String read_num; //相册阅读数
+ private String is_pwd;
+ private String is_like;//是否点赞
+ private String like_num;//点赞数
+ private String count;//图片数量
+ private String user_id;
private List image_list;
@Data
- public class ImageList{
+ public static class ImageList implements MultiItemEntity , Serializable{
+ private static final long serialVersionUID = 1L;
private String id; //图片id
private String image; //图片地址
private String content; //图片描述
private String createtime; //图片创建时间
+ private boolean isSelected; // 用于标记是否被选中
+ private int itemViewType = 1;
+
+ @Override
+ public int getItemType() {
+ return itemViewType;
+ }
}
}
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 0f4980c7..2e9ef6a8 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CircleListBean.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CircleListBean.java
@@ -4,13 +4,18 @@ import java.util.List;
import lombok.Data;
+/**
+ * @author qx
+ * @data 2025/6/3
+ * @description: 这是广场中的列表数据
+ */
@Data
public class CircleListBean {
private int id;//语圈ID
private int user_id;//用户ID
private String nickname;//用户昵称
private String avatar;//用户头像
- private int is_like;//是否点赞(0没有,1点赞)
+ private int is_like;//我是否点赞(0没有,1点赞)
private int sex;//性别 1男2女
private String content;//内容
private String like_num;//点赞数
@@ -22,6 +27,23 @@ public class CircleListBean {
private String ip;//活跃地址
private String images;////图片 JSON字符串 封面获取第一张
private String createtime;//时间
- private String title;//话题
+ private String topic_id;
+ private String share_url;
+ private List title;//话题列表
+
+ private String read_num;//阅读数
+ private List like_list;
+
+
+ @Data
+ public class LikeList {
+ private String user_id;
+ private String nickname;
+ private String avatar;
+ private int age;//年龄
+ private String sex;
+ private String constellation;//星座
+ private String birthday;//生日
+ }
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CommentBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CommentBean.java
index 5e7bdf3f..079a2b4e 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CommentBean.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/CommentBean.java
@@ -15,25 +15,29 @@ public class CommentBean {
private List list;
@Data
public static class CommentDetailsBean {
- private int id;
- private int zone_id;
- private String content;
+ private int id;//评论ID
+ private int zone_id;//动态ID
+ private String content;//评论内容
private int createtime;
- private int user_id;
+ private int user_id;//评论者ID
private String nickname;
private String avatar;
- private int is_author;
+ private int is_author;//评论者是否作者 0不是,1是
private List replies;
@Data
public static class Replies {
- private int zone_id;
+ private int id;//评论ID
+ private int zone_id;//动态ID
private String content;
private int createtime;
- private int user_id;
+ private int user_id;//评论者ID
private String nickname;
private String avatar;
- private int pid;
+ private int pid;//上级评论的ID
+ private int is_author;//评论者是否作者 0不是,1是
+ private int reply_to;//回复给谁的ID
+ private String reply_to_user;
}
}
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 4036a5fd..f6c06378 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/HeatedBean.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/HeatedBean.java
@@ -1,5 +1,8 @@
package com.qxcm.moduleutil.bean;
+import android.os.Parcel;
+import android.os.Parcelable;
+
import lombok.Data;
/**
*@author qx
@@ -7,13 +10,44 @@ import lombok.Data;
*@description: 话题实体
*/
@Data
-public class HeatedBean {
+public class HeatedBean implements Parcelable {
private String title;//话题
private String topic_id;//话题id
private String count;//引用数量
private String pic; //图片
private String content;//内容
- private String id;//话题id
+ protected HeatedBean(Parcel in) {
+ title = in.readString();
+ topic_id = in.readString();
+ count = in.readString();
+ pic = in.readString();
+ content = in.readString();
+ }
+ public static final Creator CREATOR = new Creator() {
+ @Override
+ public HeatedBean createFromParcel(Parcel in) {
+ return new HeatedBean(in);
+ }
+
+ @Override
+ public HeatedBean[] newArray(int size) {
+ return new HeatedBean[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(title);
+ dest.writeString(topic_id);
+ dest.writeString(count);
+ dest.writeString(pic);
+ dest.writeString(content);
+ }
}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserBean.java
index da851ceb..17e2a099 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserBean.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserBean.java
@@ -1,5 +1,7 @@
package com.qxcm.moduleutil.bean;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.List;
@@ -7,7 +9,7 @@ import lombok.Data;
@Data
public class UserBean implements Serializable {
-
+ @SerializedName(value = "id", alternate = "user_id")
private int user_id;
private int user_code;
private String avatar;
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserInfo.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserInfo.java
new file mode 100644
index 00000000..5516cb15
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserInfo.java
@@ -0,0 +1,53 @@
+package com.qxcm.moduleutil.bean;
+
+import java.util.List;
+
+import lombok.Data;
+/**
+ *@author qx
+ *@data 2025/6/3
+ *@description: 个人信息,点击我的获取
+ */
+@Data
+public class UserInfo {
+ private int id; //用户id
+ private String user_code;//用户id码
+ private String avatar;//头像
+ private String nickname;//昵称
+ private int sex;//性别 1男 2女
+ private List icon;//等级图标数组
+ private int follow_num;//关注数
+ private int fans_num;//粉丝数
+ private int look_me_num; //被查看次数,需要魅力等级20以上才能查看
+ private int charm_level; //魅力等级
+ private int is_use_code; //是否是靓号 0否 1是
+ private String tencent_im;
+
+ private String birthday;//生日
+ private String profile;//简介
+ private String home_bgimages;//背景图片
+ private String is_follow;//是否关注
+ private List tag_list;
+ private List gift_wall;
+ private int age;//年龄
+ private String is_room;
+
+// @Data
+// public static class TagList{
+// private String id;
+// private String tag_name;
+// }
+ @Data
+ public static class GiftWall{
+ private String gift_name;
+ private String total;
+
+ private List send_user_info;
+ @Data
+ public static class SendUserInfo{
+ private String nickname;
+ private String avatar;
+ }
+
+ }
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserTagBean.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserTagBean.java
new file mode 100644
index 00000000..72a493bc
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/bean/UserTagBean.java
@@ -0,0 +1,14 @@
+package com.qxcm.moduleutil.bean;
+
+import lombok.Data;
+/**
+ *@author qx
+ *@data 2025/6/4
+ *@description: 用户标签实体
+ */
+@Data
+public class UserTagBean {
+ private String id;
+ private String tag_name;
+ private String createtime;
+}
diff --git a/moduleUtil/src/main/java/com/qxcm/moduleutil/dialog/ReplyDialogFragment.java b/moduleUtil/src/main/java/com/qxcm/moduleutil/dialog/ReplyDialogFragment.java
new file mode 100644
index 00000000..9e2d0bdf
--- /dev/null
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/dialog/ReplyDialogFragment.java
@@ -0,0 +1,96 @@
+package com.qxcm.moduleutil.dialog;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.DialogFragment;
+import androidx.fragment.app.FragmentManager;
+
+import com.blankj.utilcode.util.ToastUtils;
+import com.qxcm.moduleutil.R;
+import com.qxcm.moduleutil.adapter.CommentAdapter;
+
+public class ReplyDialogFragment extends DialogFragment {
+ private static final String TAG = "ReplyDialogFragment";
+ private int commentId;
+ private int position;
+ private OnCommentInteractionListener listener;
+
+ public interface OnCommentInteractionListener {
+ void onInputBoxShow(int id, String content, int position);
+ }
+
+ public static ReplyDialogFragment newInstance(int commentId, int position, OnCommentInteractionListener listener) {
+ ReplyDialogFragment fragment = new ReplyDialogFragment();
+ fragment.commentId = commentId;
+ fragment.position = position;
+ fragment.listener = listener;
+ return fragment;
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.dialog_reply, container, false);
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ EditText etInput = view.findViewById(R.id.et_input);
+ TextView tvSend = view.findViewById(R.id.tv_send);
+
+ etInput.requestFocus();
+ getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
+
+ tvSend.setOnClickListener(v -> {
+ String content = etInput.getText().toString().trim();
+ if (!TextUtils.isEmpty(content) && listener != null) {
+ listener.onInputBoxShow(commentId, content, position);
+ dismiss();
+ } else {
+ ToastUtils.showShort("请输入内容");
+ }
+ });
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ Window window = getDialog().getWindow();
+ if (window != null) {
+ // 设置宽度为 match_parent
+ window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+
+ // 设置位置在底部(可选)
+ window.setGravity(Gravity.BOTTOM);
+
+ // 去除默认背景遮罩
+ window.setBackgroundDrawableResource(android.R.color.transparent);
+ window.getDecorView().setBackgroundColor(0x00000000); // 完全透明
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ // 自动弹出软键盘
+ getDialog().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
+ getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
+ }
+}
+
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 2336a283..b66e86ee 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/ApiServer.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/ApiServer.java
@@ -12,6 +12,8 @@ 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.bean.UserInfo;
+import com.qxcm.moduleutil.bean.UserTagBean;
import com.qxcm.moduleutil.widget.Constants;
import java.util.List;
@@ -53,6 +55,10 @@ public interface ApiServer {
@POST(Constants.SWITCH_ACCOUNTS)
Observable>> switchAccounts(@Field("user_login") String user_id);
+ @FormUrlEncoded
+ @POST(Constants.FORGOT_PASSWORD)
+ Call> forgotPassword(@Field("new_password") String new_password, @Field("mobile") String mobile, @Field("sms_code") String sms_code);
+
@FormUrlEncoded
@POST(Constants.USER_UPDATE)
Observable> userUpdate(@FieldMap Map map);
@@ -92,10 +98,13 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.GET_ALBUM_LIST)
- Observable>> getAlbumList(@Field("page") String page, @Field("page_limit") String page_limit);
+ Observable>> getAlbumList(@Field("page") String page, @Field("page_limit") String page_limit, @Field("user_id") String user_id);
@FormUrlEncoded
@POST(Constants.CREATE_ALBUM)
- Call > createAlbum(@Field("name") String name, @Field("image") String image);
+ Call > createAlbum(@Field("name") String name, @Field("pwd")String pwd, @Field("image") String image);
+ @FormUrlEncoded
+ @POST(Constants.EDIT_ALBUM)
+ Call > editAlbum(@Field("album_id") String album_id,@Field("name") String name, @Field("pwd")String pwd, @Field("image") String image);
@FormUrlEncoded
@POST(Constants.GET_REWARD_LIST)
@@ -118,11 +127,30 @@ public interface ApiServer {
@GET(Constants.GET_CIRCLE_LIST)
Observable>> getCircleList(@Query("page") String page, @Query("page_limit") String page_limit);
+ @FormUrlEncoded
+ @POST(Constants.GET_USER_HOME_ZONE)
+ Observable>> getCircleUserList(@Field("user_id") String user_id,@Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.LIKE_ZONE)
Call> likeZone(@Field("id") String zone_id);
+ @FormUrlEncoded
+ @POST(Constants.TOPIC_ID)
+ Observable>> topicId(@Field("topic_id") String topic_id);
+
+ @FormUrlEncoded
+ @POST(Constants.ZONE_DETAIL)
+ Observable> zoneDetail(@Field("id") String topic_id);
+
+ @FormUrlEncoded
+ @POST(Constants.GET_USER_HOME)
+ Observable> getUserHome(@Field("user_id") String user_id);
+
+ @FormUrlEncoded
+ @POST(Constants.DELETE_COMMENT)
+ Call> deleteComment(@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);
@@ -131,218 +159,61 @@ public interface ApiServer {
@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)
-// Observable> addBank(@Field("token") String token, @Field("bank_num") String bankNum, @Field("cardholder") String cardholder, @Field("bank_type") int bankType,
-// @Field("bank_name") String bankName, @Field("mobile") String mobile, @Field("bank_zhi") String bankZhi, @Field("card_number") String cardNumber,
-// @Field("code") String code
-// );
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.SEND_CODE)
-// Observable> sendCode(@Field("token") String token, @Field("mobile") String mobile, @Field("type") int type);
-//
-// @FormUrlEncoded
-// @POST(URLConstants.CHECK_SMS_CODE)
-// Observable> checkSmsCode(@Field("mobile") String mobile, @Field("code") String code);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.USER_BANK)
-// Observable> getUserBank(@Field("token") String token);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.RECHARGE)
-// Observable> userRecharge(@Field("token") String token, @Field("money") String money, @Field("type") int type);
-// @FormUrlEncoded
-// @POST(Constant.URL.THREE_PARTY_LOGIN)
-// Observable> threePay(@Field("user_id") String userId, @Field("type") int type, @Field("id") String id);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.ALIPAYMENT)
-// Observable> aliPay(@Field("token") String token, @Field("user_id") String userId, @Field("type") int type, @Field("id") String id);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.WXPAYMENT)
-// Observable> wxPay(@Field("token") String token, @Field("user_id") String userId, @Field("type") int type, @Field("id") String id);
-//
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.EDITBANK)
-// Observable> editBank(@Field("token") String token, @Field("cardholder") String cardholder, @Field("bank_name") String bank_name,
-// @Field("mobile") String mobile, @Field("card_number") String card_number, @Field("id") String id,
-// @Field("bank_num") String bank_num, @Field("bank_zhi") String bank_zhi, @Field("code") String code);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.USERWITHDRAW)
-// Observable> userWithdraw(@Field("token") String token, @Field("bank_id") String bank_id, @Field("number") String number, @Field("password") String password);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.LOGIN)
-// Observable> login(@Field("mobile") String mobile, @Field("password") String password, @Field("code") String code, @Field("type") int type);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.LOGIN)
-// Observable> oauthLogin(@Field("netease_token") String netease_token, @Field("access_token") String access_token, @Field("type") int type);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.SETUSERSEX)
-// Observable> setUserSex(@Field("user_id") String user_id, @Field("sex") int sex);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.THIRDPARTYLOGIN)
-// Observable> thirdPartyLogin(@Field("openid") String openid, @Field("three_party") int three_party, @Field("nickname") String nickname,@Field("openid_old") String oldOpenId, @Field("head_pic") String head_pic);
-//
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.EARNINGS)
-// Observable> getEarnings(@Field("token") String token);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.CONVERTEARNINGS)
-// Observable> convertEarnings(@Field("token") String token, @Field("number") String number, @Field("password") String password);
-//
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.CASHLOG)
-// Observable>> getCashLog(@Field("token") String token, @Field("p") int p, @Field("change_type") int change_type);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.BALANCE)
-// Observable> getBalance(@Field("token") String token, @Field("type") int type);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.FOLLOW)
-// Observable> follow(@Field("token") String token, @Field("user_id") String userId, @Field("type") int type);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.FRIENDLIST)
-// Observable>> friendList(@Field("p") int p);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.FOLLOWLIST)
-// Observable>> followList(@Field("p") int p);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.FANSLIST)
-// Observable>> fansList(@Field("p") int p);
-//
-// @POST(Constant.URL.MYINFO)
-// Observable> userInfo();
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.USERINFO)
-// Observable> userInfoData(@Field("user_id") String userId, @Field("emchat_username") String emchatUsername, @Field("visit") int visit);
-//
-// @POST(Constant.URL.VIPINFO)
-// Observable> vipinfo();
-//
-// @POST(Constant.URL.SERVICEUSER)
-// Observable> serviceUser();
-//
-// @POST(Constant.URL.ARTICLE_CATEGORIES)
-// Observable>> articleCategories();
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.ARTICLE_LIST)
-// Observable>> articleList(@Field("article_cat_id") String articleCatId);
-//
-// @POST(Constant.URL.USER_NOBILITYINFO)
-// Observable> userNobilityInfo();
-//
-// @POST(Constant.URL.NOBILITY)
-// Observable>> nobility();
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.BUYNOBILITY)
-// Observable> buyNobility(@Field("nobility_id") String nobilityId);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.RENEWNOBILITY)
-// Observable> renewNobility(@Field("day") String day);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.UPDATE_USERINFO)
-// Observable> updateUserInfo(@Field("signature") String signature, @Field("birthday") String birthday, @Field("constellation") String constellation, @Field("profession") String profession,
-// @Field("city_id") String city_id, @Field("user_photo") String user_photo, @Field("sex") String sex, @Field("head_picture") String head_picture,
-// @Field("nickname") String nickname, @Field("province_id") String province_id, @Field("user_no") String userNo, @Field("county_id") String county_id);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.INDEX_LABEL)
-// Observable>> indexLabel(@Field("category_id") String categoryId, @Field("p") int p);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.ADDLABEL)
-// Observable> addLabel(@Field("ids") String ids);
-//
-// @POST(Constant.URL.CASHTYPE)
-// Observable>> cashType();
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.COMEUSER)
-// Observable>> comeUser(@Field("token") String token, @Field("p") int p);
-//
-// @GET(Constant.URL.APPUPDATE)
-// Observable> appUpdate();
-//
-// @GET(Constant.URL.CHECK_UPDATE)
-// Observable> checkUpdate();
-//
-// @POST(Constant.URL.USER_FILES)
-// Observable> userFiles();
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.BIND_MOBILE)
-// Observable> bindMobile(@Field("mobile") String mobile, @Field("code") String code);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.RESET_PASSWORD)
-// Observable> resetPassword(@Field("mobile") String mobile, @Field("code") String code, @Field("password") String password);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.MESSAGE_SETTING)
-// Observable> messageSetting(@Field("broadcast") int broadcast, @Field("fans") int fans, @Field("news_voice") int news_voice, @Field("news_vibrate") int news_vibrate, @Field("only_friend") int only_friend );
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.USER_BLACK_LIST)
-// Observable>> userBlackList(@Field("p") int page, @Field("keyword") String keyword);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.ADD_BLACK_USER)
-// Observable> removeBlackUser(@Field("black_id") String blackId, @Field("type") int type);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.QUIT_ROOM_WITH_USER_ID)
-// Observable> quitRoomWithUserId(@Field("room_id") String roomId, @Field("user_id") String userId);
-//
-// @POST(Constant.URL.SIGN_SWITCH)
-// Observable> signSwitch();
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.SET_SECOND_PASSWORD)
-// Observable> setSecondPassword(@Field("mobile") String mobile, @Field("password") String password, @Field("code") String code);
-//
-// @FormUrlEncoded
-// @POST(URLConstants.NAME_AUTH)
-// Observable> nameAuth(@Field("userId") String userId, @Field("fullName") String fullName, @Field("idNumber") String idNumber, @Field("idCard") String idCard, @Field("front") String front, @Field("back") String back);
-//
-// @POST(Constant.URL.USER_PHOTO)
-// Observable>> userPhotos();
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.DELETE_USER_PHOTO)
-// Observable> deleteUserPhoto(@Field("id") String ids);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.ADD_USER_PHOTO)
-// Observable> addUserPhoto(@Field("photo") String photo);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.LOGOUT_REASON)
-// Observable> logoutReason(@Field("token") String token, @Field("mobile") String mobile,
-// @Field("reason") String reason,@Field("code") String code);
-//
-// @FormUrlEncoded
-// @POST(Constant.URL.LOGOUT_STATUS)
-// Observable> getlogoutStatus(@Field("token") String token, @Field("mobile") String mobile);
+
+ @FormUrlEncoded
+ @POST(Constants.CLEAR_LOGIN_INFO)
+ Call> clearLoginInfo(@Field("token") String token);
+
+ @FormUrlEncoded
+ @POST(Constants.CANCEL)
+ Call> cancel(@Field("token") String token);
+
+ @FormUrlEncoded
+ @POST(Constants.DELETE_ZONE)
+ Call> deleteZone(@Field("id") String id);
+
+ @GET(Constants.GET_MY_INFO)
+ Observable> getMyInfo();
+
+ @FormUrlEncoded
+ @POST(Constants.ED_USER_INFO)
+ Call> editUserInfo(@Field("nickname") String nickname, @Field("birthday") String birthday, @Field("sex") String sex, @Field("avatar") String avatar, @Field("images") String images, @Field("profile") String profile, @Field("tag_id") String tag_id);
+
+ @FormUrlEncoded
+ @POST(Constants.ED_USER_BG)
+ Call> editUserBg(@Field("images") String images);
+ @GET(Constants.GET_USER_TAG_LIST)
+ Observable>> getUserTagList();
+
+ @FormUrlEncoded
+ @POST(Constants.GET_LIKE_LIST)
+ Observable>> getLikeList(@Field("id") String id);
+
+ @FormUrlEncoded
+ @POST(Constants.GET_ALBUM_DETAIL)
+ Observable> getAlbumDetail(@Field("album_id") String albumId, @Field("pwd") String pwd, @Field("page") String page, @Field("page_limit") String page_limit);
+
+ @FormUrlEncoded
+ @POST(Constants.POST_GZ)
+ Call> userGuanz(@Field("user_id") String userId,@Field("type")String type);
+
+ @FormUrlEncoded
+ @POST(Constants.UP_ALBUM)
+ Call> upAddAlbum(@Field("album_id") String album_id, @Field("images") String images, @Field("content") String content);
+
+ @FormUrlEncoded
+ @POST(Constants.MOVE_ALBUM)
+ Call> moveAlbum(@Field("id") String id,@Field("new_album_id")String new_album_id);
+ @FormUrlEncoded
+ @POST(Constants.DELETE_ALBUM_IMAGE)
+ Call> deleteAlbumImage(@Field("id") String id);
+
+ @FormUrlEncoded
+ @POST(Constants.DELETE_ALBUM)
+ Call> deleteAlbum(@Field("album_id") String id);
+
+ @FormUrlEncoded
+ @POST(Constants.LIKE_ALBUM)
+ Call> likeAlbum(@Field("album_id") String id);
}
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 1f0d1d37..0bdfca04 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseObserver.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/BaseObserver.java
@@ -51,8 +51,13 @@ public abstract class BaseObserver implements Observer {
ToastUtils.show("解析失败");
} else if (e instanceof APIException) {
APIException apiException = (APIException) e;
- if (apiException.getCode() == -1) {
+ if (apiException.getCode() == 301) {
EventBus.getDefault().post(new LogOutEvent());
+ try {
+ CommonAppContext.getInstance().clearLoginInfo();
+ } catch (ClassNotFoundException ex) {
+ throw new RuntimeException(ex);
+ }
}
if (showErrMsg && !TextUtils.isEmpty(apiException.getMessage())) {
ToastUtils.show(apiException.getMessage());
@@ -64,7 +69,8 @@ public abstract class BaseObserver implements Observer {
}
} else if (e instanceof JsonSyntaxException) {
ToastUtils.show("网络请求错误……");
- } else {
+ }
+ else {
ToastUtils.show(e.getMessage());
// CrashReport.postCatchedException(e); //bugly收集错误信息
}
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 d1355f1e..f0434213 100644
--- a/moduleUtil/src/main/java/com/qxcm/moduleutil/http/RetrofitClient.java
+++ b/moduleUtil/src/main/java/com/qxcm/moduleutil/http/RetrofitClient.java
@@ -23,6 +23,9 @@ 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.bean.UserInfo;
+import com.qxcm.moduleutil.bean.UserTagBean;
+import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.moduleutil.utils.SystemUtils;
import com.qxcm.moduleutil.utils.logger.DataLogger;
import com.qxcm.moduleutil.utils.logger.DataLoggingInterceptor;
@@ -190,6 +193,8 @@ public class RetrofitClient {
sApiServer.switchAccounts(loginId).compose(new DefaultTransformer<>()).subscribe(observer);
}
+
+
public void userUpdate(Map map, BaseObserver observer) {
sApiServer.userUpdate(map).compose(new DefaultTransformer<>()).subscribe(observer);
}
@@ -221,39 +226,11 @@ public class RetrofitClient {
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 getAlbumList(String page,String page_limit,String userId,BaseObserver> observer){
+ sApiServer.getAlbumList(page,page_limit,userId).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);
@@ -272,36 +249,6 @@ public class RetrofitClient {
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);
@@ -311,63 +258,46 @@ public class RetrofitClient {
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());
- }
- }
+ public void getCircleUserList(String user_id,String page,String page_limit,BaseObserver> observer){//用户主页动态列表
+ sApiServer.getCircleUserList(user_id,page,page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+ public void topicId(String topic_id,BaseObserver> observer){//动态列表
+ sApiServer.topicId(topic_id).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+ public void zoneDetail(String topic_id,BaseObserver observer){//动态列表
+ sApiServer.zoneDetail(topic_id).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
- }
- }
-
- @Override
- public void onFailure(Call> call, Throwable t) {
- com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
- }
- });
+ public void getUserHome(String user_id,BaseObserver observer){
+ sApiServer.getUserHome(user_id).compose(new DefaultTransformer<>()).subscribe(observer);
}
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>() {
+ public void getMyInfo(BaseObserver observer){//点击我的获取数据
+ sApiServer.getMyInfo().compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void getUserTagList(BaseObserver> observer){
+ sApiServer.getUserTagList().compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void getLikeList(String id,BaseObserver> observer){
+ sApiServer.getLikeList(id).compose(new DefaultTransformer<>()).subscribe(observer);
+ }
+
+ public void getAlbumDetail(String albumId, String pwd,String page,String page_limit,BaseObserver observer){
+ sApiServer.getAlbumDetail(albumId,pwd,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());
- }
- }
-
- }else {
- ToastUtils.showShort("评论失败");
- }
+ onNextRetu(response,observer);
}
@Override
@@ -377,4 +307,288 @@ public class RetrofitClient {
});
}
+
+ public void likeZone(String zone_id,BaseObserver observer){
+ sApiServer.likeZone(zone_id).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void deleteComment(String id,BaseObserver observer){
+ sApiServer.deleteComment(id).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+
+ }
+
+ public void deleteZone(String id,BaseObserver observer){
+ sApiServer.deleteZone(id).enqueue(new Callback>() {
+
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ 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) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void clearLoginInfo(BaseObserver observer){
+ sApiServer.clearLoginInfo(SpUtil.getToken()).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void cancel(BaseObserver observer){
+ sApiServer.cancel(SpUtil.getToken()).enqueue(new Callback>() {
+
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void getPostData(String new_password, String mobile, String code, String userId,BaseObserver observer){
+ sApiServer.getPostData(new_password,mobile,code,userId).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ if (t.toString().contains("登录失效")){
+ try {
+ CommonAppContext.getInstance().clearLoginInfo();
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ });
+ }
+
+ public void forgotPassword(String new_password,String mobile, String sms_code, BaseObserver observer){
+ sApiServer.forgotPassword(new_password,mobile,sms_code).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+ public void createAlbum(String name,String pwd,String image,BaseObserver observer) {
+ sApiServer.createAlbum(name,pwd,image).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void editAlbum(String album_id,String name,String pwd,String image,BaseObserver observer){
+ sApiServer.editAlbum(album_id,name,pwd,image).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void editUserInfo(int type,String nickname, String birthday, String sex, String avatar, String images, String profile, String tag_id,BaseObserver observer){
+ if (type == 1) {
+ sApiServer.editUserInfo(nickname, birthday, sex, avatar, images, profile, tag_id).enqueue(new Callback>() {
+
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ } else{
+ sApiServer.editUserBg(images).enqueue(new Callback>() {
+
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+ }
+
+ public void userGuanz(String user_id,String type,BaseObserver observer){
+ sApiServer.userGuanz(user_id,type).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void upAddAlbum(String album_id,String images,String content,BaseObserver observer){
+ sApiServer.upAddAlbum(album_id,images,content).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void moveAlbum(String id,String new_album_id,BaseObserver observer){
+ sApiServer.moveAlbum(id,new_album_id).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response,observer);
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
+ }
+ });
+ }
+
+ public void deleteAlbum(String id,int type,BaseObserver observer){
+ if (type == 1) {
+ sApiServer.deleteAlbumImage(id).enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ onNextRetu(response, observer);
+ }
+
+ @Override
+ public void onFailure(Call