1、修改包的图片
2、修改房间的所有进出方式
@@ -18,8 +18,8 @@ android {
|
|||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
//设置支持的so库
|
//设置支持的so库
|
||||||
abiFilters 'arm64-v8a', 'armeabi'
|
// abiFilters 'arm64-v8a', 'armeabi','arm64'
|
||||||
// abiFilters 'armeabi-v7a', 'arm64-v8a'
|
abiFilters 'arm64-v8a','armeabi-v7a'
|
||||||
}
|
}
|
||||||
|
|
||||||
javaCompileOptions {
|
javaCompileOptions {
|
||||||
|
|||||||
@@ -143,7 +143,6 @@
|
|||||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:screenOrientation="behind"
|
android:screenOrientation="behind"
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:theme="@style/main_SplashThemeImage">
|
android:theme="@style/main_SplashThemeImage">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -25,9 +25,14 @@ public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPage
|
|||||||
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
|
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
|
||||||
super.onCreate(savedInstanceState, persistentState);
|
super.onCreate(savedInstanceState, persistentState);
|
||||||
if (!isTaskRoot()) {
|
if (!isTaskRoot()) {
|
||||||
|
// if (shouldRestoreRoom()){
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||||
|
// }
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private boolean shouldRestoreRoom() {
|
private boolean shouldRestoreRoom() {
|
||||||
// 检查是否应该恢复房间:
|
// 检查是否应该恢复房间:
|
||||||
@@ -35,8 +40,7 @@ public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPage
|
|||||||
// 2. 应用应该显示房间
|
// 2. 应用应该显示房间
|
||||||
// 3. 应用是从后台恢复的(通过检查 CommonAppContext 状态)
|
// 3. 应用是从后台恢复的(通过检查 CommonAppContext 状态)
|
||||||
return CommonAppContext.getInstance().isPlaying
|
return CommonAppContext.getInstance().isPlaying
|
||||||
&& CommonAppContext.getInstance().isShow
|
&& CommonAppContext.getInstance().isShow;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.example.modulevocal.presenter.RealNamePresenter;
|
|||||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
import com.xscm.moduleutil.bean.RealNameBean;
|
import com.xscm.moduleutil.bean.RealNameBean;
|
||||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||||
|
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
import com.xscm.moduleutil.utils.ColorManager;
|
import com.xscm.moduleutil.utils.ColorManager;
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
@@ -112,6 +113,7 @@ public class RealNameActivity extends BaseMvpActivity<RealNamePresenter, Activit
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.d("@@@", "刷脸失败!");
|
Log.d("@@@", "刷脸失败!");
|
||||||
|
queren1();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//刷脸结束后,及时释放资源
|
//刷脸结束后,及时释放资源
|
||||||
@@ -125,15 +127,49 @@ public class RealNameActivity extends BaseMvpActivity<RealNamePresenter, Activit
|
|||||||
Log.d("@@@", "刷脸失败!");
|
Log.d("@@@", "刷脸失败!");
|
||||||
//刷脸结束后,及时释放资源
|
//刷脸结束后,及时释放资源
|
||||||
WbCloudFaceVerifySdk.getInstance().release();
|
WbCloudFaceVerifySdk.getInstance().release();
|
||||||
|
queren1();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendCodeSuccess() {
|
public void sendCodeSuccess() {
|
||||||
|
queren();
|
||||||
|
}
|
||||||
|
private void queren() {
|
||||||
|
// 创建并显示确认对话框
|
||||||
|
new ConfirmDialog(this,
|
||||||
|
"温馨提示",
|
||||||
|
"恭喜您获得内测资格,将获得10万金币",
|
||||||
|
"确认",
|
||||||
|
"",
|
||||||
|
v -> {
|
||||||
|
// 点击“确认”按钮时执行
|
||||||
finish();
|
finish();
|
||||||
|
},
|
||||||
|
v -> {
|
||||||
|
// 点击“取消”按钮时什么都不做
|
||||||
|
|
||||||
|
}, true, 0).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void queren1() {
|
||||||
|
// 创建并显示确认对话框
|
||||||
|
new ConfirmDialog(this,
|
||||||
|
"温馨提示",
|
||||||
|
"实名未通过,重新实名",
|
||||||
|
"确认",
|
||||||
|
"",
|
||||||
|
v -> {
|
||||||
|
// 点击“确认”按钮时执行
|
||||||
|
finish();
|
||||||
|
},
|
||||||
|
v -> {
|
||||||
|
// 点击“取消”按钮时什么都不做
|
||||||
|
|
||||||
|
}, true, 0).show();
|
||||||
|
}
|
||||||
private void onClick(View view) {
|
private void onClick(View view) {
|
||||||
if (view.getId()== R.id.btnSubmit){
|
if (view.getId()== R.id.btnSubmit){
|
||||||
if (mBinding.edName.getText().toString().isEmpty()){
|
if (mBinding.edName.getText().toString().isEmpty()){
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ buildscript {
|
|||||||
|
|
||||||
// ✅ 添加 ARouter 插件依赖
|
// ✅ 添加 ARouter 插件依赖
|
||||||
classpath 'com.alibaba:arouter-register:1.0.2'
|
classpath 'com.alibaba:arouter-register:1.0.2'
|
||||||
|
|
||||||
|
// classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugins {
|
plugins {
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ isBuildModule=false
|
|||||||
#org.gradle.deamon=false
|
#org.gradle.deamon=false
|
||||||
android.injected.testOnly=false
|
android.injected.testOnly=false
|
||||||
|
|
||||||
APP_VERSION_NAME=1.0.1
|
APP_VERSION_NAME=1.0.2
|
||||||
APP_VERSION_CODE=130
|
APP_VERSION_CODE=144
|
||||||
|
|
||||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||||
@@ -49,3 +49,6 @@ beta=false
|
|||||||
org.gradle.caching=false
|
org.gradle.caching=false
|
||||||
# ??APT????
|
# ??APT????
|
||||||
kapt.incremental.apt=false
|
kapt.incremental.apt=false
|
||||||
|
|
||||||
|
# 或者禁用特定模块的增量编译
|
||||||
|
#org.gradle.configureondemand=false
|
||||||
@@ -163,4 +163,5 @@ android-library = { id = "com.android.library", version.ref = "agp" }
|
|||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinVersion" }
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinVersion" }
|
||||||
#kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinVersion" }
|
#kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinVersion" }
|
||||||
#alibaba-arouter = { id = "com.alibaba.arouter", version.ref = "arouter" }
|
#alibaba-arouter = { id = "com.alibaba.arouter", version.ref = "arouter" }
|
||||||
|
greendao-plugin = { id = "org.greenrobot.greendao", version.ref = "greendaoGradlePlugin" }
|
||||||
|
|
||||||
|
|||||||
@@ -31,32 +31,51 @@
|
|||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
>
|
||||||
|
|
||||||
<com.xscm.moduleutil.widget.GifAvatarOvalView
|
<com.xscm.moduleutil.widget.GifAvatarOvalView
|
||||||
android:id="@+id/rv_user_head"
|
android:id="@+id/rv_user_head"
|
||||||
android:layout_width="@dimen/dp_74"
|
android:layout_width="@dimen/dp_74"
|
||||||
android:layout_height="@dimen/dp_74"
|
android:layout_height="@dimen/dp_74"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
|
||||||
android:src="@mipmap/me_img_upld_head"
|
android:src="@mipmap/me_img_upld_head"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:riv_oval="true" />
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="@dimen/dp_24"
|
||||||
|
android:layout_height="@dimen/dp_24"
|
||||||
|
android:src="@mipmap/zhaop"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/rv_user_head"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/rv_user_head"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/dp_80"
|
android:layout_height="@dimen/dp_80"
|
||||||
android:layout_marginLeft="@dimen/dp_40"
|
android:layout_marginLeft="@dimen/dp_40"
|
||||||
android:layout_marginTop="@dimen/dp_54"
|
android:layout_marginTop="@dimen/dp_34"
|
||||||
android:layout_marginRight="@dimen/dp_40"
|
android:layout_marginRight="@dimen/dp_40">
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_ts"
|
android:id="@+id/tv_ts"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:letterSpacing="0.1"
|
||||||
android:text="起个好听的名字"
|
android:text="起个好听的名字"
|
||||||
android:textColor="#73000000"
|
android:textColor="#73000000"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold" />
|
||||||
android:letterSpacing="0.1"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll"
|
android:id="@+id/ll"
|
||||||
@@ -69,13 +88,13 @@
|
|||||||
<com.xscm.moduleutil.widget.ClearEditText
|
<com.xscm.moduleutil.widget.ClearEditText
|
||||||
android:id="@+id/ed_nick_name"
|
android:id="@+id/ed_nick_name"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
android:background="@drawable/bg_r100_hui"
|
android:background="@drawable/bg_r100_hui"
|
||||||
android:hint="请输入昵称"
|
|
||||||
android:gravity="center|left"
|
android:gravity="center|left"
|
||||||
android:paddingStart="10dp"
|
android:hint="请输入昵称"
|
||||||
android:maxLength="10"
|
android:maxLength="10"
|
||||||
|
android:paddingStart="10dp"
|
||||||
android:paddingEnd="@dimen/dp_10"
|
android:paddingEnd="@dimen/dp_10"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text=""
|
android:text=""
|
||||||
@@ -85,13 +104,12 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_user_name"
|
android:id="@+id/tv_user_name"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="0.2"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="随机"
|
android:layout_weight="0.2"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:text="随机"
|
||||||
android:textColor="@color/color_FF6C49E4"
|
android:textColor="@color/color_FF6C49E4"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp" />
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -102,6 +120,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/dp_40"
|
android:layout_marginLeft="@dimen/dp_40"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -109,13 +128,13 @@
|
|||||||
android:textColor="#73000000"
|
android:textColor="#73000000"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text=" (注册成功,不可更改)"
|
android:text=" (注册成功,不可更改)"
|
||||||
android:textColor="#33000000"
|
android:textColor="#33000000"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp" />
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
@@ -124,27 +143,25 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dp_72"
|
android:layout_height="@dimen/dp_72"
|
||||||
android:layout_marginStart="@dimen/dp_40"
|
android:layout_marginStart="@dimen/dp_40"
|
||||||
android:layout_marginEnd="@dimen/dp_40"
|
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:orientation="horizontal"
|
android:layout_marginEnd="@dimen/dp_40"
|
||||||
android:background="@drawable/selector_sex_mm">
|
android:background="@drawable/selector_sex_mm"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/rl_nv"
|
android:id="@+id/rl_nv"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center">
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_boy"
|
android:id="@+id/iv_boy"
|
||||||
android:layout_width="@dimen/dp_137"
|
android:layout_width="@dimen/dp_137"
|
||||||
android:layout_height="@dimen/dp_72"
|
android:layout_height="@dimen/dp_72"
|
||||||
android:src="@mipmap/check_boy"
|
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
/>
|
android:src="@mipmap/check_boy" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
@@ -152,16 +169,14 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center">
|
||||||
>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_girl"
|
android:id="@+id/iv_girl"
|
||||||
android:layout_width="@dimen/dp_137"
|
android:layout_width="@dimen/dp_137"
|
||||||
android:layout_height="@dimen/dp_72"
|
android:layout_height="@dimen/dp_72"
|
||||||
android:src="@mipmap/check_girl"
|
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
/>
|
android:src="@mipmap/check_girl" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@@ -174,6 +189,7 @@
|
|||||||
android:layout_marginStart="@dimen/dp_40"
|
android:layout_marginStart="@dimen/dp_40"
|
||||||
android:layout_marginTop="@dimen/dp_24"
|
android:layout_marginTop="@dimen/dp_24"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -195,11 +211,11 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_year"
|
android:id="@+id/tv_year"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="@dimen/dp_44"
|
android:layout_height="@dimen/dp_44"
|
||||||
|
android:layout_weight="1"
|
||||||
android:background="@drawable/bg_r100_hui"
|
android:background="@drawable/bg_r100_hui"
|
||||||
android:singleLine="true"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
android:text="2001"
|
android:text="2001"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
@@ -208,11 +224,11 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="@dimen/dp_0"
|
android:layout_width="@dimen/dp_0"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="@dimen/dp_7"
|
||||||
|
android:layout_marginEnd="@dimen/dp_7"
|
||||||
android:layout_weight="0.2"
|
android:layout_weight="0.2"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="年"
|
android:text="年"
|
||||||
android:layout_marginStart="@dimen/dp_7"
|
|
||||||
android:layout_marginEnd="@dimen/dp_7"
|
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
@@ -220,12 +236,12 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_month"
|
android:id="@+id/tv_month"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="@dimen/dp_44"
|
android:layout_height="@dimen/dp_44"
|
||||||
|
android:layout_weight="1"
|
||||||
android:background="@drawable/bg_r100_hui"
|
android:background="@drawable/bg_r100_hui"
|
||||||
|
android:gravity="center"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="12"
|
android:text="12"
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
@@ -233,10 +249,10 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="@dimen/dp_0"
|
android:layout_width="@dimen/dp_0"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.2"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_marginStart="@dimen/dp_7"
|
android:layout_marginStart="@dimen/dp_7"
|
||||||
android:layout_marginEnd="@dimen/dp_7"
|
android:layout_marginEnd="@dimen/dp_7"
|
||||||
|
android:layout_weight="0.2"
|
||||||
|
android:gravity="center"
|
||||||
android:text="月"
|
android:text="月"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
@@ -245,11 +261,11 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_day"
|
android:id="@+id/tv_day"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="@dimen/dp_44"
|
android:layout_height="@dimen/dp_44"
|
||||||
|
android:layout_weight="1"
|
||||||
android:background="@drawable/bg_r100_hui"
|
android:background="@drawable/bg_r100_hui"
|
||||||
android:singleLine="true"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
android:text="1"
|
android:text="1"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
@@ -258,11 +274,11 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="@dimen/dp_0"
|
android:layout_width="@dimen/dp_0"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="@dimen/dp_7"
|
||||||
|
android:layout_marginEnd="@dimen/dp_7"
|
||||||
android:layout_weight="0.2"
|
android:layout_weight="0.2"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="日"
|
android:text="日"
|
||||||
android:layout_marginStart="@dimen/dp_7"
|
|
||||||
android:layout_marginEnd="@dimen/dp_7"
|
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
@@ -301,15 +317,14 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dp_42"
|
android:layout_height="@dimen/dp_42"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:background="@drawable/theme_bg"
|
|
||||||
android:layout_marginLeft="@dimen/dp_40"
|
android:layout_marginLeft="@dimen/dp_40"
|
||||||
android:layout_marginRight="@dimen/dp_40"
|
android:layout_marginRight="@dimen/dp_40"
|
||||||
android:layout_marginBottom="@dimen/dp_20"
|
android:layout_marginBottom="@dimen/dp_20"
|
||||||
android:gravity="center"
|
android:background="@drawable/theme_bg"
|
||||||
>
|
android:gravity="center">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_commit_bg"
|
android:id="@+id/iv_commit_bg"
|
||||||
@@ -317,8 +332,8 @@
|
|||||||
android:layout_height="@dimen/dp_75"
|
android:layout_height="@dimen/dp_75"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:visibility="gone"
|
android:src="@drawable/theme_bg"
|
||||||
android:src="@drawable/theme_bg" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -330,15 +345,14 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="21dp"
|
android:layout_height="21dp"
|
||||||
android:text="进入秘地"
|
android:text="进入秘地"
|
||||||
android:textColor="@color/color_white"
|
android:textColor="@color/color_white"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp" />
|
||||||
/>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,13 @@ dependencies {
|
|||||||
|
|
||||||
api 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
|
api 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
|
||||||
api 'io.github.mayzs:paho.mqtt.android:1.2.1'
|
api 'io.github.mayzs:paho.mqtt.android:1.2.1'
|
||||||
// api project(':LocalAar')
|
// room数据库
|
||||||
|
// def room_version = "2.5.0"
|
||||||
|
// implementation "androidx.room:room-runtime:$room_version"
|
||||||
|
// implementation "androidx.room:room-ktx:$room_version"
|
||||||
|
// annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//2. 云normal SDK,
|
//2. 云normal SDK,
|
||||||
//aar的名称,例如:WbCloudNormal-v5.1.10-123456789.aar,填入 'WbCloudNormal-v5.1.10-123456789.aar'
|
//aar的名称,例如:WbCloudNormal-v5.1.10-123456789.aar,填入 'WbCloudNormal-v5.1.10-123456789.aar'
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ import com.xscm.moduleutil.utils.DisplayUtil;
|
|||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
import com.xscm.moduleutil.utils.LanguageUtil;
|
import com.xscm.moduleutil.utils.LanguageUtil;
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
import com.xscm.moduleutil.widget.PiaoPingManager;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -407,7 +406,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
|
|
||||||
/// 礼物特效
|
/// 礼物特效
|
||||||
// 在类中添加以下成员变量
|
// 在类中添加以下成员变量
|
||||||
private final List<MqttBean> mqttMessageQueue = new ArrayList<>(); // MQTT消息队列
|
private final List<MqttBean.ListBean> mqttMessageQueue = new ArrayList<>(); // MQTT消息队列
|
||||||
private final List<XLHBean> xlhMessageQueue = new ArrayList<>(); // XLH消息队列
|
private final List<XLHBean> xlhMessageQueue = new ArrayList<>(); // XLH消息队列
|
||||||
private boolean isMqttPlaying = false; // MQTT播放状态标志
|
private boolean isMqttPlaying = false; // MQTT播放状态标志
|
||||||
private boolean isXlhPlaying = false; // XLH播放状态标志
|
private boolean isXlhPlaying = false; // XLH播放状态标志
|
||||||
@@ -423,7 +422,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
if (mqttBean == null) return;
|
if (mqttBean == null) return;
|
||||||
|
|
||||||
synchronized (mqttQueueLock) {
|
synchronized (mqttQueueLock) {
|
||||||
mqttMessageQueue.add(mqttBean);
|
|
||||||
|
mqttMessageQueue.addAll(mqttBean.getList());
|
||||||
if (!isMqttPlaying) {
|
if (!isMqttPlaying) {
|
||||||
isMqttPlaying = true;
|
isMqttPlaying = true;
|
||||||
processNextMqttMessage();
|
processNextMqttMessage();
|
||||||
@@ -448,7 +448,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
|
|
||||||
// 处理下一个MQTT消息
|
// 处理下一个MQTT消息
|
||||||
private void processNextMqttMessage() {
|
private void processNextMqttMessage() {
|
||||||
MqttBean mqttBean;
|
MqttBean.ListBean mqttBean;
|
||||||
synchronized (mqttQueueLock) {
|
synchronized (mqttQueueLock) {
|
||||||
if (mqttMessageQueue.isEmpty()) {
|
if (mqttMessageQueue.isEmpty()) {
|
||||||
isMqttPlaying = false;
|
isMqttPlaying = false;
|
||||||
@@ -475,7 +475,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
ViewGroup decorView;
|
ViewGroup decorView;
|
||||||
ViewGroup decorView1;
|
ViewGroup decorView1;
|
||||||
|
|
||||||
private void showFloatingMessage(MqttBean mqttBean) {
|
private void showFloatingMessage(MqttBean.ListBean mqttBean) {
|
||||||
try {
|
try {
|
||||||
// 清理之前的视图(如果存在)
|
// 清理之前的视图(如果存在)
|
||||||
if (currentMqttView != null && currentMqttView.getParent() != null) {
|
if (currentMqttView != null && currentMqttView.getParent() != null) {
|
||||||
@@ -639,18 +639,18 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFloatingViewData(View view, MqttBean mqttBean) {
|
private void updateFloatingViewData(View view, MqttBean.ListBean mqttBean) {
|
||||||
TextView textView = view.findViewById(R.id.tv_name);
|
TextView textView = view.findViewById(R.id.tv_name);
|
||||||
TextView textView2 = view.findViewById(R.id.tv_to_name);
|
TextView textView2 = view.findViewById(R.id.tv_to_name);
|
||||||
TextView tv_time = view.findViewById(R.id.tv_num);
|
TextView tv_time = view.findViewById(R.id.tv_num);
|
||||||
|
|
||||||
if (mqttBean.getList() != null) {
|
if (mqttBean != null) {
|
||||||
textView2.setText("送给" + (mqttBean.getList().getToUserName() != null ? mqttBean.getList().getToUserName() : ""));
|
textView2.setText("送给" + (mqttBean.getToUserName() != null ? mqttBean.getToUserName() : ""));
|
||||||
textView.setText(mqttBean.getList().getFromUserName() != null ? mqttBean.getList().getFromUserName() : "");
|
textView.setText(mqttBean.getFromUserName() != null ? mqttBean.getFromUserName() : "");
|
||||||
if (mqttBean.getList().getGift_picture() != null) {
|
if (mqttBean.getGift_picture() != null) {
|
||||||
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), view.findViewById(R.id.iv_piaoping));
|
ImageUtils.loadHeadCC(mqttBean.getGift_picture(), view.findViewById(R.id.iv_piaoping));
|
||||||
}
|
}
|
||||||
tv_time.setText("x" + (mqttBean.getList().getNumber() != null ? mqttBean.getList().getNumber() : "1"));
|
tv_time.setText("x" + (mqttBean.getNumber() != null ? mqttBean.getNumber() : "1"));
|
||||||
} else {
|
} else {
|
||||||
textView2.setText("送给");
|
textView2.setText("送给");
|
||||||
textView.setText("");
|
textView.setText("");
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.xscm.moduleutil.R;
|
|||||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||||
import com.xscm.moduleutil.bean.GiftLabelBean;
|
import com.xscm.moduleutil.bean.GiftLabelBean;
|
||||||
import com.xscm.moduleutil.bean.GiftPackBean;
|
import com.xscm.moduleutil.bean.GiftPackBean;
|
||||||
|
import com.xscm.moduleutil.bean.GiftPackEvent;
|
||||||
import com.xscm.moduleutil.bean.GiftPackListCount;
|
import com.xscm.moduleutil.bean.GiftPackListCount;
|
||||||
import com.xscm.moduleutil.bean.RewardUserBean;
|
import com.xscm.moduleutil.bean.RewardUserBean;
|
||||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||||
@@ -79,6 +80,9 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadDataIfNeeded(String id, int type, String roomId) {
|
public void loadDataIfNeeded(String id, int type, String roomId) {
|
||||||
|
if (MvpPre==null){
|
||||||
|
MvpPre = new RewardGiftPresenter(this, getActivity());
|
||||||
|
}
|
||||||
if (id.equals("0")) {
|
if (id.equals("0")) {
|
||||||
MvpPre.giftPack();
|
MvpPre.giftPack();
|
||||||
} else {
|
} else {
|
||||||
@@ -95,13 +99,18 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onString(String giftId) {
|
public void onString(GiftPackEvent event) {
|
||||||
bdgiftId = giftId;
|
if (event!=null && event.getBdid()!=null) {
|
||||||
|
bdgiftId = event.getBdid();
|
||||||
MvpPre.giftPack();
|
MvpPre.giftPack();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
|
if (type==0){
|
||||||
|
MvpPre.getGiftList("0", type, roomId);
|
||||||
|
}
|
||||||
// if (id.equals("0")) {
|
// if (id.equals("0")) {
|
||||||
// MvpPre.giftPack();
|
// MvpPre.giftPack();
|
||||||
// } else {
|
// } else {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.PowerManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
@@ -36,13 +37,11 @@ import com.xscm.moduleutil.interfaces.AppLifecycleUtil;
|
|||||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||||
import com.xscm.moduleutil.service.MqttConnect;
|
import com.xscm.moduleutil.service.MqttConnect;
|
||||||
import com.xscm.moduleutil.service.MyMqttService;
|
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
import com.xscm.moduleutil.utils.UtilConfig;
|
import com.xscm.moduleutil.utils.UtilConfig;
|
||||||
import com.xscm.moduleutil.utils.config.EnvironmentEnum;
|
import com.xscm.moduleutil.utils.config.EnvironmentEnum;
|
||||||
import com.xscm.moduleutil.utils.config.EnvironmentPrefs;
|
import com.xscm.moduleutil.utils.config.EnvironmentPrefs;
|
||||||
import com.xscm.moduleutil.widget.CommonAppConfig;
|
import com.xscm.moduleutil.widget.CommonAppConfig;
|
||||||
import com.xscm.moduleutil.widget.PiaoPingManager;
|
|
||||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||||
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
|
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
|
||||||
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
|
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
|
||||||
@@ -129,7 +128,8 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
if (SpUtil.isAgreePolicy()) {
|
if (SpUtil.isAgreePolicy()) {
|
||||||
checkInEmulator();
|
checkInEmulator();
|
||||||
UtilConfig.checkInEmulator();
|
UtilConfig.checkInEmulator();
|
||||||
AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId());
|
AgoraManager.getInstance(this);
|
||||||
|
AgoraManager.init(currentEnvironment.getSwSdkAppId());
|
||||||
MessageListenerSingleton.getInstance();
|
MessageListenerSingleton.getInstance();
|
||||||
CrashReport.initCrashReport(this, "ac3ed4d89f", true);/*bugly初始化*/
|
CrashReport.initCrashReport(this, "ac3ed4d89f", true);/*bugly初始化*/
|
||||||
// // 启动 MQTT 服务
|
// // 启动 MQTT 服务
|
||||||
@@ -155,8 +155,26 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
startActivityForResult(intent, 100);
|
startActivityForResult(intent, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
requestBatteryOptimizationExemption();
|
||||||
|
}
|
||||||
|
private void requestBatteryOptimizationExemption() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
String packageName = getPackageName();
|
||||||
|
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
|
||||||
|
if (pm != null && !pm.isIgnoringBatteryOptimizations(packageName)) {
|
||||||
|
intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||||
|
intent.setData(Uri.parse("package:" + packageName));
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
try {
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("Failed to request battery optimization exemption: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
private void startActivityForResult(Intent intent, int i) {
|
private void startActivityForResult(Intent intent, int i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GiftPackEvent {
|
||||||
|
private String bdid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MqttXlhEnd {
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ public class MusicSongBean implements Serializable {
|
|||||||
|
|
||||||
private String did;//歌曲id
|
private String did;//歌曲id
|
||||||
private String room_id;
|
private String room_id;
|
||||||
private String song_code;//歌曲唯一标识
|
private String song_code="";//歌曲唯一标识
|
||||||
private String song_name;//歌曲名称
|
private String song_name;//歌曲名称
|
||||||
private String singer;//歌手
|
private String singer;//歌手
|
||||||
private String poster;//封面
|
private String poster;//封面
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class RoomMessageEvent {
|
|||||||
private String jia_jia;
|
private String jia_jia;
|
||||||
private UserInfo FromUserInfo;
|
private UserInfo FromUserInfo;
|
||||||
private UserInfo ToUserInfo;
|
private UserInfo ToUserInfo;
|
||||||
|
private List<UserInfo> ToUserInfos;
|
||||||
private GiftBean GiftInfo;
|
private GiftBean GiftInfo;
|
||||||
private int room_up_pit_type;
|
private int room_up_pit_type;
|
||||||
private MusicSongBean songInfo;
|
private MusicSongBean songInfo;
|
||||||
@@ -52,7 +53,7 @@ public class RoomMessageEvent {
|
|||||||
private String AcceptRoomId;//接收者所在的房间id
|
private String AcceptRoomId;//接收者所在的房间id
|
||||||
private String PkId;
|
private String PkId;
|
||||||
private String room_id;//当type==1的时候。这个roomId是对方的房间id
|
private String room_id;//当type==1的时候。这个roomId是对方的房间id
|
||||||
private String user_id;
|
private String user_id="";
|
||||||
private String pk_end_times;//pk结束时间
|
private String pk_end_times;//pk结束时间
|
||||||
private List<RoomPitBean> userCharmList;
|
private List<RoomPitBean> userCharmList;
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public class ConfirmDialog extends Dialog {
|
|||||||
|
|
||||||
// 设置点击监听器
|
// 设置点击监听器
|
||||||
btnPositive.setOnClickListener(v -> {
|
btnPositive.setOnClickListener(v -> {
|
||||||
|
isCountdownCancelled = true; // 标记倒计时被取消
|
||||||
if (countDownTimer != null) {
|
if (countDownTimer != null) {
|
||||||
countDownTimer.cancel(); // 取消倒计时
|
countDownTimer.cancel(); // 取消倒计时
|
||||||
countDownTimer = null;
|
countDownTimer = null;
|
||||||
@@ -130,7 +131,7 @@ public class ConfirmDialog extends Dialog {
|
|||||||
// rootView.startAnimation(shake);
|
// rootView.startAnimation(shake);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
private boolean isCountdownCancelled = false; // 添加标志位
|
||||||
private void startCountdown(Button btnNegative) {
|
private void startCountdown(Button btnNegative) {
|
||||||
countDownTimer = new CountDownTimer(countdownSeconds * 1000L, 1000) {
|
countDownTimer = new CountDownTimer(countdownSeconds * 1000L, 1000) {
|
||||||
@Override
|
@Override
|
||||||
@@ -141,12 +142,15 @@ public class ConfirmDialog extends Dialog {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
|
// 检查是否被主动取消
|
||||||
|
if (!isCountdownCancelled) {
|
||||||
btnNegative.setText(negativeButtonText);
|
btnNegative.setText(negativeButtonText);
|
||||||
if (negativeButtonClickListener != null) {
|
if (negativeButtonClickListener != null) {
|
||||||
negativeButtonClickListener.onClick(btnNegative); // 自动触发取消
|
negativeButtonClickListener.onClick(btnNegative); // 自动触发取消
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
|
|||||||
if (type==10){
|
if (type==10){
|
||||||
mBinding.gzCl.setBackgroundResource(R.mipmap.tkzj);
|
mBinding.gzCl.setBackgroundResource(R.mipmap.tkzj);
|
||||||
mBinding.imGz.setImageResource(R.mipmap.tkzj_gz);
|
mBinding.imGz.setImageResource(R.mipmap.tkzj_gz);
|
||||||
|
mBinding.webView.setPadding(16, 0, 16, 0);
|
||||||
}else if (type==11){
|
}else if (type==11){
|
||||||
mBinding.gzCl.setBackgroundResource(R.mipmap.syzc);
|
mBinding.gzCl.setBackgroundResource(R.mipmap.syzc);
|
||||||
mBinding.imGz.setImageResource(R.mipmap.syzc_gz);
|
mBinding.imGz.setImageResource(R.mipmap.syzc_gz);
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
startType = 1;
|
startType = 1;
|
||||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1",heart_id);
|
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1",heart_id);
|
||||||
} else {
|
} else {
|
||||||
com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (id == R.id.ll_ten) {
|
} else if (id == R.id.ll_ten) {
|
||||||
@@ -384,7 +384,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "6",heart_id);
|
MvpPre.drawGiftList(giftBagId, userIds, roomId, "6",heart_id);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||||
}
|
}
|
||||||
} else if (id == R.id.ll_hundred) {//抽奖100次
|
} else if (id == R.id.ll_hundred) {//抽奖100次
|
||||||
if (!isDrawing) {
|
if (!isDrawing) {
|
||||||
@@ -393,7 +393,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
startType = 3;
|
startType = 3;
|
||||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "9",heart_id);
|
MvpPre.drawGiftList(giftBagId, userIds, roomId, "9",heart_id);
|
||||||
} else {
|
} else {
|
||||||
com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||||
}
|
}
|
||||||
} else if (id == R.id.tv_gz) {//规则
|
} else if (id == R.id.tv_gz) {//规则
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
@@ -882,6 +882,9 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (MvpPre==null){
|
||||||
|
MvpPre = new GiftLotteryPresenter(this, getActivity());
|
||||||
|
}
|
||||||
MvpPre.wallet();
|
MvpPre.wallet();
|
||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
MvpPre.giftSend(blind_box_turntable_id);
|
MvpPre.giftSend(blind_box_turntable_id);
|
||||||
@@ -921,6 +924,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
? walletBean.getCoin()
|
? walletBean.getCoin()
|
||||||
: "0"
|
: "0"
|
||||||
);
|
);
|
||||||
|
if (isAdded() && getActivity() != null && !getActivity().isFinishing() &&
|
||||||
|
getDialog() != null && getDialog().isShowing()) {
|
||||||
if (type == 10) {
|
if (type == 10) {
|
||||||
mBinding.mirroeSky.tvIcon.setText(walletBean.getCoin());
|
mBinding.mirroeSky.tvIcon.setText(walletBean.getCoin());
|
||||||
} else if (type == 11) {
|
} else if (type == 11) {
|
||||||
@@ -928,6 +933,15 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
} else if (type == 12) {
|
} else if (type == 12) {
|
||||||
mBinding.pinnacleTime.tvIcon.setText(walletBean.getCoin());
|
mBinding.pinnacleTime.tvIcon.setText(walletBean.getCoin());
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
// dialog 已关闭,不进行 UI 更新
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// walletBean 为空时也关闭 dialog
|
||||||
|
if (getActivity() != null && !getActivity().isFinishing()) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setBackground();
|
setBackground();
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
|||||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
import com.xscm.moduleutil.http.BaseObserver;
|
import com.xscm.moduleutil.http.BaseObserver;
|
||||||
|
import com.xscm.moduleutil.http.RetrofitClient;
|
||||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@@ -148,6 +149,9 @@ public class GiftLotteryPresenter extends BasePresenter<GiftLotteryContacts.View
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void xlhChou(String room_id, String num) {
|
public void xlhChou(String room_id, String num) {
|
||||||
|
if (api==null){
|
||||||
|
api= RetrofitClient.getInstance();
|
||||||
|
}
|
||||||
api.xlhChou(room_id,num, new BaseObserver<List<XlhDrawBean>>() {
|
api.xlhChou(room_id,num, new BaseObserver<List<XlhDrawBean>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,46 +1,41 @@
|
|||||||
package com.xscm.moduleutil.dialog.giftLottery;
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.HorizontalScrollView;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.LinearSnapHelper;
|
import androidx.recyclerview.widget.LinearSnapHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.blankj.utilcode.util.TimeUtils;
|
import com.blankj.utilcode.util.GsonUtils;
|
||||||
import com.xscm.moduleutil.R;
|
import com.xscm.moduleutil.R;
|
||||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||||
import com.xscm.moduleutil.bean.GiftBean;
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.MqttXlhEnd;
|
||||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||||
import com.xscm.moduleutil.bean.WalletBean;
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
|
import com.xscm.moduleutil.bean.XLHBean;
|
||||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
import com.xscm.moduleutil.databinding.FragmentTourClubDialogBinding;
|
import com.xscm.moduleutil.databinding.FragmentTourClubDialogBinding;
|
||||||
import com.xscm.moduleutil.dialog.WebViewDialog;
|
import com.xscm.moduleutil.dialog.WebViewDialog;
|
||||||
|
import com.xscm.moduleutil.event.MqttBean;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
import com.xscm.moduleutil.widget.CenterScrollHelper;
|
import com.xscm.moduleutil.widget.CenterScrollHelper;
|
||||||
import com.xscm.moduleutil.widget.EqualSpaceItemDecoration;
|
import com.xscm.moduleutil.widget.EqualSpaceItemDecoration;
|
||||||
import com.xscm.moduleutil.widget.InfintLinearLayoutManager;
|
|
||||||
import com.xscm.moduleutil.widget.pagerecyclerview.PagerGridSnapHelper;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -48,11 +43,11 @@ import org.greenrobot.eventbus.ThreadMode;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
/**
|
/**
|
||||||
*@author qx
|
* @author qx
|
||||||
*@data 2025/9/15
|
* @data 2025/9/15
|
||||||
*@description: 玄镜之旅
|
* @description: 玄镜之旅
|
||||||
*/
|
*/
|
||||||
public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FragmentTourClubDialogBinding> implements GiftLotteryContacts.View {
|
public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FragmentTourClubDialogBinding> implements GiftLotteryContacts.View {
|
||||||
private String roomId;
|
private String roomId;
|
||||||
@@ -63,6 +58,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
private String num;
|
private String num;
|
||||||
private XlhRankingDialog xlhRankingDialog;
|
private XlhRankingDialog xlhRankingDialog;
|
||||||
private XlhRecordDialog xlhRecordDialog;
|
private XlhRecordDialog xlhRecordDialog;
|
||||||
|
private XlhObtainDialog xlhObtainDialog;
|
||||||
|
|
||||||
private GiftXlhChouAdapter giftXlhChouAdapter;
|
private GiftXlhChouAdapter giftXlhChouAdapter;
|
||||||
private CenterScrollHelper scrollHelper;
|
private CenterScrollHelper scrollHelper;
|
||||||
@@ -98,8 +94,8 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
dialog.setCancelable(true);
|
dialog.setCancelable(true);
|
||||||
// if (!EventBus.getDefault().isRegistered(this))
|
if (!EventBus.getDefault().isRegistered(this))
|
||||||
// EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +194,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
num = "1";
|
num = "1";
|
||||||
MvpPre.xlhChou(roomId, num);
|
MvpPre.xlhChou(roomId, num);
|
||||||
} else {
|
} else {
|
||||||
com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (id == R.id.ll_ten) {
|
} else if (id == R.id.ll_ten) {
|
||||||
@@ -208,17 +204,17 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
num = "10";
|
num = "10";
|
||||||
MvpPre.xlhChou(roomId, num);
|
MvpPre.xlhChou(roomId, num);
|
||||||
} else {
|
} else {
|
||||||
com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (id == R.id.ll_hundred) {
|
} else if (id == R.id.ll_hundred) {
|
||||||
if (!isDrawing) {
|
if (!isDrawing) {
|
||||||
isDrawing = true;
|
isDrawing = true;
|
||||||
prepareForNewLottery();
|
prepareForNewLottery();
|
||||||
num = "100";
|
num = "20";
|
||||||
MvpPre.xlhChou(roomId, num);
|
MvpPre.xlhChou(roomId, num);
|
||||||
} else {
|
} else {
|
||||||
com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
// com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (id == R.id.tv_gz) {
|
} else if (id == R.id.tv_gz) {
|
||||||
@@ -300,7 +296,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
private void upTitle(int boxPrice) {
|
private void upTitle(int boxPrice) {
|
||||||
mBinding.tvOne.setText(boxPrice + "币一次");
|
mBinding.tvOne.setText(boxPrice + "币一次");
|
||||||
mBinding.tvTen.setText((boxPrice * 10) + "币十次");
|
mBinding.tvTen.setText((boxPrice * 10) + "币十次");
|
||||||
mBinding.tvHundred.setText((boxPrice * 100) + "币百次");
|
mBinding.tvHundred.setText((boxPrice * 20) + "币二十次");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 2025/8/29 接收im推送过来的消息
|
// TODO: 2025/8/29 接收im推送过来的消息
|
||||||
@@ -308,14 +304,19 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
public void onMusicPlay(RoomMessageEvent message) {
|
public void onMusicPlay(RoomMessageEvent message) {
|
||||||
if (message.getMsgType() == 1057) {
|
if (message.getMsgType() == 1057) {
|
||||||
// UpView(message.getText().getXlh_data());
|
// UpView(message.getText().getXlh_data());
|
||||||
endTime = Long.parseLong(message.getText().getEnd_time());
|
endTime = Long.parseLong(message.getText().getEnd_time() != null ? message.getText().getEnd_time() : "0");
|
||||||
startCountdown();
|
startCountdown();
|
||||||
mBinding.tvGiftCount.setText(message.getText().getGift_num());
|
mBinding.tvGiftCount.setText(message.getText().getGift_num() != null ? message.getText().getGift_num() : "0");
|
||||||
mBinding.userName.setText(message.getText().getFromUserInfo().getNickname());
|
mBinding.userName.setText(message.getText().getFromUserInfo().getNickname() != null ? message.getText().getFromUserInfo().getNickname() : "");
|
||||||
ImageUtils.loadHeadCC(message.getText().getFromUserInfo().getAvatar(), mBinding.userPic);
|
ImageUtils.loadHeadCC(message.getText().getFromUserInfo().getAvatar(), mBinding.userPic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onMessageReceived(MqttXlhEnd event) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动倒计时
|
* 启动倒计时
|
||||||
*/
|
*/
|
||||||
@@ -411,6 +412,23 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
if (giftXlhChouAdapter != null) {
|
if (giftXlhChouAdapter != null) {
|
||||||
giftXlhChouAdapter = null;
|
giftXlhChouAdapter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EventBus.getDefault().isRegistered(this)) {
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xlhRecordDialog != null && xlhRecordDialog.isVisible()) {
|
||||||
|
xlhRecordDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果当前dialog存在且正在显示,先关闭
|
||||||
|
if (xlhRankingDialog != null && xlhRankingDialog.isVisible()) {
|
||||||
|
xlhRankingDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xlhObtainDialog != null && xlhObtainDialog.isShowing()) {
|
||||||
|
xlhObtainDialog.dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -684,7 +702,6 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将指定的原始位置item居中显示
|
* 将指定的原始位置item居中显示
|
||||||
*
|
*
|
||||||
@@ -805,14 +822,19 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
* @param data 中奖数据
|
* @param data 中奖数据
|
||||||
*/
|
*/
|
||||||
private void showResultDialog(List<XlhDrawBean> data) {
|
private void showResultDialog(List<XlhDrawBean> data) {
|
||||||
isDrawing=false;
|
isDrawing = false;
|
||||||
// 创建并显示对话框
|
// 创建并显示对话框
|
||||||
XlhObtainDialog dialog = new XlhObtainDialog(getActivity());
|
// 关闭之前可能存在的对话框
|
||||||
dialog.setOnGiftItemClickListener(new XlhObtainDialog.OnGiftItemClickListener() {
|
// if (xlhObtainDialog != null && xlhObtainDialog.isShowing()) {
|
||||||
|
// xlhObtainDialog.dismiss();
|
||||||
|
// }
|
||||||
|
// 创建并显示对话框
|
||||||
|
xlhObtainDialog = new XlhObtainDialog(getActivity());
|
||||||
|
xlhObtainDialog.setOnGiftItemClickListener(new XlhObtainDialog.OnGiftItemClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayAgainClick() {
|
public void onPlayAgainClick() {
|
||||||
isDrawing=true;
|
isDrawing = true;
|
||||||
// 处理再玩一次点击事件
|
// 处理再玩一次点击事件
|
||||||
MvpPre.xlhChou(roomId, num);
|
MvpPre.xlhChou(roomId, num);
|
||||||
}
|
}
|
||||||
@@ -820,12 +842,15 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
@Override
|
@Override
|
||||||
public void onCloseClick() {
|
public void onCloseClick() {
|
||||||
// 处理关闭点击事件
|
// 处理关闭点击事件
|
||||||
dialog.dismiss();
|
if (xlhObtainDialog != null && xlhObtainDialog.isShowing()) {
|
||||||
|
xlhObtainDialog.dismiss();
|
||||||
|
}
|
||||||
|
xlhObtainDialog = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.show();
|
xlhObtainDialog.show();
|
||||||
dialog.setGiftList(data);
|
xlhObtainDialog.setGiftList(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.xscm.moduleutil.dialog.giftLottery;
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
@@ -53,6 +54,13 @@ public class XlhObtainDialog extends BaseDialog<DialogXlhObtainBinding> {
|
|||||||
setCancelable(false);
|
setCancelable(false);
|
||||||
setCanceledOnTouchOutside(false);
|
setCanceledOnTouchOutside(false);
|
||||||
Window window = getWindow();
|
Window window = getWindow();
|
||||||
|
// 设置对话框在屏幕中央显示
|
||||||
|
window.setGravity(Gravity.CENTER);
|
||||||
|
// 去掉背景阴影
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||||
|
|
||||||
|
// 设置窗口背景为透明
|
||||||
|
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 375.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
|
window.setLayout((int) (ScreenUtils.getScreenWidth() * 375.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||||
// 设置点击事件
|
// 设置点击事件
|
||||||
mBinding.xlhClose.setOnClickListener(v -> {
|
mBinding.xlhClose.setOnClickListener(v -> {
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
package com.xscm.moduleutil.event;
|
package com.xscm.moduleutil.event;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.annotations.JsonAdapter;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.google.gson.stream.JsonToken;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,7 +21,8 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class MqttBean {
|
public class MqttBean {
|
||||||
private String room_id;
|
private String room_id;
|
||||||
private ListBean list;
|
@JsonAdapter(ListBeanListAdapter.class)
|
||||||
|
private List<ListBean> list;
|
||||||
|
|
||||||
public String getRoom_id() {
|
public String getRoom_id() {
|
||||||
return room_id == null ? "" : room_id;
|
return room_id == null ? "" : room_id;
|
||||||
@@ -20,14 +32,58 @@ public class MqttBean {
|
|||||||
this.room_id = room_id == null ? "" : room_id;
|
this.room_id = room_id == null ? "" : room_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListBean getList() {
|
public List<ListBean> getList() {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setList(ListBean list) {
|
public void setList(List<ListBean> list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 自定义TypeAdapter来处理有时是对象有时是数组的情况
|
||||||
|
public static class ListBeanListAdapter extends TypeAdapter<List<ListBean>> {
|
||||||
|
@Override
|
||||||
|
public void write(JsonWriter out, List<ListBean> value) throws IOException {
|
||||||
|
if (value == null) {
|
||||||
|
out.nullValue();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Gson gson = new Gson();
|
||||||
|
out.beginArray();
|
||||||
|
for (ListBean item : value) {
|
||||||
|
gson.toJson(item, ListBean.class, out);
|
||||||
|
}
|
||||||
|
out.endArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ListBean> read(JsonReader in) throws IOException {
|
||||||
|
List<ListBean> list = new ArrayList<>();
|
||||||
|
Gson gson = new Gson();
|
||||||
|
|
||||||
|
JsonToken token = in.peek();
|
||||||
|
if (token == JsonToken.BEGIN_ARRAY) {
|
||||||
|
// 正常的数组情况
|
||||||
|
in.beginArray();
|
||||||
|
while (in.hasNext()) {
|
||||||
|
ListBean item = gson.fromJson(in, ListBean.class);
|
||||||
|
list.add(item);
|
||||||
|
}
|
||||||
|
in.endArray();
|
||||||
|
} else if (token == JsonToken.BEGIN_OBJECT) {
|
||||||
|
// 单个对象的情况,转换为包含一个元素的列表
|
||||||
|
ListBean item = gson.fromJson(in, ListBean.class);
|
||||||
|
list.add(item);
|
||||||
|
} else if (token == JsonToken.NULL) {
|
||||||
|
in.nextNull();
|
||||||
|
}
|
||||||
|
// 其他情况(如字符串、数字等)直接跳过
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class ListBean {
|
public static class ListBean {
|
||||||
private String text;
|
private String text;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public abstract class BaseObserver<T> implements Observer<T> {
|
|||||||
if (apiException.getCode() == 301) {
|
if (apiException.getCode() == 301) {
|
||||||
EventBus.getDefault().post(new LogOutEvent());
|
EventBus.getDefault().post(new LogOutEvent());
|
||||||
try {
|
try {
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||||
CommonAppContext.getInstance().clearLoginInfo();
|
CommonAppContext.getInstance().clearLoginInfo();
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class DefaultTransformer<T> implements ObservableTransformer<BaseModel<T>
|
|||||||
.map(response -> {
|
.map(response -> {
|
||||||
if (response.isTokenExpired()) {
|
if (response.isTokenExpired()) {
|
||||||
// 触发登出事件(EventBus)
|
// 触发登出事件(EventBus)
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||||
CommonAppContext.getInstance().clearLoginInfo();
|
CommonAppContext.getInstance().clearLoginInfo();
|
||||||
throw new APIException(-1, "登录已过期");
|
throw new APIException(-1, "登录已过期");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,6 +315,7 @@ public class RetrofitClient {
|
|||||||
observer.onNext(string.getData());
|
observer.onNext(string.getData());
|
||||||
} else if (code == 301) {
|
} else if (code == 301) {
|
||||||
try {
|
try {
|
||||||
|
ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||||
CommonAppContext.getInstance().clearLoginInfo();
|
CommonAppContext.getInstance().clearLoginInfo();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -1994,7 +1995,7 @@ public class RetrofitClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||||
ToastUtils.showShort(t.toString());
|
ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||||
if (t.toString().contains("登录失效")) {
|
if (t.toString().contains("登录失效")) {
|
||||||
try {
|
try {
|
||||||
CommonAppContext.getInstance().clearLoginInfo();
|
CommonAppContext.getInstance().clearLoginInfo();
|
||||||
@@ -2308,6 +2309,7 @@ public class RetrofitClient {
|
|||||||
|
|
||||||
} else if (code == 301) {
|
} else if (code == 301) {
|
||||||
try {
|
try {
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||||
CommonAppContext.getInstance().clearLoginInfo();
|
CommonAppContext.getInstance().clearLoginInfo();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -2360,8 +2362,15 @@ public class RetrofitClient {
|
|||||||
public void onResponse(Call<BaseModel<List<XlhDrawBean>>> call, Response<BaseModel<List<XlhDrawBean>>> response) {
|
public void onResponse(Call<BaseModel<List<XlhDrawBean>>> call, Response<BaseModel<List<XlhDrawBean>>> response) {
|
||||||
if (response.code() == 200) {
|
if (response.code() == 200) {
|
||||||
BaseModel<List<XlhDrawBean>> baseModel = response.body();
|
BaseModel<List<XlhDrawBean>> baseModel = response.body();
|
||||||
|
if (baseModel.getCode()==1) {
|
||||||
|
if (baseModel != null && baseModel.getData() != null) {
|
||||||
observer.onNext(baseModel.getData());
|
observer.onNext(baseModel.getData());
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
observer.onNext(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class MessageListenerSingleton {
|
|||||||
private V2TIMSimpleMsgListener simpleMsgListener;
|
private V2TIMSimpleMsgListener simpleMsgListener;
|
||||||
private V2TIMAdvancedMsgListener v2TIMAdvancedMsgListener;
|
private V2TIMAdvancedMsgListener v2TIMAdvancedMsgListener;
|
||||||
private static String mRoomId = "";
|
private static String mRoomId = "";
|
||||||
|
public static String groupId;
|
||||||
private V2TIMGroupListener groupListener;
|
private V2TIMGroupListener groupListener;
|
||||||
private V2TIMConversationListener conversationListener; // 需要保存引用
|
private V2TIMConversationListener conversationListener; // 需要保存引用
|
||||||
|
|
||||||
@@ -80,17 +81,22 @@ public class MessageListenerSingleton {
|
|||||||
|
|
||||||
// 修改 joinGroup 方法
|
// 修改 joinGroup 方法
|
||||||
public void joinGroup(String roomId) {
|
public void joinGroup(String roomId) {
|
||||||
mRoomId = roomId;
|
|
||||||
LogUtils.e("@@@", "加入房间的"+roomId);
|
LogUtils.e("@@@", "加入房间的"+roomId);
|
||||||
|
|
||||||
|
if (groupId!=null){
|
||||||
|
quitGroup(groupId);
|
||||||
|
}
|
||||||
// 确保监听器已初始化并添加
|
// 确保监听器已初始化并添加
|
||||||
ensureListenersAdded();
|
ensureListenersAdded();
|
||||||
// RoomMessageEvent.T t = new RoomMessageEvent.T();
|
// RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||||
// t.setText("羽声严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
// t.setText("羽声严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||||
// notifyMessageReceived(new RoomMessageEvent(1000, mRoomId, t));
|
// notifyMessageReceived(new RoomMessageEvent(1000, mRoomId, t));
|
||||||
V2TIMManager.getInstance().joinGroup("room" + mRoomId, "申请加入", new V2TIMCallback() {
|
V2TIMManager.getInstance().joinGroup("room" + roomId, "申请加入", new V2TIMCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
Log.d("@@@", "加入im群组成功:");
|
Log.d("@@@", "加入im群组成功:");
|
||||||
|
groupId = roomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -290,6 +296,16 @@ public class MessageListenerSingleton {
|
|||||||
|
|
||||||
// 修改 quitGroup 方法
|
// 修改 quitGroup 方法
|
||||||
public static void quitGroup(String mRoomId) {
|
public static void quitGroup(String mRoomId) {
|
||||||
|
|
||||||
|
if (instance != null) {
|
||||||
|
instance.listeners.clear();
|
||||||
|
removeAllListeners();
|
||||||
|
isInitialized = false;
|
||||||
|
groupId=null;
|
||||||
|
// instance = null;
|
||||||
|
LogUtils.e("@@@","重置成功");
|
||||||
|
}
|
||||||
|
|
||||||
V2TIMManager.getInstance().quitGroup("room" + mRoomId, new V2TIMCallback() {
|
V2TIMManager.getInstance().quitGroup("room" + mRoomId, new V2TIMCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@@ -311,6 +327,7 @@ public class MessageListenerSingleton {
|
|||||||
instance.listeners.clear();
|
instance.listeners.clear();
|
||||||
removeAllListeners();
|
removeAllListeners();
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
|
groupId=null;
|
||||||
// instance = null;
|
// instance = null;
|
||||||
quitGroup(roomId);
|
quitGroup(roomId);
|
||||||
LogUtils.e("@@@","重置成功");
|
LogUtils.e("@@@","重置成功");
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.xscm.moduleutil.rtc;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/18
|
||||||
|
*@description: 加入声网返回
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AgoraIsOPen {
|
||||||
|
private boolean isOpen;
|
||||||
|
}
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
package com.xscm.moduleutil.service;
|
|
||||||
|
|
||||||
|
|
||||||
import android.animation.Animator;
|
|
||||||
import android.animation.AnimatorListenerAdapter;
|
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewTreeObserver;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
|
|
||||||
import com.xscm.moduleutil.R;
|
|
||||||
import com.xscm.moduleutil.event.MqttBean;
|
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
|
||||||
|
|
||||||
|
|
||||||
public class EMqttService extends Service {
|
|
||||||
private WindowManager windowManager;
|
|
||||||
private View piaoPingView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
||||||
if (intent != null && intent.hasExtra("mqttBean")) {
|
|
||||||
MqttBean mqttBean = (MqttBean) intent.getSerializableExtra("mqttBean");
|
|
||||||
showPiaoPingMessage(mqttBean);//全局飘屏
|
|
||||||
}
|
|
||||||
return START_NOT_STICKY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (piaoPingView != null) {
|
|
||||||
windowManager.removeView(piaoPingView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showPiaoPingMessage(MqttBean mqttBean) {
|
|
||||||
|
|
||||||
int screenWidth = getResources().getDisplayMetrics().widthPixels;
|
|
||||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
|
||||||
//
|
|
||||||
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
|
|
||||||
WindowManager.LayoutParams.MATCH_PARENT,
|
|
||||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
|
|
||||||
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
|
|
||||||
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
|
|
||||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
|
|
||||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
|
||||||
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
|
|
||||||
PixelFormat.TRANSLUCENT);
|
|
||||||
//
|
|
||||||
// // 设置 Gravity 为左上角
|
|
||||||
// layoutParams.gravity = Gravity.TOP | Gravity.START;
|
|
||||||
//
|
|
||||||
// // Y 轴随机位置
|
|
||||||
// layoutParams.y = (int) ((Math.random() * (screenHeight - 200)));
|
|
||||||
//
|
|
||||||
// // 初始 X 设为负值,确保 View 在屏幕左侧外
|
|
||||||
// layoutParams.x = -screenWidth;
|
|
||||||
|
|
||||||
// FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
|
||||||
// FrameLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
// FrameLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
//
|
|
||||||
|
|
||||||
// 设置随机 Y 轴位置
|
|
||||||
// layoutParams.topMargin = (int) (Math.random() * (screenHeight - 200));
|
|
||||||
|
|
||||||
|
|
||||||
piaoPingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
|
|
||||||
TextView textView = piaoPingView.findViewById(R.id.tv_name);
|
|
||||||
textView.setText(mqttBean.getList().getText());
|
|
||||||
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), piaoPingView.findViewById(R.id.iv_piaoping));
|
|
||||||
TextView tv_time = piaoPingView.findViewById(R.id.tv_num);
|
|
||||||
tv_time.setText(mqttBean.getList().getNumber());
|
|
||||||
windowManager.addView(piaoPingView, layoutParams);
|
|
||||||
|
|
||||||
piaoPingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
|
||||||
@Override
|
|
||||||
public void onGlobalLayout() {
|
|
||||||
piaoPingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
|
||||||
|
|
||||||
// 设置锚点为左上角,避免偏移干扰
|
|
||||||
piaoPingView.setPivotX(0);
|
|
||||||
piaoPingView.setPivotY(0);
|
|
||||||
|
|
||||||
// 启动动画:从左外滑入 -> 右外滑出
|
|
||||||
ObjectAnimator animator = ObjectAnimator.ofFloat(
|
|
||||||
piaoPingView,
|
|
||||||
"translationX",
|
|
||||||
0f, // 初始偏移为 0(此时 View 在左侧外)
|
|
||||||
screenWidth // 向右移动整个屏幕宽度
|
|
||||||
);
|
|
||||||
animator.setDuration(2000); // 整个动画的时长为2秒
|
|
||||||
|
|
||||||
// 强制 GPU 渲染
|
|
||||||
piaoPingView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
||||||
|
|
||||||
// 延迟显示2秒后开始滑出屏幕的动画
|
|
||||||
piaoPingView.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
animator.start();
|
|
||||||
}
|
|
||||||
}, 2000);
|
|
||||||
|
|
||||||
animator.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
windowManager.removeView(piaoPingView);
|
|
||||||
stopSelf();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
package com.xscm.moduleutil.service;
|
|
||||||
|
|
||||||
import android.animation.Animator;
|
|
||||||
import android.animation.AnimatorListenerAdapter;
|
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewTreeObserver;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.xscm.moduleutil.R;
|
|
||||||
import com.xscm.moduleutil.event.MqttBean;
|
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*@author qx
|
|
||||||
*@data 2025/8/8
|
|
||||||
*@description: 全局悬浮框管理类
|
|
||||||
*/
|
|
||||||
public class FloatingWindow {
|
|
||||||
private WindowManager windowManager;
|
|
||||||
private View piaoPingView;
|
|
||||||
|
|
||||||
public FloatingWindow(Context context, MqttBean mqttBean){
|
|
||||||
int screenWidth =context.getResources().getDisplayMetrics().widthPixels;
|
|
||||||
windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
|
||||||
piaoPingView = LayoutInflater.from(context).inflate(R.layout.item_piaoping, null);
|
|
||||||
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
|
|
||||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
|
||||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
|
||||||
|
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
|
|
||||||
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
|
|
||||||
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
|
|
||||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
|
|
||||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
|
||||||
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
|
|
||||||
|
|
||||||
PixelFormat.TRANSLUCENT);
|
|
||||||
|
|
||||||
|
|
||||||
TextView textView = piaoPingView.findViewById(R.id.tv_name);
|
|
||||||
textView.setText(mqttBean.getList().getText());
|
|
||||||
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), piaoPingView.findViewById(R.id.iv_piaoping));
|
|
||||||
TextView tv_time = piaoPingView.findViewById(R.id.tv_num);
|
|
||||||
tv_time.setText(mqttBean.getList().getNumber());
|
|
||||||
windowManager.addView(piaoPingView, layoutParams);
|
|
||||||
|
|
||||||
// piaoPingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onGlobalLayout() {
|
|
||||||
// piaoPingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
|
||||||
//
|
|
||||||
// // 设置锚点为左上角,避免偏移干扰
|
|
||||||
// piaoPingView.setPivotX(0);
|
|
||||||
// piaoPingView.setPivotY(0);
|
|
||||||
//
|
|
||||||
// // 启动动画:从左外滑入 -> 右外滑出
|
|
||||||
// ObjectAnimator animator = ObjectAnimator.ofFloat(
|
|
||||||
// piaoPingView,
|
|
||||||
// "translationX",
|
|
||||||
// 0f, // 初始偏移为 0(此时 View 在左侧外)
|
|
||||||
// screenWidth // 向右移动整个屏幕宽度
|
|
||||||
// );
|
|
||||||
// animator.setDuration(2000); // 整个动画的时长为2秒
|
|
||||||
//
|
|
||||||
// // 强制 GPU 渲染
|
|
||||||
// piaoPingView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
||||||
//
|
|
||||||
// // 延迟显示2秒后开始滑出屏幕的动画
|
|
||||||
// piaoPingView.postDelayed(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// animator.start();
|
|
||||||
// }
|
|
||||||
// }, 2000);
|
|
||||||
//
|
|
||||||
// animator.addListener(new AnimatorListenerAdapter() {
|
|
||||||
// @Override
|
|
||||||
// public void onAnimationEnd(Animator animation) {
|
|
||||||
// windowManager.removeView(piaoPingView);
|
|
||||||
// stopSelf();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
piaoPingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
|
||||||
@Override
|
|
||||||
public void onGlobalLayout() {
|
|
||||||
piaoPingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
|
||||||
|
|
||||||
// 获取视图宽度
|
|
||||||
int viewWidth = piaoPingView.getWidth();
|
|
||||||
|
|
||||||
// 设置锚点为左上角
|
|
||||||
piaoPingView.setPivotX(0);
|
|
||||||
piaoPingView.setPivotY(0);
|
|
||||||
|
|
||||||
// 强制 GPU 渲染
|
|
||||||
piaoPingView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
||||||
|
|
||||||
// 创建滑入动画:从左外滑入到屏幕左侧
|
|
||||||
ObjectAnimator slideInAnimator = ObjectAnimator.ofFloat(
|
|
||||||
piaoPingView,
|
|
||||||
"translationX",
|
|
||||||
-viewWidth, // 起始位置:屏幕左外
|
|
||||||
0f // 结束位置:屏幕左边缘
|
|
||||||
);
|
|
||||||
slideInAnimator.setDuration(500); // 滑入动画时长0.5秒
|
|
||||||
|
|
||||||
// 创建滑出动画:从当前位置滑出到屏幕右侧外
|
|
||||||
ObjectAnimator slideOutAnimator = ObjectAnimator.ofFloat(
|
|
||||||
piaoPingView,
|
|
||||||
"translationX",
|
|
||||||
0f, // 起始位置:屏幕左边缘
|
|
||||||
screenWidth // 结束位置:屏幕右外
|
|
||||||
);
|
|
||||||
slideOutAnimator.setDuration(500); // 滑出动画时长0.5秒
|
|
||||||
|
|
||||||
// 设置滑出动画监听器
|
|
||||||
slideOutAnimator.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
windowManager.removeView(piaoPingView);
|
|
||||||
stopSelf();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 开始执行动画序列
|
|
||||||
slideInAnimator.start();
|
|
||||||
|
|
||||||
// 滑入完成后延迟2秒执行滑出动画
|
|
||||||
piaoPingView.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
slideOutAnimator.start();
|
|
||||||
}
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopSelf(){
|
|
||||||
if (piaoPingView != null) {
|
|
||||||
windowManager.removeView(piaoPingView);
|
|
||||||
piaoPingView = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,10 +7,13 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.blankj.utilcode.util.GsonUtils;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
|
import com.xscm.moduleutil.bean.MqttXlhEnd;
|
||||||
import com.xscm.moduleutil.bean.XLHBean;
|
import com.xscm.moduleutil.bean.XLHBean;
|
||||||
import com.xscm.moduleutil.event.RoomGiftRunable;
|
import com.xscm.moduleutil.event.RoomGiftRunable;
|
||||||
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||||
@@ -78,6 +81,18 @@ public class MqttInitCallback implements MqttCallback {
|
|||||||
case 5019://推送所有人-横幅礼物通知
|
case 5019://推送所有人-横幅礼物通知
|
||||||
new RoomGiftRunable(message).run();
|
new RoomGiftRunable(message).run();
|
||||||
break;
|
break;
|
||||||
|
case 8000:
|
||||||
|
XLHBean xlhBean= GsonUtils.fromJson(message, XLHBean.class);
|
||||||
|
if (xlhBean!=null && xlhBean.getRoom_id()!=null && SpUtil.getMyRoomId()!=null) {
|
||||||
|
if (xlhBean.getRoom_id().equals(SpUtil.getMyRoomId())) {
|
||||||
|
MqttXlhEnd mqttXlhEnd = new MqttXlhEnd();
|
||||||
|
mqttXlhEnd.setMessage(message);
|
||||||
|
EventBus.getDefault().post(mqttXlhEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +104,7 @@ public class MqttInitCallback implements MqttCallback {
|
|||||||
XLHBean xlhBean=JSON.parseObject(message, XLHBean.class);
|
XLHBean xlhBean=JSON.parseObject(message, XLHBean.class);
|
||||||
// 将事件处理放到主线程执行
|
// 将事件处理放到主线程执行
|
||||||
new Handler(Looper.getMainLooper()).post(() -> {
|
new Handler(Looper.getMainLooper()).post(() -> {
|
||||||
// processMessageType(type, message);
|
processMessageType(type, message);
|
||||||
EventBus.getDefault().post(xlhBean);
|
EventBus.getDefault().post(xlhBean);
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置麦位数据
|
* 设置麦位数据
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -83,10 +83,12 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
|
|||||||
public void onVideoComplete() {
|
public void onVideoComplete() {
|
||||||
LogUtils.e("onVideoComplete");
|
LogUtils.e("onVideoComplete");
|
||||||
post(() -> {
|
post(() -> {
|
||||||
|
if (playerMp4View!=null) {
|
||||||
playerMp4View.setVisibility(View.GONE);
|
playerMp4View.setVisibility(View.GONE);
|
||||||
// 通知播放完成
|
// 通知播放完成
|
||||||
notifyPlaybackComplete();
|
notifyPlaybackComplete();
|
||||||
loadStartSVGAPlayer();
|
loadStartSVGAPlayer();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -415,7 +417,9 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
|
|||||||
@Override
|
@Override
|
||||||
public void onFinishedDisplay(GiftSvgaView view) {
|
public void onFinishedDisplay(GiftSvgaView view) {
|
||||||
post(() -> {
|
post(() -> {
|
||||||
|
if (svgaView!=null) {
|
||||||
svgaView.setVisibility(View.GONE);
|
svgaView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
// 通知播放完成
|
// 通知播放完成
|
||||||
notifyPlaybackComplete();
|
notifyPlaybackComplete();
|
||||||
loadStartSVGAPlayer();
|
loadStartSVGAPlayer();
|
||||||
|
|||||||
@@ -1,322 +0,0 @@
|
|||||||
package com.xscm.moduleutil.widget;
|
|
||||||
|
|
||||||
|
|
||||||
import static android.app.PendingIntent.getActivity;
|
|
||||||
import static android.content.Context.WINDOW_SERVICE;
|
|
||||||
import static androidx.core.content.ContextCompat.getSystemService;
|
|
||||||
|
|
||||||
import static com.blankj.utilcode.util.ActivityUtils.startActivityForResult;
|
|
||||||
|
|
||||||
import android.animation.Animator;
|
|
||||||
import android.animation.AnimatorListenerAdapter;
|
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.provider.Settings;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.animation.DecelerateInterpolator;
|
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
import com.petterp.floatingx.FloatingX;
|
|
||||||
import com.petterp.floatingx.assist.FxGravity;
|
|
||||||
import com.petterp.floatingx.assist.FxScopeType;
|
|
||||||
import com.petterp.floatingx.assist.helper.FxAppHelper;
|
|
||||||
import com.xscm.moduleutil.R;
|
|
||||||
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
|
|
||||||
import com.xscm.moduleutil.bean.XLHBean;
|
|
||||||
import com.xscm.moduleutil.event.MqttBean;
|
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
|
||||||
|
|
||||||
import java.util.Queue;
|
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author
|
|
||||||
* @Time 2025/7/18 21:52
|
|
||||||
* @Description 飘屏管理器
|
|
||||||
*/
|
|
||||||
public class PiaoPingManager {
|
|
||||||
private static PiaoPingManager instance;
|
|
||||||
private WindowManager windowManager;
|
|
||||||
private View piaoPingView;
|
|
||||||
private boolean isPiaoPingShown = false;
|
|
||||||
private Queue<MqttBean> messageQueue = new ConcurrentLinkedQueue<>(); // 消息队列
|
|
||||||
private Queue<XLHBean> XLHmessageQueue = new ConcurrentLinkedQueue<>(); // 消息队列
|
|
||||||
private boolean isAnimating = false; // 动画状态标记
|
|
||||||
private boolean XLHisAnimating = false; // 动画状态标记
|
|
||||||
|
|
||||||
private Context mContext; // 添加成员变量
|
|
||||||
View floatingView;
|
|
||||||
|
|
||||||
private PiaoPingManager(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
windowManager = (WindowManager) context.getSystemService(WINDOW_SERVICE);
|
|
||||||
if (windowManager == null) return;
|
|
||||||
|
|
||||||
// 创建飘屏消息的布局
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(context);
|
|
||||||
piaoPingView = inflater.inflate(R.layout.item_piaoping, null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized PiaoPingManager getInstance(Context context) {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new PiaoPingManager(context.getApplicationContext());
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showPiaoPingMessage(MqttBean mqttBean) {
|
|
||||||
// 创建 FloatingX 配置
|
|
||||||
// 添加到队列
|
|
||||||
messageQueue.offer(mqttBean);
|
|
||||||
// 如果当前没有动画正在进行,则开始处理
|
|
||||||
// if (!isAnimating) {
|
|
||||||
processNextMessage();
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processNextMessage() {
|
|
||||||
if (messageQueue.isEmpty()) {
|
|
||||||
isAnimating = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
isAnimating = true;
|
|
||||||
MqttBean mqttBean = messageQueue.poll();
|
|
||||||
|
|
||||||
displayMessage(mqttBean);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayMessage(MqttBean mqttBean) {
|
|
||||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
// WindowManager.LayoutParams params = new WindowManager.LayoutParams(
|
|
||||||
// WindowManager.LayoutParams.WRAP_CONTENT,
|
|
||||||
// WindowManager.LayoutParams.WRAP_CONTENT,
|
|
||||||
// WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
|
|
||||||
// WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
|
|
||||||
// PixelFormat.TRANSLUCENT
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
|
||||||
ToastUtils.show("飘屏开始");
|
|
||||||
// 获取悬浮窗视图并设置内容
|
|
||||||
floatingView = LayoutInflater.from(mContext).inflate(R.layout.item_piaoping, new FrameLayout(mContext), false);
|
|
||||||
TextView textView = floatingView.findViewById(R.id.tv_name);
|
|
||||||
TextView textView2 = floatingView.findViewById(R.id.tv_to_name);
|
|
||||||
textView2.setText("送给" + mqttBean.getList().getToUserName());
|
|
||||||
textView.setText(mqttBean.getList().getFromUserName());
|
|
||||||
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), floatingView.findViewById(R.id.iv_piaoping));
|
|
||||||
TextView tv_time = floatingView.findViewById(R.id.tv_num);
|
|
||||||
tv_time.setText("x" + mqttBean.getList().getNumber());
|
|
||||||
ToastUtils.show("飘屏创建");
|
|
||||||
|
|
||||||
// WindowManager windowManager = (WindowManager) mContext.getSystemService(WINDOW_SERVICE);
|
|
||||||
// windowManager.addView(floatingView, params);
|
|
||||||
// }else {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// 先将视图放置在屏幕右侧外部,避免闪现问题
|
|
||||||
floatingView.setTranslationX(10000); // 先放到屏幕外
|
|
||||||
// 在 FloatingX 配置中或者通过其他方式设置
|
|
||||||
FxAppHelper fxAppHelper = FxAppHelper.builder()
|
|
||||||
.setContext(mContext)
|
|
||||||
.setLayoutView(floatingView)
|
|
||||||
.setGravity(FxGravity.RIGHT_OR_TOP)
|
|
||||||
.setX(0)
|
|
||||||
.setY(100)
|
|
||||||
.setScopeType(FxScopeType.SYSTEM_AUTO)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
FloatingX.install(fxAppHelper).show();
|
|
||||||
ToastUtils.show("飘屏创建2");
|
|
||||||
// 首先从右侧滑入到屏幕中央
|
|
||||||
floatingView.post(() -> {
|
|
||||||
// 确保初始位置在屏幕右侧外部
|
|
||||||
floatingView.setTranslationX(floatingView.getWidth());
|
|
||||||
|
|
||||||
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
|
||||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
|
||||||
floatingView.getWidth(), 0f);
|
|
||||||
animator1.setDuration(1500); // 延长动画时间到1.5秒
|
|
||||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
|
||||||
animator1.start();
|
|
||||||
ToastUtils.show("飘屏创建2第一阶段");
|
|
||||||
// 第二阶段:延迟1秒后从当前位置向左滑出
|
|
||||||
floatingView.postDelayed(() -> {
|
|
||||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
|
||||||
0f, -floatingView.getWidth());
|
|
||||||
animator2.setDuration(1500); // 延长动画时间到1.5秒
|
|
||||||
animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
|
||||||
animator2.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
// 动画结束后移除悬浮窗
|
|
||||||
FloatingX.uninstallAll();
|
|
||||||
windowManager.removeView(floatingView);
|
|
||||||
// 处理下一个消息
|
|
||||||
processNextMessage();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
animator2.start();
|
|
||||||
}, 3000); // 停留1秒
|
|
||||||
ToastUtils.show("飘屏创建2第er阶段");
|
|
||||||
});
|
|
||||||
ToastUtils.show("飘屏结束");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void subscribe() {
|
|
||||||
try {
|
|
||||||
if (!EventBus.getDefault().isRegistered(this)) {
|
|
||||||
EventBus.getDefault().register(this);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 处理重复注册或其他异常
|
|
||||||
LogUtils.e("PiaoPingManager subscribe error: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unsubscribe() {
|
|
||||||
try {
|
|
||||||
if (EventBus.getDefault().isRegistered(this)) {
|
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 处理取消注册异常
|
|
||||||
LogUtils.e("PiaoPingManager unsubscribe error: " + e.getMessage());
|
|
||||||
}
|
|
||||||
messageQueue.clear();
|
|
||||||
isAnimating = false; // 重置动画状态
|
|
||||||
XLHmessageQueue.clear();
|
|
||||||
XLHisAnimating = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void onMessageReceived(MqttBean mqttBean) {
|
|
||||||
showPiaoPingMessage(mqttBean);
|
|
||||||
ToastUtils.show("飘屏");
|
|
||||||
// FxAppHelper fxAppHelper = FxAppHelper.builder().setContext( context).setLayout(R.layout.item_piaoping).build();
|
|
||||||
// FloatingX.install(fxAppHelper).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void onEvent(XLHBean event) {
|
|
||||||
showPiaoPingMessageXlh(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showPiaoPingMessageXlh(XLHBean event) {
|
|
||||||
// 创建 FloatingX 配置
|
|
||||||
// 添加到队列
|
|
||||||
XLHmessageQueue.offer(event);
|
|
||||||
// 如果当前没有动画正在进行,则开始处理
|
|
||||||
if (!XLHisAnimating) {
|
|
||||||
processNextMessageXlh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processNextMessageXlh() {
|
|
||||||
if (XLHmessageQueue.isEmpty()) {
|
|
||||||
XLHisAnimating = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
XLHisAnimating = true;
|
|
||||||
XLHBean xlhBean = XLHmessageQueue.poll();
|
|
||||||
displayMessageXlh(xlhBean);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint({"MissingInflatedId", "LocalSuppress"})
|
|
||||||
private void displayMessageXlh(XLHBean xlhBean) {
|
|
||||||
// 获取悬浮窗视图并设置内容
|
|
||||||
View floatingView = LayoutInflater.from(mContext).inflate(R.layout.item_piaoping_xlh, new FrameLayout(mContext), false);
|
|
||||||
TextView textView = floatingView.findViewById(R.id.tv_name);
|
|
||||||
ImageView xlh_image = floatingView.findViewById(R.id.im_xlh);
|
|
||||||
// if (xlhBean.getFrom_type() == 1){
|
|
||||||
// xlh_image.setImageResource(R.mipmap.xlh_jjks);
|
|
||||||
// }else {
|
|
||||||
// xlh_image.setImageResource(R.mipmap.xlh_zsks);
|
|
||||||
// }
|
|
||||||
|
|
||||||
xlh_image.setImageDrawable(xlhBean.getFrom_type() == 1 ? mContext.getResources().getDrawable(R.mipmap.xlh_jjks) : mContext.getResources().getDrawable(R.mipmap.xlh_zsks));
|
|
||||||
|
|
||||||
textView.setText(xlhBean.getText());
|
|
||||||
|
|
||||||
// 先将视图放置在屏幕右侧外部,避免闪现问题
|
|
||||||
floatingView.setTranslationX(10000); // 先放到屏幕外
|
|
||||||
|
|
||||||
FxAppHelper fxAppHelper = FxAppHelper.builder()
|
|
||||||
.setContext(mContext)
|
|
||||||
.setLayoutView(floatingView)
|
|
||||||
.setGravity(FxGravity.RIGHT_OR_TOP)
|
|
||||||
.setX(0)
|
|
||||||
.setY(100)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
FloatingX.install(fxAppHelper).show();
|
|
||||||
// 添加点击事件监听器
|
|
||||||
floatingView.setOnClickListener(v -> {
|
|
||||||
// 点击时执行跳转操作
|
|
||||||
handleItemClick(xlhBean);
|
|
||||||
});
|
|
||||||
// 首先从右侧滑入到屏幕中央
|
|
||||||
floatingView.post(() -> {
|
|
||||||
// 确保初始位置在屏幕右侧外部
|
|
||||||
floatingView.setTranslationX(floatingView.getWidth());
|
|
||||||
|
|
||||||
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
|
||||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
|
||||||
floatingView.getWidth(), 0f);
|
|
||||||
animator1.setDuration(1500); // 延长动画时间到1.5秒
|
|
||||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
|
||||||
animator1.start();
|
|
||||||
|
|
||||||
// 第二阶段:延迟1秒后从当前位置向左滑出
|
|
||||||
floatingView.postDelayed(() -> {
|
|
||||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
|
||||||
0f, -floatingView.getWidth());
|
|
||||||
animator2.setDuration(1500); // 延长动画时间到1.5秒
|
|
||||||
animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
|
||||||
animator2.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
// 动画结束后移除悬浮窗
|
|
||||||
FloatingX.uninstallAll();
|
|
||||||
// 处理下一个消息
|
|
||||||
processNextMessageXlh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
animator2.start();
|
|
||||||
}, 4000); // 停留1秒
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleItemClick(XLHBean xlhBean) {
|
|
||||||
// 这里可以根据实际需求实现跳转逻辑
|
|
||||||
// 例如:跳转到礼物详情页面、用户主页等
|
|
||||||
|
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", xlhBean.getRoom_id()).navigation();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -105,6 +105,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
|||||||
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
|
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
|
||||||
mIvTagBoss.setVisibility(GONE);
|
mIvTagBoss.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
|
mCharmView.setVisibility(VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
mTvName.setText((!"10".equals(pitBean.getPit_number()) && !"9".equals(pitBean.getPit_number())) ? pitBean.getPit_number() : "");
|
mTvName.setText((!"10".equals(pitBean.getPit_number()) && !"9".equals(pitBean.getPit_number())) ? pitBean.getPit_number() : "");
|
||||||
//麦位上锁
|
//麦位上锁
|
||||||
@@ -129,6 +130,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
|||||||
//停止声浪
|
//停止声浪
|
||||||
mIvRipple.stopAnimation( true);
|
mIvRipple.stopAnimation( true);
|
||||||
mIvRipple.setVisibility(GONE);
|
mIvRipple.setVisibility(GONE);
|
||||||
|
mCharmView.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
if (showSexIcon) {
|
if (showSexIcon) {
|
||||||
checkSex();
|
checkSex();
|
||||||
@@ -256,7 +258,11 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
|||||||
final float scale = getContext().getResources().getDisplayMetrics().density;
|
final float scale = getContext().getResources().getDisplayMetrics().density;
|
||||||
return (int) (dpValue * scale + 0.5f);
|
return (int) (dpValue * scale + 0.5f);
|
||||||
}
|
}
|
||||||
|
// public void setmCharmView(String charm){
|
||||||
|
// if (mCharmView!=null){
|
||||||
|
// mCharmView.setSex(pitBean.getSex(),pitBean.getUser_id(), charm,false);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开启计时
|
* 开启计时
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.xscm.moduleutil.R;
|
|||||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
|
import com.xscm.moduleutil.utils.StringUtil;
|
||||||
|
|
||||||
|
|
||||||
public class RoomMakeWheatView extends BaseWheatView {
|
public class RoomMakeWheatView extends BaseWheatView {
|
||||||
@@ -156,7 +157,7 @@ public class RoomMakeWheatView extends BaseWheatView {
|
|||||||
}else {
|
}else {
|
||||||
mTvTime.setVisibility(VISIBLE);
|
mTvTime.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
mTvTime.setText(pitBean.getCharm());
|
mTvTime.setText(StringUtil.toWan2(pitBean.getCharm(),1));
|
||||||
}else if (pitBean.getPit_number().equals("000")){
|
}else if (pitBean.getPit_number().equals("000")){
|
||||||
iv_tag_type.setVisibility(GONE);
|
iv_tag_type.setVisibility(GONE);
|
||||||
mCharmView.setVisibility(GONE);
|
mCharmView.setVisibility(GONE);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -34,13 +35,17 @@ import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
|||||||
import com.xscm.moduleutil.databinding.FragmentRewardGiftDialogBinding;
|
import com.xscm.moduleutil.databinding.FragmentRewardGiftDialogBinding;
|
||||||
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
||||||
import com.xscm.moduleutil.event.GiftRewardEvent;
|
import com.xscm.moduleutil.event.GiftRewardEvent;
|
||||||
|
import com.xscm.moduleutil.event.GiftUserRefreshEvent;
|
||||||
import com.xscm.moduleutil.presenter.RewardGiftContacts;
|
import com.xscm.moduleutil.presenter.RewardGiftContacts;
|
||||||
import com.xscm.moduleutil.presenter.RewardGiftPresenter;
|
import com.xscm.moduleutil.presenter.RewardGiftPresenter;
|
||||||
import com.xscm.moduleutil.utils.ColorManager;
|
import com.xscm.moduleutil.utils.ColorManager;
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
||||||
|
import com.xscm.moduleutil.widget.floatingView.IFloatingView;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -101,6 +106,9 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
|||||||
mGiftNumList.add(new GiftNumBean("10", "x10"));
|
mGiftNumList.add(new GiftNumBean("10", "x10"));
|
||||||
mGiftNumList.add(new GiftNumBean("5", "x5"));
|
mGiftNumList.add(new GiftNumBean("5", "x5"));
|
||||||
mGiftNumList.add(new GiftNumBean("1", "x1"));
|
mGiftNumList.add(new GiftNumBean("1", "x1"));
|
||||||
|
if (!EventBus.getDefault().isRegistered( this)){
|
||||||
|
EventBus.getDefault().register(this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,46 +197,108 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
|||||||
mBinding.tvRewardTitle.setVisibility(View.VISIBLE);
|
mBinding.tvRewardTitle.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private List<GiftLabelBean> giftLabelBeanList;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||||
|
// giftLabelBeanList = new ArrayList<>();
|
||||||
|
// giftLabelBeanList.addAll(giftLabelBeans);
|
||||||
|
// GiftLabelBean giftLabelBean = new GiftLabelBean();
|
||||||
|
// giftLabelBean.setId("0");
|
||||||
|
// giftLabelBean.setName("背包");
|
||||||
|
// giftLabelBeans.add(0, giftLabelBean);
|
||||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans,fragmentList,""));
|
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans,fragmentList,""));
|
||||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||||
mBinding.slidingTabLayout.setCurrentTab(0);
|
mBinding.slidingTabLayout.setCurrentTab(0);
|
||||||
|
refreshCurrentGiftFragment(giftLabelBeans.get(0).getId(),2,"");
|
||||||
|
mBinding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
// 当页面切换时,控制 tv_bb_qs 按钮的显示
|
||||||
|
refreshCurrentGiftFragment(giftLabelBeans.get(position).getId(),2,"");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
private void refreshCurrentGiftFragment(String id,int type,String roomId) {
|
||||||
|
if (getCurrentGiftFragment()!=null){
|
||||||
|
getCurrentGiftFragment().loadDataIfNeeded(id,type,roomId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private GiftTwoDetailsFragment getCurrentGiftFragment() {
|
||||||
|
int currentPosition = mBinding.viewPager.getCurrentItem();
|
||||||
|
// 使用 ViewPager 的 adapter 获取当前 fragment
|
||||||
|
MyFragmentPagerAdapter adapter = (MyFragmentPagerAdapter) mBinding.viewPager.getAdapter();
|
||||||
|
if (adapter != null) {
|
||||||
|
// 直接从 adapter 获取 fragment
|
||||||
|
Fragment fragment = adapter.getItem(currentPosition);
|
||||||
|
if (fragment instanceof GiftTwoDetailsFragment) {
|
||||||
|
return (GiftTwoDetailsFragment) fragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private GiftPackBean giftModel = null;
|
||||||
private int getSelectedGift() {
|
private int getSelectedGift() {
|
||||||
int currentItem = mBinding.viewPager.getCurrentItem();
|
int currentItem = mBinding.viewPager.getCurrentItem();
|
||||||
// if (currentItem < 1) { //比2小是才是礼物
|
// if (currentItem < 1) { //比2小是才是礼物
|
||||||
GiftTwoDetailsFragment fragment = (GiftTwoDetailsFragment) fragmentList.get(currentItem);
|
// GiftTwoDetailsFragment fragment = (GiftTwoDetailsFragment) fragmentList.get(currentItem);
|
||||||
roonGiftModel = fragment.getGiftList();
|
// roonGiftModel = fragment.getGiftList();
|
||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
// GiftFragment fragment = (GiftFragment) fragmentList.get(currentItem);
|
// GiftFragment fragment = (GiftFragment) fragmentList.get(currentItem);
|
||||||
// giftModel = fragment.getmData();
|
// giftModel = fragment.getmData();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (currentItem < 1) { //比1小的是背包
|
||||||
|
// GiftTwoDetailsFragment fragment = (GiftTwoDetailsFragment) fragmentList.get(currentItem);
|
||||||
|
// if (fragment != null && giftModel == null) {
|
||||||
|
// giftModel = fragment.mGiftList();
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// GiftTwoDetailsFragment fragment = (GiftTwoDetailsFragment) fragmentList.get(currentItem);
|
||||||
|
// if (fragment != null && roonGiftModel == null) {
|
||||||
|
// roonGiftModel = fragment.getGiftList();
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
return currentItem;
|
return currentItem;
|
||||||
}
|
}
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void userRefresh(GiftUserRefreshEvent event) {
|
||||||
|
if (event.addSelf) {
|
||||||
|
roonGiftModel = event.gift;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void giveGift(String num) {
|
private void giveGift(String num) {
|
||||||
getSelectedGift();
|
getSelectedGift();
|
||||||
int currentItem = mBinding.viewPager.getCurrentItem();
|
int currentItem = mBinding.viewPager.getCurrentItem();
|
||||||
String userId = user_id;
|
String userId = user_id;
|
||||||
if (currentItem < 1) {
|
// if (currentItem < 1) {
|
||||||
if (roonGiftModel == null) {
|
// if (roonGiftModel == null) {
|
||||||
ToastUtils.show("请选择礼物");
|
// ToastUtils.show("请选择礼物");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
if (TextUtils.isEmpty(num)) {
|
// if (TextUtils.isEmpty(num)) {
|
||||||
ToastUtils.show("请选择打赏礼物数量");
|
// ToastUtils.show("请选择打赏礼物数量");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if (Integer.valueOf(num) <= 0) {
|
// if (Integer.valueOf(num) <= 0) {
|
||||||
ToastUtils.show("请选择打赏礼物数量");
|
// ToastUtils.show("请选择打赏礼物数量");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
if (roonGiftModel == null) {
|
if (roonGiftModel == null) {
|
||||||
ToastUtils.show("请选择礼物");
|
ToastUtils.show("请选择礼物");
|
||||||
return;
|
return;
|
||||||
@@ -242,7 +312,7 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
|||||||
ToastUtils.show("请选择打赏礼物数量");
|
ToastUtils.show("请选择打赏礼物数量");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
// if (currentItem == 0) {
|
// if (currentItem == 0) {
|
||||||
//礼物打赏
|
//礼物打赏
|
||||||
@@ -298,24 +368,61 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
if (!EventBus.getDefault().isRegistered( this)){
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (!EventBus.getDefault().isRegistered( this)){
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
private List<GiftLabelBean> list;
|
private List<GiftLabelBean> list;
|
||||||
private List<Fragment> fragmentList ;
|
private List<Fragment> fragmentList;
|
||||||
private String roomId;
|
private String roomId;
|
||||||
|
|
||||||
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list,List<Fragment> fragmentList,String roomId) {
|
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list, List<Fragment> fragmentList, String roomId) {
|
||||||
super(fm);
|
super(fm);
|
||||||
this.list = list;
|
this.list = list != null ? list : new ArrayList<>();
|
||||||
this.fragmentList = fragmentList;
|
// 不直接使用传入的 fragmentList,而是创建一个新的列表
|
||||||
|
this.fragmentList = new ArrayList<>();
|
||||||
|
// 初始化 fragmentList 的大小,用 null 填充
|
||||||
|
for (int i = 0; i < this.list.size(); i++) {
|
||||||
|
this.fragmentList.add(null);
|
||||||
|
}
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
|
// 边界检查
|
||||||
|
if (position < 0 || list == null || position >= list.size()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查该位置是否已经有 Fragment 实例
|
||||||
|
if (position < fragmentList.size() && fragmentList.get(position) != null) {
|
||||||
|
return fragmentList.get(position);
|
||||||
|
}
|
||||||
|
// 创建新的 Fragment
|
||||||
GiftLabelBean model = list.get(position);
|
GiftLabelBean model = list.get(position);
|
||||||
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 2, roomId);
|
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 1, roomId);
|
||||||
fragmentList.add(fragment); // 保存 Fragment 实例
|
// 确保 fragmentList 有足够的空间
|
||||||
|
while (fragmentList.size() <= position) {
|
||||||
|
fragmentList.add(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在指定位置设置 Fragment 实例
|
||||||
|
fragmentList.set(position, fragment);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,6 +434,9 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getPageTitle(int position) {
|
public CharSequence getPageTitle(int position) {
|
||||||
|
if (list == null || position < 0 || position >= list.size()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
GiftLabelBean model = list.get(position);
|
GiftLabelBean model = list.get(position);
|
||||||
return model.getName();
|
return model.getName();
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 794 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/bg_room_gift.webp
Normal file
|
After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 502 B |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/detail_icon_go.webp
Normal file
|
After Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 2.2 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/group.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 652 B |
|
Before Width: | Height: | Size: 1.6 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/icon_btn_radio_0.webp
Normal file
|
After Width: | Height: | Size: 550 B |
|
Before Width: | Height: | Size: 1.2 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/icon_btn_radio_1.webp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/icon_pay_select.webp
Normal file
|
After Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/icon_pay_unselect.webp
Normal file
|
After Width: | Height: | Size: 652 B |
|
Before Width: | Height: | Size: 5.3 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/img_emperor.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 33 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/me_avatar_bg.webp
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 690 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/phonetic.webp
Normal file
|
After Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 652 B |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00000.webp
Normal file
|
After Width: | Height: | Size: 340 B |
|
Before Width: | Height: | Size: 858 B |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00001.webp
Normal file
|
After Width: | Height: | Size: 510 B |
|
Before Width: | Height: | Size: 876 B |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00002.webp
Normal file
|
After Width: | Height: | Size: 524 B |
|
Before Width: | Height: | Size: 1.1 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00003.webp
Normal file
|
After Width: | Height: | Size: 678 B |
|
Before Width: | Height: | Size: 1.2 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00004.webp
Normal file
|
After Width: | Height: | Size: 680 B |
|
Before Width: | Height: | Size: 1.5 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00005.webp
Normal file
|
After Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 1.6 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00006.webp
Normal file
|
After Width: | Height: | Size: 860 B |
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00007.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00008.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00009.webp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00010.webp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00011.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00012.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00013.webp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00014.webp
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00015.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/star_00016.webp
Normal file
|
After Width: | Height: | Size: 1.8 KiB |