1:修改启动页播放视频

This commit is contained in:
2025-12-25 15:05:46 +08:00
parent 6b1614d768
commit 2adc4948c7

View File

@@ -34,50 +34,51 @@ import com.xscm.modulemain.dialog.PolicyDialog;
import com.xscm.moduleutil.base.WebUrlConstants; import com.xscm.moduleutil.base.WebUrlConstants;
import com.xscm.moduleutil.utils.ARouteConstants; import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.SpUtil; import com.xscm.moduleutil.utils.SpUtil;
/** /**
APP准备启动 * APP准备启动
* * <p>
* _oo0oo_ * _oo0oo_
* o8888888o * o8888888o
* 88" . "88 * 88" . "88
* (| -_- |) * (| -_- |)
* 0\ = /0 * 0\ = /0
* ___/`---'\___ * ___/`---'\___
* .' \\| |// '. * .' \\| |// '.
* / \\||| : |||// \ * / \\||| : |||// \
* / _||||| -卍-|||||- \ * / _||||| -卍-|||||- \
* | | \\\ - /// | | * | | \\\ - /// | |
* | \_| ''\---/'' |_/ | * | \_| ''\---/'' |_/ |
* \ .-\__ '-' ___/-. / * \ .-\__ '-' ___/-. /
* ___'. .' /--.--\ `. .'___ * ___'. .' /--.--\ `. .'___
* ."" '< `.___\_<|>_/___.' >' "". * ."" '< `.___\_<|>_/___.' >' "".
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * | | : `- \`.;`\ _ /`;.`/ - ` : | |
* \ \ `_. \_ __\ /__ _/ .-` / / * \ \ `_. \_ __\ /__ _/ .-` / /
*=====`-.____`.___ \_____/___.-`___.-'===== * =====`-.____`.___ \_____/___.-`___.-'=====
* `=---=' * `=---='
* * <p>
* 佛祖保佑 永无BUG * 佛祖保佑 永无BUG
* 佛曰: * 佛曰:
* 写字楼里写字间,写字间里程序员; * 写字楼里写字间,写字间里程序员;
* 程序人员写程序,又拿程序换酒钱。 * 程序人员写程序,又拿程序换酒钱。
* 酒醒只在网上坐,酒醉还来网下眠; * 酒醒只在网上坐,酒醉还来网下眠;
* 酒醉酒醒日复日,网上网下年复年。 * 酒醉酒醒日复日,网上网下年复年。
* 但愿老死电脑间,不愿鞠躬老板前; * 但愿老死电脑间,不愿鞠躬老板前;
* 奔驰宝马贵者趣,公交自行程序员。 * 奔驰宝马贵者趣,公交自行程序员。
* 别人笑我忒疯癫,我笑自己命太贱; * 别人笑我忒疯癫,我笑自己命太贱;
* 不见满街漂亮妹,哪个归得程序员? * 不见满街漂亮妹,哪个归得程序员?
*/ */
public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunchPageBinding> implements IView<Activity> { public class LaunchPageActivity extends BaseMvpActivity<IPresenter, ActivityLaunchPageBinding> implements IView<Activity> {
private Handler handler; private Handler handler;
private PolicyDialog policyDialog; private PolicyDialog policyDialog;
private AppStateListener appStateListener; private AppStateListener appStateListener;
private VideoView videoView; private VideoView videoView;
private boolean isCheck=true; private boolean isCheck = true;
@Override @Override
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);
LogUtils.e("4444","LaunchPageActivity onCreate"); LogUtils.e("4444", "LaunchPageActivity onCreate");
// 获取Application实例并设置监听器 // 获取Application实例并设置监听器
CommonAppContext app = (CommonAppContext) getApplication(); CommonAppContext app = (CommonAppContext) getApplication();
appStateListener = AppStateManager.getInstance(); appStateListener = AppStateManager.getInstance();
@@ -87,7 +88,7 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
if (SpUtil.getUnderagePassword() != null && !SpUtil.getUnderagePassword().isEmpty()) { if (SpUtil.getUnderagePassword() != null && !SpUtil.getUnderagePassword().isEmpty()) {
Intent intent = new Intent(this, WebViewActivity.class); Intent intent = new Intent(this, WebViewActivity.class);
intent.putExtra("url", String.format(WebUrlConstants.INSTANCE.getWEB_ADOLESCENT_URL(),SpUtil.getToken())); intent.putExtra("url", String.format(WebUrlConstants.INSTANCE.getWEB_ADOLESCENT_URL(), SpUtil.getToken()));
intent.putExtra("title", "1"); intent.putExtra("title", "1");
startActivity(intent); startActivity(intent);
} else { } else {
@@ -176,14 +177,16 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
return null; return null;
} }
private void setEnter(){ private void setEnter() {
if (!isCheck) {
startActivity(new Intent(this, PasswordLoginActivity.class)); startActivity(new Intent(this, PasswordLoginActivity.class));
finish(); finish();
isCheck = true;
}
} }
private void setViodeo(){ private void setViodeo() {
// 创建VideoView并添加到布局中 // 创建VideoView并添加到布局中
videoView = new VideoView(this); videoView = new VideoView(this);
// 创建LayoutParams并设置MATCH_PARENT // 创建LayoutParams并设置MATCH_PARENT
@@ -242,7 +245,7 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
@Override @Override
public void onCompletion(MediaPlayer mp) { public void onCompletion(MediaPlayer mp) {
// 播放完成后执行后续操作 // 播放完成后执行后续操作
isCheck=false; isCheck = false;
setEnter(); setEnter();
} }
}); });
@@ -252,7 +255,7 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
@Override @Override
public boolean onError(MediaPlayer mp, int what, int extra) { public boolean onError(MediaPlayer mp, int what, int extra) {
// 发生错误时也执行后续操作 // 发生错误时也执行后续操作
isCheck=false; isCheck = false;
setEnter(); setEnter();
return true; // 返回true表示已处理错误 return true; // 返回true表示已处理错误
} }
@@ -266,7 +269,7 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
// 如果设置视频路径时出错,直接执行后续操作 // 如果设置视频路径时出错,直接执行后续操作
isCheck=false; isCheck = false;
setEnter(); setEnter();
} }
@@ -276,7 +279,7 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
if (videoView != null) { if (videoView != null) {
videoView.stopPlayback(); videoView.stopPlayback();
} }
isCheck=false; isCheck = false;
setEnter(); setEnter();
}); });
@@ -286,7 +289,7 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
if (videoView != null) { if (videoView != null) {
videoView.stopPlayback(); videoView.stopPlayback();
} }
isCheck=false; isCheck = false;
setEnter(); setEnter();
}); });
} }
@@ -333,9 +336,7 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
if(isCheck) { setEnter();
setEnter();
}
} }
@Override @Override