1:修改页面的图标

This commit is contained in:
2025-09-24 17:19:02 +08:00
parent e03ccb91dc
commit b4eb142c86
166 changed files with 3486 additions and 18295 deletions

View File

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-09-18T12:45:46.137835600Z">
<DropdownSelection timestamp="2025-09-23T02:14:35.252005400Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=6705124a" />
<DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=dfc6548f" />
</handle>
</Target>
</DropdownSelection>

View File

@@ -4,11 +4,11 @@ plugins {
}
android {
namespace 'com.xscm.midi'
namespace 'com.jdf.myyuliao'
compileSdk 35
defaultConfig {
applicationId "com.xscm.midi"
applicationId "com.jdf.myyuliao"
minSdk 24
targetSdk 33
versionCode Integer.parseInt(project.findProperty("APP_VERSION_CODE"))
@@ -39,14 +39,14 @@ android {
signingConfigs {
debug {
storeFile file("midi.jks")
storeFile file("myyl.jks")
storePassword "123456"
keyAlias "key0"
keyPassword "123456"
}
release {
storeFile file("midi.jks")
storeFile file("myyl.jks")
storePassword "123456"
keyAlias "key0"
keyPassword "123456"
@@ -66,7 +66,7 @@ android {
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def versionName = variant.versionName
def versionCode = variant.versionCode
def fileName = "秘地_${versionName}_${versionCode}.apk"
def fileName = "MY语聊${versionName}_${versionCode}.apk"
output.outputFileName = fileName
}
}

Binary file not shown.

BIN
app/myyl.jks Normal file

Binary file not shown.

View File

@@ -1,37 +0,0 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.xscm.midi",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 151,
"versionName": "1.0.3",
"outputFile": "秘地_1.0.3_151.apk"
}
],
"elementType": "File",
"baselineProfiles": [
{
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/秘地_1.0.3_151.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/秘地_1.0.3_151.dm"
]
}
],
"minSdkVersionForDexing": 24
}

View File

@@ -1,26 +0,0 @@
package com.xscm.midi;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.xscm.qxlive", appContext.getPackageName());
}
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.xscm.midi">
package="com.jdf.myyuliao">
<!-- Features -->
<!-- Features -->

View File

@@ -1,4 +1,4 @@
package com.xscm.midi;
package com.jdf.myyuliao;
import com.alibaba.android.arouter.launcher.ARouter;
import com.hjq.toast.ToastUtils;

View File

@@ -1,4 +1,4 @@
package com.xscm.midi;
package com.jdf.myyuliao;
import android.app.Activity;

View File

@@ -1,4 +1,4 @@
package com.xscm.midi;
package com.jdf.myyuliao;
import android.content.Intent;
@@ -10,6 +10,7 @@ import android.util.Log;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.jdf.myyuliao.databinding.ActivityLaunchPageBinding;
import com.xscm.modulelogin.activity.ImproveInfoActivity;
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
import com.xscm.moduleutil.base.AppStateListener;
@@ -18,7 +19,6 @@ import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.dialog.PolicyDialog;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.midi.databinding.ActivityLaunchPageBinding;
public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPageBinding> {
private Handler handler;

View File

@@ -1,4 +1,4 @@
package com.xscm.midi;
package com.jdf.myyuliao;
import android.content.Context;
import android.content.Intent;

View File

@@ -1,4 +1,4 @@
package com.xscm.midi;
package com.jdf.myyuliao;
import static android.view.View.VISIBLE;
@@ -22,6 +22,7 @@ import com.alipay.sdk.app.AuthTask;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.hjq.toast.ToastUtils;
import com.jdf.myyuliao.databinding.ActivityPasswordLoginBinding;
import com.mobile.auth.gatewayauth.AuthUIConfig;
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
import com.mobile.auth.gatewayauth.PreLoginResultListener;
@@ -39,7 +40,6 @@ import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.utils.BarUtils;
import com.xscm.moduleutil.utils.PreferencesUtils;
import com.xscm.moduleutil.utils.logger.Logger;
import com.xscm.midi.databinding.ActivityPasswordLoginBinding;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;

View File

@@ -1,4 +1,4 @@
package com.xscm.midi;
package com.jdf.myyuliao;
import android.graphics.Color;
import android.os.Bundle;
@@ -13,6 +13,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.blankj.utilcode.util.RegexUtils;
import com.example.modulevocal.conacts.RealNameConacts;
import com.example.modulevocal.presenter.RealNamePresenter;
import com.jdf.myyuliao.databinding.ActivityRealNameBinding;
import com.xscm.moduleutil.activity.BaseMvpActivity;
import com.xscm.moduleutil.bean.RealNameBean;
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
@@ -20,7 +21,6 @@ import com.xscm.moduleutil.dialog.ConfirmDialog;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.midi.databinding.ActivityRealNameBinding;
import com.tencent.cloud.huiyansdkface.facelight.api.WbCloudFaceContant;
import com.tencent.cloud.huiyansdkface.facelight.api.WbCloudFaceVerifySdk;
import com.tencent.cloud.huiyansdkface.facelight.api.listeners.WbCloudFaceVerifyLoginListener;

View File

@@ -1,4 +1,4 @@
package com.xscm.midi.presenter;
package com.jdf.myyuliao.presenter;
import android.content.Context;

View File

@@ -1,4 +1,4 @@
package com.xscm.midi.wxapi;
package com.jdf.myyuliao.wxapi;
import android.app.Activity;
import android.os.Bundle;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 KiB

After

Width:  |  Height:  |  Size: 517 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 977 KiB

View File

@@ -1,17 +0,0 @@
package com.xscm.midi;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@@ -29,8 +29,8 @@ isBuildModule=false
#org.gradle.deamon=false
android.injected.testOnly=false
APP_VERSION_NAME=1.0.3
APP_VERSION_CODE=151
APP_VERSION_NAME=1.0.0
APP_VERSION_CODE=1
org.gradle.jvm.toolchain.useLegacyAdapters=false
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -184,7 +184,7 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
public void loginSuccess(List<UserBean> userBean) {
if (userBean == null) {
ToastUtils.showShort("登录失败请重试");
// ToastUtils.showShort("登录失败请重试");
return;
}
if (userBean.size() == 1) {

View File

@@ -341,7 +341,7 @@
android:layout_gravity="center"
android:enabled="false"
android:gravity="center"
android:text="开启秘地之旅"
android:text="开启MY语聊之旅"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
@@ -350,7 +350,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="21dp"
android:text="进入秘地"
android:text="进入MY语聊"
android:textColor="@color/color_white"
android:textSize="16sp" />
</RelativeLayout>

View File

@@ -2,28 +2,32 @@ package com.xscm.moduleutil.activity;
import static androidx.core.content.ContextCompat.getSystemService;
import static com.xscm.moduleutil.base.CommonAppContext.postDelayed;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.FrameLayout;
@@ -50,11 +54,11 @@ import com.xscm.moduleutil.event.MqttBean;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.BackgroundManager;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.DialogUtils;
import com.xscm.moduleutil.utils.DisplayUtil;
import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.utils.LanguageUtil;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.utils.SystemUtils;
import com.xscm.moduleutil.widget.QXGiftDriftView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -68,10 +72,6 @@ import java.util.Map;
public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends AppCompatActivity
implements BackgroundManager.BackgroundUpdateListener, ColorManager.ColorChangeListener {
// @Override
// protected void attachBaseContext(Context newBase) {
// super.attachBaseContext(LanguageUtil.attachBaseContext(newBase));
// }
@Override
protected void attachBaseContext(Context newBase) {
// 设置字体缩放比例为1.0f,即不跟随系统字体大小变化
@@ -104,7 +104,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
ActivityUtils.finishAllActivities();
}
QXGiftDriftView qxGiftDriftView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -147,7 +147,6 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
EventBus.getDefault().register(this);
}
}
// 在Activity中
@@ -399,11 +398,6 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
return false;
}
// 在类中添加以下成员变量
private final List<MqttBean> messageQueue = new ArrayList<>(); // 消息队列
private boolean isPlaying = false; // 播放状态标志
private boolean isPlaying2 = false; // 播放状态标志
private final Object queueLock = new Object(); // 队列同步锁
/// 礼物特效
// 在类中添加以下成员变量
@@ -425,10 +419,10 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
synchronized (mqttQueueLock) {
mqttMessageQueue.addAll(mqttBean.getList());
if (!isMqttPlaying) {
isMqttPlaying = true;
// if (!isMqttPlaying) {
// isMqttPlaying = true;
processNextMqttMessage();
}
// }
}
}else {
mqttMessageQueue.clear();
@@ -483,6 +477,11 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
ViewGroup decorView1;
private void showFloatingMessage(MqttBean.ListBean mqttBean) {
// QXGiftDriftView.getInstance( this).addGiftModel(mqttBean);
try {
// 清理之前的视图(如果存在)
if (currentMqttView != null && currentMqttView.getParent() != null) {
@@ -573,43 +572,113 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
}
}
}
private void resetAndStartMqttAnimation(View view, Runnable onAnimationEnd) {
try {
view.setTranslationX(view.getWidth());
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
animator1.setDuration(1500);
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
animator1.start();
int screenWidth = getScreenWidth();
// 设置初始位置:在屏幕右侧外部(完全不可见)
view.setTranslationX(screenWidth);
view.postDelayed(() -> {
try {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
animator2.setDuration(1500);
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
animator2.addListener(new AnimatorListenerAdapter() {
TranslateAnimation enterAnim = new TranslateAnimation(
Animation.ABSOLUTE, screenWidth,
Animation.ABSOLUTE, (screenWidth - SystemUtils.getWidth(316)) / 2,
Animation.ABSOLUTE, 0,
Animation.ABSOLUTE, 0
);
enterAnim.setDuration(1500);
enterAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationEnd(Animator animation) {
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
// 停留后退出
postDelayed(() -> {
TranslateAnimation exitAnim = new TranslateAnimation(
Animation.ABSOLUTE, (screenWidth - SystemUtils.getWidth(316)) / 2,
Animation.ABSOLUTE, -screenWidth,
Animation.ABSOLUTE, 0,
Animation.ABSOLUTE, 0
);
exitAnim.setDuration(2000);
exitAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
// 移除视图并处理下一个
// ViewGroup rootView = (ViewGroup) getParent();
// if (rootView != null) {
// rootView.removeView(QXGiftDriftView.this);
// }
//
// if (!dataArray.isEmpty()) {
// dataArray.remove(0);
// }
// isPlaying = false;
//
// if (!dataArray.isEmpty()) {
// giftAction();
// }
onAnimationEnd.run();
}
@Override
public void onAnimationCancel(Animator animation) {
onAnimationEnd.run();
}
public void onAnimationRepeat(Animation animation) {}
});
animator2.start();
} catch (Exception e) {
LogUtils.e("MQTT动画执行失败", e);
onAnimationEnd.run();
view.startAnimation(exitAnim);
}, 3000); // 停留1秒
}
}, 3000);
@Override
public void onAnimationRepeat(Animation animation) {}
});
view.startAnimation(enterAnim);
// ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
// animator1.setDuration(1500);
// animator1.setInterpolator(new DecelerateInterpolator(1f));
// animator1.start();
// view.postDelayed(() -> {
// try {
// ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
// animator2.setDuration(3000);
// animator2.setInterpolator(new DecelerateInterpolator(2.0f));
// animator2.addListener(new AnimatorListenerAdapter() {
// @Override
// public void onAnimationEnd(Animator animation) {
// onAnimationEnd.run();
// }
//
// @Override
// public void onAnimationCancel(Animator animation) {
// onAnimationEnd.run();
// }
// });
// animator2.start();
// } catch (Exception e) {
// LogUtils.e("MQTT动画执行失败", e);
// onAnimationEnd.run();
// }
// }, 3000);
} catch (Exception e) {
LogUtils.e("MQTT动画启动失败", e);
onAnimationEnd.run();
}
}
// 添加获取屏幕宽度的方法
private int getScreenWidth() {
DisplayMetrics displayMetrics = new DisplayMetrics();
if (getWindowManager() != null) {
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return displayMetrics.widthPixels;
}
return getResources().getDisplayMetrics().widthPixels;
}
private void resetAndStartXlhAnimation(View view, Runnable onAnimationEnd) {
try {
view.setTranslationX(view.getWidth());

View File

@@ -4,6 +4,9 @@ import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
@@ -11,9 +14,21 @@ import androidx.core.content.ContextCompat;
import androidx.databinding.ViewDataBinding;
import com.blankj.utilcode.util.LogUtils;
import com.tencent.imsdk.v2.V2TIMConversationListener;
import com.tencent.imsdk.v2.V2TIMConversationManager;
import com.tencent.imsdk.v2.V2TIMSDKListener;
import com.tencent.imsdk.v2.V2TIMValueCallback;
import com.tencent.qcloud.tuicore.TUIConfig;
import com.tencent.qcloud.tuicore.TUIConstants;
import com.tencent.qcloud.tuicore.TUICore;
import com.tencent.qcloud.tuicore.interfaces.TUILoginListener;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.dialog.ConfirmDialog;
import com.xscm.moduleutil.event.UnreadCountEvent;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.utils.LanguageUtil;
import com.xscm.moduleutil.utils.location.LocationProvider;
import com.xscm.moduleutil.utils.location.SystemLocationProvider;
@@ -28,12 +43,12 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewDataBinding> extends BaseAppCompatActivity<VDB> implements
IView<Activity> , LocationProvider.LocationCallback
{
IView<Activity>, LocationProvider.LocationCallback {
protected P MvpPre;
protected abstract P bindPresenter();
private String city1;
@Override
@@ -82,31 +97,95 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
public void onError(final int code, final String desc) {
LogUtils.e("@@@1", code, "描述:", desc);
}
@Override
public void onSuccess() {
LogUtils.e("@@@", "成功");
// V2TIMUserFullInfo userFullInfo = new V2TIMUserFullInfo();
// userFullInfo.setNickname(userBean.getNickname());
// userFullInfo.setFaceUrl(userBean.getAvatar());
// userFullInfo.setAllowType(userBean.getSex());
// V2TIMManager.getInstance().setSelfInfo(userFullInfo, new V2TIMCallback() {
// @Override
// public void onSuccess() {
// LogUtils.e("@@@", "成功");
// }
//
// @Override
// public void onError(int code, String desc) {
// LogUtils.e("@@@", "描述"+desc);
// }
// });
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
@Override
public void onSuccess(Long aLong) {
// 通知未读数变化
UnreadCountEvent event =CommonAppContext.getInstance().unreadCountEvent;
if (event==null){
event=new UnreadCountEvent();
}
event.setALong(aLong);
// 使用EventBus通知
CommonAppContext.getInstance().setUnreadCountEvent(event);
EventBus.getDefault().post(event);
}
@Override
public void onError(int code, String desc) {
// 错误处理
}
});
initLocation();
}
});
V2TIMManager.getInstance().addIMSDKListener(imSdkListener);
}
private final V2TIMSDKListener imSdkListener = new V2TIMSDKListener() {
@Override
public void onConnecting() {
}
@Override
public void onConnectSuccess() {//重连成功
if (CommonAppContext.getInstance().playId!=null){
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId);
}
}
@Override
public void onConnectFailed(int code, String error) {
}
@Override
public void onKickedOffline() {
// queren1();
}
@Override
public void onUserSigExpired() {
}
@Override
public void onSelfInfoUpdated(V2TIMUserFullInfo info) {
}
};
private void queren1() {
// 创建并显示确认对话框
new ConfirmDialog(this,
"温馨提示",
"您的账号已在别处登录,请确认密码是否已经泄露",
"知道了",
"",
v -> {
// 点击“确认”按钮时执行删除操作
if (CommonAppContext.getInstance().playId!=null){
RoomManager.getInstance().exitRoom(CommonAppContext.getInstance().playId);
}
try {
CommonAppContext.getInstance().clearLoginInfo();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
},
v -> {
// 点击“取消”按钮时什么都不做
}, false, 0).show();
}
private SystemLocationProvider locationProvider;
private void initLocation() {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
@@ -151,6 +230,20 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
}
@Override
public Resources getResources() {
Resources resources = super.getResources();
if (resources != null) {
Configuration configuration = resources.getConfiguration();
if (configuration != null) {
// 设置字体缩放比例不随系统变化
configuration.fontScale = 1.0f; // 1.0f表示默认大小
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
}
}
return resources;
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void userInfoEvent(UserInfo event) {
// V2TIMUserFullInfo userFullInfo = new V2TIMUserFullInfo();

View File

@@ -405,14 +405,16 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
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_NAME, guild_name);
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 intent = new Intent(mContext, TUIGroupChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
intent.putExtra(TUIConstants.TUIChat.CHAT_NAME, nickname);
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
mContext.startActivity(intent);
}

View File

@@ -1,7 +1,5 @@
package com.xscm.moduleutil.base;
import static androidx.core.app.ActivityCompat.startActivityForResult;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Application;
@@ -19,6 +17,7 @@ import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.webkit.WebView;
import androidx.annotation.NonNull;
@@ -31,12 +30,18 @@ import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ProcessUtils;
import com.blankj.utilcode.util.ServiceUtils;
import com.lahm.library.EasyProtectorLib;
import com.lahm.library.EmulatorCheckCallback;
import com.xscm.moduleutil.R;
import com.tencent.imsdk.v2.V2TIMAdvancedMsgListener;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMMessage;
import com.tencent.imsdk.v2.V2TIMMessageManager;
import com.tencent.imsdk.v2.V2TIMMessageReceipt;
import com.tencent.imsdk.v2.V2TIMValueCallback;
import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.event.AppLifecycleEvent;
import com.xscm.moduleutil.event.UnreadCountEvent;
import com.xscm.moduleutil.interfaces.AppLifecycleUtil;
import com.xscm.moduleutil.listener.MessageListenerSingleton;
import com.xscm.moduleutil.rtc.AgoraManager;
@@ -64,10 +69,10 @@ import org.greenrobot.eventbus.EventBus;
import java.lang.reflect.Method;
import java.security.MessageDigest;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
/**
@@ -89,6 +94,8 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
public boolean isPlaying;
public String playId;
public String lable_id;
public boolean isMicPlace;
public String playCover;
public boolean showSelf;//盲盒是否能送自己
public String playName;
@@ -110,7 +117,14 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
}
private int activityCount = 0;
private AppStateListener appStateListener;
private boolean isListeningUnreadCount = false;
@Setter
@Getter
public UnreadCountEvent unreadCountEvent;
@Override
public void onCreate() {
super.onCreate();
@@ -123,9 +137,82 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
initialization();
registerActivityLifecycleCallbacks(this);
appStateListener = AppStateManager.getInstance();
startListeningUnreadMessageCount();
// 全局设置字体不缩放
adjustFontScale(getResources().getConfiguration());
}
public void adjustFontScale(Configuration configuration) {
if (configuration.fontScale != 1.0f) {
configuration.fontScale = 1.0f;
DisplayMetrics metrics = getResources().getDisplayMetrics();
getResources().updateConfiguration(configuration, metrics);
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// 配置变化时重新应用字体设置
adjustFontScale(newConfig);
}
// 在适当的位置如onCreate或onResume添加实时监听
protected void startListeningUnreadMessageCount() {
if (!isListeningUnreadCount) {
// 添加未读消息数变化监听器
V2TIMMessageManager messageManager = V2TIMManager.getMessageManager();
messageManager.addAdvancedMsgListener(new V2TIMAdvancedMsgListener() {
@Override
public void onRecvNewMessage(V2TIMMessage msg) {
// 收到新消息时更新未读数
updateUnreadMessageCount();
}
@Override
public void onRecvC2CReadReceipt(List<V2TIMMessageReceipt> receiptList) {
// 收到C2C消息已读回执时更新未读数
updateUnreadMessageCount();
}
});
isListeningUnreadCount = true;
// 首次获取未读数
updateUnreadMessageCount();
}
}
// 更新未读消息数的方法
private void updateUnreadMessageCount() {
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
@Override
public void onSuccess(Long aLong) {
// 通知未读数变化
notifyUnreadCountChanged(aLong != null ? aLong : 0L);
}
@Override
public void onError(int code, String desc) {
// 错误处理
notifyUnreadCountChanged(0L);
}
});
}
// 通知未读数变化的方法可以发送广播或EventBus事件
private void notifyUnreadCountChanged(long unreadCount) {
UnreadCountEvent event =unreadCountEvent;
if (event==null){
event=new UnreadCountEvent();
}
event.setALong(unreadCount);
// 使用EventBus通知
CommonAppContext.getInstance().setUnreadCountEvent(event);
EventBus.getDefault().post(event);
}
/**
* 优化内存设置
*/
@@ -283,6 +370,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
// 每次启动应用时重置状态
SpUtil.getInstance().setBooleanValue("youth_model_shown", false);
startInitSdk();
}
}
// piaoPingManager = PiaoPingManager.getInstance(this);
@@ -294,7 +382,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
}
}
requestBatteryOptimizationExemption();
// requestBatteryOptimizationExemption();
}
private void requestBatteryOptimizationExemption() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
@@ -552,6 +640,11 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
return mUserBean;
}
public UserInfo getUserInfo() {
UserInfo userInfo = SpUtil.getUserInfo();
return userInfo;
}
public void setUserBean(UserBean bean) {
mUserBean = bean;
}

