diff --git a/android/app/src/main/java/games/wenzi/ogame/MainActivity.java b/android/app/src/main/java/games/wenzi/ogame/MainActivity.java index a6247d0..a859ce5 100644 --- a/android/app/src/main/java/games/wenzi/ogame/MainActivity.java +++ b/android/app/src/main/java/games/wenzi/ogame/MainActivity.java @@ -1,8 +1,13 @@ package games.wenzi.ogame; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; import android.graphics.Color; import android.os.Bundle; +import android.view.View; import android.view.Window; +import android.view.animation.AccelerateDecelerateInterpolator; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; @@ -22,6 +27,29 @@ public class MainActivity extends BridgeActivity { // 保持 SplashScreen 直到 WebView 加载完成 splashScreen.setKeepOnScreenCondition(() -> !isWebViewReady); + // 设置淡出退出动画 + splashScreen.setOnExitAnimationListener(splashScreenView -> { + // 创建淡出动画 + ObjectAnimator fadeOut = ObjectAnimator.ofFloat( + splashScreenView.getView(), + View.ALPHA, + 1f, + 0f + ); + fadeOut.setInterpolator(new AccelerateDecelerateInterpolator()); + fadeOut.setDuration(300); + + // 动画结束后移除 SplashScreen + fadeOut.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + splashScreenView.remove(); + } + }); + + fadeOut.start(); + }); + super.onCreate(savedInstanceState); Window window = getWindow(); diff --git a/android/app/src/main/res/drawable/splash_icon.xml b/android/app/src/main/res/drawable/splash_icon.xml new file mode 100644 index 0000000..696eac1 --- /dev/null +++ b/android/app/src/main/res/drawable/splash_icon.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 8a1365e..4a3dbdc 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -22,7 +22,12 @@ \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index ac69bf1..8e6a607 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,8 +1,6 @@