diff --git a/app/src/leanback/java/com/fongmi/android/tv/ui/activity/HomeActivity.java b/app/src/leanback/java/com/fongmi/android/tv/ui/activity/HomeActivity.java index 5078f4ea5..55f8c4e4a 100644 --- a/app/src/leanback/java/com/fongmi/android/tv/ui/activity/HomeActivity.java +++ b/app/src/leanback/java/com/fongmi/android/tv/ui/activity/HomeActivity.java @@ -108,12 +108,23 @@ public class HomeActivity extends BaseActivity implements CustomTitleView.Listen checkAction(intent); } + // 在类里面定义一个静态变量,记录是否已经执行过自动跳转 + private static boolean hasAutoJumped = false; @Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.installSplashScreen(this); super.onCreate(savedInstanceState); - } + // 只有在没有跳转过的情况下才执行 + if (!hasAutoJumped) { + hasAutoJumped = true; // 标记为已跳转 + + new android.os.Handler(android.os.Looper.getMainLooper()).postDelayed(() -> { + android.content.Intent intent = new android.content.Intent(this, LiveActivity.class); + startActivity(intent); + // 这里不写 finish(),返回时就能回到首页 + }, 1000); + @Override protected void initView(Bundle savedInstanceState) { mResult = Result.empty(); @@ -486,4 +497,4 @@ public class HomeActivity extends BaseActivity implements CustomTitleView.Listen Server.get().stop(); super.onDestroy(); } -} \ No newline at end of file +}