From d3f602aeda11fc3c0547a5310a10ff0cbaa41e86 Mon Sep 17 00:00:00 2001 From: tanwenkang Date: Sat, 13 Apr 2024 17:17:39 +0800 Subject: [PATCH] Remove ConductorImpl.java --- app/src/main/AndroidManifest.xml | 4 +++- build.gradle | 4 ++-- .../com/phantomvk/slideback/ConductorImpl.java | 13 ------------- .../com/phantomvk/slideback/SlideManager.java | 15 ++++++++++----- 4 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 slideback/src/main/java/com/phantomvk/slideback/ConductorImpl.java diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 54eba85..7d31c66 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,7 +11,9 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/build.gradle b/build.gradle index d56d589..9019bb8 100644 --- a/build.gradle +++ b/build.gradle @@ -11,8 +11,8 @@ buildscript { // in the individual module build.gradle files } rootProject.ext { - versionCode = 902 - versionName = "0.9.2" + versionCode = 903 + versionName = "0.9.3" } } diff --git a/slideback/src/main/java/com/phantomvk/slideback/ConductorImpl.java b/slideback/src/main/java/com/phantomvk/slideback/ConductorImpl.java deleted file mode 100644 index 3ecb7db..0000000 --- a/slideback/src/main/java/com/phantomvk/slideback/ConductorImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.phantomvk.slideback; - -import android.os.Build; - -import com.phantomvk.slideback.utility.TranslucentHelper; - -public class ConductorImpl implements SlideManager.Conductor { - - @Override - public boolean slideBackDisable() { - return Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || !TranslucentHelper.isEnabled(); - } -} diff --git a/slideback/src/main/java/com/phantomvk/slideback/SlideManager.java b/slideback/src/main/java/com/phantomvk/slideback/SlideManager.java index 6ab8fa2..cd2dc73 100644 --- a/slideback/src/main/java/com/phantomvk/slideback/SlideManager.java +++ b/slideback/src/main/java/com/phantomvk/slideback/SlideManager.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; +import android.os.Build; import android.os.Bundle; import androidx.annotation.ColorInt; @@ -13,11 +14,11 @@ import com.phantomvk.slideback.listener.SlideStateAdapter; import com.phantomvk.slideback.listener.SlideStateListener; +import com.phantomvk.slideback.utility.TranslucentHelper; public class SlideManager { private static final ColorDrawable DRAWABLE_TRANSPARENT = new ColorDrawable(Color.TRANSPARENT); - private static final Conductor CONDUCTOR = new ConductorImpl(); /** * The target activity to control. @@ -41,7 +42,7 @@ public class SlideManager { */ public SlideManager(@NonNull Activity activity) { this(activity, - activity instanceof Conductor ? (Conductor) activity : CONDUCTOR, + activity instanceof Conductor ? (Conductor) activity : null, new SlideStateAdapter(activity)); } @@ -62,7 +63,7 @@ public SlideManager(@NonNull Activity activity, @NonNull Conductor conductor) { * @param listener must not be null. For more detail, see {@link SlideStateListener} */ public SlideManager(@NonNull Activity activity, @NonNull SlideStateListener listener) { - this(activity, activity instanceof Conductor ? (Conductor) activity : CONDUCTOR, listener); + this(activity, activity instanceof Conductor ? (Conductor) activity : null, listener); } /** @@ -73,7 +74,7 @@ public SlideManager(@NonNull Activity activity, @NonNull SlideStateListener list * @param listener must not be null. For more detail, see {@link SlideStateListener} */ public SlideManager(@NonNull Activity activity, - @NonNull Conductor conductor, + @Nullable Conductor conductor, @NonNull SlideStateListener listener) { this.conductor = conductor; @@ -178,7 +179,11 @@ public boolean isTranslucent() { } public boolean isSlideDisable() { - return conductor != null && conductor.slideBackDisable(); + if (conductor == null) { + return Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || !TranslucentHelper.isEnabled(); + } + + return conductor.slideBackDisable(); } /**