View File

@@ -43,7 +43,8 @@ public class RoomManager {
// 缓存有效期5分钟
private static final long CACHE_DURATION = 5 * 60 * 1000;
private RoomManager() {}
private RoomManager() {
}
public static synchronized RoomManager getInstance() {
if (instance == null) {
@@ -54,6 +55,7 @@ public class RoomManager {
/**
* 进入房间 - 自动获取房间数据
*
* @param context 上下文
* @param roomId 房间ID
*/
@@ -63,6 +65,7 @@ public class RoomManager {
/**
* 进入房间 - 使用密码
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
@@ -73,6 +76,7 @@ public class RoomManager {
/**
* 进入房间 - 使用缓存数据
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
@@ -98,6 +102,7 @@ public class RoomManager {
/**
* 获取房间数据并进入房间
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
@@ -113,7 +118,14 @@ public class RoomManager {
if (CommonAppContext.getInstance().playId == null) {
fetchAndJoinRoom(context, roomId, password);
} else {
if (!CommonAppContext.getInstance().playId.equals(roomId)) {
exitRoom(CommonAppContext.getInstance().playId);
} else if (CommonAppContext.getInstance().lable_id.equals("6")) {
upInfo(context, roomId, password, true, null, true);
return;
}
isUserOnline(context, roomId, password, null);
}
// try {
@@ -184,7 +196,6 @@ public class RoomManager {
}
// if (isCurrentRoom&& isOnline) {
// if (roomInfo != null) {
// navigateToRoom(context, roomId, password, roomInfo);
@@ -223,6 +234,7 @@ public class RoomManager {
/**
* 获取新的房间数据并加入房间
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
@@ -270,6 +282,7 @@ public class RoomManager {
/**
* 检查是否是当前房间
*
* @param roomId 房间ID
* @return true表示是当前房间false表示不是
*/
@@ -289,8 +302,10 @@ public class RoomManager {
return false;
}
/**
* 跳转到房间页面
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
@@ -325,6 +340,7 @@ public class RoomManager {
/**
* 缓存房间数据
*
* @param roomId 房间ID
* @param roomInfo 房间信息
*/
@@ -342,6 +358,7 @@ public class RoomManager {
/**
* 获取缓存的房间数据
*
* @param roomId 房间ID
* @return 房间信息如果缓存无效则返回null
*/
@@ -365,8 +382,10 @@ public class RoomManager {
return roomDataCache.get(roomId);
}
/**
* 检查用户是否在线
*
* @param roomId 房间ID
* @return true表示用户在线false表示不在线
*/
@@ -389,6 +408,7 @@ public class RoomManager {
@Override
public void onNext(RoomOnline roomOnline) {
try {
if (roomOnline != null) {
if (roomOnline.getOn_pit() != null) {
for (RoomOnlineBean roomOnlineBean : roomOnline.getOn_pit()) {
@@ -410,12 +430,21 @@ public class RoomManager {
} else {
isOnline[0] = false;
}
} catch (Exception e) {
// 捕获所有可能的异常,避免崩溃
e.printStackTrace();
isOnline[0] = false;
// 即使出现异常也继续执行
upInfo(context, roomId, password, isOnline[0], roomInfo, true);
}
}
});
return isOnline[0];
}
/**
* 清除指定房间的缓存数据
*
* @param roomId 房间ID
*/
public void clearRoomCache(String roomId) {
@@ -435,6 +464,7 @@ public class RoomManager {
/**
* 退出房间
*
* @param roomId 房间ID
*/
public void exitRoom(String roomId) {
@@ -444,11 +474,24 @@ public class RoomManager {
// 可以在这里添加其他退出房间的逻辑
// 例如:通知服务器用户已退出、清理房间相关资源等
RetrofitClient.getInstance().quitRoom(roomId, SpUtil.getUserId() + "", new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(String s) {
}
});
Logger.d(TAG, "退出房间: " + roomId);
}
/**
* 批量退出房间
*
* @param roomIds 房间ID列表
*/
public void exitRooms(String... roomIds) {
@@ -461,6 +504,7 @@ public class RoomManager {
/**
* 获取房间缓存状态
*
* @param roomId 房间ID
* @return 缓存状态信息
*/

View File

@@ -19,6 +19,8 @@ public class UserBean implements Serializable {
private String mobile;
private int sex;
private int auth;
private int is_can_chat;//是否可以私聊1可以0不可以
private int can_chat_money;//需要充值的金额
private List<MultiUserBean> multi_user;

View File

@@ -55,6 +55,9 @@ public class UserInfo implements Serializable {
private String red_status;
private String gift_num;
private int is_can_chat;//是否可以私聊1可以0不可以
private int can_chat_money;//需要充值的金额
private RelationshipBean qinmi;
private RelationshipBean zhenai;

View File

@@ -34,7 +34,7 @@ public class RoomPitBean implements Serializable {
private int is_lock;//0未锁麦 1锁麦
private int is_mute;//0未禁麦 1禁麦
private int count_down;//麦位倒计时
private String user_id;//麦位上用户id
private String user_id="";//麦位上用户id
private String nickname;//麦位上用户昵称
private String avatar;//用户头像
private String sex;//性别

View File

@@ -63,7 +63,7 @@ public class PolicyDialog extends Dialog {
ds.setUnderlineText(true);
}
};
spanUtils.append("欢迎使用秘地\n").append("在使用我们的产品和服务之前,请您先阅读并了解").append("《用户协议》").setClickSpan(clickSpan).append("").append("《隐私协议》").setClickSpan(ysClickSpan).append("。我们将严格按照上述协议为" +
spanUtils.append("欢迎使用MY语聊\n").append("在使用我们的产品和服务之前,请您先阅读并了解").append("《用户协议》").setClickSpan(clickSpan).append("").append("《隐私协议》").setClickSpan(ysClickSpan).append("。我们将严格按照上述协议为" +
"您提供服务,保护您的信息安全,点" +
"击“同意”即表示您已阅读并同意全部" +
"条款,可以继续使用我们的产品和服" +

View File

@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import com.blankj.utilcode.util.ScreenUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.bean.FirstChargeGiftBean;
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.databinding.DialogRealNameBinding;
import com.xscm.moduleutil.databinding.IndexDialogYouthModelBinding;
@@ -20,6 +21,18 @@ import com.xscm.moduleutil.widget.dialog.BaseDialog;
*/
public class RealNameDialog extends BaseDialog<DialogRealNameBinding> {
public interface OnFirstChargeListener {
void onFirstChargeConfirmed(String giftBean, int type);
void onFirstChargeCancelled();
}
private OnFirstChargeListener listener;
// 设置监听器的方法
public void setOnFirstChargeListener(OnFirstChargeListener listener) {
this.listener = listener;
}
public RealNameDialog(@NonNull Context context) {
super(context);
}
@@ -36,8 +49,19 @@ public class RealNameDialog extends BaseDialog<DialogRealNameBinding> {
Window window = getWindow();
window.setLayout((int) (ScreenUtils.getScreenWidth() * 315.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
mBinding.tvIKnow.setOnClickListener(v -> dismiss());
mBinding.ivClose.setOnClickListener(v -> dismiss());
// mBinding.tvIKnow.setOnClickListener(v -> dismiss());
// mBinding.ivClose.setOnClickListener(v -> dismiss());
mBinding.tvIKnow.setOnClickListener(v -> {
if (listener != null) {
listener.onFirstChargeConfirmed(null, 0);
}
});
mBinding.ivClose.setOnClickListener(v -> {
if (listener != null) {
listener.onFirstChargeCancelled();
}
});
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvIKnow, ColorManager.getInstance().getPrimaryColorInt(), 53);
mBinding.tvIKnow.setTextColor(ColorManager.getInstance().getButtonColorInt());

View File

@@ -0,0 +1,228 @@
package com.xscm.moduleutil.dialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
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.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.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.xscm.moduleutil.R;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.databinding.DialogRoomAuctionWebviewBinding;
import com.xscm.moduleutil.databinding.WebViewDialogBinding;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.widget.dialog.BaseDialog;
/**
*@author qx
*@data 2025/9/24
*@description: 这是拍卖房的规则界面
*/
public class RoomAuctionWebViewDialog extends BaseDialog<DialogRoomAuctionWebviewBinding> {
String mUrl;
int type;//10天空之境 11岁月之城 12时空之巅
public RoomAuctionWebViewDialog(@NonNull Context context, Bundle args) {
super(context, R.style.BaseDialogStyleH);
this.mUrl = args.getString("url");
this.type = args.getInt("type");
initData1();
}
@Override
public void onStart() {
super.onStart();
if (getWindow() != null) {
// 获取屏幕尺寸
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
// 设置高度为屏幕高度的80%
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = (int) (displayMetrics.heightPixels * 0.9);
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
getWindow().setAttributes(params);
}
}
@Override
public int getLayoutId() {
return R.layout.dialog_room_auction_webview;
}
@Override
public void initView() {
setCancelable(true);
setCanceledOnTouchOutside(true);
Window window = getWindow();
assert window != null;
window.setGravity(Gravity.BOTTOM);
window.setLayout((int) (ScreenUtils.getScreenWidth() * 320.f / 375), WindowManager.LayoutParams.MATCH_PARENT);
mBinding.topBar.setTitle("规则");
mBinding.topBar.getIvBack().setOnClickListener(v -> dismiss());
}
@Override
public void initData() {
}
public void initData1() {
// 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);//解决图片不显示
// // 启用 WebView 内容的滚动
// mBinding.webView.setVerticalScrollBarEnabled(true);
// mBinding.webView.setScrollbarFadingEnabled(true);
// 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(mUrl);
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);
// 启用 WebView 内容的滚动,但隐藏滚动条
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);
// 确保内容可以滚动
webSettings.setDomStorageEnabled(true);
mBinding.webView.requestFocus();
mBinding.webView.loadUrl(mUrl);
}
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) {
RoomManager.getInstance().fetchRoomDataAndEnter(getContext(), 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();
}
}
}

View File

@@ -58,7 +58,7 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
// 设置高度为屏幕高度的80%
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = (int) (displayMetrics.heightPixels * 0.7);
params.height = (int) (displayMetrics.heightPixels * 0.9);
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
getWindow().setAttributes(params);
}
@@ -102,6 +102,32 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
public void initData1() {
// 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);//解决图片不显示
// // 启用 WebView 内容的滚动
// mBinding.webView.setVerticalScrollBarEnabled(true);
// mBinding.webView.setScrollbarFadingEnabled(true);
// 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(mUrl);
WebSettings webSettings = mBinding.webView.getSettings();
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
@@ -116,12 +142,16 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
webSettings.setBlockNetworkImage(false);//解决图片不显示
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
// 启用 WebView 内容的滚动,但隐藏滚动条
mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示滚动条
mBinding.webView.setWebViewClient(new WebViewClient());
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
// 确保内容可以滚动
webSettings.setDomStorageEnabled(true);
mBinding.webView.requestFocus();
mBinding.webView.loadUrl(mUrl);
}

View File

@@ -35,6 +35,7 @@ import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
import com.xscm.moduleutil.databinding.DialogGiftLotteryBinding;
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
import com.xscm.moduleutil.dialog.WebViewDialog;
import com.xscm.moduleutil.event.LotteryEvent;
import com.xscm.moduleutil.utils.ARouteConstants;
@@ -440,7 +441,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
}
}
} else if (id == R.id.exchange_layout) {
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
// ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager());
}
}

View File

@@ -30,6 +30,7 @@ import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
import com.xscm.moduleutil.databinding.FragmentTourClubDialogBinding;
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
import com.xscm.moduleutil.dialog.WebViewDialog;
import com.xscm.moduleutil.event.MqttBean;
import com.xscm.moduleutil.utils.ARouteConstants;
@@ -81,7 +82,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
private Runnable autoScrollRunnable;
private boolean isAutoScrolling = false;
private static final int AUTO_SCROLL_DELAY = 1000; // 1秒滚动一个item
private boolean vCheckbox=false;
@Override
protected GiftLotteryPresenter bindPresenter() {
@@ -154,8 +155,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
mBinding.tvBd.setOnClickListener(this::onClick);
mBinding.tvJl.setOnClickListener(this::onClick);
mBinding.exchangeLayout.setOnClickListener(this::onClick);
mBinding.vCheckbox.setOnClickListener(this::onClick);
giftXlhChouAdapter = new GiftXlhChouAdapter();
// 使用 LinearLayoutManager 横向滚动
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
@@ -313,7 +313,11 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
xlhRecordDialog = XlhRecordDialog.newInstance(roomId);
xlhRecordDialog.show(getChildFragmentManager(), "XlhRecordDialog");
} else if (id == R.id.exchange_layout) {//钻石兑换
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
// ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager());
}else if (id==R.id.v_checkbox){
mBinding.vCheckbox.setSelected(!mBinding.vCheckbox.isSelected());
vCheckbox=mBinding.vCheckbox.isSelected();
}
}
@@ -586,7 +590,9 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
@Override
public void xlhChouSuccess(List<XlhDrawBean> data) {
if (data != null) {
if (vCheckbox){
showResultDialog(data);
}else {
// showResultDialog(data);
// 取消之前可能存在的任务
@@ -655,7 +661,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
};
mBinding.recycleView.postDelayed(pendingLotteryRunnable, 1000);
}
}else {
isDrawing=false;
// 抽奖失败也重新启动自动滚动

View File

@@ -9,8 +9,18 @@ import lombok.Data;
@Data
public class UnreadCountEvent {
private long aLong;
private long bLong;
public UnreadCountEvent(long aLong) {
this.aLong = aLong;
}
// public UnreadCountEvent(long aLong, long bLong) {
// this.aLong = aLong;
// this.bLong = bLong;
// }
//
// public UnreadCountEvent() {
// }
// public UnreadCountEvent(long aLong) {
// this.aLong = aLong;
// }
}

View File

@@ -91,7 +91,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.LOGIN)
Observable<BaseModel<List<UserBean>>> login(@Field("user_login") String user_login, @Field("sms_code") String sms_code);
Call<BaseModel<List<UserBean>>> login(@Field("user_login") String user_login, @Field("sms_code") String sms_code);
@FormUrlEncoded //手机换绑
@POST(Constants.MODIFY_MOBILE)
@@ -171,7 +171,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_ROOM_RANK)
Observable<BaseModel<List<CharmRankingResp>>> getRoomRank(@Field("room_id") String room_id, @Field("type") String type, @Field("time_type") String time_type, @Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<List<CharmRankingResp>>> getRoomRank(@Field("room_id") String room_id, @Field("type") String type, @Field("time_type") String time_type, @Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.POST_ROOM_RANKING)
@@ -182,16 +182,16 @@ public interface ApiServer {
Observable<BaseModel<PlaceholderBean>> loveRanking(@Field("type") String type);
@GET(Constants.GET_REAL_NAME)
Observable<BaseModel<RealNameBean>> realNameInfo();
Call<BaseModel<RealNameBean>> realNameInfo();
@GET(Constants.GET_DAILY_TASK_BOX)
Observable<BaseModel<List<GiftBoxRecordBean>>> dailyTasksBoxRecord();
Call<BaseModel<List<GiftBoxRecordBean>>> dailyTasksBoxRecord();
@GET(Constants.GET_MY_BAG_DATA)
Observable<BaseModel<List<MyBagDataBean>>> packIncome(@Query("page") String page, @Query("page_limit") String page_size);
Call<BaseModel<List<MyBagDataBean>>> packIncome(@Query("page") String page, @Query("page_limit") String page_size);
@GET(Constants.GET_MY_BAG_OUTCOME)
Observable<BaseModel<List<MyBagDataBean>>> packOutcome(@Query("page") String page, @Query("page_limit") String page_size);
Call<BaseModel<List<MyBagDataBean>>> packOutcome(@Query("page") String page, @Query("page_limit") String page_size);
@GET(Constants.GET_GIFT_PACK)
Call<BaseModel<List<GiftPackBean>>> giftPack();
@@ -213,7 +213,7 @@ public interface ApiServer {
Call<ResponseBody> endPk(@Field("pk_id") String is_pk, @Field("type") String type, @Field("user_id") String user_id);
@GET(Constants.GET_RECHARGE)
Observable<BaseModel<List<RechargeBean>>> recharge();
Call<BaseModel<List<RechargeBean>>> recharge();
@FormUrlEncoded
@POST(Constants.POST_START_PK)
@@ -225,7 +225,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.SWITCH_ACCOUNTS)
Observable<BaseModel<List<UserBean>>> switchAccounts(@Field("user_login") String user_id);
Call<BaseModel<List<UserBean>>> switchAccounts(@Field("user_login") String user_id);
@FormUrlEncoded
@POST(Constants.FORGOT_PASSWORD)
@@ -233,7 +233,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.USER_UPDATE)
Observable<BaseModel<UserBean>> userUpdate(@Field("nickname") String nickname, @Field("birthday") String birthday, @Field("sex") String sex, @Field("avatar") String avatar, @Field("init_code") String init_code, @Field("user_id") String user_id);
Call<BaseModel<UserBean>> userUpdate(@Field("nickname") String nickname, @Field("birthday") String birthday, @Field("sex") String sex, @Field("avatar") String avatar, @Field("init_code") String init_code, @Field("user_id") String user_id);
@GET(Constants.AUTHORIZATION)
Call<ResponseBody> authorization();
@@ -263,18 +263,18 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.REAL_NAME)
Observable<BaseModel<RealNameBean>> realName(@Field("real_name") String real_name, @Field("card_number") String card_number);
Call<BaseModel<RealNameBean>> realName(@Field("real_name") String real_name, @Field("card_number") String card_number);
@FormUrlEncoded
@POST(Constants.GET_EXPAND_COLUMN)
Observable<BaseModel<List<ExpandColumnBean>>> getExpandColumn(@Field("type") String type, @Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<List<ExpandColumnBean>>> getExpandColumn(@Field("type") String type, @Field("page") String page, @Field("page_limit") String page_limit);
@GET(Constants.GET_OFFICIAL_NOTICE)
Observable<BaseModel<NewsDataBean>> getOfficialNotice();
Call<BaseModel<NewsDataBean>> getOfficialNotice();
@FormUrlEncoded
@POST(Constants.GET_ALBUM_LIST)
Observable<BaseModel<List<AlbumBean>>> getAlbumList(@Field("page") String page, @Field("page_limit") String page_limit, @Field("user_id") String user_id);
Call<BaseModel<List<AlbumBean>>> getAlbumList(@Field("page") String page, @Field("page_limit") String page_limit, @Field("user_id") String user_id);
@FormUrlEncoded
@POST(Constants.CREATE_ALBUM)
@@ -289,19 +289,19 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_FOLLOW_LIST)
Observable<BaseModel<List<BlackUserBean>>> getUserFollowList(@Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<List<BlackUserBean>>> getUserFollowList(@Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.POST_FANS_LIST)
Observable<BaseModel<List<BlackUserBean>>> getUserFansList(@Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<List<BlackUserBean>>> getUserFansList(@Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.POST_BLACK_LIST)
Observable<BaseModel<List<BlackUserBean>>> getBlacklist(@Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<List<BlackUserBean>>> getBlacklist(@Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.POST_LOCK_MI_LIST)
Observable<BaseModel<List<BlackUserBean>>> getLockMiniList(@Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<List<BlackUserBean>>> getLockMiniList(@Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.GET_MY_ROOM)
@@ -316,7 +316,7 @@ public interface ApiServer {
Call<BaseModel<List<TopRoom>>> getTopRooms(@Field("page") String page, @Field("page_limit") String page_limit, @Field("is_top") String is_top, @Field("label_id") String label_id);
@GET(Constants.GET_ROOM_TYPE)
Observable<BaseModel<List<RoomTypeModel>>> getRoomCategories();
Call<BaseModel<List<RoomTypeModel>>> getRoomCategories();
@FormUrlEncoded
@POST(Constants.CHECK_TXT)
@@ -324,35 +324,35 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.GET_REWARD_LIST)
Observable<BaseModel<List<RewardUserBean>>> getRewardList(@Field("id") String id, @Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<List<RewardUserBean>>> getRewardList(@Field("id") String id, @Field("page") String page, @Field("page_limit") String page_limit);
@GET(Constants.GET_GIFT_LABEL)
Observable<BaseModel<List<GiftLabelBean>>> getGiftLabel(@Query("have_hot") String have_hot);
Call<BaseModel<List<GiftLabelBean>>> getGiftLabel(@Query("have_hot") String have_hot);
@GET(Constants.GIFT_LIST)
//获取礼物列表
Observable<BaseModel<List<RoonGiftModel>>> getGiftList(@Query("label") int label,@Query("room_id")String room_id);
Call<BaseModel<List<RoonGiftModel>>> getGiftList(@Query("label") int label,@Query("room_id")String room_id);
@GET(Constants.TOPIC_LIST)
//获取话题
Observable<BaseModel<List<HeatedBean>>> topicList(@Query("page") String page, @Query("page_limit") String page_limit);
Call<BaseModel<List<HeatedBean>>> topicList(@Query("page") String page, @Query("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.PUBLISH_ZONE)
Call<BaseModel<String>> publishZone(@Field("images") String images, @Field("content") String content, @Field("topic_id") String topic_id, @Field("room_id") String room_id, @Field("ip") String ip);
@GET(Constants.GET_CATEGORIES)
Observable<BaseModel<List<HeatedBean>>> getCategories();
Call<BaseModel<List<HeatedBean>>> getCategories();
@GET(Constants.GET_CIRCLE_LIST)
Call<BaseModel<List<CircleListBean>>> getCircleList(@Query("page") String page, @Query("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.GET_USER_HOME_ZONE)
Observable<BaseModel<List<CircleListBean>>> getCircleUserList(@Field("user_id") String user_id, @Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<List<CircleListBean>>> getCircleUserList(@Field("user_id") String user_id, @Field("page") String page, @Field("page_limit") String page_limit);
@GET(Constants.GET_MY_FOOT)
Observable<BaseModel<List<MyFootResp>>> getMyFoot(@Query("page") String page, @Query("page_limit") String page_limit);
Call<BaseModel<List<MyFootResp>>> getMyFoot(@Query("page") String page, @Query("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.LIKE_ZONE)
@@ -360,15 +360,15 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.TOPIC_ID)
Observable<BaseModel<List<CircleListBean>>> topicId(@Field("topic_id") String topic_id);
Call<BaseModel<List<CircleListBean>>> topicId(@Field("topic_id") String topic_id);
@FormUrlEncoded
@POST(Constants.ZONE_DETAIL)
Observable<BaseModel<CircleListBean>> zoneDetail(@Field("id") String topic_id);
Call<BaseModel<CircleListBean>> zoneDetail(@Field("id") String topic_id);
@FormUrlEncoded
@POST(Constants.GET_USER_HOME)
Observable<BaseModel<UserInfo>> getUserHome(@Field("user_id") String user_id);
Call<BaseModel<UserInfo>> getUserHome(@Field("user_id") String user_id);
@FormUrlEncoded
@POST(Constants.DELETE_COMMENT)
@@ -376,11 +376,11 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.GET_COMMENT_LIST)
Observable<BaseModel<CommentBean>> getCommentList(@Field("id") String id, @Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<CommentBean>> getCommentList(@Field("id") String id, @Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.POST_SONG)
Observable<BaseModel<List<SongMusicBean>>> song(@Field("room_id") String roomId, @Field("user_id") String userId, @Field("song_code") String songCode, @Field("song_name") String songName, @Field("singer") String singer, @Field("poster") String poster, @Field("duration") String duration);
Call<BaseModel<List<SongMusicBean>>> song(@Field("room_id") String roomId, @Field("user_id") String userId, @Field("song_code") String songCode, @Field("song_name") String songName, @Field("singer") String singer, @Field("poster") String poster, @Field("duration") String duration);
@FormUrlEncoded
@POST(Constants.COMMENT_ZONE)
@@ -403,7 +403,7 @@ public interface ApiServer {
Call<BaseModel<String>> deleteZone(@Field("id") String id);
@GET(Constants.GET_MY_INFO)
Observable<BaseModel<UserInfo>> getMyInfo();
Call<BaseModel<UserInfo>> getMyInfo();
@FormUrlEncoded
@POST(Constants.ED_USER_INFO)
@@ -414,25 +414,25 @@ public interface ApiServer {
Call<BaseModel<String>> editUserBg(@Field("images") String images);
@GET(Constants.GET_USER_TAG_LIST)
Observable<BaseModel<List<UserTagBean>>> getUserTagList();
Call<BaseModel<List<UserTagBean>>> getUserTagList();
@FormUrlEncoded
@POST(Constants.GET_LIKE_LIST)
Observable<BaseModel<List<CircleListBean.LikeList>>> getLikeList(@Field("id") String id);
Call<BaseModel<List<CircleListBean.LikeList>>> getLikeList(@Field("id") String id);
@FormUrlEncoded
@POST(Constants.GET_ALBUM_DETAIL)
Observable<BaseModel<AlbumBean>> getAlbumDetail(@Field("album_id") String albumId, @Field("pwd") String pwd, @Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<AlbumBean>> getAlbumDetail(@Field("album_id") String albumId, @Field("pwd") String pwd, @Field("page") String page, @Field("page_limit") String page_limit);
@GET(Constants.GET_PERSONALTY)
Observable<BaseModel<List<PersonaltyBean>>> getPersonaltyList();
Call<BaseModel<List<PersonaltyBean>>> getPersonaltyList();
@FormUrlEncoded
@POST(Constants.GET_SUBSIDY)
Observable<BaseModel<RoomSubsidy>> getSubsidy(@Field("room_id") String roomId);
Call<BaseModel<RoomSubsidy>> getSubsidy(@Field("room_id") String roomId);
@GET(Constants.GET_DECORATE)
Observable<BaseModel<List<ZhuangBanShangChengBean>>> getDecorateList(@Query("type") String type);
Call<BaseModel<List<ZhuangBanShangChengBean>>> getDecorateList(@Query("type") String type);
@FormUrlEncoded
@POST(Constants.POST_GZ)
@@ -497,11 +497,11 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.UPDATEPASSWORD)
Observable<BaseModel<String>> updatePassword(@Field("room_id") String roomId, @Field("password") String password);
Call<BaseModel<String>> updatePassword(@Field("room_id") String roomId, @Field("password") String password);
@FormUrlEncoded
@POST(Constants.GET_ROOM_ONLINE)
Observable<BaseModel<RoomOnline>> getRoomOnline(@Field("room_id") String roomId, @Field("page") String page, @Field("page_limit") String page_limit);
Call<BaseModel<RoomOnline>> getRoomOnline(@Field("room_id") String roomId, @Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.GET_GIVE_GIFT)
@@ -512,29 +512,29 @@ public interface ApiServer {
Call<BaseModel<String>> roomGift(@Field("room_id") String room_id, @Field("gift_id") String gift_id, @Field("gift_num") String num, @Field("to_uid") String to_uid, @Field("type") String gift_type, @Field("pit_number") String pit_number, @Field("heart_id") String heat_id);
@GET(Constants.GET_FIRST_CHARGE_GIFT)
Observable<BaseModel<FirstChargeGiftBean>> firstChargeGift();
Call<BaseModel<FirstChargeGiftBean>> firstChargeGift();
@GET(Constants.GET_WALLET)
Observable<BaseModel<WalletBean>> wallet();
Call<BaseModel<WalletBean>> wallet();
@FormUrlEncoded
@POST(Constants.POST_APPLY_Pay)
Observable<BaseModel<AppPay>> appPay(@Field("user_id") String user_id, @Field("money") String money, @Field("coin") String coin, @Field("type") String type);
Call<BaseModel<AppPay>> appPay(@Field("user_id") String user_id, @Field("money") String money, @Field("coin") String coin, @Field("type") String type);
@FormUrlEncoded
@POST(Constants.POST_APPLY_LIST)
Observable<BaseModel<RoomApplyListBean>> roomApplyListBean(@Field("room_id") String room_id);
Call<BaseModel<RoomApplyListBean>> roomApplyListBean(@Field("room_id") String room_id);
@FormUrlEncoded
@POST(Constants.GET_ROOM_USER)
Observable<BaseModel<UserInfo>> getRoomUserInfo(@Field("room_id") String roomId, @Field("user_id") String userId);
Call<BaseModel<UserInfo>> getRoomUserInfo(@Field("room_id") String roomId, @Field("user_id") String userId);
@FormUrlEncoded
@POST(Constants.POST_BIND_TYPE)
Observable<BaseModel<BindType>> bindType(@Field("user_id") String userId);
Call<BaseModel<BindType>> bindType(@Field("user_id") String userId);
@GET(Constants.GET_WALLET_CONFIG)
Observable<BaseModel<WalletConfig>> getWalletConfig();
Call<BaseModel<WalletConfig>> getWalletConfig();
@FormUrlEncoded
@POST(Constants.POST_BIND)
@@ -542,7 +542,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_SONG_LIST)
Observable<BaseModel<List<MusicSongBean>>> songList(@Field("room_id") String room_id);
Call<BaseModel<List<MusicSongBean>>> songList(@Field("room_id") String room_id);
@FormUrlEncoded
@POST(Constants.APPLY_PIT)
@@ -626,23 +626,23 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_HOST_LIST)
Observable<BaseModel<List<HostBean>>> getHostList(@Query("room_id") String room_id, @Field("type") String type);
Call<BaseModel<List<HostBean>>> getHostList(@Query("room_id") String room_id, @Field("type") String type);
@FormUrlEncoded
@POST(Constants.GET_CHARM_RANK)
Observable<BaseModel<List<RoomCharmRankBean>>> getCharmRank(@Field("room_id") String roomId);
Call<BaseModel<List<RoomCharmRankBean>>> getCharmRank(@Field("room_id") String roomId);
@FormUrlEncoded
@POST(Constants.POST_ROOM_RELATION_LIST)
Observable<BaseModel<List<RoomRelationBean>>> roomRelationList(@Field("type") String type);
Call<BaseModel<List<RoomRelationBean>>> roomRelationList(@Field("type") String type);
@FormUrlEncoded
@POST(Constants.POST_ROOM_AUCTION_LIST)
Observable<BaseModel<List<RoomAuction.AuctionListBean>>> roomAuctionList(@Field("auction_id") String auction_id);
Call<BaseModel<List<RoomAuction.AuctionListBean>>> roomAuctionList(@Field("auction_id") String auction_id);
@FormUrlEncoded
@POST(Constants.POST_SEARCH)
Observable<BaseModel<List<RoomSearchResp>>> getSearch(@Query("search") String room_id, @Field("type") String type);
Call<BaseModel<List<RoomSearchResp>>> getSearch(@Query("search") String room_id, @Field("type") String type);
@FormUrlEncoded
@POST(Constants.SET_PRESIDED_RATIO)
@@ -670,11 +670,11 @@ public interface ApiServer {
Call<BaseModel<String>> setLockPit(@Field("room_id") String room_id, @Field("pit_number") String pit_number, @Field("is_lock") String is_lock);
@GET(Constants.GET_ROOM_BJ)
Observable<BaseModel<RoomBgBean>> getBackgroundList();
Call<BaseModel<RoomBgBean>> getBackgroundList();
@FormUrlEncoded
@POST(Constants.POST_CHARM_LIST)
Observable<BaseModel<RoomDetails>> getCharmList(@Field("room_id") String room_id, @Field("start_time") String start_time, @Field("end_time") String end_time, @Field("page") String page);
Call<BaseModel<RoomDetails>> getCharmList(@Field("room_id") String room_id, @Field("start_time") String start_time, @Field("end_time") String end_time, @Field("page") String page);
@FormUrlEncoded
@POST(Constants.POST_SET_UPLOAD_BG_IMG)
@@ -707,7 +707,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_RELATION_CARD)
Observable<BaseModel<RelationCardBean>> relationCard(@Field("user_id") String user_id);
Call<BaseModel<RelationCardBean>> relationCard(@Field("user_id") String user_id);
@FormUrlEncoded
@POST(Constants.POST_TOP_RELATION_CARD)
@@ -720,11 +720,11 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_ROOM_AUCTION)
Observable<BaseModel<AuctionBean>> roomAuction(@Field("room_id") String room_id, @Field("user_id") String user_id, @Field("gift_id") String gift_id, @Field("relation_id") String relation_id, @Field("auction_type") String auction_type, @Field("time_day") String time_day);
Call<BaseModel<AuctionBean>> roomAuction(@Field("room_id") String room_id, @Field("user_id") String user_id, @Field("gift_id") String gift_id, @Field("relation_id") String relation_id, @Field("auction_type") String auction_type, @Field("time_day") String time_day);
@FormUrlEncoded
@POST(Constants.POST_ROOM_AUCTION_TIME)
Observable<BaseModel<RoomTime>> roomAuctionTime(@Field("gift_id") String gift_id);
Call<BaseModel<RoomTime>> roomAuctionTime(@Field("gift_id") String gift_id);
@FormUrlEncoded
@POST(Constants.POST_ROOM_AUCTION_JOIN)
@@ -733,7 +733,7 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_SEARCH_PK_ROOM)
Observable<BaseModel<List<RoomBean>>> searchPkRoom(@Field("room_id") String room_id, @Field("page") String page, @Field("limit") String limit);
Call<BaseModel<List<RoomBean>>> searchPkRoom(@Field("room_id") String room_id, @Field("page") String page, @Field("limit") String limit);
@GET(Constants.GET_BOX_GIFT_LIST)
Call<BaseModel<BlindBoxBean>> getBoxGiftList(@Query("gift_bag_id") String gift_bag_id, @Query("room_id") String room_id);
@@ -777,4 +777,8 @@ public interface ApiServer {
@GET(Constants.GET_GIFT_PACK_LIST_COUNT)
Call<BaseModel<GiftPackListCount>> getGiftPackListCount();
@FormUrlEncoded
@POST(Constants.ROOM_USER_RECONNECT)
Call<BaseModel<String>> roomUserReconnect(@Field("room_id") String room_id);
}

View File

@@ -53,9 +53,11 @@ public abstract class BaseObserver<T> implements Observer<T> {
} else if (e instanceof APIException) {
APIException apiException = (APIException) e;
if (apiException.getCode() == 301) {
EventBus.getDefault().post(new LogOutEvent());
try {
com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
ToastUtils.show(extractChinese(apiException.getMessage()));
// com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
EventBus.getDefault().post(new LogOutEvent());
CommonAppContext.getInstance().clearLoginInfo();
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);

View File

@@ -2,8 +2,13 @@ package com.xscm.moduleutil.http;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.base.CommonAppContext;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
@@ -23,17 +28,27 @@ public class DefaultTransformer<T> implements ObservableTransformer<BaseModel<T>
return upstream
.map(response -> {
if (response.isTokenExpired()) {
// 触发登出事件EventBus
com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
if (response.getCode()==301){
CommonAppContext.getInstance().clearLoginInfo();
throw new APIException(-1, "登录已过期");
ToastUtils.showShort(response.getMsg());
}else {
// 触发登出事件EventBus
// com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
CommonAppContext.getInstance().clearLoginInfo();
}
throw new APIException(response.getCode(), response.getMsg());
}
if (!response.isSuccess()) {
throw new APIException(response.getCode(), response.getMsg());
}
return response.getData();
// 确保不会返回null值
T data = response.getData();
if (data == null) {
return getDefaultValue();
}
return data;
// return response.getData();
})
.onErrorResumeNext(throwable -> {
// 可以在这里统一处理异常
@@ -45,4 +60,32 @@ public class DefaultTransformer<T> implements ObservableTransformer<BaseModel<T>
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
@SuppressWarnings("unchecked")
private T getDefaultValue() {
try {
// 根据类型返回合理的默认值
Class<T> type = (Class<T>) Object.class;
if (String.class.isAssignableFrom(type)) {
return (T) "";
} else if (List.class.isAssignableFrom(type)) {
return (T) new ArrayList<>();
} else if (Integer.class.isAssignableFrom(type) || int.class.isAssignableFrom(type)) {
return (T) Integer.valueOf(0);
} else if (Long.class.isAssignableFrom(type) || long.class.isAssignableFrom(type)) {
return (T) Long.valueOf(0L);
} else if (Double.class.isAssignableFrom(type) || double.class.isAssignableFrom(type)) {
return (T) Double.valueOf(0.0);
} else if (Float.class.isAssignableFrom(type) || float.class.isAssignableFrom(type)) {
return (T) Float.valueOf(0.0f);
} else if (Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type)) {
return (T) Boolean.FALSE;
} else {
// 对于其他对象类型返回一个新的Object实例
return (T) new Object();
}
} catch (Exception e) {
return null;
}
}
}

View File

@@ -3,6 +3,7 @@ package com.xscm.moduleutil.http;
import com.blankj.utilcode.util.ToastUtils;
import com.google.gson.Gson;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.xscm.moduleutil.utils.GsonUtils;
@@ -25,12 +26,13 @@ public class ResponseBodyConverter<T> implements Converter<ResponseBody, T> {
@Override
public T convert(@NonNull ResponseBody value) throws IOException {
String json = value.string();
try {
BaseModel obj = GsonUtils.GsonToBean(json, BaseModel.class);
if (obj.getCode() != 1) {
String info = obj.getMsg();
if ("当前余额不足".equals(info)) {
value.close();
return adapter.fromJson(json);
return parseDataSafely(json);
} else {
if (!info.contains("更新失败")) {
// ToastUtils.showShort(info);
@@ -39,7 +41,61 @@ public class ResponseBodyConverter<T> implements Converter<ResponseBody, T> {
}
}
value.close();
return parseDataSafely(json);
} catch (Exception e) {
// 处理解析异常,避免崩溃
value.close();
try {
// 尝试返回默认值
return createDefaultInstance();
} catch (Exception ex) {
return null;
}
}
}
/**
* 安全地解析数据,处理各种可能的返回类型
*/
private T parseDataSafely(String json) {
try {
return adapter.fromJson(json);
} catch (IOException | JsonParseException e) {
// 当解析失败时,尝试其他方式处理
try {
// 尝试返回默认值
return createDefaultInstance();
} catch (Exception ex) {
return null;
}
}
}
/**
* 创建默认实例以避免null返回
*/
@SuppressWarnings("unused")
private T createDefaultInstance() {
try {
// 对于基本类型和常见集合类型,返回默认值
Class<?> rawType = adapter.getClass();
if (rawType.isAssignableFrom(String.class)) {
return (T) "";
} else if (rawType.isAssignableFrom(Boolean.class) || rawType.isAssignableFrom(boolean.class)) {
return (T) Boolean.FALSE;
} else if (rawType.isAssignableFrom(Integer.class) || rawType.isAssignableFrom(int.class)) {
return (T) Integer.valueOf(0);
} else if (rawType.isAssignableFrom(Long.class) || rawType.isAssignableFrom(long.class)) {
return (T) Long.valueOf(0L);
} else if (rawType.isAssignableFrom(Double.class) || rawType.isAssignableFrom(double.class)) {
return (T) Double.valueOf(0.0);
} else if (rawType.isAssignableFrom(Float.class) || rawType.isAssignableFrom(float.class)) {
return (T) Float.valueOf(0.0f);
} else {
// 对于其他类型返回null而不是抛出异常
return null;
}
} catch (Exception e) {
return null;
}
}
}

View File

@@ -9,6 +9,7 @@ import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.HeadlineBean;
import com.xscm.moduleutil.bean.RoomMessageEvent;
import com.xscm.moduleutil.bean.room.EMMessageInfo;
@@ -512,7 +513,15 @@ public class MessageListenerSingleton {
@Override
public void onTotalUnreadMessageCountChanged(long totalUnreadCount) {
super.onTotalUnreadMessageCountChanged(totalUnreadCount);
EventBus.getDefault().post(new UnreadCountEvent(totalUnreadCount));
UnreadCountEvent event = CommonAppContext.getInstance().getUnreadCountEvent();
if (event== null){
event = new UnreadCountEvent();
event.setBLong(0);
}
event.setALong( totalUnreadCount);
CommonAppContext.getInstance().setUnreadCountEvent(event);
EventBus.getDefault().post(event);
}
};
}

View File

@@ -85,11 +85,13 @@ public class MqttInitCallback implements MqttCallback {
XLHBean xlhBean= GsonUtils.fromJson(message, XLHBean.class);
if (xlhBean!=null && xlhBean.getRoom_id()!=null && SpUtil.getMyRoomId()!=null) {
if (xlhBean.getRoom_id().equals(SpUtil.getMyRoomId())) {
if (xlhBean.getFrom_type()==3) {
MqttXlhEnd mqttXlhEnd = new MqttXlhEnd();
mqttXlhEnd.setMessage(message);
EventBus.getDefault().post(mqttXlhEnd);
}
}
}
break;
default:
break;

View File

@@ -235,10 +235,10 @@ public class AvatarFrameView extends FrameLayout {
// }
// 检查特效是否开启
if (SpUtil.getOpenEffect() != 1) {
clearQueue();
return;
}
// if (SpUtil.getOpenEffect() != 1) {
// clearQueue();
// return;
// }
// 检查是否可以开始新的播放
// if (!playbackManager.canStartNewPlayback()) {
// Logger.d("AvatarFrameView", "Max concurrent playbacks reached, waiting...");

View File

@@ -250,7 +250,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
if (!mIvRipple.isAnimating()) {
mIvRipple.startAnimation();
}
// iv_on_line.setVisibility(GONE);
iv_on_line.setVisibility(GONE);
});
}
@@ -270,7 +270,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
if (!mIvRipple.isAnimating()) {
mIvRipple.startAnimation();
}
// iv_on_line.setVisibility(GONE);
iv_on_line.setVisibility(GONE);
});
}

View File

@@ -380,13 +380,14 @@ public class Constants {
public static final String GET_ALL_RECORD = "/api/BlindBoxTurntable/get_all_record";//获取全服抽奖记录
public static final String GIFT_SEND = "/api/BlindBoxTurntable/gift_send";//礼物发放
public static final String GET_BOX_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh";///巡乐会
public static final String POST_DRAW_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh_draw_gift";///巡乐会抽奖
public static final String POST_XLH_ALL_RECORD = "/api/BlindBoxTurntable/get_xlh_all_record";///巡乐会榜单
public static final String GET_XLH_MY_RECORD = "/api/BlindBoxTurntable/get_xlh_my_record";///巡乐会记录
public static final String POST_GIFT_ALL_CLEAR = "/api/Room/room_gift_all_clear";///背包礼物全清
public static final String POST_ROOM_USER_CHARM_LIST = "/api/Room/room_user_charm_list";///房间用户当前魅力值列表
public static final String GET_GIFT_PACK_LIST_COUNT = "/api/UserGiftPack/get_gift_pack_list_count";///背包礼物总价值
public static final String GET_BOX_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh";//巡乐会
public static final String POST_DRAW_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh_draw_gift";//巡乐会抽奖
public static final String POST_XLH_ALL_RECORD = "/api/BlindBoxTurntable/get_xlh_all_record";//巡乐会榜单
public static final String GET_XLH_MY_RECORD = "/api/BlindBoxTurntable/get_xlh_my_record";//巡乐会记录
public static final String POST_GIFT_ALL_CLEAR = "/api/Room/room_gift_all_clear";//背包礼物全清
public static final String POST_ROOM_USER_CHARM_LIST = "/api/Room/room_user_charm_list";//房间用户当前魅力值列表
public static final String GET_GIFT_PACK_LIST_COUNT = "/api/UserGiftPack/get_gift_pack_list_count";//背包礼物总价值
public static final String ROOM_USER_RECONNECT = "/api/Room/user_reconnect";//用户重连

View File

@@ -2,6 +2,7 @@ package com.xscm.moduleutil.widget;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
@@ -47,7 +48,22 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
private List<String> giftArray = new ArrayList<>();
public ExecutorService queue = Executors.newSingleThreadExecutor();
private Context mContext;
private boolean isOnece;
// 添加带Context参数的构造函数
// 添加带Context和AttributeSet参数的构造函数解决XML inflate问题的关键
public GiftAnimView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
this.mContext = context;
init();
}
// 添加带Context、AttributeSet和 defStyleAttr 参数的构造函数(更完整的实现)
public GiftAnimView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.mContext = context;
init();
}
public void setQueue(ExecutorService queue) {
this.queue = queue;
}
@@ -85,6 +101,9 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
post(() -> {
if (playerMp4View!=null) {
playerMp4View.setVisibility(View.GONE);
if (isOnece){
return;
}
// 通知播放完成
notifyPlaybackComplete();
loadStartSVGAPlayer();
@@ -187,6 +206,35 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
});
}
public void previewEffectWith(String playImage){
this.isOnece=true;
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());
// 处理失败情况,继续播放下一个
}
});
} else if (playImage.endsWith("svga")) {
// File file = downloadAndPlay(getContext(), playImage);
post(() -> {
playerMp4View.setVisibility(View.GONE);
svgaView.setVisibility(View.VISIBLE);
svgaView.loadSVGAPlayerWith(playImage, false);
});
}
}
public void openOrCloseEffectViewWith(boolean isShow) {
this.isShow = isShow;
removeSvgaQueueData();
@@ -420,6 +468,9 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
if (svgaView!=null) {
svgaView.setVisibility(View.GONE);
}
if (isOnece){
return;
}
// 通知播放完成
notifyPlaybackComplete();
loadStartSVGAPlayer();

View File

@@ -0,0 +1,273 @@
package com.xscm.moduleutil.widget;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.event.MqttBean;
import java.util.ArrayList;
import java.util.List;
public class QXGiftDriftView extends ViewGroup {
private static QXGiftDriftView instance;
private ImageView bgImageView;
private TextView titleLabel;
private ImageView giftImageView;
private TextView countLabel;
private boolean isPlaying=false;
private boolean isClose;
private List<MqttBean.ListBean> dataArray = new ArrayList<>();
private MqttBean.ListBean model;
private Context context;
private int screenWidth;
public static QXGiftDriftView getInstance(Context context) {
if (instance == null) {
instance = new QXGiftDriftView(context);
}
return instance;
}
private QXGiftDriftView(Context context) {
super(context);
this.context = context;
// 获取屏幕宽度
screenWidth = context.getResources().getDisplayMetrics().widthPixels;
// 初始化视图
initSubviews();
// 从SharedPreferences读取设置
SharedPreferences prefs = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE);
isClose = prefs.getBoolean("kIsCloseDrifPop", false);
}
private void initSubviews() {
// 设置视图尺寸
int width = scaleWidth(316);
int height = scaleWidth(50);
setLayoutParams(new LayoutParams(width, height));
// 背景图片
bgImageView = new ImageView(context);
bgImageView.setImageResource(R.mipmap.gift_p_b);
addView(bgImageView);
// 标题标签
titleLabel = new TextView(context);
titleLabel.setTextSize(14);
titleLabel.setTextColor(Color.WHITE);
addView(titleLabel);
// 礼物图片
giftImageView = new ImageView(context);
giftImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
addView(giftImageView);
// 数量标签
countLabel = new TextView(context);
countLabel.setTextSize(14);
countLabel.setTextColor(Color.WHITE);
addView(countLabel);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
// 布局子视图
int width = getWidth();
int height = getHeight();
// 背景图片填满整个视图
bgImageView.layout(0, 0, width, height);
// 标题标签居中偏左
int titleWidth = titleLabel.getMeasuredWidth();
int titleHeight = titleLabel.getMeasuredHeight();
int titleLeft = (width - titleWidth) / 2 - scaleWidth(30);
int titleTop = (height - titleHeight) / 2;
titleLabel.layout(titleLeft, titleTop, titleLeft + titleWidth, titleTop + titleHeight);
// 礼物图片在标题右侧
int giftSize = scaleWidth(20);
int giftLeft = titleLeft + titleWidth + scaleWidth(5);
int giftTop = titleTop + (titleHeight - giftSize) / 2;
giftImageView.layout(giftLeft, giftTop, giftLeft + giftSize, giftTop + giftSize);
// 数量标签在礼物图片右侧
int countWidth = countLabel.getMeasuredWidth();
int countLeft = giftLeft + giftSize;
countLabel.layout(countLeft, titleTop, countLeft + countWidth, titleTop + titleHeight);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = scaleWidth(316);
int height = scaleWidth(50);
setMeasuredDimension(width, height);
// 测量子视图
measureChildren(widthMeasureSpec, heightMeasureSpec);
}
public void addGiftModel(MqttBean.ListBean model) {
if (isClose) {
return;
}
dataArray.add(model);
giftAction();
}
public void addGiftModelList(List<MqttBean.ListBean> list) {
dataArray.addAll(list);
giftAction();
}
private void giftAction() {
if (isPlaying) {
return;
}
if (dataArray.isEmpty()) {
return;
}
isPlaying = true;
model = dataArray.get(0);
// 添加到窗口(这里需要根据实际情况获取根布局)
ViewGroup rootView = (ViewGroup) ((Activity) context).getWindow().getDecorView();
rootView.addView(QXGiftDriftView.getInstance( context));
// 设置初始位置(屏幕右侧外)
setX(screenWidth);
// 进入动画
TranslateAnimation enterAnim = new TranslateAnimation(
Animation.ABSOLUTE, screenWidth,
Animation.ABSOLUTE, (screenWidth - scaleWidth(316)) / 2,
Animation.ABSOLUTE, 0,
Animation.ABSOLUTE, 0
);
enterAnim.setDuration(1500);
enterAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
// 停留后退出
postDelayed(() -> {
TranslateAnimation exitAnim = new TranslateAnimation(
Animation.ABSOLUTE, (screenWidth - scaleWidth(316)) / 2,
Animation.ABSOLUTE, -screenWidth,
Animation.ABSOLUTE, 0,
Animation.ABSOLUTE, 0
);
exitAnim.setDuration(2000);
exitAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
// 移除视图并处理下一个
ViewGroup rootView = (ViewGroup) getParent();
if (rootView != null) {
rootView.removeView(QXGiftDriftView.getInstance( context));
}
if (!dataArray.isEmpty()) {
dataArray.remove(0);
}
isPlaying = false;
if (!dataArray.isEmpty()) {
giftAction();
}
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
startAnimation(exitAnim);
}, 1000); // 停留1秒
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
startAnimation(enterAnim);
}
public void setModel(MqttBean.ListBean model) {
this.model = model;
String text = String.format("%s送给%s", model.getFromUserName(), model.getToUserName());
// 这里需要使用SpannableString来实现富文本效果
// 简化处理,直接设置文本
titleLabel.setText(text);
// 加载图片 - 使用图片加载库如Glide
// Glide.with(context).load(model.getGiftPicture()).into(giftImageView);
countLabel.setText(String.format("X%s", model.getNumber()));
}
public void drifPopIsClose(boolean isClose) {
this.isClose = isClose;
setVisibility(isClose ? View.GONE : View.VISIBLE);
SharedPreferences prefs = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE);
prefs.edit().putBoolean("kIsCloseDrifPop", isClose).apply();
if (isClose) {
ViewGroup rootView = (ViewGroup) getParent();
if (rootView != null) {
rootView.removeView(this);
}
dataArray.clear();
isPlaying = false;
}
}
private int scaleWidth(int width) {
// 根据屏幕密度进行缩放
float density = context.getResources().getDisplayMetrics().density;
return (int) (width * density);
}
// QXGiftScrollModel 类(需要单独定义)
public static class QXGiftScrollModel {
private String fromUserName;
private String toUserName;
private String giftPicture;
private String number;
// getters and setters
public String getFromUserName() { return fromUserName; }
public void setFromUserName(String fromUserName) { this.fromUserName = fromUserName; }
public String getToUserName() { return toUserName; }
public void setToUserName(String toUserName) { this.toUserName = toUserName; }
public String getGiftPicture() { return giftPicture; }
public void setGiftPicture(String giftPicture) { this.giftPicture = giftPicture; }
public String getNumber() { return number; }
public void setNumber(String number) { this.number = number; }
}
}

View File

@@ -64,6 +64,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
public void onClick(View v) {
if (mOnZhulClickListener != null && pitBean != null) {
mOnZhulClickListener.onZhulClick(RoomFriendshipWheatView.this, pitBean);
}
}
});

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<com.xscm.moduleutil.widget.CustomTopBar
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-30dp"
app:layout_constraintTop_toTopOf="parent" />
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/white"
app:layout_constraintTop_toBottomOf="@+id/top_bar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -52,7 +52,7 @@
<LinearLayout
android:id="@+id/line"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_14"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_marginStart="@dimen/dp_2"
android:layout_marginTop="@dimen/dp_5"

View File

@@ -313,7 +313,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
android:visibility="gone"
/>
<View
@@ -326,7 +325,6 @@
app:layout_constraintEnd_toStartOf="@+id/tv_option"
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
android:visibility="gone"
/>
<LinearLayout
android:id="@+id/exchange_layout"

View File

@@ -23,6 +23,8 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_600"
android:background="@color/transparent"
android:layout_marginStart="@dimen/dp_25"
android:layout_marginEnd="@dimen/dp_25"
android:hardwareAccelerated="true"
app:layout_constraintTop_toBottomOf="@+id/im_gz"
app:layout_constraintStart_toStartOf="parent"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,7 +1,7 @@
<resources>
<string name="app_name">秘地</string>
<string name="app_name">MY语聊</string>
<string name="recommend_skip">跳过</string>
<string name="voice_title">秘地</string>
<string name="voice_title">MY语聊</string>
<string name="circle_title">语圈</string>
<string name="wallet">钱包</string>
<string name="dan">段位</string>
@@ -42,7 +42,7 @@
<string name="login_title_password">密码登录</string>
<string name="login_title">验证码登录</string>
<string name="login_web_title">欢迎来到秘地</string>
<string name="login_web_title">欢迎来到MY语聊</string>
<string name="login_hint_phion">请输入您的手机号</string>
<string name="login_hint_code">请输入验证码</string>
<string name="login_hint_pass">请输入密码</string>

View File

@@ -114,8 +114,8 @@ public class ExpandColumnAdapter extends BaseQuickAdapter<ExpandColumnBean, Base
ImageView imageView = new ImageView(mContext);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
);
params.setMargins(0, 0, mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
imageView.setLayoutParams(params);

View File

@@ -68,7 +68,8 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginStart="@dimen/dp_9"
android:gravity="center_vertical"/>
android:gravity="center_vertical"
android:visibility="gone"/>
</LinearLayout>

View File

@@ -29,6 +29,7 @@ import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;
import com.example.modulecircle.fragment.CircleFragment;
import com.example.modulenews.fragment.NewsFragment;
import com.example.moduleroom.activity.RoomActivity;
import com.example.modulevocal.fragment.VocalRangeFragment;
import com.example.modulevoice.fragment.VoiceFragment;
import com.xscm.modulemain.R;
@@ -118,9 +119,12 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
// 检查是否有正在播放的房间
if (CommonAppContext.getInstance().isPlaying) {
// 如果有正在播放的房间,直接退出应用
finish();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
// finish();
// android.os.Process.killProcess(android.os.Process.myPid());
// System.exit(0);
// exitApp();
clearAllOtherTasksAndRestart();
return;
}
@@ -156,7 +160,26 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
MvpPre.initData();
MvpPre.userFiles();
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
@Override
public void onSuccess(Long aLong) {
if (aLong == 0) {
mBinding.tvMessage.setVisibility(View.GONE);
mBinding.tvMessage.setText("0");
} else {
mBinding.tvMessage.setVisibility(View.VISIBLE);
}
mBinding.tvMessage.setText(String.valueOf(aLong));
}
@Override
public void onError(int code, String desc) {
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
@@ -216,9 +239,11 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
// 检查是否有正在播放的房间
if (CommonAppContext.getInstance().isPlaying) {
// 如果有正在播放的房间,直接退出应用
finish();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
// finish();
// android.os.Process.killProcess(android.os.Process.myPid());
// System.exit(0);
// exitApp();
clearAllOtherTasksAndRestart();
return true;
}
@@ -237,7 +262,22 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
}
return super.onKeyDown(keyCode, event);
}
// 最推荐的方法
private void clearAllOtherTasksAndRestart() {
// Intent intent = new Intent(this, MainActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
// intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
// startActivity(intent);
// 可选finish当前Activity
// if (!isFinishing()) {
// finish();
// }
// 可选:如果上面的方法不够彻底,可以配合使用
Runtime.getRuntime().gc(); // 建议垃圾回收
}
/**
* 优雅地退出应用,避免闪屏
*/
@@ -500,23 +540,9 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
}
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
@Override
public void onSuccess(Long aLong) {
if (aLong == 0) {
mBinding.tvMessage.setVisibility(View.GONE);
mBinding.tvMessage.setText("0");
} else {
mBinding.tvMessage.setVisibility(View.VISIBLE);
}
mBinding.tvMessage.setText(String.valueOf(aLong));
}
@Override
public void onError(int code, String desc) {
}
});
MvpPre.getMyInfo(SpUtil.getUserId() + "");//获取首充是否需要展示
@@ -525,12 +551,33 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(UnreadCountEvent event) {
if (event.getALong() == 0) {
long aLong = event.getALong();
long bLong = event.getBLong();
if (aLong==0 && bLong==0){
mBinding.tvMessage.setVisibility(View.GONE);
mBinding.tvMessage.setText("0");
} else if (event.getALong() > 0) {
mBinding.tvMessage.setText(String.valueOf(event.getALong()));
}else {
mBinding.tvMessage.setVisibility(View.VISIBLE);
mBinding.tvMessage.setText(String.valueOf(event.getALong()+event.getBLong()));
}
// if (event.getALong() == 0) {
// if (event.getBLong()==0){
// mBinding.tvMessage.setVisibility(View.GONE);
// }else {
// mBinding.tvMessage.setVisibility(View.VISIBLE);
// mBinding.tvMessage.setText(String.valueOf(event.getBLong()));
// }
//// mBinding.tvMessage.setVisibility(View.GONE);
//// mBinding.tvMessage.setText("0");
// } else if (event.getALong() > 0) {
// mBinding.tvMessage.setVisibility(View.VISIBLE);
// if (event.getBLong()==0){
// mBinding.tvMessage.setText(String.valueOf(event.getALong()));
// }else {
// mBinding.tvMessage.setText(String.valueOf(event.getALong()+event.getBLong()));
// }
//
// }
}
@Override

View File

@@ -5,16 +5,19 @@ import android.app.Activity;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.activity.IView;
import com.xscm.moduleutil.bean.NewsDataBean;
import com.xscm.moduleutil.bean.UserInfo;
public class NewsContacts {
public interface View extends IView<Activity> {
void getOfficialNoticeList(NewsDataBean newsDataBeans);
void myInfoSuccess(UserInfo data);
}
public interface IHomePre extends IPresenter {
void getOfficialNotice();
void getMyInfo();
}
}

View File

@@ -10,14 +10,22 @@ import com.example.modulenews.R;
import com.example.modulenews.contacts.NewsContacts;
import com.example.modulenews.databinding.FragmentNewsBinding;
import com.example.modulenews.presenter.NewsPresenter;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMValueCallback;
import com.xscm.moduleutil.activity.news.OfficialNoticeActivity;
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
import com.xscm.moduleutil.base.BaseMvpFragment;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.NewsDataBean;
import com.tencent.imsdk.v2.V2TIMConversation;
import com.tencent.qcloud.tuicore.TUIConstants;
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment;
import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.event.UnreadCountEvent;
import com.xscm.moduleutil.utils.SpUtil;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.List;
@@ -29,20 +37,29 @@ import java.util.List;
*@description: 音域
*/
public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBinding> implements NewsContacts.View {
private Long messageCount;
public static NewsFragment newInstance () {
return new NewsFragment();
}
@Override
protected void initData () {
}
@Override
public void onResume() {
super.onResume();
MvpPre.getOfficialNotice();
MvpPre.getMyInfo();
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (!hidden){
MvpPre.getOfficialNotice();
MvpPre.getMyInfo();
}
}
@Override
@@ -131,5 +148,20 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
}else {
mBinding.tvOfficialCount.setVisibility(View.GONE);
}
int count = newsDataBeans.getSystem_no_read_count()+newsDataBeans.getAnnouncement_read_count();
UnreadCountEvent event = CommonAppContext.getInstance().getUnreadCountEvent();
if (event== null){
event = new UnreadCountEvent();
event.setALong(0);
}
event.setBLong( (long)count);
CommonAppContext.getInstance().setUnreadCountEvent(event);
EventBus.getDefault().post(event);
}
@Override
public void myInfoSuccess(UserInfo data) {
SpUtil.saveUserInfo(data);
}
}

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import com.example.modulenews.contacts.NewsContacts;
import com.xscm.moduleutil.bean.NewsDataBean;
import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.presenter.BasePresenter;
@@ -28,4 +29,19 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
}
});
}
@Override
public void getMyInfo() {
api.getMyInfo(new BaseObserver<UserInfo>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(UserInfo userInfo) {
MvpRef.get().myInfoSuccess(userInfo);
}
});
}
}

Some files were not shown because too many files have changed in this diff Show More