Skip to content

Commit

Permalink
Battery Style Manager: Rescale battery size in landscape mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Oct 10, 2023
1 parent 860a5a6 commit 29321bb
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ protected void afterHookedMethod(MethodHookParam param) {
mBatteryPercentView.setVisibility(mShowPercentInside ? View.GONE : View.VISIBLE);
}

scaleBatteryMeterViews(view);
scaleBatteryMeterView(view);
updateChargingIconView(view, mIsCharging);
});
} catch (Throwable ignored) {
Expand Down Expand Up @@ -584,6 +584,7 @@ private void updateBatteryResources(XC_MethodHook.MethodHookParam param) {
callMethod(getObjectField(param.thisObject, "iconManager"), "setTint", textColorPrimary);
}
callMethod(batteryIcon, "updateColors", textColorPrimary, textColorSecondary, textColorPrimary);
scaleBatteryMeterView((Object) batteryIcon);
} catch (Throwable throwable) {
log(TAG + throwable);
}
Expand All @@ -603,7 +604,7 @@ private void refreshBatteryIcons() {
}

if (CustomBatteryEnabled) {
scaleBatteryMeterViews(mBatteryIconView);
scaleBatteryMeterView(mBatteryIconView);

try {
BatteryDrawable mBatteryDrawable = (BatteryDrawable) getAdditionalInstanceField(view, "mBatteryDrawable");
Expand All @@ -619,12 +620,12 @@ private void refreshBatteryIcons() {
}
}

public static void scaleBatteryMeterViews(Object thisObject) {
public static void scaleBatteryMeterView(Object thisObject) {
ImageView mBatteryIconView = (ImageView) getObjectField(thisObject, "mBatteryIconView");
scaleBatteryMeterViews(mBatteryIconView);
scaleBatteryMeterView(mBatteryIconView);
}

public static void scaleBatteryMeterViews(ImageView mBatteryIconView) {
public static void scaleBatteryMeterView(ImageView mBatteryIconView) {
if (mBatteryIconView == null) {
return;
}
Expand Down

0 comments on commit 29321bb

Please sign in to comment.