Skip to content

Commit

Permalink
Experimental: Allow removing default zoom of depth wallpaper
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Sep 24, 2023
1 parent 2f92f53 commit 2d8ce46
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
43 changes: 43 additions & 0 deletions app/src/main/res/layout/activity_experimental.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,49 @@

</RelativeLayout>

<RelativeLayout
android:id="@+id/unzoom_depth_wallpaper_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/item_background_material"
android:clickable="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginVertical="22dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="10dp"
android:layout_toStartOf="@id/unzoom_depth_wallpaper"
android:orientation="vertical">

<TextView
style="@style/TextAppearance.Material3.TitleMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/unzoom_depth_wallpaper_title"
android:textColor="@color/text_color_primary" />

<TextView
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/unzoom_depth_wallpaper_desc"
android:textColor="@color/text_color_secondary" />

</LinearLayout>

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/unzoom_depth_wallpaper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp" />

</RelativeLayout>

<RelativeLayout
android:id="@+id/hide_data_disabled_icon_container"
android:layout_width="match_parent"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@
<string name="experimental_features_title">Experimental</string>
<string name="overlap_header_image_title">Overlap Header Image</string>
<string name="overlap_header_image_desc">Overlap header image on expanded QS</string>
<string name="unzoom_depth_wallpaper_title">Unzoom Depth Wallpaper</string>
<string name="unzoom_depth_wallpaper_desc">Remove the zoom effect on depth wallpaper</string>
<string name="hide_data_disabled_icon_title">Hide Data Disabled Icon</string>
<string name="hide_data_disabled_icon_desc">Hide data disabled indicator</string>

Expand Down

0 comments on commit 2d8ce46

Please sign in to comment.