1:修改送礼中趣味的岁月之城和时空之巅,不需要选择人员就可以打开
2:优化用在房间点击用户,点击抱麦出现的错误 3: 在岁月之城和时空之巅中查看记录的时候,进行判断,当返回的nickname是null的时候,就直接不展示赠与 4:修改任务UI, 5:添加房间暴币功能 6:修改房间暴币飘屏 7:添加启动页动画 8:修改房间的设置
This commit is contained in:
@@ -10,7 +10,7 @@ import com.xscm.modulemain.Application;
|
||||
*/
|
||||
|
||||
public class AppContext extends Application {
|
||||
|
||||
private static boolean isKilled = false;
|
||||
private boolean mBeautyInited;
|
||||
|
||||
@Override
|
||||
@@ -18,7 +18,7 @@ public class AppContext extends Application {
|
||||
super.onCreate();
|
||||
ToastUtils.init(this);
|
||||
ARouter.init(this);
|
||||
|
||||
isKilled = true;
|
||||
/* mqttClient = MyMQTTClient.getInstance(this);
|
||||
mqttClient.initialize("tcp://81.70.45.221:1883");
|
||||
new Thread(() -> {
|
||||
@@ -39,6 +39,15 @@ public class AppContext extends Application {
|
||||
// });
|
||||
// L.setDeBug(BuildConfig.DEBUG);
|
||||
}
|
||||
|
||||
public static boolean isKilled() {
|
||||
return isKilled;
|
||||
}
|
||||
|
||||
public static void setKilled(boolean killed) {
|
||||
isKilled = killed;
|
||||
}
|
||||
|
||||
public static void initSdk() {
|
||||
// CommonAppContext context = CommonAppContext.getInstance();
|
||||
|
||||
|
||||
@@ -3,15 +3,25 @@ package com.qxcm.qxlive;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.PersistableBundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.qxcm.qxlive.databinding.ActivityLaunchPageBinding;
|
||||
import com.tencent.qgame.animplayer.AnimConfig;
|
||||
import com.tencent.qgame.animplayer.inter.IAnimListener;
|
||||
import com.xscm.modulemain.BaseMvpActivity;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
@@ -60,11 +70,12 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
|
||||
private Handler handler;
|
||||
private PolicyDialog policyDialog;
|
||||
private AppStateListener appStateListener;
|
||||
private VideoView videoView;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
|
||||
super.onCreate(savedInstanceState, persistentState);
|
||||
|
||||
LogUtils.e("4444","LaunchPageActivity onCreate");
|
||||
// 获取Application实例并设置监听器
|
||||
CommonAppContext app = (CommonAppContext) getApplication();
|
||||
appStateListener = AppStateManager.getInstance();
|
||||
@@ -113,6 +124,35 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
|
||||
initLogin();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
// 如果 PolicyDialog 仍在显示,则 dismiss 它
|
||||
if (policyDialog != null && policyDialog.isShowing()) {
|
||||
policyDialog.dismiss();
|
||||
policyDialog = null;
|
||||
}
|
||||
|
||||
// 移除所有待处理的回调以防止内存泄漏
|
||||
if (handler != null) {
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
if (videoView != null) {
|
||||
videoView.stopPlayback();
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IPresenter bindPresenter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setEnter(){
|
||||
if (SpUtil.isAgreePolicy()) {
|
||||
initLogin();
|
||||
// //延迟1.5秒执行
|
||||
@@ -137,32 +177,86 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
|
||||
policyDialog.show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
// 如果 PolicyDialog 仍在显示,则 dismiss 它
|
||||
if (policyDialog != null && policyDialog.isShowing()) {
|
||||
policyDialog.dismiss();
|
||||
policyDialog = null;
|
||||
}
|
||||
|
||||
// 移除所有待处理的回调以防止内存泄漏
|
||||
if (handler != null) {
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IPresenter bindPresenter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
if (AppContext.isKilled()) {
|
||||
videoView = new VideoView(this);
|
||||
// 创建LayoutParams并设置MATCH_PARENT
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
);
|
||||
// 设置gravity来填充整个布局
|
||||
params.gravity = Gravity.FILL;
|
||||
mBinding.root.addView(videoView, params);
|
||||
|
||||
// 设置视频缩放模式为拉伸填充
|
||||
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
||||
@Override
|
||||
public void onPrepared(MediaPlayer mp) {
|
||||
// 获取视频的宽高
|
||||
int videoWidth = mp.getVideoWidth();
|
||||
int videoHeight = mp.getVideoHeight();
|
||||
// 获取屏幕的宽高
|
||||
int screenWidth = getResources().getDisplayMetrics().widthPixels;
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
|
||||
// 计算缩放比例
|
||||
float scaleX = (float) screenWidth / videoWidth;
|
||||
float scaleY = (float) screenHeight / videoHeight;
|
||||
|
||||
// 选择较大的缩放比例,确保视频填满屏幕
|
||||
float scale = Math.max(scaleX, scaleY);
|
||||
|
||||
// 计算实际显示的宽高
|
||||
int scaledWidth = (int) (videoWidth * scale);
|
||||
int scaledHeight = (int) (videoHeight * scale);
|
||||
|
||||
// 设置VideoView的布局参数
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(scaledWidth, scaledHeight);
|
||||
layoutParams.gravity = Gravity.CENTER;
|
||||
videoView.setLayoutParams(layoutParams);
|
||||
}
|
||||
});
|
||||
// 设置视频路径,从raw资源中
|
||||
String videoPath = "android.resource://" + getPackageName() + "/" + R.raw.app_start;
|
||||
|
||||
// 设置播放完成监听器
|
||||
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mp) {
|
||||
// 播放完成后执行后续操作
|
||||
setEnter();
|
||||
}
|
||||
});
|
||||
|
||||
// 设置错误监听器
|
||||
videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
|
||||
@Override
|
||||
public boolean onError(MediaPlayer mp, int what, int extra) {
|
||||
// 发生错误时也执行后续操作
|
||||
setEnter();
|
||||
return true; // 返回true表示已处理错误
|
||||
}
|
||||
});
|
||||
|
||||
// 设置视频路径并开始播放
|
||||
try {
|
||||
videoView.setVideoURI(Uri.parse(videoPath));
|
||||
videoView.requestFocus(); // 请求焦点以确保视频能够播放
|
||||
videoView.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// 如果设置视频路径时出错,直接执行后续操作
|
||||
setEnter();
|
||||
}
|
||||
AppContext.setKilled(false);
|
||||
} else {
|
||||
setEnter();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -177,20 +271,19 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_launch_page;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!isTaskRoot()) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
// @Override
|
||||
// protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// if (!isTaskRoot()) {
|
||||
// finish();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
@@ -89,14 +89,14 @@
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:src="@mipmap/screen"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="visible" />
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/cover"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:clickable="true"-->
|
||||
<!-- android:src="@mipmap/screen"-->
|
||||
<!-- android:scaleType="centerCrop"-->
|
||||
<!-- android:visibility="visible" />-->
|
||||
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
Reference in New Issue
Block a user