Compare commits
99 Commits
branch_new
...
837231f4f0
| Author | SHA1 | Date | |
|---|---|---|---|
| 837231f4f0 | |||
| 53b9f0f034 | |||
| f34a67c2e8 | |||
| 6bd210217a | |||
| 6c8065711d | |||
| 5c607c58ae | |||
| f2363dad01 | |||
| 07dbffaa5a | |||
| b028ec883b | |||
| 552e238254 | |||
| 3fde4df00f | |||
| 471a0453fa | |||
| 420afc7a1e | |||
| 6130accb48 | |||
| e2b0c9ce8c | |||
| 894b397537 | |||
| 6207705d2a | |||
| f5fea27595 | |||
| c388d765d4 | |||
| 952621baaa | |||
| df499aaa6c | |||
| 3d8e152cd8 | |||
| 727e343d1f | |||
| ef27636564 | |||
| aa778ca1de | |||
| 90077d24f6 | |||
| 81b41ef392 | |||
| c2714ff68a | |||
| 1fbece3e62 | |||
| 7f4843b023 | |||
| ec3f3d6233 | |||
| 1b06d5725f | |||
| 0874998249 | |||
| b611147176 | |||
| ac9d9b19fd | |||
| ea2b45c1be | |||
| 19bc9dbad8 | |||
| 4b356a6ce4 | |||
| 72a7eecbcd | |||
| 9b7c586d6b | |||
| 41e4dcf2fc | |||
| a512b50343 | |||
| a9af37489e | |||
| e16878b0cf | |||
| 8dcafa37ba | |||
| a7a24b52f9 | |||
| c2f5376ec8 | |||
| 39098757fd | |||
| 7768a8f70b | |||
| 42f786f9ef | |||
| 0c8163277a | |||
| c2096a8274 | |||
| 5fb367e321 | |||
| 14782341f9 | |||
| 724046c9c6 | |||
| b915e9d044 | |||
| f80582a189 | |||
| c200c6c307 | |||
| dce92eb61a | |||
| 56d5d40214 | |||
| 98f8928bc8 | |||
| bc4e9b4bfa | |||
| fda29801b3 | |||
| 13d8e94083 | |||
| be09d0e792 | |||
| ec535432e7 | |||
| c563354117 | |||
| 71fce13074 | |||
| 1746e7a89b | |||
| d63fd43ad2 | |||
| 8faac0f526 | |||
| dfefaae153 | |||
| 23de7e5bf6 | |||
| 37395ccff3 | |||
| ebf29b2aa2 | |||
| f646493800 | |||
| 6825009aba | |||
| 17b562f194 | |||
| 89374e536d | |||
| 0d8b0134d9 | |||
| feb922624f | |||
| 6bae825d0f | |||
| d470b2fdb1 | |||
| ed0eccd0ee | |||
| ecdd2fc063 | |||
| b6bc353db1 | |||
| e386b072f5 | |||
| 3263fbd7f6 | |||
| b5b443e188 | |||
| 9d546717db | |||
| dab7e1e83a | |||
| 8232415cbf | |||
| 611c4829ce | |||
| 2b137643f2 | |||
| 913e92644c | |||
| 531d62ae3a | |||
| 19ce1dbe94 | |||
| 91e222554a | |||
| a9c2bd9878 |
@@ -74,8 +74,7 @@ public class AppUpdateDialog extends BaseDialog<DialogAppUpdateBinding> implemen
|
||||
mProgressDialog.setCanceledOnTouchOutside(false);
|
||||
mProgressDialog.setMessage("下载中请稍等!!!");
|
||||
mProgressDialog.show();
|
||||
DownloadUtil downloadUtil = new DownloadUtil(getContext());
|
||||
downloadUtil.downloadFile(appUpdateModel.getUrl(), this);
|
||||
DownloadUtil downloadUtil = new DownloadUtil(getContext(),appUpdateModel.getUrl(),this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +117,7 @@ public class AppUpdateDialog extends BaseDialog<DialogAppUpdateBinding> implemen
|
||||
mProgressDialog.dismiss();
|
||||
}
|
||||
try {
|
||||
LogUtils.e("installAppSuccess",localPath);
|
||||
AppUtils.installApp(localPath);
|
||||
} catch (Exception e) {
|
||||
Logger.e("installAppError", e);
|
||||
|
||||
@@ -186,7 +186,7 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
|
||||
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(VISIBLE);
|
||||
helper.getView(R.id.dy_lookmore_tv).setVisibility(GONE);
|
||||
helper.getView(R.id.dy_content_tv).setVisibility(VISIBLE);
|
||||
}
|
||||
helper.getView(R.id.dy_lookmore_tv).getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||
@@ -196,7 +196,7 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
|
||||
TextView view = helper.getView(R.id.dy_content_tv);
|
||||
int lineCount = view.getLineCount();
|
||||
if (lineCount >= 7) {
|
||||
helper.getView(R.id.dy_lookmore_tv).setVisibility(VISIBLE);
|
||||
helper.getView(R.id.dy_lookmore_tv).setVisibility(GONE);
|
||||
helper.getView(R.id.dy_content_tv).getViewTreeObserver().removeOnPreDrawListener(this);//销毁
|
||||
} else {
|
||||
helper.getView(R.id.dy_lookmore_tv).setVisibility(GONE);
|
||||
@@ -274,9 +274,11 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
|
||||
}
|
||||
|
||||
if (item.getRoom_id() != null && !item.getRoom_id().equals("0")) {
|
||||
helper.setText(R.id.gensui, "跟随");
|
||||
helper.setText(R.id.gensui, "");
|
||||
helper.getView(R.id.gensui).setBackgroundResource(com.xscm.moduleutil.R.mipmap.gsui);
|
||||
} else if (item.getRoom_id() == null || item.getRoom_id().equals("0")) {
|
||||
helper.setText(R.id.gensui, "私信");
|
||||
helper.setText(R.id.gensui, "");
|
||||
helper.getView(R.id.gensui).setBackgroundResource(com.xscm.moduleutil.R.mipmap.six);
|
||||
}
|
||||
//分享数
|
||||
// helper.setText(R.id.dy_zs, item.getRewards_num() != null ? item.getRewards_num() : "0");
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -80,6 +81,7 @@ public class GiftRoomAdapter extends BaseAdapter {
|
||||
private static RoonGiftModel sGiftModel;
|
||||
private GiftRoomAdapter mAdapter;
|
||||
private RoonGiftModel mGiftModel;
|
||||
|
||||
public void setGiftModel(GiftRoomAdapter adapter, RoonGiftModel gift) {
|
||||
sAdapter = new WeakReference<>(adapter);
|
||||
sGiftModel = gift;
|
||||
@@ -129,7 +131,7 @@ public class GiftRoomAdapter extends BaseAdapter {
|
||||
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.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on);
|
||||
viewHolder.iv_gift_select= (ImageView) convertView.findViewById(R.id.iv_gift_select);
|
||||
viewHolder.iv_gift_select = (ImageView) convertView.findViewById(R.id.iv_gift_select);
|
||||
|
||||
// im_heart现在位于顶层布局中
|
||||
viewHolder.im_heart = (ImageView) convertView.findViewById(R.id.im_heartssss);
|
||||
@@ -140,25 +142,37 @@ public class GiftRoomAdapter extends BaseAdapter {
|
||||
|
||||
viewHolder.item_layout.setOnClickListener(v -> {
|
||||
// RoonGiftModel clickedModel = (RoonGiftModel) v.getTag();
|
||||
if (giftModel.getIs_lock()==0) {
|
||||
if (giftModel.getIs_lock() == 0) {
|
||||
EventBus.getDefault().post(new RoomGiftClickToEvent(this, giftModel, 1));
|
||||
}else if (giftModel.getIs_lock()==1){
|
||||
} else if (giftModel.getIs_lock() == 1) {
|
||||
ToastUtils.show("当前属于爵位礼物,请开通爵位");
|
||||
}
|
||||
});
|
||||
if (giftModel.getIs_lock()==0){
|
||||
if (giftModel.getIs_lock() == 0) {
|
||||
viewHolder.iv_gift_select.setVisibility(GONE);
|
||||
}else {
|
||||
} else {
|
||||
viewHolder.iv_gift_select.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
if (giftModel.getIs_cp()==0) {//这是cp礼物
|
||||
viewHolder.im_heart.setVisibility(GONE);
|
||||
if (TextUtils.isEmpty(giftModel.getIcon())) {
|
||||
viewHolder.im_heart.setVisibility(GONE);
|
||||
}else {
|
||||
if (viewHolder.im_heart != null) {
|
||||
viewHolder.im_heart.setVisibility(VISIBLE);
|
||||
}
|
||||
ImageUtils.loadHead(giftModel.getIcon(), viewHolder.im_heart);
|
||||
}
|
||||
|
||||
// if (giftModel.getIs_cp() == 0 && giftModel.getIs_teacher() == 0 ) {//这是cp礼物
|
||||
// viewHolder.im_heart.setVisibility(GONE);
|
||||
// } else {
|
||||
// if (viewHolder.im_heart != null) {
|
||||
// viewHolder.im_heart.setVisibility(VISIBLE);
|
||||
// if (giftModel.getIs_cp() == 1) {
|
||||
// viewHolder.im_heart.setImageResource(R.mipmap.icon_heart);
|
||||
// }else if (giftModel.getIs_teacher() == 1) {
|
||||
// viewHolder.im_heart.setImageResource(R.mipmap.icon_teacher);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/*
|
||||
* 在给View绑定显示的数据时,计算正确的position = position + curIndex * pageSize,
|
||||
*/
|
||||
|
||||
@@ -297,12 +297,18 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
roonGiftModel.setNum(giftModel.getNum());
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
if (!giftModel.isChecked()) {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
|
||||
giftModel.setChecked(true);
|
||||
roonGiftModel.setChecked(giftModel.isChecked());
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
|
||||
}else {
|
||||
giftModel.setChecked(false);
|
||||
roonGiftModel.setChecked(giftModel.isChecked());
|
||||
}
|
||||
} else {
|
||||
giftModel.setChecked(false);
|
||||
roonGiftModel.setChecked(giftModel.isChecked());
|
||||
}
|
||||
|
||||
}
|
||||
if (event.adapter != null && event.adapter.get() != null) {
|
||||
event.adapter.get().notifyDataSetChanged();
|
||||
@@ -321,13 +327,20 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
selGift = giftModel;
|
||||
if (!giftModel.isChecked()) {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
|
||||
giftModel.setChecked(true);
|
||||
roonGiftModel.setChecked(giftModel.isChecked());
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
|
||||
}else {
|
||||
giftModel.setChecked(false);
|
||||
roonGiftModel.setChecked(giftModel.isChecked());
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
|
||||
}
|
||||
} else {
|
||||
giftModel.setChecked(false);
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
|
||||
roonGiftModel.setChecked(giftModel.isChecked());
|
||||
// EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, roonGiftModel));
|
||||
}
|
||||
|
||||
}
|
||||
if (event.adapter != null && event.adapter.get() != null) {
|
||||
event.adapter.get().notifyDataSetChanged();
|
||||
|
||||
@@ -161,7 +161,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
//设置mqtt环境 false 测试环境 true 正式环境
|
||||
// ExternalResConstants.INSTANCE.setIS_MQTT_RELEASE(false);
|
||||
//设置http环境 false 测试环境 true 正式环境
|
||||
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(false);
|
||||
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(true);
|
||||
currentEnvironment = ExternalResConstants.INSTANCE.HTTP_PATH();
|
||||
|
||||
initialization();
|
||||
|
||||
@@ -16,6 +16,6 @@ public class BlackUserBean {
|
||||
private int sex;
|
||||
private String user_code;
|
||||
private int is_online;
|
||||
private int is_follow;
|
||||
private int is_follow;// 是否关注 0:未关注 1:已关注 2:别人关注了你,你没有关注别人,这个2只会在粉丝中使用
|
||||
private List<String> icon;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xscm.moduleutil.bean
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2025/12/21 11:37
|
||||
* 用途:盲盒转盘状态
|
||||
*/
|
||||
class BlindBoxStatus {
|
||||
var gift_bag_id: Int = 0
|
||||
var name: String = ""
|
||||
var status: Int = 0 //0关闭 1开启
|
||||
var status_str: String = ""
|
||||
var icon: String = ""
|
||||
|
||||
// "gift_bag_id": 11,
|
||||
// "name": "岁月之城",
|
||||
// "status": 1,
|
||||
// "status_str": "开启中",
|
||||
// "icon": null
|
||||
}
|
||||
@@ -3,16 +3,18 @@ package com.xscm.moduleutil.bean;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/27
|
||||
*@description: 礼盒数据
|
||||
* @author qx
|
||||
* @data 2025/5/27
|
||||
* @description: 礼盒数据
|
||||
*/
|
||||
@Data
|
||||
public class GiftBoxBean {
|
||||
private String user_gold;//累计获取的金币
|
||||
private List<GiftBean> gift_box_list;
|
||||
private TaskDataBean tasks;
|
||||
private List<TaskDataBean> tasks;
|
||||
|
||||
@Data
|
||||
public static class GiftBean {
|
||||
// private String giftName; //初级礼盒、高级礼盒
|
||||
@@ -21,10 +23,25 @@ public class GiftBoxBean {
|
||||
// private String giftTypeNumber; //当前的百分比
|
||||
// private String giftTypeStatus; //是否已经可以
|
||||
|
||||
|
||||
/*{
|
||||
"id":2,
|
||||
"name":"高级礼盒",
|
||||
"title":"最高可获得10000金币",
|
||||
"icon":"",
|
||||
"highest_gain":"10000",
|
||||
"meet":"300",
|
||||
"unlock_progress":0,
|
||||
"all_number":"1",
|
||||
"taday_number":0,
|
||||
"taday_number_left":1,
|
||||
"status":0,
|
||||
"status_str":"未解锁"
|
||||
}*/
|
||||
private String id;//礼盒ID
|
||||
private String name;//礼盒名称
|
||||
private String title; //标题
|
||||
private String icon ;//图标
|
||||
private String icon;//图标
|
||||
private String highest_gain;//最高获得金币数
|
||||
private String meet;//满多少金币可抽
|
||||
private String unlock_progress;// //解锁进度
|
||||
@@ -37,25 +54,63 @@ public class GiftBoxBean {
|
||||
|
||||
@Data
|
||||
public static class TaskDataBean {
|
||||
private List<DailyTasksBean> daily_tasks;
|
||||
private List<DailyTasksBean> daily_tasks_special;
|
||||
private List<DailyTasksBean> usual_tasks;
|
||||
private List<DailyTasksBean> teacher_tasks;
|
||||
private List<DailyTasksBean> task_list;
|
||||
// private List<DailyTasksBean> daily_tasks_special;
|
||||
// private List<DailyTasksBean> usual_tasks;
|
||||
// private List<DailyTasksBean> teacher_tasks;
|
||||
|
||||
private int task_type_id;
|
||||
private String task_type_name;
|
||||
private int is_lock;//锁:0 不开启锁 1 开启锁
|
||||
private int wait_reward_num;//待领取奖励数量
|
||||
@Data
|
||||
public static class DailyTasksBean {
|
||||
private int task_id;////任务Id
|
||||
private String task_name;//任务名称
|
||||
private String icon;//图标
|
||||
private int gold_reward; //奖励金币
|
||||
private int target_quantity;//目标完成数量
|
||||
private int task_type;//任务类型 1每日任务 2每日特殊任务 3平台常规任务
|
||||
private int task_status;//任务状态:1完成 2去领取 3已领取
|
||||
private String task_type_str; //任务状态
|
||||
private int processing_type;//跳转状态:
|
||||
private String processing_type_str;//跳转状态
|
||||
private String from_id;
|
||||
private int reward_type;//1:金币 2:钻石
|
||||
|
||||
/* {
|
||||
"task_id":20,
|
||||
"icon":null,
|
||||
"task_name":"每日在房间时长 15 分钟(0/15)",
|
||||
"target_quantity":900,
|
||||
"task_type":2,
|
||||
"jump_type":4,
|
||||
"tasks_bag_id":0,
|
||||
"task_status":1,
|
||||
"task_type_str":"去完成",
|
||||
"jump_type_str":"跳转房间",
|
||||
"from_id":6040,
|
||||
"is_time":1,
|
||||
"processing_type":2,
|
||||
"processing_type_str":"去观看",
|
||||
"reward_str":"25金币,笨笨狗x1,
|
||||
仙女之星头像框,
|
||||
三八大杠"
|
||||
}*/
|
||||
|
||||
private int task_id;////任务Id
|
||||
private String icon;//图标
|
||||
private String task_name;//任务名称
|
||||
private int target_quantity;//目标完成数量
|
||||
private int task_type;//任务类型 1每日任务 2每日特殊任务 3平台常规任务
|
||||
/**
|
||||
* 0 不跳转
|
||||
* 1 跳转实名
|
||||
* 2 跳转我的相册
|
||||
* 3 跳转绑定管理
|
||||
* 4 跳转房间
|
||||
* 5 跳转申请加入公会
|
||||
* 6 跳转充值
|
||||
*/
|
||||
private int jump_type; //跳转类型
|
||||
private int tasks_bag_id; //任务礼盒ID
|
||||
private int task_status;//任务状态:1完成 2去领取 3已领取
|
||||
private String task_type_str; //任务状态
|
||||
private String jump_type_str; //跳转类型提示
|
||||
private String from_id;
|
||||
private int is_time;
|
||||
private int processing_type;//跳转状态:
|
||||
private String processing_type_str;//跳转状态
|
||||
private String reward_str;//1:奖励
|
||||
private String student_id;//徒弟ID
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public class MyRoomBean {
|
||||
private String come_count; //房间进入数
|
||||
private Double today_income; //今日收益;
|
||||
private int earnings_ratio;//房间收益比例
|
||||
private String lucky_water="";//房间幸运流水
|
||||
|
||||
@Data
|
||||
static class CpRoom {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class PlaceholderBean {
|
||||
private String nickname1;
|
||||
private String avatar;
|
||||
private String total;
|
||||
private String rank;
|
||||
private String rank="";
|
||||
private List<String> icon;
|
||||
private String room_name;
|
||||
private String room_id;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RoomMessageEvent extends BaseEvent {
|
||||
private List<RoomAuction.AuctionListBean> auction_list; //拍卖列表
|
||||
private long duration;//时间
|
||||
private RoomAuction.AuctionListBean recipient;//是否成功,有值的是成功的,没有值的时候,是失败的
|
||||
private int type;//拍卖者,1:上麦、2:下麦
|
||||
private int type;//拍卖者,1:上麦、2:下麦 暴币的时候,1是大奖 2:是小奖
|
||||
private String hot_value;
|
||||
private String SendRoomId;//发起者所在的房间ID
|
||||
private String AcceptRoomId;//接收者所在的房间id
|
||||
@@ -111,6 +111,11 @@ public class RoomMessageEvent extends BaseEvent {
|
||||
private String sign_day;//被签约天数
|
||||
private String current_body_value;//被签约身价
|
||||
|
||||
private String status = "";
|
||||
private String from_id = "";
|
||||
|
||||
private String play_image;//暴币播放动画地址
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -34,8 +34,10 @@ public class RoonGiftModel {
|
||||
private int activities_id;//4:盲盒 ;5:天空之境;
|
||||
private int gift_bag;//10:天空之境 11:岁月之城 12:时空之巅
|
||||
private int is_lock;//爵位礼物 0:不锁 1:锁
|
||||
private String icon="";//礼物标签图片
|
||||
|
||||
private int is_cp;//1:是 0:不是
|
||||
private int is_cp;//1:是 0:不是 是不是cp心动礼物
|
||||
private int is_teacher;//1:是 0:不是 是不是师徒礼物
|
||||
public boolean isCan_send_self() {
|
||||
if ( isManghe()) {
|
||||
return true;
|
||||
|
||||
115
BaseModule/src/main/java/com/xscm/moduleutil/bean/SignInData.kt
Normal file
@@ -0,0 +1,115 @@
|
||||
package com.xscm.moduleutil.bean
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2025/12/12 10:35
|
||||
* 用途:签到实体类
|
||||
*/
|
||||
class SignInData : MultiItemEntity{
|
||||
val TYPE_NORMAL: Int = 0 // 普通类型,使用day_sgin布局
|
||||
val TYPE_DOUBLE: Int = 1 // 双倍宽度类型,使用day_sgin2布局
|
||||
var viewType: Int = TYPE_NORMAL // 默认为普通类型
|
||||
|
||||
var day: Int = 0 //第几天
|
||||
var sign_in_date: String = "" //日期
|
||||
var sign_in_status: Int = 0 // 签到状态:1已签到 0未签到
|
||||
var sign_in_status_str: String = "" //已签到
|
||||
var is_today: Int = 0 //是否是当天 0否 1是
|
||||
var gift_name: String = "" //礼物名称
|
||||
var num: String = "" //数量
|
||||
var gift_price: Int = 0 //价格
|
||||
var type: Int = 0 //类型: 1金币 2礼物 3装扮 4钻石
|
||||
var base_image: String = "" //礼物图片
|
||||
override fun getItemType(): Int {
|
||||
return viewType
|
||||
}
|
||||
|
||||
/* "gift_bag": [
|
||||
{
|
||||
"day": 1, //第几天
|
||||
"sign_in_date": "2025-12-09", //日期
|
||||
"sign_in_status": 1, //签到状态:1已签到 0未签到
|
||||
"sign_in_status_str": "已签到",
|
||||
"is_today": 0, //是否是当天 0否 1是
|
||||
"gift_name": "金币", //礼物名称
|
||||
"num": 1, //数量
|
||||
"gift_price": 1, //价格
|
||||
"type": 1, //类型: 1金币 2礼物 3装扮 4钻石
|
||||
"base_image": "https://test.vespa.qxyushen.top/static/image/icon/gold.png" //礼物图片
|
||||
},
|
||||
{
|
||||
"day": 2,
|
||||
"sign_in_date": "2025-12-10",
|
||||
"sign_in_status": 1,
|
||||
"sign_in_status_str": "已签到",
|
||||
"is_today": 0,
|
||||
"gift_name": "打工狗",
|
||||
"num": "1 个",
|
||||
"gift_price": "9",
|
||||
"type": 2,
|
||||
"base_image": "https://cos.xscmmidi.site/admin/3143tianxuanbanzhuangou_17615346376493.png"
|
||||
},
|
||||
{
|
||||
"day": 3,
|
||||
"sign_in_date": "2025-12-11",
|
||||
"sign_in_status": 1,
|
||||
"sign_in_status_str": "已签到",
|
||||
"is_today": 0,
|
||||
"gift_name": "神皇",
|
||||
"num": "3 天",
|
||||
"gift_price": 30,
|
||||
"type": 3,
|
||||
"base_image": "https://midi01.oss-cn-beijing.aliyuncs.com/5544shenhuang_17579016149523.png"
|
||||
},
|
||||
{
|
||||
"day": 4,
|
||||
"sign_in_date": "2025-12-12",
|
||||
"sign_in_status": 1,
|
||||
"sign_in_status_str": "已签到",
|
||||
"is_today": 1,
|
||||
"gift_name": "心动喷发",
|
||||
"num": "2 个",
|
||||
"gift_price": "100",
|
||||
"type": 2,
|
||||
"base_image": "https://cos.xscmmidi.site/admin/3300xindongpenfa_17615347008740.png"
|
||||
},
|
||||
{
|
||||
"day": 5,
|
||||
"sign_in_date": "2025-12-13",
|
||||
"sign_in_status": 0,
|
||||
"sign_in_status_str": "未签到",
|
||||
"is_today": 0,
|
||||
"gift_name": "钻石",
|
||||
"num": 20,
|
||||
"gift_price": 1,
|
||||
"type": 4,
|
||||
"base_image": "https://test.vespa.qxyushen.top/static/image/icon/gold.png"
|
||||
},
|
||||
{
|
||||
"day": 6,
|
||||
"sign_in_date": "2025-12-14",
|
||||
"sign_in_status": 0,
|
||||
"sign_in_status_str": "未签到",
|
||||
"is_today": 0,
|
||||
"gift_name": "王者之戒",
|
||||
"num": "1 个",
|
||||
"gift_price": "19",
|
||||
"type": 2,
|
||||
"base_image": "https://cos.xscmmidi.site/admin/5390wangzhezhijie_17615353361010.png"
|
||||
},
|
||||
{
|
||||
"day": 7,
|
||||
"sign_in_date": "2025-12-15",
|
||||
"sign_in_status": 0,
|
||||
"sign_in_status_str": "未签到",
|
||||
"is_today": 0,
|
||||
"gift_name": "财源滚滚",
|
||||
"num": "30 天",
|
||||
"gift_price": 288,
|
||||
"type": 3,
|
||||
"base_image": "https://midi01.oss-cn-beijing.aliyuncs.com/2160caiyuangunguntouxiangkuang_17579008394073.png"
|
||||
}
|
||||
]*/
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xscm.moduleutil.bean
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2025/12/16 11:35
|
||||
* 用途:任务未领取角标
|
||||
*/
|
||||
class TasksMessage {
|
||||
var num: Int=0
|
||||
var not_received_tasks_num : Int=0 //任务未领取奖励数 这是心跳中返回的参数,用于展示任务未领取角标,是在房间内展示的
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xscm.moduleutil.bean
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2025/12/12 14:54
|
||||
* 用途:签到状态
|
||||
*/
|
||||
class TasksSignStatus {
|
||||
var status : Int=0
|
||||
var status_str: String=""
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.xscm.moduleutil.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -9,8 +11,9 @@ public class UserResultResp {
|
||||
private String user_id;
|
||||
private String user_code;
|
||||
private String nickname;
|
||||
private String head_picture;
|
||||
private String sex;
|
||||
private String avatar;
|
||||
private int sex;
|
||||
private List<String> icon;
|
||||
private String follow;
|
||||
private String fans_count;
|
||||
private String online_text;
|
||||
|
||||
@@ -11,10 +11,21 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
public static final int QXRoomMessageTypeJoin = 1001;
|
||||
/// 用户退出房间
|
||||
public static final int QXRoomMessageTypeQuit = 1002;
|
||||
|
||||
//================================================================================================麦上变化=================================================================
|
||||
/// 用户上麦
|
||||
public static final int QXRoomMessageTypeUpSeat = 1003;
|
||||
/// 用户下麦
|
||||
public static final int QXRoomMessageTypeDownSeat = 1004;
|
||||
/// 拍卖者被拉上麦
|
||||
public static final int QXRoomMessageTypeAuctionIsUp = 1022;
|
||||
/// 竞拍开始,竞拍麦位发生变化
|
||||
public static final int QXRoomMessageTypeAuctionIsStart = 1024;
|
||||
/// 互娱 麦位发生变化
|
||||
public static final int QXRoomMessageTypeSeatDidChanged = 1053;
|
||||
/// 房间内换麦
|
||||
public static final int QXRoomMessageTypehm = 1039;
|
||||
//==============================================================================================end=================================================================
|
||||
/// 房间收到礼物
|
||||
public static final int QXRoomMessageTypeGift = 1005;
|
||||
/// 设置管理员
|
||||
@@ -48,12 +59,11 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
public static final int QXRoomMessageTypeRoomUpdate = 1020;
|
||||
/// 清除魅力值
|
||||
public static final int QXRoomMessageTypeRoom = 1021;
|
||||
/// 拍卖者被拉上麦
|
||||
public static final int QXRoomMessageTypeAuctionIsUp = 1022;
|
||||
|
||||
|
||||
/// 拍卖者拍卖开始
|
||||
public static final int QXRoomMessageTypeAuctionIsSelected = 1023;
|
||||
/// 竞拍开始,竞拍麦位发生变化
|
||||
public static final int QXRoomMessageTypeAuctionIsStart = 1024;
|
||||
|
||||
/// 竞拍结束
|
||||
public static final int QXRoomMessageTypeAuctionIsEnd = 1025;
|
||||
/// 主持延时
|
||||
@@ -101,8 +111,7 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
public static final int QXRoomMessageTypeRoomFriendCreateRelation = 1051;
|
||||
/// 私密小屋结束时间发生延时
|
||||
public static final int QXRoomMessageTypeCabinTimeDelay = 1052;
|
||||
/// 麦位发生变化
|
||||
public static final int QXRoomMessageTypeSeatDidChanged = 1053;
|
||||
|
||||
/// 心动值发生变化
|
||||
public static final int QXRoomMessageTypeHeartDidChanged = 1054;
|
||||
/// 小黑屋有人退出房间
|
||||
@@ -129,8 +138,7 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
//已点歌曲数量
|
||||
public static final int QXRoomMessageTypeSongerNum = 1072;
|
||||
|
||||
/// 房间内换麦
|
||||
public static final int QXRoomMessageTypehm = 1039;
|
||||
|
||||
public static final int QXRoomMessageTypeCPText = 1080;//CP特效,进入房间的特效,
|
||||
/// 签约开始
|
||||
public static final int QXRoomMessageTypeSignStartText = 1090;
|
||||
@@ -150,6 +158,8 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
|
||||
/// 被签约者提示弹窗
|
||||
public static final int QXRoomMessageTypeSignTipText = 1094;
|
||||
/// 暴币展示动画列表
|
||||
public static final int QXRoomMessageTypeSignChat = 1100;
|
||||
private RoomMessageEvent emMessage;
|
||||
|
||||
private int custom = 0;
|
||||
@@ -204,6 +214,7 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
case QXRoomMessageTypeRoomFriendPartDidChanged:
|
||||
case QXRoomMessageTypeSeatDidChanged:
|
||||
case QXRoomMessageTypehm:
|
||||
case QXRoomMessageTypeSignChat:
|
||||
return 1;
|
||||
case QXRoomMessageTypeRoomOMh:
|
||||
case QXRoomMessageTypeGift:
|
||||
|
||||
@@ -26,7 +26,7 @@ public class RoomInfoResp implements Serializable {
|
||||
private RoomOrderDemand demand;//嘉宾需求
|
||||
private int rejoin;
|
||||
private int is_show_self;//盲盒是否送自己
|
||||
private MusicSongBean song_user_info;
|
||||
private MusicSongBean song_user_info;//ktv
|
||||
private MusicSongBean nextInfo;
|
||||
private RoomAuction room_auction;//拍卖房信息
|
||||
private RoomCpUserBean cp_user;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.xscm.moduleutil.bean.room;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoomOnline {
|
||||
public class RoomOnline implements Serializable {
|
||||
|
||||
private List<RoomOnlineBean> on_pit;//麦上用户
|
||||
private List<RoomOnlineBean> off_pit;//麦下用户
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.xscm.moduleutil.bean.room;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -12,7 +13,7 @@ import lombok.Data;
|
||||
* @description: 房间在线列表
|
||||
*/
|
||||
@Data
|
||||
public class RoomOnlineBean implements MultiItemEntity {
|
||||
public class RoomOnlineBean implements MultiItemEntity, Serializable {
|
||||
private int itemViewType;
|
||||
private String typeNames;
|
||||
private int user_id;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.xscm.moduleutil.bean.room;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -57,6 +59,10 @@ public class RoomSettingBean implements MultiItemEntity {
|
||||
public static final int QXRoomSettingTypeRoomFloatingScreen = 29;//关闭飘屏
|
||||
public static final int QXRoomSettingTypeRoomFloatingRed = 30;//红包
|
||||
|
||||
public static final int QXRoomSettingTypeRoomTheCityYears = 33;//岁月之城
|
||||
public static final int QXRoomSettingTypeRoomTimeSpace = 34;//时空之巅
|
||||
public static final int QXRoomSettingTypeRoomTimeRedSound = 35;//红包声音
|
||||
|
||||
public static final int ITEM_TYPE_DEFAULT = 0;
|
||||
public static final int ITEM_TYPE_WITH_ICON = 1;
|
||||
|
||||
@@ -70,7 +76,7 @@ public class RoomSettingBean implements MultiItemEntity {
|
||||
private boolean isSelected;//是否在麦位上
|
||||
private boolean status;
|
||||
private boolean select;//是否选中
|
||||
|
||||
private List<RoomSettingBean> children; // 新增子项列表
|
||||
|
||||
public RoomSettingBean(String name, String icon, String selectName, String selectIcon, int type, int read, boolean isSelected, boolean status, boolean select) {
|
||||
this.name = name;
|
||||
@@ -96,6 +102,7 @@ public class RoomSettingBean implements MultiItemEntity {
|
||||
this.itemType = ITEM_TYPE_WITH_ICON;
|
||||
}
|
||||
}
|
||||
|
||||
// public void updateItemType() {
|
||||
// switch (type) {
|
||||
// case QXRoomSettingTypeRoomSubsidy:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xscm.moduleutil.dialog;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
@@ -36,6 +37,7 @@ public class ConfirmDialog extends Dialog {
|
||||
private int countdownSeconds = 0; // 倒计时秒数
|
||||
private CountDownTimer countDownTimer; // 倒计时对象
|
||||
|
||||
private Context context;
|
||||
|
||||
public ConfirmDialog(Context context, String title, String message,
|
||||
String positiveButtonText, String negativeButtonText,
|
||||
@@ -43,6 +45,7 @@ public class ConfirmDialog extends Dialog {
|
||||
View.OnClickListener negativeButtonClickListener,
|
||||
boolean isCountdownEnabled, int countdownSeconds) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
this.positiveButtonText = positiveButtonText;
|
||||
@@ -60,6 +63,7 @@ public class ConfirmDialog extends Dialog {
|
||||
View.OnClickListener negativeButtonClickListener,
|
||||
boolean isCountdownEnabled, int countdownSeconds) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
this.title = title;
|
||||
this.spannableMessage = spannableMessage;
|
||||
this.positiveButtonText = positiveButtonText;
|
||||
@@ -178,6 +182,12 @@ public class ConfirmDialog extends Dialog {
|
||||
countDownTimer.cancel(); // 取消倒计时
|
||||
countDownTimer = null;
|
||||
}
|
||||
if (context instanceof Activity) {
|
||||
Activity activity = (Activity) context;
|
||||
if (activity.isFinishing() || activity.isDestroyed()) {
|
||||
return; // Don't try to dismiss if activity is gone
|
||||
}
|
||||
}
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,11 @@ import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.AppPay;
|
||||
import com.xscm.moduleutil.bean.BindType;
|
||||
import com.xscm.moduleutil.bean.RechargeBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.databinding.FragmentRechargeDialogBinding;
|
||||
import com.xscm.moduleutil.presenter.RechargeDialogContacts;
|
||||
import com.xscm.moduleutil.presenter.RechargeDialogPresenter;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.PaymentUtil;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
@@ -142,6 +144,9 @@ public class RechargeDialogFragment extends BaseMvpDialogFragment<RechargeDialog
|
||||
}else{
|
||||
mBinding.r4.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvPayment, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvPayment.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,13 +45,13 @@ public class GiftLotteryAdapter extends BaseQuickAdapter<GiftBean, BaseViewHolde
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||
helper.setText(R.id.tv_gift_time, item.getCreatetime());
|
||||
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_image));
|
||||
ImageUtils.loadHeadCC(item.getBase_image(), helper.getView(R.id.iv_gift_image));
|
||||
// 使用 SpannableString 给 "x4" 设置不同颜色
|
||||
TextView giftNameTextView = helper.getView(R.id.gift_name);
|
||||
TextView nickNameTextView = helper.getView(R.id.tv_user_name);
|
||||
if (giftNameTextView != null) {
|
||||
String baseName = item.getGift_name();
|
||||
String countText = "x"+item.getCount();
|
||||
String countText = "x" + item.getCount();
|
||||
String fullText = baseName + countText;
|
||||
|
||||
SpannableStringBuilder spannable = new SpannableStringBuilder(fullText);
|
||||
@@ -67,7 +67,7 @@ public class GiftLotteryAdapter extends BaseQuickAdapter<GiftBean, BaseViewHolde
|
||||
giftNameTextView.setText(spannable);
|
||||
}
|
||||
|
||||
if (nickNameTextView!=null){
|
||||
if (nickNameTextView != null && item.getNickname() != null) {
|
||||
nickNameTextView.setText(item.getNickname());
|
||||
String nickName = "赠予";
|
||||
String fullText = nickName + " " + item.getNickname();
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.xscm.moduleutil.widget.Constants;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Field;
|
||||
@@ -26,7 +27,7 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded //请求验证码
|
||||
@POST(Constants.SEND_CODE)
|
||||
Observable<BaseModel<Object>> sendCode(@Field("mobile") String mobile, @Field("event") String event);
|
||||
Call<BaseModel<String>> sendCode(@Field("mobile") String mobile, @Field("event") String event);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.LOGIN)
|
||||
@@ -38,7 +39,7 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded //手机换绑
|
||||
@POST(Constants.MODIFY_MOBILE)
|
||||
Call<BaseModel<String>> mobileView(@Field("mobile") String mobile, @Field("new_mobile") String new_mobile, @Field("sms_code") String sms_code);
|
||||
Call<BaseModel<String>> mobileView(@Field("mobile") String mobile, @Field("new_mobile") String new_mobile, @Field("sms_code") String sms_code,@Field("new_sms_code") String new_sms_code);
|
||||
|
||||
@GET(Constants.GET_EMOTION)
|
||||
Call<BaseModel<List<Emotion>>> upEmotion();
|
||||
@@ -80,7 +81,7 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.dailyTasksReceive)
|
||||
Call<ResponseBody> dailyTasksReceive(@Field("task_id") String task_id);
|
||||
Call<ResponseBody> dailyTasksReceive(@Field("task_id") String task_id,@Field("student_id") String student_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.dailyTasksComplete)
|
||||
@@ -498,6 +499,10 @@ public interface ApiServer {
|
||||
@POST(Constants.JOIN_ROOM)
|
||||
Call<BaseModel<RoomInfoResp>> roomGetIn(@Field("room_id") String roomId, @Field("password") String password);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.TASK_JUMP_ROOM)
|
||||
Call<BaseModel<String>> taskJumpRoomId(@Field("task_id") String taskId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.DELETE_ALBUM_IMAGE)
|
||||
Call<BaseModel<String>> deleteAlbumImage(@Field("id") String id);
|
||||
@@ -552,6 +557,9 @@ public interface ApiServer {
|
||||
@GET(Constants.GET_WALLET)
|
||||
Call<BaseModel<WalletBean>> wallet();
|
||||
|
||||
@GET(Constants.GET_TASKS_MESSAGE)
|
||||
Call<BaseModel<TasksMessage>> getTasksMessage();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.REDPACKET_CREATE)
|
||||
Call<ResponseBody> redPacketCreate(@Field("type") int type, @Field("password") String password, @Field("coin_type") int coin_type, @Field("total_amount") String total_amount,
|
||||
@@ -625,7 +633,7 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_KEEP_XINTIAO)
|
||||
Call<ResponseBody> keepXintiao(@Field("room_id") String room_id);
|
||||
Call<BaseModel<TasksMessage>> keepXintiao(@Field("room_id") String room_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.DOWN_PIT)
|
||||
@@ -675,6 +683,9 @@ public interface ApiServer {
|
||||
@POST(Constants.POST_AGREE_SONG)
|
||||
Call<BaseModel<String>> agreeSong(@Field("room_id") String roomId, @Field("type") String type);
|
||||
|
||||
@GET(Constants.GET_BLIND_BOX_STATUS)
|
||||
Call<BaseModel<List<BlindBoxStatus>>> blindBoxStatus();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_END_SONG)
|
||||
Call<BaseModel<String>> endSong(@Field("room_id") String roomId);
|
||||
@@ -685,7 +696,7 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.CHANGE_SONG)
|
||||
Call<BaseModel<String>> changeSong(@Field("room_id") String roomId, @Field("now_did") String now_did);
|
||||
Call<BaseModel<String>> changeSong(@Field("room_id") String roomId, @Field("now_did") String now_did,@Field("is_auto_next") String is_auto_next);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_HOST_LIST)
|
||||
@@ -915,4 +926,14 @@ public interface ApiServer {
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_SIGN_REFUSE)
|
||||
Call<BaseModel<String>> signRefuse(@Field("room_id") String room_id);
|
||||
|
||||
|
||||
@GET(Constants.GET_SIGN_IN_LIST)
|
||||
Call<BaseModel<List<SignInData>>> signIn();
|
||||
|
||||
@GET(Constants.POST_DAILY_TASKS_SIGN)
|
||||
Call<BaseModel<String>> postDailyTasksSign();
|
||||
|
||||
@GET(Constants.POST_DAILY_TASKS_SIGN_STATUS)
|
||||
Call<BaseModel<TasksSignStatus>> postDailyTasksSignStatus();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.util.Log;
|
||||
|
||||
import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
@@ -79,6 +80,7 @@ public class RetrofitClient {
|
||||
public interface JoinRoomLoadListener {
|
||||
void onJoinRoomLoad(String result);
|
||||
}
|
||||
|
||||
public void setJoinRoomLoadListener(JoinRoomLoadListener joinRoomLoadListener) {
|
||||
this.joinRoomLoadListener = joinRoomLoadListener;
|
||||
}
|
||||
@@ -161,6 +163,16 @@ public class RetrofitClient {
|
||||
return cpListener;
|
||||
}
|
||||
|
||||
private TasksMessageListener tasksMessageListener;
|
||||
|
||||
public interface TasksMessageListener {
|
||||
void onTasksMessageNum(int result);
|
||||
}
|
||||
|
||||
public void setTasksMessageListener(TasksMessageListener tasksMessageListener) {
|
||||
this.tasksMessageListener = tasksMessageListener;
|
||||
}
|
||||
|
||||
|
||||
public static RetrofitClient getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
@@ -197,6 +209,9 @@ public class RetrofitClient {
|
||||
private <T> void handleNetworkUnavailable(BaseObserver<T> observer) {
|
||||
ToastUtils.showShort("网络不可用,请检查网络设置");
|
||||
observer.onError(new Throwable("网络不可用,请检查网络设置"));
|
||||
if (joinRoomLoadListener != null) {
|
||||
joinRoomLoadListener.onJoinRoomLoad("网络部可用");
|
||||
}
|
||||
}
|
||||
|
||||
public <T> T createApiClient(Class<T> apiClientClass) {
|
||||
@@ -207,12 +222,30 @@ public class RetrofitClient {
|
||||
sApiServer.appUpdate().compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void sendCode(String mobile, String event, BaseObserver<Object> observer) {
|
||||
sApiServer.sendCode(mobile, event).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
public void sendCode(String mobile, String event, BaseObserver<String> observer) {
|
||||
sApiServer.sendCode(mobile, event).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> body = response.body();
|
||||
if (body.getCode() == 1) {
|
||||
observer.onNext(body.getMsg());
|
||||
} else if (body.getCode() == 0) {
|
||||
ToastUtils.showLong(body.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
LogUtils.e("sendCode", t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void mobileView(String mobile, String new_mobile, String sms_code, BaseObserver<String> observer) {
|
||||
sApiServer.mobileView(mobile, new_mobile, sms_code).enqueue(new Callback<BaseModel<String>>() {
|
||||
public void mobileView(String mobile, String new_mobile, String sms_code, String new_sms_code, BaseObserver<String> observer) {
|
||||
sApiServer.mobileView(mobile, new_mobile, sms_code, new_sms_code).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code() == 200) {
|
||||
@@ -545,7 +578,7 @@ public class RetrofitClient {
|
||||
} catch (ClassNotFoundException e) {
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showLong(baseModel.getMsg());
|
||||
ToastUtils.showLong(baseModel.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -887,8 +920,8 @@ public class RetrofitClient {
|
||||
sApiServer.roomRanking(type).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
} else if (ranking_type.equals("1") || ranking_type.equals("2")) {
|
||||
sApiServer.wealthRanking(ranking_type, type).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
} else if (ranking_type.equals("3")) {
|
||||
sApiServer.loveRanking(type).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
} else if (ranking_type.equals("3")) {//2025年12月11日14:57:44,原是传递的type,现在修改成0.只是将真爱榜变成心动榜
|
||||
sApiServer.loveRanking("0").compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
} else if (ranking_type.equals("4")) {
|
||||
sApiServer.guildRanking().compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
@@ -921,6 +954,8 @@ public class RetrofitClient {
|
||||
BaseModel<List<MyBagDataBean>> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
} else if (baseModel.getCode() == 0) {
|
||||
observer.onNext(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -940,6 +975,8 @@ public class RetrofitClient {
|
||||
BaseModel<List<MyBagDataBean>> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
} else if (baseModel.getCode() == 0) {
|
||||
observer.onNext(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -961,7 +998,7 @@ public class RetrofitClient {
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
} else {
|
||||
observer.onNext(null);
|
||||
// observer.onNext(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -982,7 +1019,7 @@ public class RetrofitClient {
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getMsg());
|
||||
} else {
|
||||
observer.onNext(null);
|
||||
// observer.onNext(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1058,8 +1095,8 @@ public class RetrofitClient {
|
||||
sApiServer.dailyTasksOpenBox(gift_box_id).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void dailyTasksReceive(String task_id, BaseObserver<String> observer) {
|
||||
sApiServer.dailyTasksReceive(task_id).enqueue(new Callback<ResponseBody>() {
|
||||
public void dailyTasksReceive(String task_id, String student_id, BaseObserver<String> observer) {
|
||||
sApiServer.dailyTasksReceive(task_id, student_id).enqueue(new Callback<ResponseBody>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
||||
@@ -2046,6 +2083,11 @@ public class RetrofitClient {
|
||||
BaseModel<UserInfo> listBaseModel = response.body();
|
||||
if (listBaseModel.getCode() == 1) {
|
||||
observer.onNext(listBaseModel.getData());
|
||||
} else if (listBaseModel.getCode() == 0) {
|
||||
ToastUtils.showShort(listBaseModel.getMsg());
|
||||
if (ActivityUtils.getTopActivity().getComponentName().getClassName().contains("UserHomepageActivity")) {
|
||||
ActivityUtils.getTopActivity().finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2257,10 +2299,10 @@ public class RetrofitClient {
|
||||
}
|
||||
} else if (roomInfoRespBaseModel.getCode() == 0) {
|
||||
ToastUtils.showShort(roomInfoRespBaseModel.getMsg());
|
||||
if (joinRoomLoadListener != null){
|
||||
if (joinRoomLoadListener != null) {
|
||||
joinRoomLoadListener.onJoinRoomLoad(roomInfoRespBaseModel.getMsg());
|
||||
}
|
||||
}else if (roomInfoRespBaseModel.getCode() == 202){
|
||||
} else if (roomInfoRespBaseModel.getCode() == 202) {
|
||||
observer.onNext(roomInfoRespBaseModel.getData());
|
||||
} else {
|
||||
MessageListenerSingleton.getInstance().quitGroup(roomId);
|
||||
@@ -2273,6 +2315,29 @@ public class RetrofitClient {
|
||||
MessageListenerSingleton.getInstance().quitGroup(roomId);
|
||||
CommonAppContext.getInstance().isRoomJoininj = false;
|
||||
observer.onError(t);
|
||||
if (joinRoomLoadListener != null) {
|
||||
joinRoomLoadListener.onJoinRoomLoad("网络异常");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void taskJumpRoomId(String taskId, BaseObserver<String> observer) {
|
||||
sApiServer.taskJumpRoomId(taskId).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> stringBaseModel = response.body();
|
||||
if (stringBaseModel.getCode() == 1) {
|
||||
observer.onNext(stringBaseModel.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2338,7 +2403,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void check_create_room(BaseObserver<String> observer){
|
||||
public void check_create_room(BaseObserver<String> observer) {
|
||||
sApiServer.checkCreateRoom().enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -2346,9 +2411,9 @@ public class RetrofitClient {
|
||||
BaseModel<String> stringBaseModel = response.body();
|
||||
if (stringBaseModel.getCode() == 1) {
|
||||
observer.onNext("");
|
||||
}else if (stringBaseModel.getCode() == 0) {
|
||||
} else if (stringBaseModel.getCode() == 0) {
|
||||
com.hjq.toast.ToastUtils.show(stringBaseModel.getMsg());
|
||||
}else if(stringBaseModel.getCode()==301){
|
||||
} else if (stringBaseModel.getCode() == 301) {
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
ToastUtils.showShort(stringBaseModel.getMsg());
|
||||
@@ -2356,7 +2421,7 @@ public class RetrofitClient {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
LogUtils.e("check_create_room", response.message());
|
||||
}
|
||||
|
||||
@@ -2402,7 +2467,7 @@ public class RetrofitClient {
|
||||
BaseModel<RoomOnline> roomOnlineBaseModel = response.body();
|
||||
if (roomOnlineBaseModel.getCode() == 1) {
|
||||
observer.onNext(roomOnlineBaseModel.getData());
|
||||
}else if (roomOnlineBaseModel.getCode() == 0) {
|
||||
} else if (roomOnlineBaseModel.getCode() == 0) {
|
||||
ToastUtils.showLong(roomOnlineBaseModel.getMsg());
|
||||
}
|
||||
}
|
||||
@@ -2444,7 +2509,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void index_recommend_room(BaseObserver<IndexRecommendRoom> observer) {
|
||||
public void index_recommend_room(BaseObserver<IndexRecommendRoom> observer) {
|
||||
sApiServer.index_recommend_room().enqueue(new Callback<BaseModel<IndexRecommendRoom>>() {
|
||||
|
||||
@Override
|
||||
@@ -2452,7 +2517,11 @@ public class RetrofitClient {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<IndexRecommendRoom> indexRecommendRoomBaseModel = response.body();
|
||||
if (indexRecommendRoomBaseModel.getCode() == 1) {
|
||||
observer.onNext(indexRecommendRoomBaseModel.getData());
|
||||
if (indexRecommendRoomBaseModel.getData() == null) {
|
||||
observer.onNext(new IndexRecommendRoom());
|
||||
} else {
|
||||
observer.onNext(indexRecommendRoomBaseModel.getData());
|
||||
}
|
||||
} else if (indexRecommendRoomBaseModel.getCode() == 0) {
|
||||
ToastUtils.showShort(indexRecommendRoomBaseModel.getMsg());
|
||||
} else if (indexRecommendRoomBaseModel.getCode() == 301) {
|
||||
@@ -2468,11 +2537,11 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<IndexRecommendRoom>> call, Throwable t) {
|
||||
LogUtils.e("首页房间推荐",t.fillInStackTrace());
|
||||
LogUtils.e("首页房间推荐", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void wallet(BaseObserver<WalletBean> observer) {
|
||||
sApiServer.wallet().enqueue(new Callback<BaseModel<WalletBean>>() {
|
||||
@@ -2493,7 +2562,36 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void redPacketCreate(int type, String password, int coin_type, String total_amount, String total_count, String conditions, String countdown, String room_id, String remark, BaseObserver<String> observer) {
|
||||
public void getTasksMessage(BaseObserver<TasksMessage> observer) {
|
||||
sApiServer.getTasksMessage().enqueue(new Callback<BaseModel<TasksMessage>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<TasksMessage>> call, Response<BaseModel<TasksMessage>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<TasksMessage> tasksMessage = response.body();
|
||||
if (tasksMessage.getCode() == 1) {
|
||||
observer.onNext(tasksMessage.getData());
|
||||
} else if (tasksMessage.getCode() == 0) {
|
||||
} else if (tasksMessage.getCode() == 301) {
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
ToastUtils.showShort(tasksMessage.getMsg());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<TasksMessage>> call, Throwable t) {
|
||||
LogUtils.e("任务个数", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void redPacketCreate(int type, String password, int coin_type, String
|
||||
total_amount, String total_count, String conditions, String countdown, String
|
||||
room_id, String remark, BaseObserver<String> observer) {
|
||||
sApiServer.redPacketCreate(type, password, coin_type, total_amount, total_count, conditions, countdown, room_id, remark).enqueue(new Callback<ResponseBody>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
||||
@@ -2554,7 +2652,8 @@ public class RetrofitClient {
|
||||
// });
|
||||
}
|
||||
|
||||
public void appPay(String user_id, String money, String coin, String type, String type_params, String type_id, String nobility_id, BaseObserver<AppPay> observer) {
|
||||
public void appPay(String user_id, String money, String coin, String type, String
|
||||
type_params, String type_id, String nobility_id, BaseObserver<AppPay> observer) {
|
||||
sApiServer.appPay(user_id, money, coin, type, type_params, type_id, nobility_id).enqueue(new Callback<BaseModel<AppPay>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<AppPay>> call, Response<BaseModel<AppPay>> response) {
|
||||
@@ -2613,7 +2712,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void bind(String userId, String type, String alipayAccount, String bank_card_number, String bank_card, String open_bank, BaseObserver<String> observer) {
|
||||
public void bind(String userId, String type, String alipayAccount, String
|
||||
bank_card_number, String bank_card, String open_bank, BaseObserver<String> observer) {
|
||||
sApiServer.bind(userId, type, alipayAccount, bank_card_number, bank_card, open_bank).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -2646,7 +2746,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getRoomUserInfo(String room_id, String user_id, BaseObserver<UserInfo> observer) {
|
||||
public void getRoomUserInfo(String room_id, String
|
||||
user_id, BaseObserver<UserInfo> observer) {
|
||||
sApiServer.getRoomUserInfo(room_id, user_id).enqueue(new Callback<BaseModel<UserInfo>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<UserInfo>> call, Response<BaseModel<UserInfo>> response) {
|
||||
@@ -2665,8 +2766,9 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void songList(String room_id,String page, BaseObserver<List<MusicSongBean>> observer) {
|
||||
sApiServer.songList(room_id,page).enqueue(new Callback<BaseModel<List<MusicSongBean>>>() {
|
||||
public void songList(String room_id, String
|
||||
page, BaseObserver<List<MusicSongBean>> observer) {
|
||||
sApiServer.songList(room_id, page).enqueue(new Callback<BaseModel<List<MusicSongBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<MusicSongBean>>> call, Response<BaseModel<List<MusicSongBean>>> response) {
|
||||
if (response.code() == 200) {
|
||||
@@ -2706,7 +2808,8 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
|
||||
public void getSearch(String keyWord, String type, BaseObserver<List<RoomSearchResp>> observer) {
|
||||
public void getSearch(String keyWord, String
|
||||
type, BaseObserver<List<RoomSearchResp>> observer) {
|
||||
sApiServer.getSearch(keyWord, type).enqueue(new Callback<BaseModel<List<RoomSearchResp>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RoomSearchResp>>> call, Response<BaseModel<List<RoomSearchResp>>> response) {
|
||||
@@ -2829,7 +2932,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void roomAuctionJoin(String auctionId, String userId, String giftId, String num, String type, BaseObserver<RoomAuction.AuctionListBean> observer) {
|
||||
public void roomAuctionJoin(String auctionId, String userId, String giftId, String
|
||||
num, String type, BaseObserver<RoomAuction.AuctionListBean> observer) {
|
||||
sApiServer.roomAuctionJoin(auctionId, userId, giftId, num, type).enqueue(new ApiResponseCallback<RoomAuction.AuctionListBean>(CommonAppContext.getInstance()) {
|
||||
@Override
|
||||
public void onSuccess(RoomAuction.AuctionListBean data) {
|
||||
@@ -2944,10 +3048,14 @@ public class RetrofitClient {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<RedPackGrab> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
if (baseModel.getData() != null) {
|
||||
observer.onNext(baseModel.getData());
|
||||
}
|
||||
} else if (baseModel.getCode() == 0) {
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
observer.onNext(baseModel.getData());
|
||||
if (baseModel.getData() != null) {
|
||||
observer.onNext(baseModel.getData());
|
||||
}
|
||||
} else if (baseModel.getCode() == 301) {
|
||||
try {
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
@@ -3172,7 +3280,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String type, String pit_number, String heart_id, BaseObserver<RoomGiftData> observer) {
|
||||
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String
|
||||
type, String pit_number, String heart_id, BaseObserver<RoomGiftData> observer) {
|
||||
sApiServer.roomGift(room_id, gift_id, gift_num, to_uid, type, pit_number, heart_id).enqueue(new Callback<BaseModel<RoomGiftData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<RoomGiftData>> call, Response<BaseModel<RoomGiftData>> response) {
|
||||
@@ -3210,7 +3319,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void cpGiveGift(String user_id, String gift_id, String room_id, BaseObserver<RoomGiftData> observer) {
|
||||
public void cpGiveGift(String user_id, String gift_id, String
|
||||
room_id, BaseObserver<RoomGiftData> observer) {
|
||||
sApiServer.cpGiveGift(user_id, gift_id, room_id).enqueue(new Callback<BaseModel<RoomGiftData>>() {
|
||||
|
||||
@Override
|
||||
@@ -3404,21 +3514,36 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
public void keepXintiao(String roomId) {
|
||||
sApiServer.keepXintiao(roomId).enqueue(new Callback<ResponseBody>() {
|
||||
sApiServer.keepXintiao(roomId).enqueue(new Callback<BaseModel<TasksMessage>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
||||
|
||||
public void onResponse(Call<BaseModel<TasksMessage>> call, Response<BaseModel<TasksMessage>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<TasksMessage> tasksMessage = response.body();
|
||||
assert tasksMessage != null;
|
||||
if (tasksMessage.getCode() == 1) {
|
||||
if (tasksMessageListener != null && tasksMessage.getData() != null) {
|
||||
tasksMessageListener.onTasksMessageNum(tasksMessage.getData().getNot_received_tasks_num());
|
||||
}
|
||||
} else if (tasksMessage.getCode() == 0) {
|
||||
} else if (tasksMessage.getCode() == 301) {
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
ToastUtils.showShort(tasksMessage.getMsg());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseBody> call, Throwable t) {
|
||||
|
||||
public void onFailure(Call<BaseModel<TasksMessage>> call, Throwable t) {
|
||||
LogUtils.e("心跳: " + t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setMutePit(String roomId, String user_id, String
|
||||
isMute, BaseObserver<String> observer) {
|
||||
public void setMutePit(String roomId, String user_id, String isMute, BaseObserver<String> observer) {
|
||||
sApiServer.setMutePit(roomId, user_id, isMute).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -3504,6 +3629,35 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void blindBoxStatus(BaseObserver<List<BlindBoxStatus>> observer) {
|
||||
sApiServer.blindBoxStatus().enqueue(new Callback<BaseModel<List<BlindBoxStatus>>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<BlindBoxStatus>>> call, Response<BaseModel<List<BlindBoxStatus>>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<List<BlindBoxStatus>> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
} else if (baseModel.getCode() == 301) {
|
||||
try {
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<BlindBoxStatus>>> call, Throwable t) {
|
||||
LogUtils.e("盲盒转盘", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void endSong(String room_id, BaseObserver<String> observer) {
|
||||
sApiServer.endSong(room_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
@@ -3558,7 +3712,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void roomRelationList(String type, BaseObserver<List<RoomRelationBean>> observer) {
|
||||
public void roomRelationList(String
|
||||
type, BaseObserver<List<RoomRelationBean>> observer) {
|
||||
sApiServer.roomRelationList(type).enqueue(new Callback<BaseModel<List<RoomRelationBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RoomRelationBean>>> call, Response<BaseModel<List<RoomRelationBean>>> response) {
|
||||
@@ -3597,8 +3752,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void changeSong(String room_id, String now_did, BaseObserver<String> observer) {
|
||||
sApiServer.changeSong(room_id, now_did).enqueue(new Callback<BaseModel<String>>() {
|
||||
public void changeSong(String room_id, String now_did, String isAutoNext, BaseObserver<String> observer) {
|
||||
sApiServer.changeSong(room_id, now_did, isAutoNext).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
onNextRetu(response, observer);
|
||||
@@ -3695,7 +3850,7 @@ public class RetrofitClient {
|
||||
|
||||
|
||||
public void quitRoom(String room_id, String user_id, BaseObserver<String> observer) {
|
||||
if (room_id == null ||room_id.isEmpty())
|
||||
if (room_id == null || room_id.isEmpty())
|
||||
return;
|
||||
sApiServer.quitRoom(room_id, user_id).enqueue(new Callback<ResponseBody>() {
|
||||
@Override
|
||||
@@ -3710,7 +3865,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getFriendListMore(String user_id, String relation_id, BaseObserver<List<RelationshipBean>> observer) {
|
||||
public void getFriendListMore(String user_id, String
|
||||
relation_id, BaseObserver<List<RelationshipBean>> observer) {
|
||||
sApiServer.getFriendListMore(user_id, relation_id).enqueue(new Callback<BaseModel<List<RelationshipBean>>>() {
|
||||
|
||||
@Override
|
||||
@@ -3856,7 +4012,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void commentZone(String id, String content, String pid, String reply_to, BaseObserver<String> observer) {
|
||||
public void commentZone(String id, String content, String pid, String
|
||||
reply_to, BaseObserver<String> observer) {
|
||||
sApiServer.commentZone(id, content, pid, reply_to).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -3870,7 +4027,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getFriendList(String userId, String page, String page_limit, BaseObserver<RelationBean> observer) {
|
||||
public void getFriendList(String userId, String page, String
|
||||
page_limit, BaseObserver<RelationBean> observer) {
|
||||
sApiServer.getFriendList(userId, page, page_limit).enqueue(new Callback<BaseModel<RelationBean>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<RelationBean>> call, Response<BaseModel<RelationBean>> response) {
|
||||
@@ -3913,8 +4071,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void cancel(String sms_code,BaseObserver<String> observer) {
|
||||
sApiServer.cancel(SpUtil.getToken(),sms_code).enqueue(new Callback<BaseModel<String>>() {
|
||||
public void cancel(String sms_code, BaseObserver<String> observer) {
|
||||
sApiServer.cancel(SpUtil.getToken(), sms_code).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -3942,7 +4100,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getPostData(String new_password, String mobile, String code, String userId, BaseObserver<String> observer) {
|
||||
public void getPostData(String new_password, String mobile, String code, String
|
||||
userId, BaseObserver<String> observer) {
|
||||
sApiServer.getPostData(new_password, mobile, code, userId).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -4099,7 +4258,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void userOnlineStatus(String user_id, String roomId, BaseObserver<List<UserOnlineStatusBean>> observer) {
|
||||
public void userOnlineStatus(String user_id, String
|
||||
roomId, BaseObserver<List<UserOnlineStatusBean>> observer) {
|
||||
sApiServer.userOnlineStatus(user_id, roomId).enqueue(new Callback<BaseModel<List<UserOnlineStatusBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<UserOnlineStatusBean>>> call, Response<BaseModel<List<UserOnlineStatusBean>>> response) {
|
||||
@@ -4276,7 +4436,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void onNextRetu(Response<BaseModel<String>> response, BaseObserver<String> observer) {
|
||||
public void onNextRetu
|
||||
(Response<BaseModel<String>> response, BaseObserver<String> observer) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> string = response.body();
|
||||
if (string != null) {
|
||||
@@ -4399,7 +4560,8 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
/// 盲盒转盘抽奖
|
||||
public void drawGiftList(String giftBagId, String gift_user_ids, String roomId, String num, String heart_id, String auction_id, BaseObserver<BlindReslutBean> observer) {
|
||||
public void drawGiftList(String giftBagId, String gift_user_ids, String roomId, String
|
||||
num, String heart_id, String auction_id, BaseObserver<BlindReslutBean> observer) {
|
||||
sApiServer.drawGiftList(giftBagId, gift_user_ids, roomId, num, heart_id, auction_id).enqueue(new Callback<BaseModel<BlindReslutBean>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<BlindReslutBean>> call, Response<BaseModel<BlindReslutBean>> response) {
|
||||
@@ -4619,7 +4781,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void roomUserCharmList(String room_id, String user_id, BaseObserver<List<RoomUserCharmListBean>> observer) {
|
||||
public void roomUserCharmList(String room_id, String
|
||||
user_id, BaseObserver<List<RoomUserCharmListBean>> observer) {
|
||||
sApiServer.roomUserCharmList(room_id, user_id).enqueue(new Callback<BaseModel<List<RoomUserCharmListBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RoomUserCharmListBean>>> call, Response<BaseModel<List<RoomUserCharmListBean>>> response) {
|
||||
@@ -4669,8 +4832,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void signCoin(String sign_id,String sign_value, BaseObserver<String> observer) {
|
||||
sApiServer.signCoin(sign_id,sign_value).enqueue(new Callback<BaseModel<String>>() {
|
||||
public void signCoin(String sign_id, String sign_value, BaseObserver<String> observer) {
|
||||
sApiServer.signCoin(sign_id, sign_value).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -4685,8 +4848,8 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
|
||||
public void getCpRoom(String userId,int page, BaseObserver<HeartCpBean> observer) {
|
||||
sApiServer.getCpRoom(userId,page+"").enqueue(new Callback<BaseModel<HeartCpBean>>() {
|
||||
public void getCpRoom(String userId, int page, BaseObserver<HeartCpBean> observer) {
|
||||
sApiServer.getCpRoom(userId, page + "").enqueue(new Callback<BaseModel<HeartCpBean>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<HeartCpBean>> call, Response<BaseModel<HeartCpBean>> response) {
|
||||
if (response.code() == 200) {
|
||||
@@ -4764,7 +4927,8 @@ public class RetrofitClient {
|
||||
}
|
||||
}
|
||||
|
||||
public void familyEarnings(String user_id, int page, String start_time, String end_time, BaseObserver<List<FamilyEarnings>> observer) {
|
||||
public void familyEarnings(String user_id, int page, String start_time, String
|
||||
end_time, BaseObserver<List<FamilyEarnings>> observer) {
|
||||
sApiServer.familyEarnings(user_id, page, start_time, end_time).enqueue(new Callback<BaseModel<List<FamilyEarnings>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<FamilyEarnings>>> call, Response<BaseModel<List<FamilyEarnings>>> response) {
|
||||
@@ -4865,7 +5029,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void signRefuse(String roomId,BaseObserver<String> observer){
|
||||
public void signRefuse(String roomId, BaseObserver<String> observer) {
|
||||
sApiServer.signRefuse(roomId).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
@@ -4880,8 +5044,8 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void freeReSign(int type, String userId,BaseObserver<String> observer) {
|
||||
if (type==1) {
|
||||
public void freeReSign(int type, String userId, BaseObserver<String> observer) {
|
||||
if (type == 1) {
|
||||
sApiServer.freeReSign(userId).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
@@ -4894,7 +5058,7 @@ public class RetrofitClient {
|
||||
LogUtils.e("freeReSign", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}else {
|
||||
} else {
|
||||
sApiServer.reSign(userId).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -4909,6 +5073,85 @@ public class RetrofitClient {
|
||||
}
|
||||
}
|
||||
|
||||
public void signIn(BaseObserver<List<SignInData>> observer) {
|
||||
sApiServer.signIn().enqueue(new Callback<BaseModel<List<SignInData>>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<SignInData>>> call, Response<BaseModel<List<SignInData>>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<List<SignInData>> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData() != null ? baseModel.getData() : new ArrayList<SignInData>());
|
||||
} else if (baseModel.getCode() == 0) {
|
||||
com.hjq.toast.ToastUtils.show(baseModel.getMsg());
|
||||
} else if (baseModel.getCode() == 301) {
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogUtils.e("signIn", response.errorBody());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<SignInData>>> call, Throwable t) {
|
||||
LogUtils.e("signIn", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void dailyTasksSign(BaseObserver<String> observer) {
|
||||
sApiServer.postDailyTasksSign().enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
onNextRetu(response, observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
LogUtils.e("signIn", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void tasksSignStatus(BaseObserver<TasksSignStatus> observer) {
|
||||
sApiServer.postDailyTasksSignStatus().enqueue(new Callback<BaseModel<TasksSignStatus>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<TasksSignStatus>> call, Response<BaseModel<TasksSignStatus>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<TasksSignStatus> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
} else if (baseModel.getCode() == 0) {
|
||||
com.hjq.toast.ToastUtils.show(baseModel.getMsg());
|
||||
} else if (baseModel.getCode() == 301) {
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogUtils.e("postDailyTasksSignStatus", response.errorBody());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<TasksSignStatus>> call, Throwable t) {
|
||||
LogUtils.e("postDailyTasksSignStatus", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.xscm.moduleutil.event.RoomJoinMountModel;
|
||||
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.rtc.MusicPlayBean;
|
||||
import com.xscm.moduleutil.utils.CustomMsgCode;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.tencent.imsdk.v2.V2TIMAdvancedMsgListener;
|
||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||
@@ -66,6 +67,8 @@ public class MessageListenerSingleton {
|
||||
private final Map<String, List<RoomMessageEvent>> cachedMessages = new ConcurrentHashMap<>();
|
||||
private final Set<String> joinedRooms = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private OnMsgTaskListener onMsgTaskListener;
|
||||
|
||||
// private boolean listenersAdded = false; // 标记监听器是否已添加
|
||||
// 1. 添加新的监听器接口
|
||||
public interface PublicScreenMessageListener {
|
||||
@@ -321,6 +324,10 @@ public class MessageListenerSingleton {
|
||||
if (event.getMsgType() == 130 || event.getMsgType() == 131) {
|
||||
// EventBus.getDefault().post(event);
|
||||
RetrofitClient.getInstance().getCpListener().onReceiveMsg(event);
|
||||
} else if (event.getMsgType() == CustomMsgCode.INSTANCE.getCODE_TASK_APPRENTICE_JOIN_ROOM()) {
|
||||
if (onMsgTaskListener != null) {
|
||||
onMsgTaskListener.onMsgTask(event);
|
||||
}
|
||||
} else {
|
||||
notifyMessageReceived(event);
|
||||
}
|
||||
@@ -400,7 +407,7 @@ public class MessageListenerSingleton {
|
||||
// 使用默认解析
|
||||
event = GsonUtils.fromJson(message, RoomMessageEvent.class);
|
||||
}
|
||||
LogUtils.e("收到群自定义消息:"+mRoomId+"===" + event);
|
||||
LogUtils.e("收到群自定义消息:" + mRoomId + "===" + event);
|
||||
// event = GsonUtils.fromJson(message, RoomMessageEvent.class);
|
||||
} catch (Exception e) {
|
||||
// 处理 JSON 解析过程中可能出现的异常,例如记录日志
|
||||
@@ -608,6 +615,30 @@ public class MessageListenerSingleton {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// TODO: 2025/11/19 添加发送公共方法,messageType:发送的type;message:发送的内容 userId:发送给谁
|
||||
public void sendCustomC2CMessage(int messageType, String userId,RoomMessageEvent.T text) {
|
||||
text.setFromUserInfo(SpUtil.getUserInfo());
|
||||
LogUtils.e("发送消息", "messageType:" + messageType + "\nuserId:" + userId + "\ntext:" + text,toString());
|
||||
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(messageType, mRoomId, text);
|
||||
String json = com.blankj.utilcode.util.GsonUtils.toJson(roomMessageEvent);
|
||||
// 转换为 byte[]
|
||||
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
// 创建自定义群消息
|
||||
V2TIMMessage v2TIMMessage = V2TIMManager.getMessageManager().createCustomMessage(binaryData);
|
||||
v2TIMMessage.setExcludedFromUnreadCount(true);
|
||||
v2TIMMessage.setExcludedFromContentModeration(true);
|
||||
// v2TIMMessage.setNeedReadReceipt(true);
|
||||
//
|
||||
// // 发送消息
|
||||
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, "u" + userId, null, V2TIMMessage.V2TIM_PRIORITY_HIGH,
|
||||
true,
|
||||
null,
|
||||
sendCallback);
|
||||
|
||||
}
|
||||
|
||||
public void sendCustomC2CMessage125(String userId, byte[] binaryData) {
|
||||
// 创建自定义群消息
|
||||
V2TIMMessage v2TIMMessage = V2TIMManager.getMessageManager().createCustomMessage(binaryData);
|
||||
@@ -664,4 +695,13 @@ public class MessageListenerSingleton {
|
||||
public interface OnMessageReceivedListener {
|
||||
void onMessageReceived(RoomMessageEvent message);
|
||||
}
|
||||
|
||||
|
||||
public void setOnMsgTaskListener(OnMsgTaskListener listener) {
|
||||
this.onMsgTaskListener = listener;
|
||||
}
|
||||
|
||||
public interface OnMsgTaskListener {
|
||||
void onMsgTask(RoomMessageEvent message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.xscm.moduleutil.utils
|
||||
|
||||
object CustomMsgCode {
|
||||
val CODE_TASK_APPRENTICE_JOIN_ROOM_TIMER_ID = "132"
|
||||
val CODE_TASK_APPRENTICE_JOIN_ROOM = 132
|
||||
val CODE_TASK_APPRENTICE_JOIN_ROOM_MSG = "您的师傅邀请您进入房间,您是否同意?"
|
||||
val CODE_TASK_APPRENTICE_JOIN_ROOM_MSG_REFUSE = "您的徒弟拒绝了您的邀请。"
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class DateSelectDialog extends BaseBottomSheetDialog<MeDialogDateSelectBi
|
||||
int currentDay = TimeUtils.getDay();
|
||||
|
||||
// 如果是最大年份且是最大月份,则日期不能超过当前日期
|
||||
if (year == currentYear - 16 && month == currentMonth) {
|
||||
if (year == currentYear - 18 && month == currentMonth) {
|
||||
dayLimit = currentDay;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class DateSelectDialog extends BaseBottomSheetDialog<MeDialogDateSelectBi
|
||||
|
||||
int monthLimit = 12;
|
||||
// 如果是最大年份(16年前),则月份不能超过当前月份
|
||||
if (year == currentYear - 16) {
|
||||
if (year == currentYear - 18) {
|
||||
monthLimit = currentMonth;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public class DateSelectDialog extends BaseBottomSheetDialog<MeDialogDateSelectBi
|
||||
private List<DateBean> getYear() {
|
||||
int currentYear = TimeUtils.getYear();
|
||||
int minYear = currentYear - 100; // 最小年份设为100年前
|
||||
int maxYear = currentYear - 16; // 最大年份设为16年前
|
||||
int maxYear = currentYear - 18; // 最大年份设为16年前
|
||||
|
||||
List<DateBean> yearList = new ArrayList<>();
|
||||
for (int i = minYear; i <= maxYear; i++) {
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
package com.xscm.moduleutil.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.utils.TextUtils;
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ThreadUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -19,6 +24,11 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -41,14 +51,58 @@ public class DownloadUtil {
|
||||
private static final String PATH_AUDIO = Environment.getExternalStorageDirectory() + "/qipao/audio";
|
||||
|
||||
|
||||
public DownloadUtil(Context context) {
|
||||
@SuppressLint("CheckResult")
|
||||
public DownloadUtil(Context context, String downUrl,final DownloadListener downloadListener) {
|
||||
// 1. 判空,避免空指针
|
||||
if (context == null) {
|
||||
ToastUtils.showShort("Context 不能为 null!");
|
||||
LogUtils.e("Context 不能为 null!."+(mApi == null));
|
||||
return;
|
||||
}
|
||||
if (downUrl == null || downUrl.trim().isEmpty()) {
|
||||
ToastUtils.showShort("下载链接不能为 null 或空!");
|
||||
LogUtils.e("下载链接不能为 null 或空!."+(mApi == null));
|
||||
return;
|
||||
}
|
||||
|
||||
this.mContext = context;
|
||||
final String dUrl = downUrl;
|
||||
File qipaoDir = new File(mContext.getFilesDir(), PATH_APK);
|
||||
if (qipaoDir.exists() && qipaoDir.isDirectory()) {
|
||||
Observable.create(new ObservableOnSubscribe<Boolean>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Boolean> emitter) throws Exception {
|
||||
LogUtils.e("删除文件中."+(mApi == null));
|
||||
FileUtils.deleteAllInDir(qipaoDir);
|
||||
emitter.onNext(true);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(result -> {
|
||||
LogUtils.e("删除成功."+(mApi == null));
|
||||
if (mApi == null) {
|
||||
//初始化网络请求接口
|
||||
mApi = ApiHelper.getInstance().createService(ApiInterface.class);
|
||||
int i = dUrl.lastIndexOf('/');//一定是找最后一个'/'出现的位置
|
||||
String downUrlEnd = "";
|
||||
if (i != -1) {
|
||||
downUrlEnd = dUrl.substring(i);
|
||||
}
|
||||
mApkPath = new File(mContext.getFilesDir(), PATH_APK + downUrlEnd).getAbsolutePath();
|
||||
}
|
||||
downloadFile(dUrl, downloadListener);
|
||||
});
|
||||
} else {
|
||||
LogUtils.e("else ."+(mApi == null));
|
||||
if (mApi == null) {
|
||||
//初始化网络请求接口
|
||||
mApi = ApiHelper.getInstance().createService(ApiInterface.class);
|
||||
int i = downUrl.lastIndexOf('/');//一定是找最后一个'/'出现的位置
|
||||
if (i != -1) {
|
||||
downUrl = downUrl.substring(i);
|
||||
}
|
||||
mApkPath = new File(mContext.getFilesDir(), PATH_APK + downUrl).getAbsolutePath();
|
||||
}
|
||||
|
||||
if (mApi == null) {
|
||||
//初始化网络请求接口
|
||||
mApi = ApiHelper.getInstance().createService(ApiInterface.class);
|
||||
mApkPath = new File(mContext.getFilesDir(), PATH_APK).getAbsolutePath();
|
||||
|
||||
downloadFile(downUrl, downloadListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,18 @@ import android.widget.LinearLayout;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.vectordrawable.graphics.drawable.Animatable2Compat;
|
||||
|
||||
import com.blankj.utilcode.util.ConvertUtils;
|
||||
import com.blankj.utilcode.util.Utils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.integration.webp.decoder.WebpDrawable;
|
||||
import com.bumptech.glide.integration.webp.decoder.WebpDrawableTransformation;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterInside;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.FutureTarget;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
@@ -655,6 +660,54 @@ public class ImageUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void loadWebpOneStart(int webp_anim, ImageView mAnimView){
|
||||
|
||||
if (mAnimView == null) {
|
||||
return;
|
||||
}
|
||||
// 1. 本地资源专属优化配置
|
||||
RequestOptions options = new RequestOptions()
|
||||
// 强制限制解码尺寸为ImageView显示尺寸(核心优化)
|
||||
.override(800, 800); // 本地图用原尺寸,或指定固定尺寸
|
||||
|
||||
//webp动图
|
||||
CenterInside transformation = new CenterInside();
|
||||
Glide.with(mAnimView)
|
||||
.load(webp_anim)//不是本地资源就改为url即可
|
||||
.apply(options)
|
||||
.optionalTransform(transformation)
|
||||
.optionalTransform(WebpDrawable.class, new WebpDrawableTransformation(transformation))
|
||||
.addListener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
||||
WebpDrawable webpDrawable = (WebpDrawable) resource;
|
||||
//需要设置为循环1次才会有onAnimationEnd回调
|
||||
webpDrawable.setLoopCount(1);
|
||||
webpDrawable.registerAnimationCallback(new Animatable2Compat.AnimationCallback() {
|
||||
@Override
|
||||
public void onAnimationStart(Drawable drawable) {
|
||||
super.onAnimationStart(drawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Drawable drawable) {
|
||||
super.onAnimationEnd(drawable);
|
||||
webpDrawable.unregisterAnimationCallback(this);
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(mAnimView);
|
||||
}
|
||||
|
||||
public static void clearDiskCache(Context context){
|
||||
Glide.get(context).clearDiskCache();
|
||||
}
|
||||
|
||||
@@ -50,15 +50,16 @@ public class QXRedPacketManager {
|
||||
*
|
||||
* @param redPackets 红包模型列表
|
||||
*/
|
||||
public void addRedPackets(List<RedPacketInfo> redPackets) {
|
||||
public void addRedPackets(String roomId,List<RedPacketInfo> redPackets) {
|
||||
if (redPackets == null || redPackets.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.redPackets.entrySet().removeIf(entry ->
|
||||
!(entry.getValue().getRoom_id()+"").equals(roomId));
|
||||
|
||||
for (RedPacketInfo model : redPackets) {
|
||||
this.redPackets.put(model.getRedpacket_id(), model);
|
||||
}
|
||||
|
||||
// 在添加数据后启动定时器(如果尚未启动)
|
||||
startCheckTimer();
|
||||
if (this.delegate != null && this.delegate instanceof QXRedPacketManagerDelegate) {
|
||||
@@ -71,11 +72,12 @@ public class QXRedPacketManager {
|
||||
*
|
||||
* @param redPacket 红包模型
|
||||
*/
|
||||
public void addRedPacket(RedPacketInfo redPacket) {
|
||||
public void addRedPacket(String roomId,RedPacketInfo redPacket) {
|
||||
if (redPacket == null || redPacket.getRedpacket_id() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.redPackets.entrySet().removeIf(entry ->
|
||||
!(entry.getValue().getRoom_id()+"").equals(roomId));
|
||||
this.redPackets.put(redPacket.getRedpacket_id(), redPacket);
|
||||
|
||||
// 在添加数据后启动定时器(如果尚未启动)
|
||||
|
||||
@@ -18,6 +18,7 @@ public class SPConstants {
|
||||
public static final String VOLUME = "VOLUME"; //音量
|
||||
public static final String CURRENT_MUSIC = "CURRENT_MUSIC"; //当前播放音乐
|
||||
public static final String OPEN_EFFECT = "OPEN_EFFECT"; //开启特效
|
||||
public static final String RED_SOUND = "RED_SOUND"; //开启红包声音
|
||||
public static final String OPEN_AU_BACK = "OPEN_AU_BACK"; //开启耳返
|
||||
public static final String ORDER_NEWS_COUNT = "orderNewsCount";
|
||||
public static final String ORDER_LAST_MSG = "lastOrderMsg";
|
||||
|
||||
@@ -370,6 +370,14 @@ public class SpUtil {
|
||||
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put(SPConstants.OPEN_EFFECT, i);
|
||||
}
|
||||
|
||||
public static void setRedSound(int i){
|
||||
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put(SPConstants.RED_SOUND, i);
|
||||
}
|
||||
|
||||
public static int getRedSound(){
|
||||
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.RED_SOUND, 1);
|
||||
}
|
||||
|
||||
//获取开启特效
|
||||
public static int getOpenEffect() {
|
||||
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.OPEN_EFFECT, 1);
|
||||
|
||||
@@ -168,4 +168,28 @@ public class TextViewUtils {
|
||||
public interface OnClickableTextListener {
|
||||
void onClick();
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用正则表达式格式化手机号,中间4位替换为****
|
||||
* @param phone 原始手机号
|
||||
* @return 格式化后的手机号
|
||||
*/
|
||||
public static String formatPhoneNumberWithRegex(String phone) {
|
||||
if (phone == null) {
|
||||
return "";
|
||||
}
|
||||
return phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理带区号的手机号,中间4位替换为****
|
||||
* @param phone 原始手机号(可能带区号)
|
||||
* @return 格式化后的手机号
|
||||
*/
|
||||
public static String formatAnyPhone(String phone) {
|
||||
if (phone == null) {
|
||||
return "";
|
||||
}
|
||||
return phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.xscm.moduleutil.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
@@ -207,7 +209,7 @@ public class TimeUtils {
|
||||
//获取当前日期
|
||||
public static String getCurrentDate2() {
|
||||
Date d = new Date();
|
||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss_SSS");
|
||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy年MM月dd日hh时mm分ss秒SSS");
|
||||
return sf.format(d);
|
||||
}
|
||||
/**
|
||||
@@ -258,6 +260,25 @@ public class TimeUtils {
|
||||
return "1天"; // 或者 return "0天";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算时间差值并向上取整为天数
|
||||
* @param currentTimeMillis 当前时间(毫秒级时间戳)
|
||||
* @param createTimeSecond 创建时间(秒级时间戳)
|
||||
* @return 向上取整后的天数
|
||||
*/
|
||||
public static int calculateDays(long currentTimeMillis, long createTimeSecond) {
|
||||
// 1. 计算时间差(毫秒)
|
||||
long timeDiffMillis = currentTimeMillis - createTimeSecond;
|
||||
|
||||
// 2. 转换为天数(1天 = 24*60*60*1000 毫秒)
|
||||
BigDecimal daysDecimal = new BigDecimal(timeDiffMillis)
|
||||
.divide(new BigDecimal(24 * 60 * 60 * 1000), 10, RoundingMode.HALF_UP);
|
||||
|
||||
// 3. 向上取整(即使是 8.0001 天也会变成 9 天)
|
||||
return daysDecimal.setScale(0, RoundingMode.CEILING).intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据生日字符串计算年龄
|
||||
* @param birthDay 生日字符串,格式为 "yyyy-MM-dd"
|
||||
|
||||
@@ -15,7 +15,8 @@ public enum EnvironmentEnum {
|
||||
1600096860,
|
||||
"3e8f3add448d4692bc1d04c75ffe801b",
|
||||
//"tcp://1.13.101.98",
|
||||
"tcp://1.13.20.30",
|
||||
// "tcp://1.13.20.30",
|
||||
"tcp://yushengapi.qxyushen.top",
|
||||
// "https://vespa.qxyushen.top/h5",
|
||||
"https://yushengapi.qxyushen.top/h5",
|
||||
0),
|
||||
@@ -30,7 +31,8 @@ public enum EnvironmentEnum {
|
||||
"wxc7681513be9f926b",
|
||||
1600096890,
|
||||
"02f7339ec98947deaeab173599891932",
|
||||
"tcp://1.13.181.248",
|
||||
// "tcp://1.13.181.248",
|
||||
"tcp://test.vespa.qxyushen.top",
|
||||
"https://test.vespa.qxyushen.top/h5",
|
||||
1);
|
||||
|
||||
|
||||
@@ -422,6 +422,7 @@ public class AvatarFrameView extends FrameLayout {
|
||||
mainHandler.post(() -> {
|
||||
// 检查是否已销毁
|
||||
if (file.exists()) {
|
||||
LogUtils.e("有缓存:"+file.exists()+"===="+file.getAbsolutePath());
|
||||
playMp4File(file);
|
||||
} else {
|
||||
LogUtils.w(TAG, "有缓存2222222222222");
|
||||
|
||||
@@ -260,6 +260,7 @@ public class Constants {
|
||||
public static final String GET_DECORATE = "/api/Decorate/user_decorate";//装扮详情
|
||||
public static final String SET_USER_DECORATE = "/api/Decorate/set_user_decorate";//用户装扮
|
||||
public static final String JOIN_ROOM = "/api/Room/join_room";//加入房间
|
||||
public static final String TASK_JUMP_ROOM = "/api/Room/task_jump_room";//师徒任务 加入房间
|
||||
|
||||
public static final String UPDATEPASSWORD = "/api/room/setRoomPassword";//更新房间秘密啊
|
||||
public static final String GET_ROOM_ONLINE = "/api/Room/room_online_list";//房间在线列表
|
||||
@@ -271,6 +272,7 @@ public class Constants {
|
||||
public static final String GET_ROOM_TYPE = "/api/Index/room_type_list";//房间分类列表
|
||||
public static final String GET_GIVE_GIFT = "/api/Gift/chat_gift_send";//聊天送礼物
|
||||
public static final String GET_WALLET = "/api/UserWallet/wallet";//钱包
|
||||
public static final String GET_TASKS_MESSAGE = "/api/Tasks/dailyTasksUnReceiveCount";//【新】未领取奖励任务数量
|
||||
public static final String REDPACKET_CREATE = "/api/Redpacket/create";//创建红包
|
||||
public static final String ROOM_REDPACKET = "/api/Redpacket/roomRedPackets";//红包列表
|
||||
|
||||
@@ -298,6 +300,7 @@ public class Constants {
|
||||
public static final String HELP_APPLY = "/api/RoomPit/help_apply_pit";//上麦助力
|
||||
public static final String POST_APPLY_SONG = "/api/RoomSong/apply_song";//申请点歌
|
||||
public static final String POST_AGREE_SONG = "/api/RoomSong/agree_song";//同意、拒绝点歌
|
||||
public static final String GET_BLIND_BOX_STATUS = "/api/BlindBoxTurntable/blind_box_status";//盲盒转盘状态
|
||||
public static final String POST_SONG_LIST = "/api/RoomSong/song_list";//获取已点歌曲
|
||||
public static final String POST_SONG = "/api/RoomSong/song";//点歌
|
||||
public static final String POST_UP_SONG = "/api/RoomSong/up_song";//移动歌曲
|
||||
@@ -360,9 +363,11 @@ public class Constants {
|
||||
public static final String POST_ROOM_RANKING = "/api/Ranking/room_ranking";//房间榜
|
||||
public static final String GUILD_RANKING = "/api/Ranking/guild_ranking";//公会榜
|
||||
public static final String POST_LOVE_RANKING = "/api/Ranking/love_ranking";//真爱榜
|
||||
public static final String GET_TASKS_LIHEN = "/api/Dailytasks/dailyTasksList";//每日任务列表
|
||||
public static final String GET_DAILY_TASK_BOX = "/api/Dailytasks/dailyTasksBoxRecord";//礼盒记录
|
||||
public static final String dailyTasksOpenBox = "/api/Dailytasks/dailyTasksOpenBox";//开启礼盒
|
||||
public static final String GET_TASKS_LIHEN = "/api/Tasks/dailyTasksList";//每日任务列表
|
||||
public static final String GET_DAILY_TASK_BOX = "/api/Tasks/dailyTasksBoxRecord";//礼盒记录
|
||||
public static final String dailyTasksOpenBox = "/api/Tasks/dailyTasksOpenBox";//开启礼盒
|
||||
public static final String dailyTasksReceive = "/api/Tasks/dailyTasksReceive";//领取每日任务奖励
|
||||
public static final String dailyTasksComplete = "/api/Tasks/dailyTasksComplete";//领取每日任务奖励
|
||||
public static final String GET_MY_BAG_DATA = "/api/UserGiftPack/get_gift_pack_income";//背包收入
|
||||
public static final String GET_MY_BAG_OUTCOME = "/api/UserGiftPack/get_gift_pack_outcome";//背包礼物支出列表
|
||||
public static final String GET_GIFT_PACK = "/api/UserGiftPack/get_gift_pack_list";//获取背包礼物列表
|
||||
@@ -386,9 +391,7 @@ public class Constants {
|
||||
public static final String GET_ACTIVITIES_PERMISSION = "/api/Activities/activities_permission";//活动弹框权限
|
||||
public static final String GET_INDEX_RECOMMEND_ROOM = "/api/Index/index_recommend_room";//首页弹窗推荐房间
|
||||
public static final String GET_DAY_DROP_GIFT = "/api/Activities/day_drop_gift";//天降好礼列表接口(弹框)
|
||||
public static final String dailyTasksReceive = "/api/Dailytasks/dailyTasksReceive";//领取每日任务奖励
|
||||
public static final String postRoomSwToken = "/api/Room/update_user_sw_token";//获取用户声网token
|
||||
public static final String dailyTasksComplete = "/api/Dailytasks/dailyTasksComplete";//领取每日任务奖励
|
||||
public static final String POST_CANCEL_USER_DECORATE = "/api/Decorate/cancel_user_decorate";//取消装扮
|
||||
public static final String GET_THEME_DATA = "/api/Theme/get_theme_data";//主题接口
|
||||
public static final String START_FRIEND = "/api/Friend/start_friend";//点击开始按钮 交友房
|
||||
@@ -436,10 +439,14 @@ public class Constants {
|
||||
public static final String POST_FREE_RE_SIGN = "/api/Sign/free_re_sign";//免费续约
|
||||
public static final String POST_RE_SIGN = "/api/Sign/re_sign";//续签(花金币)
|
||||
public static final String POST_SIGN_REFUSE = "/api/RoomPit/refuse_sign_room_host_invite";//签约房间主持邀请上签约麦用户拒绝
|
||||
public static final String GET_SIGN_IN_LIST = "/api/Tasks/dailyTasksSignList";//签到列表页面
|
||||
public static final String POST_DAILY_TASKS_SIGN = "/api/Tasks/dailyTasksSign";//每日签到
|
||||
public static final String POST_DAILY_TASKS_SIGN_STATUS = "/api/Tasks/dailyTasksSignStatus";//每日签到状态
|
||||
|
||||
|
||||
|
||||
public static final String MODIFY_MOBILE = "/api/UserData/modify_mobile";//手机换绑
|
||||
// public static final String MODIFY_MOBILE = "/api/UserData/modify_mobile";//手机换绑
|
||||
public static final String MODIFY_MOBILE = "/api/UserData/modify_mobiles";//手机换绑
|
||||
public static final String BIND_MOBILE = "/api/UserData/bind_mobile";//手机绑定
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ class CustomViewPager(context: Context, attrs: AttributeSet?) : ViewPager(contex
|
||||
private var initialX = 0f
|
||||
private var initialY = 0f
|
||||
|
||||
private var isBeingDragged = false
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
when (ev.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
@@ -31,11 +33,34 @@ class CustomViewPager(context: Context, attrs: AttributeSet?) : ViewPager(contex
|
||||
if (deltaX > deltaY && deltaX > 30) { // 30是阈值,可以根据需要调整
|
||||
return super.onInterceptTouchEvent(ev)
|
||||
}
|
||||
// 否则,不拦截,让子视图处理
|
||||
parent.requestDisallowInterceptTouchEvent(true)
|
||||
return false
|
||||
|
||||
// 如果是向上滑动,确保父容器不拦截
|
||||
if (deltaY > deltaX && ev.y < initialY) {
|
||||
parent.requestDisallowInterceptTouchEvent(true)
|
||||
return false
|
||||
}
|
||||
// // 否则,不拦截,让子视图处理
|
||||
// parent.requestDisallowInterceptTouchEvent(true)
|
||||
// return false
|
||||
}
|
||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
||||
isBeingDragged = false
|
||||
}
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev)
|
||||
}
|
||||
|
||||
override fun onTouchEvent(ev: MotionEvent): Boolean {
|
||||
when (ev.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
parent.requestDisallowInterceptTouchEvent(true)
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
if (isBeingDragged) {
|
||||
parent.requestDisallowInterceptTouchEvent(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onTouchEvent(ev)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,28 +10,20 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.opensource.svgaplayer.SVGACallback;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.tencent.qgame.animplayer.AnimConfig;
|
||||
import com.tencent.qgame.animplayer.AnimView;
|
||||
import com.tencent.qgame.animplayer.inter.IAnimListener;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
@@ -49,6 +41,7 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
|
||||
private ReentrantLock lock = new ReentrantLock();
|
||||
private List<String> giftArray = new ArrayList<>();
|
||||
@Setter
|
||||
@Getter
|
||||
public ExecutorService queue;
|
||||
private Context mContext;
|
||||
private boolean isOnece;
|
||||
@@ -234,17 +227,19 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
|
||||
public void openOrCloseEffectViewWith(boolean isShow) {
|
||||
this.isShow = isShow;
|
||||
removeSvgaQueueData();
|
||||
|
||||
playerMp4View.stopPlay();
|
||||
playerMp4View.setVisibility(View.GONE);
|
||||
if(playerMp4View!=null) {
|
||||
playerMp4View.stopPlay();
|
||||
playerMp4View.setVisibility(View.GONE);
|
||||
}
|
||||
setVisibility(isShow ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public void stopPlay() {
|
||||
removeSvgaQueueData();
|
||||
|
||||
playerMp4View.stopPlay();
|
||||
playerMp4View.setVisibility(View.GONE);
|
||||
if(playerMp4View!=null) {
|
||||
playerMp4View.stopPlay();
|
||||
playerMp4View.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -276,55 +271,52 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
|
||||
|
||||
if (isLoadEffect && giftModel != null && !TextUtils.isEmpty(giftModel)) {
|
||||
String finalGiftModel = giftModel;
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String playImage = finalGiftModel;
|
||||
if (playImage.endsWith("mp4")) {
|
||||
downloadAndPlay(getContext(), playImage, new DownloadCallback() {
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
post(() -> {
|
||||
playerMp4View.setVisibility(View.VISIBLE);
|
||||
svgaView.setVisibility(View.GONE);
|
||||
playerMp4View.startPlay(file);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
LogUtils.e("MP4下载或播放失败: " + e.getMessage());
|
||||
// 处理失败情况,继续播放下一个
|
||||
post(() -> {
|
||||
lock.lock();
|
||||
try {
|
||||
isLoadEffect = false;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
loadStartSVGAPlayer();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (playImage.endsWith("svga")) {
|
||||
// File file = downloadAndPlay(getContext(), playImage);
|
||||
post(() -> {
|
||||
playerMp4View.setVisibility(View.GONE);
|
||||
svgaView.setVisibility(View.VISIBLE);
|
||||
svgaView.loadSVGAPlayerWith(finalGiftModel, false);
|
||||
});
|
||||
} else {
|
||||
lock.lock();
|
||||
try {
|
||||
isLoadEffect = false;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
post(() -> {
|
||||
String playImage = finalGiftModel;
|
||||
if (playImage.endsWith("mp4")) {
|
||||
downloadAndPlay(getContext(), playImage, new DownloadCallback() {
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
post(() -> {
|
||||
playerMp4View.setVisibility(View.VISIBLE);
|
||||
svgaView.setVisibility(View.GONE);
|
||||
playerMp4View.startPlay(file);
|
||||
});
|
||||
}
|
||||
loadStartSVGAPlayer();
|
||||
// 直接播放缓存文件
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
LogUtils.e("MP4下载或播放失败: " + e.getMessage());
|
||||
// 处理失败情况,继续播放下一个
|
||||
post(() -> {
|
||||
lock.lock();
|
||||
try {
|
||||
isLoadEffect = false;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
loadStartSVGAPlayer();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (playImage.endsWith("svga")) {
|
||||
// File file = downloadAndPlay(getContext(), playImage);
|
||||
post(() -> {
|
||||
playerMp4View.setVisibility(View.GONE);
|
||||
svgaView.setVisibility(View.VISIBLE);
|
||||
svgaView.loadSVGAPlayerWith(finalGiftModel, false);
|
||||
});
|
||||
} else {
|
||||
lock.lock();
|
||||
try {
|
||||
isLoadEffect = false;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
loadStartSVGAPlayer();
|
||||
// 直接播放缓存文件
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,13 @@ public class QXGiftPlayerManager {
|
||||
}
|
||||
|
||||
public void displayFullEffectView1(List<String> stringList){
|
||||
if (getDefaultFullEffectView().getQueue() == null){
|
||||
// 创建专用线程池替代GCD队列
|
||||
ExecutorService queue = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<Runnable>(),
|
||||
Executors.defaultThreadFactory());
|
||||
fullEffectView.setQueue(queue);
|
||||
}
|
||||
getDefaultFullEffectView().displayEffectView1(stringList);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class ShineTextView : AppCompatTextView {
|
||||
|
||||
var _count: Int = 0 //自行运行动画次数
|
||||
|
||||
private lateinit var mLinearGradient: LinearGradient
|
||||
private var mLinearGradient: LinearGradient? = null
|
||||
private var mGradientMatrix: Matrix = Matrix()
|
||||
private var mViewWidth = 0
|
||||
private var mTranslate = 0
|
||||
@@ -121,13 +121,13 @@ class ShineTextView : AppCompatTextView {
|
||||
_count++
|
||||
}
|
||||
mGradientMatrix.setTranslate(mTranslate.toFloat(), 0f)
|
||||
mLinearGradient.setLocalMatrix(mGradientMatrix)
|
||||
mLinearGradient?.setLocalMatrix(mGradientMatrix)
|
||||
when {
|
||||
shineType == 0 && _count < shineCount -> postInvalidateDelayed(50)
|
||||
shineType == 1 && _count < 1 -> postInvalidateDelayed(50)
|
||||
else -> {
|
||||
mGradientMatrix.setTranslate((1.2 * mViewWidth).toFloat(), 0f)
|
||||
mLinearGradient.setLocalMatrix(mGradientMatrix)
|
||||
mLinearGradient?.setLocalMatrix(mGradientMatrix)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
||||
|
||||
private void giveGift(String num) {
|
||||
getSelectedGift();
|
||||
if (roonGiftModel == null) {
|
||||
if (roonGiftModel == null || !roonGiftModel.isChecked()) {
|
||||
ToastUtils.show("请选择礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
14
BaseModule/src/main/res/drawable/bg_r16_deff85_cfffdc.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:centerColor="#CFFFDC"
|
||||
android:endColor="#CFFFDC"
|
||||
android:startColor="#DEFF85"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners
|
||||
android:radius="@dimen/dp_16"
|
||||
/>
|
||||
</shape>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:centerColor="#90FF86"
|
||||
android:endColor="#E7FE67"
|
||||
android:startColor="#5CFBBD"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<stroke android:color="#FFFFF072" android:width="@dimen/dp_1"/>
|
||||
<corners android:radius="@dimen/dp_99" />
|
||||
</shape>
|
||||
10
BaseModule/src/main/res/drawable/bg_sigin_status.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#fffcf7eb" />
|
||||
<corners
|
||||
android:bottomLeftRadius="4dp"
|
||||
android:bottomRightRadius="4dp"
|
||||
android:topLeftRadius="4dp"
|
||||
android:topRightRadius="4dp" />
|
||||
</shape>
|
||||
16
BaseModule/src/main/res/drawable/selector_sign_bg.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:centerColor="#CFFFDC"
|
||||
android:endColor="#CFFFDC"
|
||||
android:startColor="#DEFF85"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners
|
||||
android:bottomLeftRadius="4dp"
|
||||
android:bottomRightRadius="4dp"
|
||||
android:topLeftRadius="4dp"
|
||||
android:topRightRadius="4dp" />
|
||||
</shape>
|
||||
@@ -67,7 +67,8 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/textView1"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView1"
|
||||
app:layout_constraintWidth_default="percent"
|
||||
app:layout_constraintWidth_percent="0.2" />
|
||||
app:layout_constraintWidth_percent="0.2"
|
||||
android:visibility="gone" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
android:gravity="center"
|
||||
android:text="抽奖榜单"
|
||||
android:textColor="@drawable/text_color_radio_selector"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RadioButton
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_3"
|
||||
android:gravity="center"
|
||||
android:text="抽十次"
|
||||
android:text="抽五次"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<TextView
|
||||
@@ -573,7 +573,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_3"
|
||||
android:gravity="center"
|
||||
android:text="抽百次"
|
||||
android:text="抽八次"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -122,8 +122,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="7"
|
||||
tools:text="为什么会有这篇文章呢,是因为之前关于 TabLayout 的使用陆陆续续也写了好几篇了,感觉比较分散,且不成体系,写这篇文章的目的就是希望能把各种效果的实现一次性讲齐,所以也有了标题的「看这篇就够了」。
|
||||
TabLayout作为导航组件来说,使用场景非常的多,也意味着要满足各种各样的需求。
|
||||
在效果实现上,有同学会选择自定义 View 来做,定制性高,但易用性、稳定性、维护性不敢保证,使用官方组件能避免这些不确定性,一是开源,有很多大佬共建,会不停的迭代;二是经过大型 app 验证,比如 google play;有了这两点,基本可以放心大胆的使用官方组件了。
|
||||
那可能有的同学又会说,道理我都懂,可是不满足需求啊,只能自定义了。是的,早期的 api 确实不够丰富,在某些需求的实现上显得捉襟见肘,但是 google 也在不断的迭代,目前为止,常见的样式都能满足。"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
android:id="@+id/im_heartssss"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/icon_heart"
|
||||
tools:src="@mipmap/icon_heart"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:scaleType="fitCenter"
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.59" />
|
||||
app:layout_constraintGuide_percent="0.62" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_frame_bg"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
android:src="@mipmap/jiaoy"/>
|
||||
|
||||
<!-- 头像框,与头像大小相同,覆盖在头像上 -->
|
||||
|
||||
BIN
BaseModule/src/main/res/mipmap-hdpi/day_task.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/hourly_djs.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/hourly_top_bj.png
Normal file
|
After Width: | Height: | Size: 196 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/icon_teacher.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/me_test.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 626 B |
BIN
BaseModule/src/main/res/mipmap-hdpi/rank_im_t1.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/rank_im_t2.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/rank_im_t3.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/task_lq.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/the_city_years.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/time_space.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/y_w.png
Normal file
|
After Width: | Height: | Size: 541 B |
BIN
BaseModule/src/main/res/mipmap-hdpi/y_won.png
Normal file
|
After Width: | Height: | Size: 633 B |
|
Before Width: | Height: | Size: 3.0 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/day_task.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/hourly_djs.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/hourly_top_bj.png
Normal file
|
After Width: | Height: | Size: 301 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/icon_teacher.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/me_test.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 596 B |
BIN
BaseModule/src/main/res/mipmap-xhdpi/rank_im_t1.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/rank_im_t2.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/rank_im_t3.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/task_lq.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/the_city_years.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/time_space.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/y_w.png
Normal file
|
After Width: | Height: | Size: 505 B |
BIN
BaseModule/src/main/res/mipmap-xhdpi/y_won.png
Normal file
|
After Width: | Height: | Size: 522 B |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/day_task.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 12 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/hourly_djs.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/hourly_top_bj.png
Normal file
|
After Width: | Height: | Size: 554 KiB |
|
Before Width: | Height: | Size: 30 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/icon_teacher.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/me_test.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/rank_im_t1.png
Normal file
|
After Width: | Height: | Size: 133 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/rank_im_t2.png
Normal file
|
After Width: | Height: | Size: 100 KiB |