Skip to content

Commit

Permalink
Misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Apr 26, 2024
1 parent 36636d3 commit 5bb4bbe
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/makeBetaRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Upload Xposed Artifact to Actions
uses: actions/[email protected]
with:
name: OxygenCustomizer.zip
name: OxygenCustomizer
path: app/build/outputs/apk/release/*.apk

- name: Oxygen Customizer Binary Release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,15 +499,30 @@ public void setColors(int i, int i2) {
}
});


Class<?> StatBatteryMeterView = findClass("com.oplusos.systemui.statusbar.widget.StatBatteryMeterView", lpparam.classLoader);
findAndHookMethod(StatBatteryMeterView, "initViews", Context.class, new XC_MethodHook() {
findAndHookMethod(StatBatteryMeterView, "onBatteryLevelChanged",
int.class,
boolean.class,
boolean.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
mBatteryIcon = (ImageView) getObjectField(param.thisObject, "mBatteryIconView");
batteryPercentOutView = (TextView) getObjectField(param.thisObject, "batteryPercentText");

if (CustomBatteryEnabled && mBatteryOOS13 != null) {
/*
public void onBatteryLevelChanged(int i, boolean z, boolean z2) {
TwoBatteryMeterDrawable twoBatteryMeterDrawable = this.mTwoDrawable;
if (twoBatteryMeterDrawable != null) {
twoBatteryMeterDrawable.setCharging(z2);
twoBatteryMeterDrawable.setBatteryLevel(i);
}
*/

int batteryLevel = (int) param.args[0];
mIsCharging = (boolean) param.args[2];
if (CustomBatteryEnabled && mBatteryIcon != null) {

if (mHidePercentage)
batteryPercentOutView.setVisibility(View.GONE);
Expand All @@ -517,7 +532,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
BatteryDrawable mBatteryDrawable = getNewBatteryDrawable(mContext);
if (mBatteryDrawable == null) return;
if (mBatteryDrawable != null) {
mBatteryDrawable.setBatteryLevel(getCurrentLevel());
mBatteryDrawable.setBatteryLevel(batteryLevel);
mBatteryDrawable.setChargingEnabled(mIsCharging, isFastCharging());
mBatteryDrawable.setPowerSavingEnabled(isPowerSaving());
mBatteryDrawable.setShowPercentEnabled(mShowPercentInside);
Expand All @@ -537,10 +552,9 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
mCustomPowerSaveFillColor,
mChargingIconSwitch
);
if (mBatteryIcon.getScaleType() != mBatteryOOS13.getScaleType())
mBatteryIcon.setScaleType(mBatteryOOS13.getScaleType());
mBatteryIcon.setScaleType(ImageView.ScaleType.FIT_XY);
mBatteryIcon.setLayerType(View.LAYER_TYPE_NONE, null);
mBatteryIcon.setImageDrawable(mBatteryDrawable);
mBatteryIcon.setVisibility(View.VISIBLE);
}

scaleBatteryMeterViews(mBatteryIcon);
Expand All @@ -552,6 +566,11 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
batteryPercentOutView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mBatteryPercSize);
}
}
}
});
findAndHookMethod(StatBatteryMeterView, "initViews", Context.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {

}
});
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/gesture_prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<SwitchPreferenceCompat
android:key="gesture_override_holdback"
android:title="@string/gesture_override_back_hold"
android:defaultValue="true"
android:defaultValue="false"
app:iconSpaceReserved="false"/>

<it.dhd.oxygencustomizer.customprefs.ListWithPopUpPreference
Expand Down

0 comments on commit 5bb4bbe

Please sign in to comment.