From a66d4605724c4ebe973663e2f1b4e624e6419811 Mon Sep 17 00:00:00 2001 From: tarsin Date: Mon, 1 Aug 2022 09:35:02 +0800 Subject: [PATCH] Remove warning --- .../com/hippo/ehviewer/ui/MainActivity.java | 9 -- .../hippo/ehviewer/ui/scene/SolidScene.java | 10 +- .../hippo/ehviewer/ui/scene/WarningScene.java | 85 --------------- .../res/layout-television/scene_warning.xml | 101 ------------------ app/src/main/res/layout/scene_warning.xml | 82 -------------- 5 files changed, 2 insertions(+), 285 deletions(-) delete mode 100644 app/src/main/java/com/hippo/ehviewer/ui/scene/WarningScene.java delete mode 100644 app/src/main/res/layout-television/scene_warning.xml delete mode 100644 app/src/main/res/layout/scene_warning.xml diff --git a/app/src/main/java/com/hippo/ehviewer/ui/MainActivity.java b/app/src/main/java/com/hippo/ehviewer/ui/MainActivity.java index 67fca3a31..4866563c3 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/MainActivity.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/MainActivity.java @@ -71,7 +71,6 @@ import com.hippo.ehviewer.ui.scene.SecurityScene; import com.hippo.ehviewer.ui.scene.SelectSiteScene; import com.hippo.ehviewer.ui.scene.SignInScene; import com.hippo.ehviewer.ui.scene.SolidScene; -import com.hippo.ehviewer.ui.scene.WarningScene; import com.hippo.ehviewer.ui.scene.WebViewSignInScene; import com.hippo.ehviewer.widget.EhStageLayout; import com.hippo.io.UniFileInputStreamPipe; @@ -99,7 +98,6 @@ public final class MainActivity extends StageActivity static { registerLaunchMode(SecurityScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK); - registerLaunchMode(WarningScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK); registerLaunchMode(SignInScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK); registerLaunchMode(WebViewSignInScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK); registerLaunchMode(CookieSignInScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK); @@ -145,8 +143,6 @@ public final class MainActivity extends StageActivity protected Announcer getLaunchAnnouncer() { if (Settings.getSecurity() && SecurityScene.Companion.isAuthenticationSupported(this)) { return new Announcer(SecurityScene.class); - } else if (Settings.getShowWarning()) { - return new Announcer(WarningScene.class); } else if (EhUtils.needSignedIn(this)) { return new Announcer(SignInScene.class); } else if (Settings.getSelectSite()) { @@ -166,11 +162,6 @@ public final class MainActivity extends StageActivity newArgs.putString(SecurityScene.KEY_TARGET_SCENE, announcer.getClazz().getName()); newArgs.putBundle(SecurityScene.KEY_TARGET_ARGS, announcer.getArgs()); return new Announcer(SecurityScene.class).setArgs(newArgs); - } else if (Settings.getShowWarning()) { - Bundle newArgs = new Bundle(); - newArgs.putString(WarningScene.KEY_TARGET_SCENE, announcer.getClazz().getName()); - newArgs.putBundle(WarningScene.KEY_TARGET_ARGS, announcer.getArgs()); - return new Announcer(WarningScene.class).setArgs(newArgs); } else if (EhUtils.needSignedIn(this)) { Bundle newArgs = new Bundle(); newArgs.putString(SignInScene.KEY_TARGET_SCENE, announcer.getClazz().getName()); diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/SolidScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/SolidScene.java index 396e2b187..a4f82caa6 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/SolidScene.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/SolidScene.java @@ -29,9 +29,8 @@ import com.hippo.scene.Announcer; public class SolidScene extends BaseScene { public static final int CHECK_STEP_SECURITY = 0; - public static final int CHECK_STEP_WARNING = 1; - public static final int CHECK_STEP_SIGN_IN = 2; - public static final int CHECK_STEP_SELECT_SITE = 3; + public static final int CHECK_STEP_SIGN_IN = 1; + public static final int CHECK_STEP_SELECT_SITE = 2; public static final String KEY_TARGET_SCENE = "target_scene"; public static final String KEY_TARGET_ARGS = "target_args"; private static final String TAG = SolidScene.class.getSimpleName(); @@ -39,11 +38,6 @@ public class SolidScene extends BaseScene { public void startSceneForCheckStep(int checkStep, Bundle args) { switch (checkStep) { case CHECK_STEP_SECURITY: - if (Settings.getShowWarning()) { - startScene(new Announcer(WarningScene.class).setArgs(args), true); - break; - } - case CHECK_STEP_WARNING: if (EhUtils.needSignedIn(getContext())) { startScene(new Announcer(SignInScene.class).setArgs(args), true); break; diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/WarningScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/WarningScene.java deleted file mode 100644 index 3c4fc84fa..000000000 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/WarningScene.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2016 Hippo Seven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hippo.ehviewer.ui.scene; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.hippo.ehviewer.R; -import com.hippo.ehviewer.Settings; -import com.hippo.ehviewer.ui.MainActivity; -import com.hippo.ehviewer.ui.annotation.ViewLifeCircle; -import com.hippo.yorozuya.ViewUtils; - -public final class WarningScene extends SolidScene implements View.OnClickListener { - - @Nullable - private View mReject; - @Nullable - @ViewLifeCircle - private View mAccept; - - @Override - public boolean needShowLeftDrawer() { - return false; - } - - @NonNull - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.scene_warning, container, false); - - mReject = ViewUtils.$$(view, R.id.reject); - mAccept = ViewUtils.$$(view, R.id.accept); - - mReject.setOnClickListener(this); - mAccept.setOnClickListener(this); - - return view; - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - - mReject = null; - mAccept = null; - } - - @Override - public void onClick(View v) { - if (mReject == v) { - finishStage(); - } else if (mAccept == v) { - // Never show this warning anymore - Settings.putShowWarning(false); - - // Start new scene and finish it self - MainActivity activity = getMainActivity(); - if (null != activity) { - startSceneForCheckStep(CHECK_STEP_WARNING, getArguments()); - } - finish(); - } - } -} diff --git a/app/src/main/res/layout-television/scene_warning.xml b/app/src/main/res/layout-television/scene_warning.xml deleted file mode 100644 index 801ba42ef..000000000 --- a/app/src/main/res/layout-television/scene_warning.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - -