mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 05:27:10 +08:00
feat: 开屏动画支持触摸立即终止
开屏展现期间任意触摸可立即终止动画,进入主窗口。 - 添加OnTouchListener监听触摸事件 - 抽取dismissSplash()统一处理定时到期和触摸终止 - 清除Handler回调和所有子视图动画防止内存泄漏 - 防止重复调用dismissSplash()导致异常
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Jul 10 20:15:30 CST 2026
|
||||
#Fri Jul 10 20:21:17 CST 2026
|
||||
stageCount=4
|
||||
libraryProject=
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.3
|
||||
buildCount=3
|
||||
buildCount=5
|
||||
baseBetaVersion=15.20.4
|
||||
|
||||
@@ -99,6 +99,14 @@ public class MainActivity extends BaseWinBoLLActivity {
|
||||
final TextView splashTitle = findViewById(R.id.splash_title);
|
||||
final TextView splashSubtitle = findViewById(R.id.splash_subtitle);
|
||||
|
||||
splashOverlay.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, android.view.MotionEvent event) {
|
||||
dismissSplash();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
AlphaAnimation fadeInTitle = new AlphaAnimation(0f, 1f);
|
||||
fadeInTitle.setDuration(SPLASH_FADE_IN);
|
||||
fadeInTitle.setFillAfter(true);
|
||||
@@ -113,23 +121,20 @@ public class MainActivity extends BaseWinBoLLActivity {
|
||||
splashHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AlphaAnimation fadeOut = new AlphaAnimation(1f, 0f);
|
||||
fadeOut.setDuration(SPLASH_FADE_OUT);
|
||||
fadeOut.setFillAfter(true);
|
||||
fadeOut.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
splashOverlay.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
});
|
||||
splashOverlay.startAnimation(fadeOut);
|
||||
dismissSplash();
|
||||
}
|
||||
}, SPLASH_DURATION);
|
||||
}
|
||||
|
||||
private void dismissSplash() {
|
||||
splashHandler.removeCallbacksAndMessages(null);
|
||||
if (splashOverlay == null || splashOverlay.getVisibility() != View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
splashOverlay.clearAnimation();
|
||||
for (int i = 0; i < ((android.view.ViewGroup) splashOverlay).getChildCount(); i++) {
|
||||
((android.view.ViewGroup) splashOverlay).getChildAt(i).clearAnimation();
|
||||
}
|
||||
splashOverlay.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user