修改BUG
This commit is contained in:
@@ -7,6 +7,7 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@@ -27,6 +28,8 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends AppCompatActivity {
|
||||
@Override
|
||||
@@ -34,6 +37,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
super.attachBaseContext(LanguageUtil.attachBaseContext(newBase));
|
||||
}
|
||||
protected VDB mBinding;
|
||||
private static final List<BaseMvpActivity> activityList = new ArrayList<>();
|
||||
|
||||
|
||||
// private LoadingDialog mLoadingDialog;
|
||||
|
||||
@@ -70,6 +75,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
|
||||
// // 设置全屏模式,隐藏状态栏和导航栏
|
||||
// View decorView = getWindow().getDecorView();
|
||||
// decorView.setSystemUiVisibility(
|
||||
@@ -81,7 +87,13 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
// | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
|
||||
}
|
||||
|
||||
public static void finishAll() {
|
||||
for (BaseMvpActivity activity : activityList) {
|
||||
if (!activity.isFinishing()) {
|
||||
activity.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Resources getResources() {//禁止app字体大小跟随系统字体大小调节
|
||||
Resources resources = super.getResources();
|
||||
@@ -189,5 +201,4 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.content.pm.PackageManager;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
@@ -302,5 +303,4 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -82,6 +83,10 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
|
||||
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
|
||||
mBinding.webView.setWebViewClient(new WebViewClient());
|
||||
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
mBinding.webView.requestFocus();
|
||||
mBinding.webView.loadUrl(url);
|
||||
|
||||
@@ -274,6 +279,11 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
|
||||
public void enterAuthent() {//实名认证
|
||||
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void Recharge(){
|
||||
ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation();
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.qxcm.moduleutil.event.GiftDoubleClickEvent;
|
||||
import com.qxcm.moduleutil.event.GiftUserRefreshEvent;
|
||||
import com.qxcm.moduleutil.event.RoomGiftClickEvent;
|
||||
import com.qxcm.moduleutil.event.RoomGiftClickToEvent;
|
||||
import com.qxcm.moduleutil.event.RoomGiftPackToEvent;
|
||||
import com.qxcm.moduleutil.presenter.RewardGiftContacts;
|
||||
import com.qxcm.moduleutil.presenter.RewardGiftPresenter;
|
||||
|
||||
@@ -171,7 +172,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
// mAdapter = new GiftTwoAdapter(getActivity(), data, j, "0");
|
||||
// mBinding.rvGift.setAdapter(mAdapter);
|
||||
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, j, "0");
|
||||
mBinding.rvGift.setAdapter(roomAdapter);
|
||||
mBinding.rvGift.setAdapter(packAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +232,65 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGiftClicPackEvent(RoomGiftPackToEvent event) {
|
||||
if (giftPackList == null) {
|
||||
giftPackList = new ArrayList<>();
|
||||
giftPackList.add(event.gift);
|
||||
}
|
||||
if (event.type == 1){
|
||||
String id = event.gift.getGift_id();
|
||||
for (int i = 0; i < giftPackList.size(); i++) {
|
||||
GiftPackBean giftModel = giftPackList.get(i);
|
||||
RoonGiftModel roonGiftModel = new RoonGiftModel();
|
||||
roonGiftModel.setGift_id(giftModel.getGift_id());
|
||||
roonGiftModel.setGift_name(giftModel.getGift_name());
|
||||
roonGiftModel.setGift_price(giftModel.getGift_price());
|
||||
roonGiftModel.setBase_image(giftModel.getBase_image());
|
||||
roonGiftModel.setNum(Integer.parseInt(giftModel.getNum()));
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
if (!giftModel.isChecked()) {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,roonGiftModel));
|
||||
giftModel.setChecked(true);
|
||||
}
|
||||
} else {
|
||||
giftModel.setChecked(false);
|
||||
}
|
||||
}
|
||||
if (event.adapter != null && event.adapter.get() != null) {
|
||||
event.adapter.get().notifyDataSetChanged();
|
||||
}
|
||||
}else {
|
||||
String id = event.gift.getGift_id();
|
||||
GiftPackBean selGift = null;
|
||||
for (int i = 0; i < giftPackList.size(); i++) {
|
||||
GiftPackBean giftModel = giftPackList.get(i);
|
||||
RoonGiftModel roonGiftModel = new RoonGiftModel();
|
||||
roonGiftModel.setGift_id(giftModel.getGift_id());
|
||||
roonGiftModel.setGift_name(giftModel.getGift_name());
|
||||
roonGiftModel.setGift_price(giftModel.getGift_price());
|
||||
roonGiftModel.setBase_image(giftModel.getBase_image());
|
||||
roonGiftModel.setNum(Integer.parseInt(giftModel.getNum()));
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
selGift = giftModel;
|
||||
if (!giftModel.isChecked()) {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,roonGiftModel));
|
||||
giftModel.setChecked(true);
|
||||
}
|
||||
} else {
|
||||
giftModel.setChecked(false);
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
|
||||
}
|
||||
}
|
||||
if (event.adapter != null && event.adapter.get() != null) {
|
||||
event.adapter.get().notifyDataSetChanged();
|
||||
}
|
||||
if (selGift != null) {
|
||||
EventBus.getDefault().post(new GiftDoubleClickEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGiftClicRoomkTEvent(RoomGiftClickToEvent event) {
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.scwang.smartrefresh.layout.api.RefreshHeader;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
|
||||
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.tencent.qcloud.tuicore.TUILogin;
|
||||
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
|
||||
|
||||
@@ -131,6 +132,8 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId());
|
||||
MessageListenerSingleton.getInstance();
|
||||
|
||||
CrashReport.initCrashReport(this, "865cfe9555", true);
|
||||
// CrashReport.testJavaCrash();
|
||||
// startInitSdk();
|
||||
}
|
||||
private PiaoPingManager piaoPingManager;
|
||||
|
||||
@@ -4,6 +4,11 @@ import com.stx.xhb.xbanner.entity.SimpleBannerInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class BannerModel extends SimpleBannerInfo {
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-5 01:38:04$ $
|
||||
* @Description 更新用户声网token$
|
||||
*/
|
||||
@Data
|
||||
public class PkSwTokenBean {
|
||||
private String agora_token;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ public class RevenueBean {
|
||||
private String change_value;
|
||||
private String remarks;
|
||||
private String createtime;
|
||||
private int type; //1:金币 2:钻石
|
||||
// private String title;
|
||||
// private String time;
|
||||
// private String money;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-6 12:04:05$ $
|
||||
* @Description 完成任务后返回的参数$
|
||||
*/
|
||||
@Data
|
||||
public class RoomSingleton {
|
||||
private int is_completed;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class UserInfo implements Serializable {
|
||||
// private String tag_name;
|
||||
// }
|
||||
@Data
|
||||
public static class GiftWall{
|
||||
public static class GiftWall {
|
||||
private String gift_name;
|
||||
private String total;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
/**
|
||||
*@author qx
|
||||
@@ -7,7 +9,7 @@ import lombok.Data;
|
||||
*@description: 用户标签实体
|
||||
*/
|
||||
@Data
|
||||
public class UserTagBean {
|
||||
public class UserTagBean implements Serializable {
|
||||
private String id;
|
||||
private String tag_name;
|
||||
private String createtime;
|
||||
|
||||
@@ -13,4 +13,6 @@ public class WalletBean {
|
||||
private String user_id;
|
||||
private String coin;//金币
|
||||
private String earnings;//钻石
|
||||
private String url;//灵活就业合作伙伴协议
|
||||
private String title;//状态
|
||||
}
|
||||
|
||||
@@ -74,9 +74,10 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
public static final int QXRoomMessageTypeRoomPKDisconnect = 1033;
|
||||
///排麦模式下的人数变化
|
||||
public static final int QXRoomMessageTypeRoomMaiwrens = 1034;
|
||||
public static final int QXRoomMessageTypeRoomDress = 1035;
|
||||
public static final int QXRoomMessageTypeRoomOnline = 1036;
|
||||
public static final int QXRoomMessageTypeRoomDress = 1035;//动态修改用户头像信息
|
||||
public static final int QXRoomMessageTypeRoomOnline = 1036;//
|
||||
public static final int QXRoomMessageTypeRoomOPK = 1037;
|
||||
public static final int QXRoomMessageTypeRoomOMh = 1038;
|
||||
///关闭对方麦克风
|
||||
public static final int QXRoomMessageTypeMuteRemoteAudio = 125;
|
||||
public static final int QXRoomMessageTypeMuteLocalAudio = 126;
|
||||
@@ -131,6 +132,7 @@ public class EMMessageInfo implements MultiItemEntity {
|
||||
case QXRoomMessageTypeRoomDress:
|
||||
case QXRoomMessageTypeRoomOnline:
|
||||
case QXRoomMessageTypeRoomOPK:
|
||||
case QXRoomMessageTypeRoomOMh:
|
||||
return 1;
|
||||
case QXRoomMessageTypeGift:
|
||||
return 3;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.qxcm.moduleutil.bean.room;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
/**
|
||||
*@author qx
|
||||
@@ -7,7 +9,7 @@ import lombok.Data;
|
||||
*@description: pk实体
|
||||
*/
|
||||
@Data
|
||||
public class PkRoomInfo {
|
||||
public class PkRoomInfo implements Serializable {
|
||||
private String pk_room_id;//对方房间的roomId
|
||||
private String invite_pk_user_id;//pk发起者的用户id
|
||||
private String pk_id;//pkid
|
||||
|
||||
@@ -112,7 +112,7 @@ public class FirstChargeDialog extends BaseDialog<DialogFirstChargeBinding> {
|
||||
type=2;
|
||||
} else if (i == R.id.btn_2) {
|
||||
List<RoonGiftModel> list = new ArrayList<>();
|
||||
if (firstChargeGiftBean.getGift_bag().size() > 3) {
|
||||
if (firstChargeGiftBean.getGift_bag().size() == 3) {
|
||||
if (firstChargeGiftBean.getGift_bag().get(2)!=null) {
|
||||
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(2).getTitle1());
|
||||
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(2).getTitle2());
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
package com.qxcm.moduleutil.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.activity.WebViewActivity;
|
||||
import com.qxcm.moduleutil.adapter.HeavenGiftAdapter;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.bean.BaseListData;
|
||||
import com.qxcm.moduleutil.bean.FirstChargeGiftBean;
|
||||
import com.qxcm.moduleutil.bean.RoonGiftModel;
|
||||
import com.qxcm.moduleutil.databinding.DialogFirstChargeBinding;
|
||||
import com.qxcm.moduleutil.databinding.WebViewDialogBinding;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.http.RetrofitClient;
|
||||
import com.qxcm.moduleutil.utils.ARouteConstants;
|
||||
import com.qxcm.moduleutil.widget.dialog.BaseDialog;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity;
|
||||
import com.zhpan.bannerview.indicator.DrawableIndicator;
|
||||
import com.zhpan.indicator.base.IIndicator;
|
||||
import com.zhpan.indicator.enums.IndicatorSlideMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-8 09:20:18$ $
|
||||
* @Description 弹窗webview$
|
||||
*/
|
||||
public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
|
||||
|
||||
String mUrl;
|
||||
|
||||
public WebViewDialog(@NonNull Context context,String url) {
|
||||
super(context, R.style.BaseDialogStyleH);
|
||||
this.mUrl=url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.web_view_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
Window window = getWindow();
|
||||
assert window != null;
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 320.f / 375), WindowManager.LayoutParams.MATCH_PARENT);
|
||||
mBinding.ivClose.setOnClickListener(v -> dismiss());
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
WebSettings webSettings = mBinding.webView.getSettings();
|
||||
webSettings.setUseWideViewPort(true);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
|
||||
//增加JSBridge
|
||||
mBinding.webView.addJavascriptInterface(new WebAppInterface(getContext()), "Android");
|
||||
// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
|
||||
webSettings.setBuiltInZoomControls(false);
|
||||
webSettings.setSupportZoom(false);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
|
||||
mBinding.webView.setWebViewClient(new WebViewClient());
|
||||
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
mBinding.webView.requestFocus();
|
||||
mBinding.webView.loadUrl("https://vespa.qxmier.com/web/index.html#/pages/other/taskDesc");
|
||||
}
|
||||
|
||||
private Resources getResources() {
|
||||
return getContext().getResources();
|
||||
}
|
||||
|
||||
public class WebAppInterface {
|
||||
Context mContext;
|
||||
|
||||
WebAppInterface(Context c) {
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
// 被 H5 调用的方法
|
||||
@JavascriptInterface
|
||||
public void showToast(String toast) {
|
||||
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void closeWeb() {
|
||||
LogUtils.e("value: ");
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void customerService() {
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(); // 填移动应用(App)的 AppId
|
||||
IWXAPI api = WXAPIFactory.createWXAPI(mContext, appId);
|
||||
|
||||
// 判断当前版本是否支持拉起客服会话
|
||||
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
|
||||
req.corpId = "ww1de4300858c0b461"; // 企业ID
|
||||
req.url = "https://work.weixin.qq.com/kfid/kfcb3d23a59c188a0e7"; // 客服URL
|
||||
api.sendReq(req);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void jumpRoomPage(String room_id) {
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void jumpWebPage(String objects) {
|
||||
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", objects).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void enterGroupChat(String group_id,String cover,String guild_name) {
|
||||
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void chatWithUser(String user_id,String nickname) {
|
||||
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void exchange(){
|
||||
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void Withdrawal() {
|
||||
ARouter.getInstance().build(ARouteConstants.WITHDRAWAL_ACTIVITY).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void enterAuthent() {//实名认证
|
||||
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void Recharge(){
|
||||
ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.qxcm.moduleutil.event;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-6 14:53:35$ $
|
||||
* @Description 房间任务信息$
|
||||
*/
|
||||
public class RoomTaskEvent {
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import com.qxcm.moduleutil.bean.MyRoomBean;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
import com.qxcm.moduleutil.bean.NewsMessageList;
|
||||
import com.qxcm.moduleutil.bean.PersonaltyBean;
|
||||
import com.qxcm.moduleutil.bean.PkSwTokenBean;
|
||||
import com.qxcm.moduleutil.bean.PlaceholderBean;
|
||||
import com.qxcm.moduleutil.bean.RealNameBean;
|
||||
import com.qxcm.moduleutil.bean.RechargeBean;
|
||||
@@ -110,11 +111,14 @@ public interface ApiServer {
|
||||
@POST(Constants.dailyTasksOpenBox)
|
||||
Observable<BaseModel<GiftName>> dailyTasksOpenBox(@Field("gift_box_id") String gift_box_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.dailyTasksReceive)
|
||||
Call<ResponseBody> dailyTasksReceive(@Field("task_id") String task_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.dailyTasksComplete)
|
||||
Call<ResponseBody> dailyTasksComplete(@Field("task_id") String task_id);
|
||||
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.SEND_HEADLINE)
|
||||
Call<BaseModel<String>> sendHeadine(@Field("content") String content, @Field("money") String money, @Field("room_id") String roomId);
|
||||
@@ -135,7 +139,7 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_LOG_LIST)
|
||||
Observable<BaseModel<List<RevenueBean>>> getRevenueData(@Field("page") String page, @Field("page_limit") String page_limit, @Field("in_out_type") String in_out_type, @Field("start_time") String start_time, @Field("end_time") String end_time, @Field("gift_type") String gift_type);
|
||||
Call<BaseModel<List<RevenueBean>>> getRevenueData(@Field("page") String page, @Field("page_limit") String page_limit, @Field("in_out_type") String in_out_type, @Field("start_time") String start_time, @Field("end_time") String end_time, @Field("gift_type") String gift_type);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_WEALTH_RANKING)
|
||||
@@ -429,10 +433,19 @@ public interface ApiServer {
|
||||
@POST(Constants.POST_USER_OLINE_STATUS)
|
||||
Call<BaseModel<List<UserOnlineStatusBean>>> userOnlineStatus(@Field("user_id") String userId,@Field("room_id")String roomId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.postRoomSwToken)
|
||||
Call<BaseModel<PkSwTokenBean>> postRoomSwToken(@Field("room_id") String roomId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.SET_USER_DECORATE)
|
||||
Call<BaseModel<String>> setUserDecorate(@Field("udid") String udid);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_CANCEL_USER_DECORATE)
|
||||
Call<BaseModel<String>> cancelUserDecorate(@Field("type") String type);
|
||||
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.UP_ALBUM)
|
||||
Call<BaseModel<String>> upAddAlbum(@Field("album_id") String album_id, @Field("images") String images, @Field("content") String content);
|
||||
|
||||
@@ -62,12 +62,12 @@ public abstract class BaseObserver<T> implements Observer<T> {
|
||||
}
|
||||
}
|
||||
if (showErrMsg && !TextUtils.isEmpty(apiException.getMessage())) {
|
||||
ToastUtils.show(extractChinese(apiException.getMessage()));
|
||||
// ToastUtils.show(extractChinese(apiException.getMessage()));
|
||||
}
|
||||
} else if (e instanceof APIException) {
|
||||
APIException apiException = (APIException) e;
|
||||
if (showErrMsg && !TextUtils.isEmpty(apiException.getMessage())) {
|
||||
ToastUtils.show(apiException.getMessage());
|
||||
// ToastUtils.show(apiException.getMessage());
|
||||
}
|
||||
} else if (e instanceof JsonSyntaxException) {
|
||||
ToastUtils.show("网络请求错误……");
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.qxcm.moduleutil.bean.MyRoomBean;
|
||||
import com.qxcm.moduleutil.bean.NewsDataBean;
|
||||
import com.qxcm.moduleutil.bean.NewsMessageList;
|
||||
import com.qxcm.moduleutil.bean.PersonaltyBean;
|
||||
import com.qxcm.moduleutil.bean.PkSwTokenBean;
|
||||
import com.qxcm.moduleutil.bean.PlaceholderBean;
|
||||
import com.qxcm.moduleutil.bean.RealNameBean;
|
||||
import com.qxcm.moduleutil.bean.RechargeBean;
|
||||
@@ -56,6 +57,7 @@ import com.qxcm.moduleutil.bean.RoomCharmRankBean;
|
||||
import com.qxcm.moduleutil.bean.RoomDetails;
|
||||
import com.qxcm.moduleutil.bean.RoomRelationBean;
|
||||
import com.qxcm.moduleutil.bean.RoomSearchResp;
|
||||
import com.qxcm.moduleutil.bean.RoomSingleton;
|
||||
import com.qxcm.moduleutil.bean.RoomSubsidy;
|
||||
import com.qxcm.moduleutil.bean.RoomSubsidyDetails;
|
||||
import com.qxcm.moduleutil.bean.RoomTime;
|
||||
@@ -445,8 +447,8 @@ public class RetrofitClient {
|
||||
sApiServer.dailyTasksOpenBox(gift_box_id).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void dailyTasksComplete(String task_id,BaseObserver<String> observer){
|
||||
sApiServer.dailyTasksComplete(task_id).enqueue(new Callback<ResponseBody>() {
|
||||
public void dailyTasksReceive(String task_id,BaseObserver<String> observer){
|
||||
sApiServer.dailyTasksReceive(task_id).enqueue(new Callback<ResponseBody>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
||||
@@ -462,6 +464,30 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void dailyTasksComplete(String task_id,BaseObserver<RoomSingleton> observer) {
|
||||
sApiServer.dailyTasksComplete(task_id).enqueue(new Callback<ResponseBody>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
||||
if (response.code() == 200) {
|
||||
String json = null;
|
||||
try {
|
||||
json = response.body().string();
|
||||
Type type = new TypeToken<BaseModel<RoomSingleton>>() {
|
||||
}.getType();
|
||||
BaseModel<RoomSingleton> baseModel = GsonUtils.fromJson(json, type);
|
||||
observer.onNext(baseModel.getData());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseBody> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
public void sendHeadine(String content, String money, String roomId, BaseObserver<String> observer) {
|
||||
sApiServer.sendHeadine(content, money, roomId).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
@@ -503,7 +529,26 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
public void getRevenueData(String page, String page_limit, String in_out_type, String start_time, String end_time, String gift_type, BaseObserver<List<RevenueBean>> observer) {
|
||||
sApiServer.getRevenueData(page, page_limit, in_out_type, start_time, end_time, gift_type).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
sApiServer.getRevenueData(page, page_limit, in_out_type, start_time, end_time, gift_type).enqueue(new Callback<BaseModel<List<RevenueBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RevenueBean>>> call, Response<BaseModel<List<RevenueBean>>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<List<RevenueBean>> baseModel = response.body();
|
||||
if (baseModel != null) {
|
||||
if (baseModel.getData() != null && baseModel.getData().size() > 0) {
|
||||
observer.onNext(baseModel.getData());
|
||||
}else {
|
||||
observer.onNext(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<RevenueBean>>> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void realNameInfo(BaseObserver<RealNameBean> observer) {
|
||||
@@ -1563,6 +1608,22 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void cancelUserDecorate(String type, BaseObserver<String> observer) {
|
||||
sApiServer.cancelUserDecorate(type).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code() == 200){
|
||||
observer.onNext("取消成功");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void publishZone(String images, String content, String topic_id, String room_id, String ip, BaseObserver<String> observer) {
|
||||
|
||||
sApiServer.publishZone(images, content, topic_id, room_id, ip).enqueue(new Callback<BaseModel<String>>() {
|
||||
@@ -1820,6 +1881,24 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void postRoomSwToken(String roomId, BaseObserver<PkSwTokenBean> observer){
|
||||
sApiServer.postRoomSwToken(roomId).enqueue(new Callback<BaseModel<PkSwTokenBean>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<PkSwTokenBean>> call, Response<BaseModel<PkSwTokenBean>> response) {
|
||||
if (response.code() == 200){
|
||||
BaseModel<PkSwTokenBean> baseModel = response.body();
|
||||
observer.onNext(baseModel.getData());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<PkSwTokenBean>> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeBlackList(String user_id, BaseObserver<String> observer) {
|
||||
sApiServer.removeBlackList(user_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
|
||||
@@ -125,12 +125,35 @@ public class MessageListenerSingleton {
|
||||
public void onReceiveRESTCustomData(String groupID, byte[] customData) {
|
||||
// 服务器发送的自定义系统通知
|
||||
// 将 byte[] 转换为 String
|
||||
String message = new String(customData, StandardCharsets.UTF_8);
|
||||
RoomMessageEvent event = GsonUtils.fromJson(message, RoomMessageEvent.class);
|
||||
|
||||
// String message = new String(customData, StandardCharsets.UTF_8);
|
||||
// RoomMessageEvent event = GsonUtils.fromJson(message, RoomMessageEvent.class);
|
||||
// if (groupID.contains(SpUtil.getMyRoomId())) {
|
||||
// notifyMessageReceived(event);
|
||||
// }
|
||||
// LogUtils.e("收到群自定义消息(系统):" + message);
|
||||
|
||||
String message = "";
|
||||
try {
|
||||
message = new String(customData, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
// 处理转换过程中可能出现的异常,例如记录日志
|
||||
LogUtils.e("转换 customData 为 String 时出错:" + e.getMessage());
|
||||
return; // 退出方法,避免后续代码执行
|
||||
}
|
||||
|
||||
RoomMessageEvent event = null;
|
||||
try {
|
||||
event = GsonUtils.fromJson(message, RoomMessageEvent.class);
|
||||
} catch (Exception e) {
|
||||
// 处理 JSON 解析过程中可能出现的异常,例如记录日志
|
||||
LogUtils.e("解析 JSON 数据时出错:" + e.getMessage());
|
||||
return; // 退出方法,避免后续代码执行
|
||||
}
|
||||
|
||||
if (groupID.contains(SpUtil.getMyRoomId())) {
|
||||
notifyMessageReceived(event);
|
||||
}
|
||||
LogUtils.e("收到群自定义消息(系统):" + message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -11,15 +11,17 @@ import com.qxcm.moduleutil.bean.WalletBean;
|
||||
import com.qxcm.moduleutil.bean.room.RoomAuction;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View> implements RewardGiftContacts.IIndexPre {
|
||||
|
||||
RewardGiftContacts.View mView;
|
||||
public RewardGiftPresenter(RewardGiftContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,6 +99,9 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
if (MvpRef==null){
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().giveGift();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1123,7 +1123,7 @@ public class AgoraManager {
|
||||
}
|
||||
|
||||
public static void nextSong() {
|
||||
if (musicList.size() > 0) {
|
||||
if (musicList != null && musicList.size() > 0) {
|
||||
stopMuisc();
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
EventBus.getDefault().post(musicList.get(0));
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
@@ -36,7 +37,7 @@ public class EMqttService extends Service {
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
if (intent != null && intent.hasExtra("mqttBean")) {
|
||||
MqttBean mqttBean = (MqttBean) intent.getSerializableExtra("mqttBean");
|
||||
showPiaoPingMessage(mqttBean);
|
||||
showPiaoPingMessage(mqttBean);//全局飘屏
|
||||
}
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
@@ -55,28 +56,37 @@ public class EMqttService extends Service {
|
||||
}
|
||||
|
||||
public void showPiaoPingMessage(MqttBean mqttBean) {
|
||||
|
||||
int screenWidth = getResources().getDisplayMetrics().widthPixels;
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
//
|
||||
// WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
|
||||
// WindowManager.LayoutParams.MATCH_PARENT,
|
||||
// WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
// Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
|
||||
// WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
|
||||
// WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
|
||||
// WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
|
||||
// WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
||||
// WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
|
||||
// PixelFormat.TRANSLUCENT);
|
||||
//
|
||||
// // 设置 Gravity 为左上角
|
||||
// layoutParams.gravity = Gravity.TOP | Gravity.START;
|
||||
//
|
||||
// // Y 轴随机位置
|
||||
// layoutParams.y = (int) ((Math.random() * (screenHeight - 200)));
|
||||
//
|
||||
// // 初始 X 设为负值,确保 View 在屏幕左侧外
|
||||
// layoutParams.x = -screenWidth;
|
||||
|
||||
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
|
||||
WindowManager.LayoutParams.MATCH_PARENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
|
||||
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
|
||||
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
|
||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
||||
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
|
||||
PixelFormat.TRANSLUCENT);
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
// 设置 Gravity 为左上角
|
||||
layoutParams.gravity = Gravity.TOP | Gravity.START;
|
||||
// 设置随机 Y 轴位置
|
||||
layoutParams.topMargin = (int) (Math.random() * (screenHeight - 200));
|
||||
|
||||
// Y 轴随机位置
|
||||
layoutParams.y = (int) ((Math.random() * (screenHeight - 200)));
|
||||
|
||||
// 初始 X 设为负值,确保 View 在屏幕左侧外
|
||||
layoutParams.x = -screenWidth;
|
||||
|
||||
piaoPingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
|
||||
TextView textView = piaoPingView.findViewById(R.id.tv_name);
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.qxcm.moduleutil.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.qxcm.moduleutil.bean.RoomSingleton;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.http.RetrofitClient;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-6 11:42:49$ $
|
||||
* @Description 每日任务的定时任务单例模式$
|
||||
*/
|
||||
public class MyRoomSingleton {
|
||||
private int count;
|
||||
private static MyRoomSingleton instance;
|
||||
private Handler handler;
|
||||
private String taskId;
|
||||
private boolean isTimerActive;
|
||||
private Context context;
|
||||
|
||||
private MyRoomSingleton() {
|
||||
this.context = context;
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
isTimerActive = false;
|
||||
}
|
||||
|
||||
public static MyRoomSingleton getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new MyRoomSingleton();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void startTimerTask(String taskId) {
|
||||
this.taskId = taskId;
|
||||
count = 0; // 重置计数
|
||||
isTimerActive = true;
|
||||
handler.postDelayed(timerRunnable, 60 * 1000); // 每分钟请求一次接口
|
||||
}
|
||||
|
||||
private Runnable timerRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isTimerActive && count < 5) { // 30分钟任务,每分钟请求一次,共30/60=0.5次,这里假设每分钟请求一次,共30次
|
||||
fetchData();
|
||||
handler.postDelayed(this, 60 * 1000);
|
||||
} else {
|
||||
stopTimerTask(); // 达到最大请求次数后停止定时任务
|
||||
}
|
||||
}
|
||||
};
|
||||
public void stopTimerTask() {
|
||||
handler.removeCallbacksAndMessages(null); // 销毁定时器
|
||||
isTimerActive = false;
|
||||
}
|
||||
public void onExitRoom() {
|
||||
stopTimerTask(); // 退出房间时停止定时任务
|
||||
}
|
||||
public void onEnterRoom(String taskId) {
|
||||
this.taskId = taskId;
|
||||
if (count!=0 ){
|
||||
startTimerTask(taskId); // 进入房间时启动定时任务,延迟为0表示立即执行
|
||||
}else {
|
||||
count = 0; // 重置请求计数
|
||||
startTimerTask(taskId); // 进入房间时启动定时任务,延迟为0表示立即执行
|
||||
}
|
||||
}
|
||||
private void fetchData() {
|
||||
// 这里编写请求接口的代码,例如使用Retrofit或Volley等库
|
||||
// 示例使用Retrofit:
|
||||
RetrofitClient.getInstance().dailyTasksComplete(taskId, new BaseObserver<RoomSingleton>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomSingleton roomSingleton) {
|
||||
count++;
|
||||
// 这里处理请求结果
|
||||
if (roomSingleton.getIs_completed()==1){
|
||||
// 任务完成,可以做一些后续操作
|
||||
stopTimerTask();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public class ARouteConstants {
|
||||
public static final String REAL_NAME_ACTIVITY2 ="/app/RealNameActivity"; //实名认证
|
||||
public static final String H5 ="/moduleutil/WebViewActivity"; //实名认证
|
||||
public static final String GIFT_WALL ="/moduleroom/UserGiftWallFragment"; //实名认证
|
||||
public static final String RECHARGE_ACTIVITY ="/modulevocal/RechargeActivity"; //实名认证
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class GlideEngine implements ImageEngine {
|
||||
|
||||
@Override
|
||||
public void loadImage(Context context, ImageView imageView, String url, int maxWidth, int maxHeight) {
|
||||
|
||||
Glide.with(context).load(url).into(imageView);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,7 +65,6 @@ public class GlideEngine implements ImageEngine {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadGridImage(Context context, String url, ImageView imageView) {
|
||||
Glide.with(context)
|
||||
@@ -239,7 +238,7 @@ public class GlideEngine implements ImageEngine {
|
||||
// .load(url)
|
||||
// .override(200, 200)
|
||||
// .centerCrop()
|
||||
// .apply(new RequestOptions().placeholder(com.luck.picture.lib.R.drawable.picture_image_placeholder))
|
||||
// .apply(new RequestOptions().placeholder(com.luck.picture.lib.R.drawable.ps_ic_placeholder))
|
||||
// .into(imageView);
|
||||
// }
|
||||
|
||||
@@ -252,11 +251,70 @@ public class GlideEngine implements ImageEngine {
|
||||
public void resumeRequests(Context context) {
|
||||
|
||||
}
|
||||
// /**
|
||||
// * 加载网络图片适配长图方案
|
||||
// * # 注意:此方法只有加载网络图片才会回调
|
||||
// *
|
||||
// * @param context
|
||||
// * @param url
|
||||
// * @param imageView
|
||||
// * @param longImageView
|
||||
// * @param callback 网络图片加载回调监听 {link after version 2.5.1 Please use the #OnImageCompleteCallback#}
|
||||
// */
|
||||
// @Override
|
||||
// public void loadImage(@NonNull Context context, @NonNull String url,
|
||||
// @NonNull ImageView imageView,
|
||||
// SubsamplingScaleImageView longImageView, OnImageCompleteCallback callback) {
|
||||
// Glide.with(context)
|
||||
// .asBitmap()
|
||||
// .load(url)
|
||||
// .into(new ImageViewTarget<Bitmap>(imageView) {
|
||||
// @Override
|
||||
// public void onLoadStarted(@Nullable Drawable placeholder) {
|
||||
// super.onLoadStarted(placeholder);
|
||||
// if (callback != null) {
|
||||
// callback.onShowLoading();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
// super.onLoadFailed(errorDrawable);
|
||||
// if (callback != null) {
|
||||
// callback.onHideLoading();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void setResource(@Nullable Bitmap resource) {
|
||||
// if (callback != null) {
|
||||
// callback.onHideLoading();
|
||||
// }
|
||||
// if (resource != null) {
|
||||
// boolean eqLongImage = MediaUtils.isLongImg(resource.getWidth(),
|
||||
// resource.getHeight());
|
||||
// longImageView.setVisibility(eqLongImage ? View.VISIBLE : View.GONE);
|
||||
// imageView.setVisibility(eqLongImage ? View.GONE : View.VISIBLE);
|
||||
// if (eqLongImage) {
|
||||
// // 加载长图
|
||||
// longImageView.setQuickScaleEnabled(true);
|
||||
// longImageView.setZoomEnabled(true);
|
||||
// longImageView.setPanEnabled(true);
|
||||
// longImageView.setDoubleTapZoomDuration(100);
|
||||
// longImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
|
||||
// longImageView.setDoubleTapZoomDpi(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER);
|
||||
// longImageView.setImage(ImageSource.bitmap(resource),
|
||||
// new ImageViewState(0, new PointF(0, 0), 0));
|
||||
// } else {
|
||||
// // 普通图片
|
||||
// imageView.setImageBitmap(resource);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
private GlideEngine() {
|
||||
}
|
||||
|
||||
private static GlideEngine instance;
|
||||
|
||||
public static GlideEngine createGlideEngine() {
|
||||
|
||||
@@ -158,7 +158,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
private void playNextFromQueue() {
|
||||
PlayItem item = playQueue.poll();
|
||||
if (item != null) {
|
||||
isPlaying = true;
|
||||
isPlaying = false;
|
||||
RenderType type = null;
|
||||
String ext = getFileExtension(item.url);
|
||||
if ("svga".equalsIgnoreCase(ext)) {
|
||||
@@ -229,51 +229,58 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
}
|
||||
|
||||
private void downloadAndPlayMp4(String url) {
|
||||
String filePath = PathUtils.getInternalAppCachePath() + Md5Utils.getStringMD5(url) + ".mp4";
|
||||
File file = new File(filePath);
|
||||
|
||||
DownloadTask task = new DownloadTask.Builder(url, PathUtils.getInternalAppCachePath()
|
||||
, Md5Utils.getStringMD5(url) + ".mp4")
|
||||
.setMinIntervalMillisCallbackProcess(100)
|
||||
.setPassIfAlreadyCompleted(false)
|
||||
.setAutoCallbackToUIThread(true)
|
||||
.build();
|
||||
if (StatusUtil.isCompleted(task)) {
|
||||
playMp4(task.getFile());
|
||||
mFile = task.getFile();
|
||||
if (file.exists()) {
|
||||
playMp4(file);
|
||||
mFile = file;
|
||||
} else {
|
||||
task.enqueue(new DownloadListener1() {
|
||||
@Override
|
||||
public void taskStart(@NonNull DownloadTask task, @NonNull Listener1Assist.Listener1Model model) {
|
||||
Logger.e("taskStart", model);
|
||||
}
|
||||
DownloadTask task = new DownloadTask.Builder(url, PathUtils.getInternalAppCachePath()
|
||||
, Md5Utils.getStringMD5(url) + ".mp4")
|
||||
.setMinIntervalMillisCallbackProcess(100)
|
||||
.setPassIfAlreadyCompleted(false)
|
||||
.setAutoCallbackToUIThread(true)
|
||||
.build();
|
||||
// if (StatusUtil.isCompleted(task)) {
|
||||
// playMp4(task.getFile());
|
||||
// mFile = task.getFile();
|
||||
// } else {
|
||||
task.enqueue(new DownloadListener1() {
|
||||
@Override
|
||||
public void taskStart(@NonNull DownloadTask task, @NonNull Listener1Assist.Listener1Model model) {
|
||||
Logger.e("taskStart", model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retry(@NonNull DownloadTask task, @NonNull ResumeFailedCause cause) {
|
||||
Logger.e("retry", cause);
|
||||
task.cancel();
|
||||
@Override
|
||||
public void retry(@NonNull DownloadTask task, @NonNull ResumeFailedCause cause) {
|
||||
Logger.e("retry", cause);
|
||||
task.cancel();
|
||||
|
||||
// CrashReport.postCatchedException(new RuntimeException("下载文件重试:" + cause == null ? "" : cause.name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(@NonNull DownloadTask task, int blockCount, long currentOffset, long totalLength) {
|
||||
Logger.e("connected", blockCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void progress(@NonNull DownloadTask task, long currentOffset, long totalLength) {
|
||||
Logger.e("progress", currentOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, @NonNull Listener1Assist.Listener1Model model) {
|
||||
Logger.e("taskEnd", model);
|
||||
playMp4(task.getFile());
|
||||
mFile = task.getFile();
|
||||
if (cause != null && cause != EndCause.COMPLETED) {
|
||||
// CrashReport.postCatchedException(new RuntimeException("下载任务结束:" + cause == null ? "" : cause.name() + "_realCause:" + realCause == null ? "" : realCause.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void connected(@NonNull DownloadTask task, int blockCount, long currentOffset, long totalLength) {
|
||||
Logger.e("connected", blockCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void progress(@NonNull DownloadTask task, long currentOffset, long totalLength) {
|
||||
Logger.e("progress", currentOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, @NonNull Listener1Assist.Listener1Model model) {
|
||||
Logger.e("taskEnd", model);
|
||||
playMp4(task.getFile());
|
||||
mFile = task.getFile();
|
||||
if (cause != null && cause != EndCause.COMPLETED) {
|
||||
// CrashReport.postCatchedException(new RuntimeException("下载任务结束:" + cause == null ? "" : cause.name() + "_realCause:" + realCause == null ? "" : realCause.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,18 +282,18 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
|
||||
@Override
|
||||
public void userJoined(int userId, int elapsd) {
|
||||
if (pitBean!=null && pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0")) {
|
||||
if (pitBean != null && pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0")) {
|
||||
if (pitBean.getUser_id().equals(userId + "")) {
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userOffline(int userId, int reason) {
|
||||
if (pitBean!=null && pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0")) {
|
||||
if (pitBean != null && pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0")) {
|
||||
if (pitBean.getUser_id().equals(userId + "")) {
|
||||
// iv_on_line.setVisibility(VISIBLE);
|
||||
iv_on_line.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,17 +346,19 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Subscribe( threadMode = ThreadMode.MAIN, sticky =true)
|
||||
public void subscribeMessages(UserOnlineStatusBean userOnlineStatusBean) {
|
||||
if (pitBean.getUser_id()!=null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()){
|
||||
// for (UserOnlineStatusBean userOnlineStatus : userOnlineStatusBean) {
|
||||
if (pitBean.getUser_id().equals(userOnlineStatusBean.getUser_id())) {
|
||||
if (userOnlineStatusBean.getIs_online() == 1) {
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
} else {
|
||||
// iv_on_line.setVisibility(VISIBLE);
|
||||
}
|
||||
// }
|
||||
|
||||
public void setOnlineStatus(UserOnlineStatusBean isOnline) {
|
||||
// iv_on_line.setVisibility(isOnline ? GONE : VISIBLE);
|
||||
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
//// for (UserOnlineStatusBean userOnlineStatus : userOnlineStatusBean) {
|
||||
if (pitBean.getUser_id().equals(isOnline.getUser_id())) {
|
||||
if (isOnline.getIs_online() == 1) {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
} else {
|
||||
iv_on_line.setVisibility(VISIBLE);
|
||||
}
|
||||
//// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +364,11 @@ public class Constants {
|
||||
public static final String POST_DELETE_RELATION_CARD = "/api/Room/delete_relation_card";//删除关系
|
||||
public static final String GET_FIRST_CHARGE = "/api/Activities/first_charge_gift_permission";//首充好礼弹框权限
|
||||
public static final String GET_FIRST_CHARGE_GIFT = "/api/Activities/first_charge_gift";//首充好礼列表接口
|
||||
public static final String dailyTasksComplete = "/api/Dailytasks/dailyTasksReceive";//领取每日任务奖励
|
||||
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";//取消装扮
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -209,4 +209,16 @@ public class RoomMakeWheatView extends BaseWheatView {
|
||||
public void userOffline(int userId, int reason) {
|
||||
|
||||
}
|
||||
|
||||
public void setOnlineStatus(UserOnlineStatusBean isOnline) {
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (pitBean.getUser_id().equals(isOnline.getUser_id())) {
|
||||
if (isOnline.getIs_online() == 1) {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
} else {
|
||||
iv_on_line.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.qxcm.moduleutil.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
@@ -25,7 +27,8 @@ import io.reactivex.disposables.Disposable;
|
||||
public class RoomMessageInputMenu extends ConstraintLayout {
|
||||
EditText etContent;
|
||||
Button tvSend;
|
||||
|
||||
private View rootView;
|
||||
private int screenHeight;
|
||||
public RoomMessageInputMenu(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -42,8 +45,14 @@ public class RoomMessageInputMenu extends ConstraintLayout {
|
||||
}
|
||||
});
|
||||
setVisibility(GONE);
|
||||
}
|
||||
|
||||
}
|
||||
private void moveInputMenuAboveKeyboard(int keypadHeight) {
|
||||
// 调整输入框的位置
|
||||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) this.getLayoutParams();
|
||||
params.bottomMargin = keypadHeight;
|
||||
this.setLayoutParams(params);
|
||||
}
|
||||
public void setText(String text) {
|
||||
etContent.setText(text);
|
||||
}
|
||||
@@ -66,7 +75,7 @@ public class RoomMessageInputMenu extends ConstraintLayout {
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
EventBus.getDefault().post(new RoomInputEvent(text));
|
||||
// EventBus.getDefault().post(new RoomInputEvent(text));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
@@ -74,13 +83,15 @@ public class RoomMessageInputMenu extends ConstraintLayout {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
sendInput(text);
|
||||
dismiss();
|
||||
etContent.setText("");
|
||||
countDownTimer();
|
||||
dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
private void sendInput(String text) {
|
||||
EventBus.getDefault().post(new RoomInputEvent(text));
|
||||
}
|
||||
/**
|
||||
* 下面的内容为发送消息逻辑
|
||||
*/
|
||||
@@ -120,12 +131,12 @@ public class RoomMessageInputMenu extends ConstraintLayout {
|
||||
setVisibility(VISIBLE);
|
||||
etContent.requestFocus();
|
||||
KeyboardUtils.showSoftInput(etContent);
|
||||
// EventBus.getDefault().post(new RoomInputHideEvent(false));
|
||||
EventBus.getDefault().post(new RoomInputHideEvent(false));
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
setVisibility(GONE);
|
||||
KeyboardUtils.hideSoftInput(etContent);
|
||||
// EventBus.getDefault().post(new RoomInputHideEvent(true));
|
||||
EventBus.getDefault().post(new RoomInputHideEvent(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
package com.qxcm.moduleutil.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.UserInfo;
|
||||
import com.qxcm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
import com.qxcm.moduleutil.utils.SpUtil;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-6 17:27:29$ $
|
||||
* @Description 二卡八视图控件$
|
||||
*/
|
||||
public class RoomSingSongWheatView extends BaseWheatView {
|
||||
public ImageView mIvTagBoss;
|
||||
public TextView mTvTime;
|
||||
public TextView tv_time_pk;
|
||||
|
||||
private boolean showBoss;//显示老板标识
|
||||
|
||||
public RoomSingSongWheatView(Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public RoomSingSongWheatView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public RoomSingSongWheatView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initPit(Context context, AttributeSet attrs) {
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoomDefaultWheatView);
|
||||
pitNumber = typedArray.getString(R.styleable.RoomDefaultWheatView_room_wheat_number);
|
||||
typedArray.recycle();
|
||||
mIvTagBoss = findViewById(R.id.iv_tag_boos);
|
||||
mTvTime = findViewById(R.id.tv_time);
|
||||
tv_time_pk = findViewById(R.id.tv_time_pk);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_view_sing_wheat;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPitData(RoomPitBean bean) {
|
||||
sex = bean.getSex();
|
||||
if (isOn()) {
|
||||
//开启声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mTvName.setText(bean.getNickname());
|
||||
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
|
||||
if (TextUtils.isEmpty(pitBean.getDress())) {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mIvFrame.setVisibility(VISIBLE);
|
||||
mIvFrame.setSource(pitBean.getDress(), 1);
|
||||
// ImageUtils.loadDecorationAvatar(pitBean.getDress_picture(), mIvFrame);
|
||||
}
|
||||
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
|
||||
mIvTagBoss.setVisibility(GONE);
|
||||
}
|
||||
} else {
|
||||
mTvName.setText(
|
||||
"-1".equals(pitNumber) ? "" :
|
||||
"9".equals(pitNumber) ? "主持位" :
|
||||
"10".equals(pitNumber) ? "嘉宾位" :
|
||||
pitNumber + "号麦位"
|
||||
);
|
||||
//麦位上锁
|
||||
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
|
||||
mIvTagBoss.setVisibility(VISIBLE);
|
||||
ImageUtils.loadRes(isLocked() ? R.mipmap.room_ic_wheat_default_suo : R.mipmap.room_ic_wheat_default, mRiv);
|
||||
} else {
|
||||
// mIvTagBoss.setVisibility(GONE);
|
||||
// @DrawableRes int origin = getOriginImage();
|
||||
// ImageUtils.loadRes(isLocked() ? R.mipmap.room_ic_wheat_default_suo :
|
||||
// (origin == 0 ? R.mipmap.room_ic_wheat_default : origin), mRiv);
|
||||
mRiv.setImageResource(bean.getIs_lock() == 1 ? R.mipmap.room_ic_wheat_default_suo : R.mipmap.room_ic_wheat_default);
|
||||
// ImageUtils.loadRes(isLocked() ? R.mipmap.room_ic_wheat_default_suo : R.mipmap.room_ic_wheat_default, mRiv);
|
||||
}
|
||||
if (isMute()) {
|
||||
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
|
||||
}
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
mIvFace.remove();
|
||||
//停止声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.setVisibility(GONE);
|
||||
}
|
||||
if (showSexIcon) {
|
||||
checkSex();
|
||||
}
|
||||
if (pitBean.getNickname() == null || pitBean.getNickname().isEmpty()) {
|
||||
mCharmView.setVisibility(GONE);
|
||||
} else {
|
||||
mCharmView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
if (pitBean.is_pk() ){
|
||||
if (pitBean.getUser_id()!=null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
tv_time_pk.setVisibility(VISIBLE);
|
||||
setSex(pitBean.getCharm(),false);
|
||||
mCharmView.setVisibility(GONE);
|
||||
}else {
|
||||
tv_time_pk.setVisibility(GONE);
|
||||
}
|
||||
// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mCharmView.getLayoutParams();
|
||||
// params.width = 35;
|
||||
// mCharmView.setLayoutParams(params);
|
||||
|
||||
}else {
|
||||
tv_time_pk.setVisibility(GONE);
|
||||
mCharmView.setVisibility(VISIBLE);
|
||||
// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mCharmView.getLayoutParams();
|
||||
// params.width = 52;
|
||||
// mCharmView.setLayoutParams(params);
|
||||
}
|
||||
|
||||
// setCardiac(pitBean.getPit_number(), 0.0f);
|
||||
}
|
||||
public void setSex( String value, boolean format) {
|
||||
if (format) {
|
||||
tv_time_pk.setText(value);
|
||||
} else {
|
||||
try {
|
||||
long xd = Long.parseLong(value);
|
||||
if (xd > 9999 || xd < -9999) {
|
||||
tv_time_pk.setText(String.format("%.2fw", xd / 10000.0f));
|
||||
// mBinding.tvValue.setText(String.valueOf(xd));
|
||||
} else {
|
||||
tv_time_pk.setText(value);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean showSexIcon = false;
|
||||
private String sex;
|
||||
|
||||
public boolean isMale() {
|
||||
return "1".equals(sex);
|
||||
}
|
||||
|
||||
public boolean isFemale() {
|
||||
return "2".equals(sex);
|
||||
}
|
||||
|
||||
public void setShowSexIcon(boolean show) {
|
||||
showSexIcon = show;
|
||||
}
|
||||
|
||||
public void checkSex() {
|
||||
if (isOn()) {
|
||||
mIvSex.setVisibility(VISIBLE);
|
||||
if (!TextUtils.isEmpty(sex)) {
|
||||
if (UserInfo.MALE.equals(sex)) {
|
||||
mIvSex.setBackgroundResource(R.drawable.room_xq_wheat_male_mask);
|
||||
if (mTvNo != null) mTvNo.setBackgroundResource(R.mipmap.ic_room_xq_wno_male);
|
||||
} else {
|
||||
mIvSex.setBackgroundResource(R.drawable.room_xq_wheat_female_mask);
|
||||
if (mTvNo != null) mTvNo.setBackgroundResource(R.mipmap.ic_room_xq_wno_female);
|
||||
}
|
||||
} else {
|
||||
mIvSex.setVisibility(GONE);
|
||||
if (mTvNo != null) mTvNo.setBackgroundResource(getOriginNoImage());
|
||||
}
|
||||
} else {
|
||||
mIvSex.setVisibility(GONE);
|
||||
if (mTvNo != null) mTvNo.setBackgroundResource(getOriginNoImage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否显示老板标识
|
||||
*/
|
||||
public void setIsBossShow(String is_boss_pit) {
|
||||
showBoss = "1".equals(is_boss_pit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启计时
|
||||
*/
|
||||
public void setTime(int time) {
|
||||
if (time == 0) {
|
||||
mTvTime.setText("");
|
||||
mTvTime.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mTvTime.setText(String.format("%s'%s", time / 60, time % 60));
|
||||
mTvTime.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void hideMaoziIcon() {
|
||||
View maozi = findViewById(R.id.iv_maozi);
|
||||
if (maozi != null) maozi.setVisibility(GONE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRemoteSoundLevelUpdate(String userId, int soundLevel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalSoundLevelUpdate(int volume) {
|
||||
if (volume==0){
|
||||
mIvRipple.stopAnimation();
|
||||
} else {
|
||||
if (pitBean.getUser_id().equals(SpUtil.getUserId()) && closePhone) {
|
||||
mIvRipple.stopAnimation();
|
||||
}else {
|
||||
mIvRipple.post(() -> {
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
}
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userJoined(int userId, int elapsd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userOffline(int userId, int reason) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.flexbox.FlexboxLayout;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.qxcm.moduleutil.bean.room.RoomPitBean;
|
||||
|
||||
import java.util.List;
|
||||
@@ -424,5 +425,13 @@ public class WheatLayoutManager {
|
||||
// updateSingleWheat(pitNumber);
|
||||
}
|
||||
}
|
||||
public void updateSingleOnlineWheat(UserOnlineStatusBean bean) {
|
||||
if (pitList == null || pitList.isEmpty()) return;
|
||||
|
||||
for (RoomPitBean pitBean : pitList) {
|
||||
int pitNumber = Integer.parseInt(pitBean.getPit_number());
|
||||
RoomDefaultWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||
wheatView.setOnlineStatus(bean); // 刷新数据
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
package com.qxcm.moduleutil.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.qxcm.moduleutil.bean.room.RoomPitBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-6 17:29:04$ $
|
||||
* @Description 二卡八显示布局$
|
||||
*/
|
||||
public class WheatLayoutSingManager {
|
||||
private final Context context;
|
||||
private final ViewGroup container;
|
||||
private List<RoomPitBean> pitList;
|
||||
private boolean isSingleMode = false;
|
||||
private int currentSinglePit = -1;
|
||||
private RoomSingSongWheatView singleWheatView;
|
||||
|
||||
private final int[] pitIndexMap = {9, 10, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
|
||||
public interface OnWheatClickListener {
|
||||
void onWheatClick(RoomSingSongWheatView view, int pitNumber);
|
||||
|
||||
void onMakeWheatClick(RoomSingSongWheatView view, int pitNumber);
|
||||
|
||||
}
|
||||
|
||||
private @Nullable OnWheatClickListener wheatClickListener;
|
||||
|
||||
public WheatLayoutSingManager(Context context, ViewGroup container) {
|
||||
this.context = context;
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public void setWheatData(List<RoomPitBean> pitList) {
|
||||
this.pitList = pitList;
|
||||
restoreMultiWheat();
|
||||
}
|
||||
|
||||
public void setWheatDataPk(List<RoomPitBean> pitList, int layoutType) {
|
||||
this.pitList = pitList;
|
||||
restoreMultiWheatPk(layoutType);
|
||||
}
|
||||
|
||||
public void setOnWheatClickListener(@Nullable OnWheatClickListener listener) {
|
||||
this.wheatClickListener = listener;
|
||||
}
|
||||
|
||||
public void showSingleWheat(int pitNumber) {
|
||||
if (isSingleMode && this.currentSinglePit == pitNumber) return;
|
||||
|
||||
container.removeAllViews();
|
||||
|
||||
if (pitNumber < 1 || pitNumber > 10 || pitList == null || pitList.size() < 10)
|
||||
return;
|
||||
|
||||
RoomPitBean bean = pitList.get(pitNumber - 1);
|
||||
|
||||
singleWheatView = new RoomSingSongWheatView(context);
|
||||
singleWheatView.pitNumber = String.valueOf(pitNumber);
|
||||
singleWheatView.setData(bean);
|
||||
|
||||
// 默认设置为 MATCH_PARENT,也可以自定义
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
params.setMargins(20, 20, 20, 20);
|
||||
singleWheatView.setLayoutParams(params);
|
||||
|
||||
// 添加点击事件
|
||||
singleWheatView.setOnClickListener(v -> {
|
||||
if (wheatClickListener != null) {
|
||||
wheatClickListener.onWheatClick(singleWheatView, pitNumber);
|
||||
}
|
||||
restoreMultiWheat();
|
||||
});
|
||||
|
||||
container.addView(singleWheatView);
|
||||
isSingleMode = true;
|
||||
currentSinglePit = pitNumber;
|
||||
}
|
||||
|
||||
public void restoreMultiWheat() {
|
||||
container.removeAllViews();
|
||||
|
||||
int screenWidth = getScreenWidth();
|
||||
int itemWidth = screenWidth / 4; // 每个控件宽度为屏幕宽度的 1/4
|
||||
|
||||
LinearLayout row = new LinearLayout(context);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int pitNumber = pitIndexMap[i];
|
||||
RoomSingSongWheatView wheatView = new RoomSingSongWheatView(context);
|
||||
wheatView.pitNumber = String.valueOf(pitNumber);
|
||||
wheatView.setData(pitList.get(pitNumber - 1));
|
||||
|
||||
LinearLayout.LayoutParams params;
|
||||
|
||||
if (i == 0) {
|
||||
int fixedHeightInDp = 110; // 固定高度为 100dp
|
||||
int fixedHeightInPx = dpToPx(fixedHeightInDp); // 调用已有的 dpToPx 方法
|
||||
// 第一个控件:左边距 86dp,右边距 100dp
|
||||
params = new LinearLayout.LayoutParams(itemWidth, fixedHeightInPx);
|
||||
params.rightMargin = dpToPx(50);
|
||||
} else if (i == 1) {
|
||||
int fixedHeightInDp = 110; // 固定高度为 100dp
|
||||
int fixedHeightInPx = dpToPx(fixedHeightInDp); // 调用已有的 dpToPx 方法
|
||||
// 第二个控件:右边距 86dp
|
||||
params = new LinearLayout.LayoutParams(itemWidth, fixedHeightInPx);
|
||||
} else {
|
||||
int fixedHeightInDp = 90; // 固定高度为 100dp
|
||||
int fixedHeightInPx = dpToPx(fixedHeightInDp); // 调用已有的 dpToPx 方法
|
||||
params = new LinearLayout.LayoutParams(itemWidth - 30, fixedHeightInPx + 30);
|
||||
// 其他控件保持原有逻辑
|
||||
|
||||
|
||||
// if (i > 1 && (i - 2) % 4 != 0) {
|
||||
// params.leftMargin = 12;
|
||||
// params.rightMargin = 12;
|
||||
// }
|
||||
params.setMargins(0, 0, 0, 0); // 不设右边距,由 row padding 控制
|
||||
}
|
||||
|
||||
wheatView.setLayoutParams(params);
|
||||
wheatView.setOnClickListener(v -> {
|
||||
if (wheatClickListener != null) {
|
||||
wheatClickListener.onWheatClick(wheatView, Integer.parseInt(wheatView.pitNumber));
|
||||
}
|
||||
// showSingleWheat(Integer.parseInt(wheatView.pitNumber));
|
||||
});
|
||||
|
||||
row.addView(wheatView);
|
||||
|
||||
// 第一行添加两个后换行
|
||||
if (i == 1) {
|
||||
container.addView(row);
|
||||
row = new LinearLayout(context);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
} else if (i > 1 && (i - 2) % 4 == 3) {
|
||||
container.addView(row);
|
||||
row = new LinearLayout(context);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加最后一行可能存在的剩余 view
|
||||
if (row.getChildCount() > 0) {
|
||||
container.addView(row);
|
||||
}
|
||||
isSingleMode = false;
|
||||
currentSinglePit = -1;
|
||||
|
||||
}
|
||||
// public void restoreMultiWheatPk(int layoutType, int width) {
|
||||
// container.removeAllViews();
|
||||
//
|
||||
// int screenWidth = getScreenWidth();
|
||||
// int itemWidth = screenWidth / 8; // 每个控件宽度为屏幕宽度的 1/4
|
||||
//
|
||||
// LinearLayout row = new LinearLayout(context);
|
||||
// row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
//
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// int pitNumber = pitIndexMap[i];
|
||||
// RoomDefaultWheatView wheatView = new RoomDefaultWheatView(context);
|
||||
// wheatView.pitNumber = String.valueOf(pitNumber);
|
||||
// wheatView.setData(pitList.get(pitNumber - 1));
|
||||
//
|
||||
// LinearLayout.LayoutParams params;
|
||||
//
|
||||
// if (i == 0) {
|
||||
// int fixedHeightInDp = 110; // 固定高度为 100dp
|
||||
// int fixedHeightInPx =context.getResources().getDimensionPixelSize(R.dimen.dp_80); // 调用已有的 dpToPx 方法
|
||||
// // 第一个控件:左边距 86dp,右边距 100dp
|
||||
// params = new LinearLayout.LayoutParams(itemWidth, fixedHeightInPx);
|
||||
// params.rightMargin = context.getResources().getDimensionPixelSize(R.dimen.dp_50);
|
||||
// } else if (i == 1) {
|
||||
// int fixedHeightInDp = 110; // 固定高度为 100dp
|
||||
// int fixedHeightInPx = context.getResources().getDimensionPixelSize(R.dimen.dp_80); // 调用已有的 dpToPx 方法
|
||||
// // 第二个控件:右边距 86dp
|
||||
// params = new LinearLayout.LayoutParams(itemWidth, fixedHeightInPx);
|
||||
// } else {
|
||||
// int fixedHeightInDp = 90; // 固定高度为 100dp
|
||||
// int fixedHeightInPx = context.getResources().getDimensionPixelSize(R.dimen.dp_60); // 调用已有的 dpToPx 方法
|
||||
// params = new LinearLayout.LayoutParams(itemWidth -10, fixedHeightInPx + 30);
|
||||
// // 其他控件保持原有逻辑
|
||||
//
|
||||
//
|
||||
//// if (i > 1 && (i - 2) % 4 != 0) {
|
||||
//// params.leftMargin = 12;
|
||||
//// params.rightMargin = 12;
|
||||
//// }
|
||||
// params.setMargins(0, 0, 0, 0); // 不设右边距,由 row padding 控制
|
||||
// }
|
||||
//
|
||||
// wheatView.setLayoutParams(params);
|
||||
// wheatView.setOnClickListener(v -> {
|
||||
// if (wheatClickListener != null) {
|
||||
// wheatClickListener.onWheatClick(wheatView, Integer.parseInt(wheatView.pitNumber));
|
||||
// }
|
||||
//// showSingleWheat(Integer.parseInt(wheatView.pitNumber));
|
||||
// });
|
||||
//
|
||||
// row.addView(wheatView);
|
||||
//
|
||||
// // 第一行添加两个后换行
|
||||
// if (i == 1) {
|
||||
// container.addView(row);
|
||||
// row = new LinearLayout(context);
|
||||
// row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
// } else if (i > 1 && (i - 2) % 4 == 3) {
|
||||
// container.addView(row);
|
||||
// row = new LinearLayout(context);
|
||||
// row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//// 添加最后一行可能存在的剩余 view
|
||||
// if (row.getChildCount() > 0) {
|
||||
// container.addView(row);
|
||||
// }
|
||||
// isSingleMode = false;
|
||||
// currentSinglePit = -1;
|
||||
// }
|
||||
|
||||
|
||||
public void restoreMultiWheatPk(int layoutType) {
|
||||
if (layoutType == 1) {
|
||||
container.removeAllViews();
|
||||
}
|
||||
int screenWidth = getScreenWidth();
|
||||
int itemWidth = screenWidth / 8;
|
||||
|
||||
LinearLayout row = new LinearLayout(context);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
// 根据 layoutType 调整前两个控件的顺序
|
||||
int firstPitNumber, secondPitNumber;
|
||||
if (layoutType == 1) {
|
||||
firstPitNumber = 10; // 第一个显示 10
|
||||
secondPitNumber = 9; // 第二个显示 9
|
||||
} else if (layoutType == 2) {
|
||||
firstPitNumber = 9; // 第一个显示 9
|
||||
secondPitNumber = 10; // 第二个显示 10
|
||||
} else {
|
||||
firstPitNumber = 9;
|
||||
secondPitNumber = 10;
|
||||
}
|
||||
|
||||
// 添加第一个控件(10 或 9)
|
||||
addWheatViewItem(row, firstPitNumber, itemWidth * 2, layoutType);
|
||||
|
||||
// 添加第二个控件(9 或 10)
|
||||
addWheatViewItem(row, secondPitNumber, itemWidth * 2, layoutType);
|
||||
|
||||
container.addView(row);
|
||||
row = new LinearLayout(context);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
// 添加其余 8 个控件(1~8)
|
||||
for (int i = 2; i < 10; i++) {
|
||||
int pitNumber = pitIndexMap[i];
|
||||
addWheatViewItem(row, pitNumber, itemWidth, layoutType);
|
||||
|
||||
if (i > 1 && (i - 2) % 4 == 3) {
|
||||
container.addView(row);
|
||||
row = new LinearLayout(context);
|
||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||
}
|
||||
}
|
||||
|
||||
if (row.getChildCount() > 0) {
|
||||
container.addView(row);
|
||||
}
|
||||
|
||||
isSingleMode = false;
|
||||
currentSinglePit = -1;
|
||||
}
|
||||
|
||||
// 抽取公共方法:添加单个控件
|
||||
private void addWheatViewItem(LinearLayout row, int pitNumber, int itemWidth, int layoutType) {
|
||||
RoomSingSongWheatView wheatView = new RoomSingSongWheatView(context);
|
||||
wheatView.pitNumber = String.valueOf(pitNumber);
|
||||
wheatView.setData(pitList.get(pitNumber - 1));
|
||||
|
||||
LinearLayout.LayoutParams params;
|
||||
|
||||
if (pitNumber == 9 || pitNumber == 10) {
|
||||
int fixedHeightInPx = context.getResources().getDimensionPixelSize(R.dimen.dp_90);
|
||||
|
||||
if (pitNumber == 9) {
|
||||
params = new LinearLayout.LayoutParams(itemWidth - 40, fixedHeightInPx);
|
||||
if (layoutType == 1) {
|
||||
// 9号在右边,右边距10dp
|
||||
params.rightMargin = context.getResources().getDimensionPixelSize(R.dimen.dp_1);
|
||||
params.setMargins(20, -30, -20, 0);
|
||||
} else if (layoutType == 2) {
|
||||
// 9号在左边,左边距10dp
|
||||
params.leftMargin = context.getResources().getDimensionPixelSize(R.dimen.dp_1);
|
||||
params.setMargins(-30, -20, 0, 0);
|
||||
}
|
||||
|
||||
} else {
|
||||
params = new LinearLayout.LayoutParams(itemWidth - 80, fixedHeightInPx);
|
||||
if (layoutType == 1) {
|
||||
// 10号在左边,左边距15dp
|
||||
// params.leftMargin = context.getResources().getDimensionPixelSize(R.dimen.dp_5);
|
||||
params.setMargins(-30, 10, 0, 0);
|
||||
} else if (layoutType == 2) {
|
||||
// 10号在右边,右边距15dp
|
||||
// params.rightMargin = context.getResources().getDimensionPixelSize(R.dimen.dp_5);
|
||||
params.setMargins(0, 10, -30, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
int fixedHeightInPx = context.getResources().getDimensionPixelSize(R.dimen.dp_60);
|
||||
params = new LinearLayout.LayoutParams(itemWidth + 15, fixedHeightInPx + 20);
|
||||
params.setMargins(-20, -20, -20, 0);
|
||||
}
|
||||
|
||||
wheatView.setLayoutParams(params);
|
||||
wheatView.setOnClickListener(v -> {
|
||||
if (wheatClickListener != null) {
|
||||
if (layoutType == 1) {
|
||||
wheatClickListener.onWheatClick(wheatView, Integer.parseInt(wheatView.pitNumber));
|
||||
} else {
|
||||
wheatClickListener.onMakeWheatClick(wheatView, Integer.parseInt(wheatView.pitNumber));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
row.addView(wheatView);
|
||||
}
|
||||
|
||||
|
||||
private RoomSingSongWheatView createWheatView(int pitNumber) {
|
||||
RoomSingSongWheatView wheatView = new RoomSingSongWheatView(context);
|
||||
wheatView.pitNumber = String.valueOf(pitNumber);
|
||||
wheatView.setData(pitList.get(pitNumber - 1));
|
||||
return wheatView;
|
||||
}
|
||||
|
||||
private RoomMakeWheatView createRoomMakeWheatView(int pitNumber) {
|
||||
RoomMakeWheatView wheatView = new RoomMakeWheatView(context);
|
||||
wheatView.pitNumber = String.valueOf(pitNumber);
|
||||
wheatView.setData(pitList.get(pitNumber - 1));
|
||||
return wheatView;
|
||||
}
|
||||
|
||||
|
||||
private int dpToPx(int dp) {
|
||||
return Math.round(dp * context.getResources().getDisplayMetrics().density);
|
||||
}
|
||||
|
||||
private int getScreenWidth() {
|
||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||
return metrics.widthPixels;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新指定 pitNumber 的麦位信息(用于局部刷新)
|
||||
*/
|
||||
public void updateSingleWheat(RoomPitBean pitBean, int pitNumber) {
|
||||
if (pitList == null || pitList.isEmpty() || pitNumber < 1 || pitNumber > 10) return;
|
||||
|
||||
// 如果是单个展示模式且不是当前麦位,不处理
|
||||
if (isSingleMode && this.currentSinglePit != pitNumber) return;
|
||||
|
||||
RoomSingSongWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||
if (wheatView != null) {
|
||||
|
||||
// RoomPitBean bean = pitList.get(pitNumber - 1);
|
||||
RoomPitBean bean = pitBean;
|
||||
wheatView.setData(bean); // 刷新数据
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private RoomSingSongWheatView findWheatViewByPitNumber(int pitNumber) {
|
||||
for (int i = 0; i < container.getChildCount(); i++) {
|
||||
View row = container.getChildAt(i);
|
||||
if (row instanceof LinearLayout) {
|
||||
LinearLayout linearRow = (LinearLayout) row;
|
||||
for (int j = 0; j < linearRow.getChildCount(); j++) {
|
||||
View child = linearRow.getChildAt(j);
|
||||
if (child instanceof RoomSingSongWheatView) {
|
||||
RoomSingSongWheatView view = (RoomSingSongWheatView) child;
|
||||
if (Integer.parseInt(view.pitNumber) == pitNumber) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (row instanceof RoomSingSongWheatView) {
|
||||
RoomSingSongWheatView view = (RoomSingSongWheatView) row;
|
||||
if (Integer.parseInt(view.pitNumber) == pitNumber) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量刷新多个麦位状态
|
||||
*/
|
||||
public void refreshWheatData(List<RoomPitBean> newPitList, List<Integer> changedPits) {
|
||||
this.pitList = newPitList;
|
||||
for (int pitNumber : changedPits) {
|
||||
// updateSingleWheat(pitNumber);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSingleOnlineWheat(UserOnlineStatusBean bean) {
|
||||
if (pitList == null || pitList.isEmpty()) return;
|
||||
|
||||
for (RoomPitBean pitBean : pitList) {
|
||||
int pitNumber = Integer.parseInt(pitBean.getPit_number());
|
||||
RoomSingSongWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||
wheatView.setOnlineStatus(bean); // 刷新数据
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.qxcm.moduleutil.widget.picker;
|
||||
|
||||
import static com.qxcm.moduleutil.utils.UtilConfig.getContext;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.luck.picture.lib.basic.FragmentInjectManager;
|
||||
import com.luck.picture.lib.engine.CropFileEngine;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.luck.picture.lib.interfaces.OnPreviewInterceptListener;
|
||||
import com.luck.picture.lib.style.BottomNavBarStyle;
|
||||
import com.luck.picture.lib.style.PictureSelectorStyle;
|
||||
import com.luck.picture.lib.style.SelectMainStyle;
|
||||
import com.luck.picture.lib.style.TitleBarStyle;
|
||||
import com.luck.picture.lib.utils.DensityUtil;
|
||||
import com.luck.picture.lib.utils.StyleUtils;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.yalantis.ucrop.UCrop;
|
||||
import com.yalantis.ucrop.UCropImageEngine;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-5 21:50:02$ $
|
||||
* @Description 图片选择器$
|
||||
*/
|
||||
public class PictureSelectorUtil {
|
||||
|
||||
public CropFileEngine ImageFileCropEngine;
|
||||
private PictureSelectorStyle selectorStyle;
|
||||
|
||||
public PictureSelectorStyle syltPictureSelector() {
|
||||
selectorStyle = new PictureSelectorStyle();
|
||||
// 主体风格
|
||||
SelectMainStyle numberSelectMainStyle = new SelectMainStyle();
|
||||
numberSelectMainStyle.setSelectNumberStyle(true);
|
||||
numberSelectMainStyle.setPreviewSelectNumberStyle(false);
|
||||
numberSelectMainStyle.setPreviewDisplaySelectGallery(true);
|
||||
numberSelectMainStyle.setSelectBackground(com.luck.picture.lib.R.drawable.ps_default_num_selector);
|
||||
numberSelectMainStyle.setPreviewSelectBackground(com.luck.picture.lib.R.drawable.ps_preview_checkbox_selector);
|
||||
numberSelectMainStyle.setSelectNormalBackgroundResources(com.luck.picture.lib.R.drawable.ps_select_complete_normal_bg);
|
||||
numberSelectMainStyle.setSelectNormalTextColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_53575e));
|
||||
numberSelectMainStyle.setSelectNormalText(com.luck.picture.lib.R.string.ps_send);
|
||||
numberSelectMainStyle.setAdapterPreviewGalleryBackgroundResource(com.luck.picture.lib.R.drawable.ps_preview_gallery_bg);
|
||||
numberSelectMainStyle.setAdapterPreviewGalleryItemSize(DensityUtil.dip2px(getContext(), 52));
|
||||
numberSelectMainStyle.setPreviewSelectText(com.luck.picture.lib.R.string.ps_select);
|
||||
numberSelectMainStyle.setPreviewSelectTextSize(14);
|
||||
numberSelectMainStyle.setPreviewSelectTextColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_white));
|
||||
numberSelectMainStyle.setPreviewSelectMarginRight(DensityUtil.dip2px(getContext(), 6));
|
||||
numberSelectMainStyle.setSelectBackgroundResources(com.luck.picture.lib.R.drawable.ps_select_complete_bg);
|
||||
numberSelectMainStyle.setSelectText(com.luck.picture.lib.R.string.ps_send_num);
|
||||
numberSelectMainStyle.setSelectTextColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_white));
|
||||
numberSelectMainStyle.setMainListBackgroundColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_black));
|
||||
numberSelectMainStyle.setCompleteSelectRelativeTop(true);
|
||||
numberSelectMainStyle.setPreviewSelectRelativeBottom(true);
|
||||
numberSelectMainStyle.setAdapterItemIncludeEdge(false);
|
||||
|
||||
// 头部TitleBar 风格
|
||||
TitleBarStyle numberTitleBarStyle = new TitleBarStyle();
|
||||
numberTitleBarStyle.setHideCancelButton(true);
|
||||
numberTitleBarStyle.setAlbumTitleRelativeLeft(true);
|
||||
numberTitleBarStyle.setTitleAlbumBackgroundResource(com.luck.picture.lib.R.drawable.ps_album_bg);
|
||||
numberTitleBarStyle.setTitleDrawableRightResource(com.luck.picture.lib.R.drawable.ps_ic_grey_arrow);
|
||||
numberTitleBarStyle.setPreviewTitleLeftBackResource(com.luck.picture.lib.R.drawable.ps_ic_normal_back);
|
||||
|
||||
// 底部NavBar 风格
|
||||
BottomNavBarStyle numberBottomNavBarStyle = new BottomNavBarStyle();
|
||||
numberBottomNavBarStyle.setBottomPreviewNarBarBackgroundColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_half_grey));
|
||||
numberBottomNavBarStyle.setBottomPreviewNormalText(com.luck.picture.lib.R.string.ps_preview);
|
||||
numberBottomNavBarStyle.setBottomPreviewNormalTextColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_9b));
|
||||
numberBottomNavBarStyle.setBottomPreviewNormalTextSize(16);
|
||||
numberBottomNavBarStyle.setCompleteCountTips(false);
|
||||
numberBottomNavBarStyle.setBottomPreviewSelectText(com.luck.picture.lib.R.string.ps_preview_num);
|
||||
numberBottomNavBarStyle.setBottomPreviewSelectTextColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_white));
|
||||
|
||||
|
||||
selectorStyle.setTitleBarStyle(numberTitleBarStyle);
|
||||
selectorStyle.setBottomBarStyle(numberBottomNavBarStyle);
|
||||
selectorStyle.setSelectMainStyle(numberSelectMainStyle);
|
||||
return selectorStyle;
|
||||
}
|
||||
|
||||
public class ImageFileCropEngine implements CropFileEngine {
|
||||
|
||||
@Override
|
||||
public void onStartCrop(Fragment fragment, Uri srcUri, Uri destinationUri, ArrayList<String> dataSource, int requestCode) {
|
||||
UCrop.Options options = buildOptions();
|
||||
UCrop uCrop = UCrop.of(srcUri, destinationUri, dataSource);
|
||||
uCrop.withOptions(options);
|
||||
uCrop.setImageEngine(new UCropImageEngine() {
|
||||
@Override
|
||||
public void loadImage(Context context, String url, ImageView imageView) {
|
||||
// if (!ImageLoaderUtils.assertValidRequest(context)) {
|
||||
// return;
|
||||
// }
|
||||
Glide.with(context).load(url).override(180, 180).into(imageView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadImage(Context context, Uri url, int maxWidth, int maxHeight, OnCallbackListener<Bitmap> call) {
|
||||
Glide.with(context).asBitmap().load(url).override(maxWidth, maxHeight).into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
if (call != null) {
|
||||
call.onCall(resource);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
if (call != null) {
|
||||
call.onCall(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
uCrop.start(fragment.requireActivity(), fragment, requestCode);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 配制UCrop,可根据需求自我扩展
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public UCrop.Options buildOptions() {
|
||||
UCrop.Options options = new UCrop.Options();
|
||||
options.setHideBottomControls(true);//是否显示裁剪
|
||||
options.setFreeStyleCropEnabled(true);//裁剪是否可以拖动
|
||||
options.setShowCropFrame(true);//是否显示裁剪边缘
|
||||
options.setShowCropGrid(true);//是否显示裁剪网格
|
||||
options.setCircleDimmedLayer(false);//圆形头像裁剪
|
||||
options.withAspectRatio(1, 1);
|
||||
options.isCropDragSmoothToCenter(false);
|
||||
options.isForbidCropGifWebp(false);
|
||||
options.isForbidSkipMultipleCrop(true);
|
||||
options.setMaxScaleMultiplier(100);
|
||||
if (selectorStyle != null && selectorStyle.getSelectMainStyle().getStatusBarColor() != 0) {
|
||||
SelectMainStyle mainStyle = selectorStyle.getSelectMainStyle();
|
||||
boolean isDarkStatusBarBlack = mainStyle.isDarkStatusBarBlack();
|
||||
int statusBarColor = mainStyle.getStatusBarColor();
|
||||
options.isDarkStatusBarBlack(isDarkStatusBarBlack);
|
||||
if (StyleUtils.checkStyleValidity(statusBarColor)) {
|
||||
options.setStatusBarColor(statusBarColor);
|
||||
options.setToolbarColor(statusBarColor);
|
||||
} else {
|
||||
options.setStatusBarColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_grey));
|
||||
options.setToolbarColor(ContextCompat.getColor(getContext(),com.luck.picture.lib.R.color.ps_color_grey));
|
||||
}
|
||||
TitleBarStyle titleBarStyle = selectorStyle.getTitleBarStyle();
|
||||
if (StyleUtils.checkStyleValidity(titleBarStyle.getTitleTextColor())) {
|
||||
options.setToolbarWidgetColor(titleBarStyle.getTitleTextColor());
|
||||
} else {
|
||||
options.setToolbarWidgetColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_white));
|
||||
}
|
||||
} else {
|
||||
options.setStatusBarColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_grey));
|
||||
options.setToolbarColor(ContextCompat.getColor(getContext(), com.luck.picture.lib.R.color.ps_color_grey));
|
||||
options.setToolbarWidgetColor(ContextCompat.getColor(getContext(),com.luck.picture.lib. R.color.ps_color_white));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user