Skip to content

Commit

Permalink
Depth Wallpaper: Fix bottom gap for A12 and A12L
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Sep 23, 2023
1 parent 3b10e11 commit 933239c
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.content.res.Resources;
import android.graphics.ImageDecoder;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Environment;
import android.view.Gravity;
import android.view.View;
Expand Down Expand Up @@ -155,7 +156,7 @@ protected void afterHookedMethod(MethodHookParam param) {
}
});

hookAllMethods(Resources.class, "getDimensionPixelOffset", new XC_MethodHook() {
XC_MethodHook noKeyguardIndicationPadding = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) {
int resId = mContext.getResources().getIdentifier("keyguard_indication_area_padding", "dimen", mContext.getPackageName());
Expand All @@ -164,7 +165,27 @@ protected void beforeHookedMethod(MethodHookParam param) {
param.setResult(0);
}
}
});
};

hookAllMethods(Resources.class, "getDimensionPixelOffset", noKeyguardIndicationPadding);
hookAllMethods(Resources.class, "getDimensionPixelSize", noKeyguardIndicationPadding);

if (Build.VERSION.SDK_INT <= 32) {
// This method is only available on Android 12L and below
hookAllMethods(KeyguardBottomAreaViewClass, "updateIndicationAreaPadding", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) {
if (!showDepthWallpaper) return;

View view = (View) param.thisObject;
ViewGroup container = view.findViewById(mContext.getResources().getIdentifier("keyguard_indication_area", "id", mContext.getPackageName()));

ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) container.getLayoutParams();
mlp.bottomMargin = 0;
container.setLayoutParams(mlp);
}
});
}
}

private void updateWallpaper() {
Expand Down

0 comments on commit 933239c

Please sign in to comment.