From 2d8ce4626ab5aac77d6f4743f059689b256d023a Mon Sep 17 00:00:00 2001 From: DrDisagree Date: Sun, 24 Sep 2023 20:28:02 +0600 Subject: [PATCH] Experimental: Allow removing default zoom of depth wallpaper --- .../iconify/common/Preferences.java | 1 + .../iconify/ui/activities/Experimental.java | 9 ++++ .../iconify/xposed/mods/DepthWallpaper.java | 17 ++++++-- .../main/res/layout/activity_experimental.xml | 43 +++++++++++++++++++ app/src/main/res/values/strings.xml | 2 + 5 files changed, 68 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/drdisagree/iconify/common/Preferences.java b/app/src/main/java/com/drdisagree/iconify/common/Preferences.java index 39e5f91a6..f7dbbe6aa 100644 --- a/app/src/main/java/com/drdisagree/iconify/common/Preferences.java +++ b/app/src/main/java/com/drdisagree/iconify/common/Preferences.java @@ -61,6 +61,7 @@ public class Preferences { public static final String HEADER_QQS_TOPMARGIN = "qqspanelTopMargin"; public static final String HIDE_DATA_DISABLED_ICON = "xposed_hideDataDisabledIcon"; public static final String DEPTH_WALLPAPER_SWITCH = "xposed_depthwallpaper"; + public static final String UNZOOM_DEPTH_WALLPAPER = "xposed_unzoomdepthwallpaper"; // Xposed view tags public static final String ICONIFY_HEADER_CLOCK_TAG = "iconify_header_clock"; diff --git a/app/src/main/java/com/drdisagree/iconify/ui/activities/Experimental.java b/app/src/main/java/com/drdisagree/iconify/ui/activities/Experimental.java index 8605d1489..c9a765ff7 100644 --- a/app/src/main/java/com/drdisagree/iconify/ui/activities/Experimental.java +++ b/app/src/main/java/com/drdisagree/iconify/ui/activities/Experimental.java @@ -3,6 +3,7 @@ import static com.drdisagree.iconify.common.Const.SWITCH_ANIMATION_DELAY; import static com.drdisagree.iconify.common.Preferences.HEADER_IMAGE_OVERLAP; import static com.drdisagree.iconify.common.Preferences.HIDE_DATA_DISABLED_ICON; +import static com.drdisagree.iconify.common.Preferences.UNZOOM_DEPTH_WALLPAPER; import android.annotation.SuppressLint; import android.os.Bundle; @@ -37,6 +38,14 @@ protected void onCreate(Bundle savedInstanceState) { }); binding.headerImageOverlapContainer.setOnClickListener(v -> binding.headerImageOverlap.toggle()); + // Unzoom depth wallpaper + binding.unzoomDepthWallpaper.setChecked(RPrefs.getBoolean(UNZOOM_DEPTH_WALLPAPER, false)); + binding.unzoomDepthWallpaper.setOnCheckedChangeListener((compoundButton, isChecked) -> { + RPrefs.putBoolean(UNZOOM_DEPTH_WALLPAPER, isChecked); + new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::restartSystemUI, SWITCH_ANIMATION_DELAY); + }); + binding.unzoomDepthWallpaperContainer.setOnClickListener(v -> binding.unzoomDepthWallpaper.toggle()); + // Hide data disabled icon binding.hideDataDisabledIcon.setChecked(RPrefs.getBoolean(HIDE_DATA_DISABLED_ICON, false)); binding.hideDataDisabledIcon.setOnCheckedChangeListener((buttonView, isChecked) -> { diff --git a/app/src/main/java/com/drdisagree/iconify/xposed/mods/DepthWallpaper.java b/app/src/main/java/com/drdisagree/iconify/xposed/mods/DepthWallpaper.java index 0166f6b7b..ff1a2125c 100644 --- a/app/src/main/java/com/drdisagree/iconify/xposed/mods/DepthWallpaper.java +++ b/app/src/main/java/com/drdisagree/iconify/xposed/mods/DepthWallpaper.java @@ -3,6 +3,7 @@ import static com.drdisagree.iconify.common.Const.SYSTEMUI_PACKAGE; import static com.drdisagree.iconify.common.Preferences.DEPTH_WALLPAPER_SWITCH; import static com.drdisagree.iconify.common.Preferences.ICONIFY_DEPTH_WALLPAPER_TAG; +import static com.drdisagree.iconify.common.Preferences.UNZOOM_DEPTH_WALLPAPER; import static com.drdisagree.iconify.config.XPrefs.Xprefs; import static de.robv.android.xposed.XposedBridge.hookAllMethods; import static de.robv.android.xposed.XposedHelpers.findClass; @@ -222,14 +223,22 @@ private void updateWallpaper() { mDepthWallpaperBackground.setImageDrawable(backgroundDrawable); mDepthWallpaperBackground.setClipToOutline(true); mDepthWallpaperBackground.setScaleType(ImageView.ScaleType.CENTER_CROP); - mDepthWallpaperBackground.setScaleX(1.1f); - mDepthWallpaperBackground.setScaleY(1.1f); + + boolean zoomWallpaper = !Xprefs.getBoolean(UNZOOM_DEPTH_WALLPAPER, false); + + if (zoomWallpaper) { + mDepthWallpaperBackground.setScaleX(1.1f); + mDepthWallpaperBackground.setScaleY(1.1f); + } mDepthWallpaperForeground.setImageDrawable(foregroundDrawable); mDepthWallpaperForeground.setClipToOutline(true); mDepthWallpaperForeground.setScaleType(ImageView.ScaleType.CENTER_CROP); - mDepthWallpaperForeground.setScaleX(1.1f); - mDepthWallpaperForeground.setScaleY(1.1f); + + if (zoomWallpaper) { + mDepthWallpaperForeground.setScaleX(1.1f); + mDepthWallpaperForeground.setScaleY(1.1f); + } mDepthWallpaperLayout.setVisibility(View.VISIBLE); } catch (Throwable ignored) { diff --git a/app/src/main/res/layout/activity_experimental.xml b/app/src/main/res/layout/activity_experimental.xml index 71c3c09ee..f3892c69e 100644 --- a/app/src/main/res/layout/activity_experimental.xml +++ b/app/src/main/res/layout/activity_experimental.xml @@ -64,6 +64,49 @@ + + + + + + + + + + + + + + Experimental Overlap Header Image Overlap header image on expanded QS + Unzoom Depth Wallpaper + Remove the zoom effect on depth wallpaper Hide Data Disabled Icon Hide data disabled indicator