Skip to content

Commit

Permalink
Fixes for OOS 13
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Apr 25, 2024
1 parent 32a74ca commit b596f20
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ public static String getSummary(Context fragmentCompat, @NonNull String key) {
String.valueOf(instance.mPreferences.getSliderInt("quick_settings_tiles_vertical_columns", 4));

// Statusbar
case "status_bar_clock_size" -> instance.mPreferences.getSliderInt("status_bar_clock_size", 14) + "sp";
case "status_bar_clock_size" -> instance.mPreferences.getSliderInt("status_bar_clock_size", 12) + "sp";
case "status_bar_clock_auto_hide_hduration" ->
fragmentCompat.getString(R.string.status_bar_clock_auto_hide_hdur_summary) + "\n" +
instance.mPreferences.getSliderInt("status_bar_clock_auto_hide_hduration", 60) + " " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static it.dhd.oxygencustomizer.xposed.XPrefs.Xprefs;
import static it.dhd.oxygencustomizer.xposed.hooks.systemui.OpUtils.getPrimaryColor;
import static it.dhd.oxygencustomizer.xposed.utils.ViewHelper.dp2px;
import static it.dhd.oxygencustomizer.xposed.utils.ViewHelper.setMargins;

import android.annotation.SuppressLint;
import android.app.ActivityManager;
Expand Down Expand Up @@ -560,14 +561,25 @@ else if (chipUseGradient)
setupChip();
}

@SuppressLint("RtlHardcoded")
private void setupChip() {
if (clockChip) {
mClockView.setPadding(dp2px(mContext, 1), 0, dp2px(mContext, 1), 0);
mClockView.setPadding(dp2px(mContext, 8), dp2px(mContext, 2), dp2px(mContext, 8), dp2px(mContext, 2));
mClockView.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
mClockView.setBackground(mClockChipDrawale);
} else {
mClockView.setPadding(0, 0, 0, 0);
mClockView.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
mClockView.setBackground(null);
}
switch (mClockDatePosition) {
case POSITION_LEFT -> mClockView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
case POSITION_CENTER -> mClockView.setGravity(Gravity.CENTER_VERTICAL);
case POSITION_RIGHT -> mClockView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
}
mClockView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
mClockView.requestLayout();
if (mCenteredIconArea != null) mCenteredIconArea.requestLayout();
}

private void updateShowClock() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static it.dhd.oxygencustomizer.xposed.XPrefs.Xprefs;

import android.content.Context;
import android.os.Build;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
Expand All @@ -32,7 +33,12 @@ public void updatePrefs(String... Key) {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
try {
Class<?> OplusPhoneStatusBarPolicyExImpl = findClass("com.oplus.systemui.statusbar.phone.OplusPhoneStatusBarPolicyExImpl", lpparam.classLoader);
Class<?> OplusPhoneStatusBarPolicyExImpl;
try {
OplusPhoneStatusBarPolicyExImpl = findClass("com.oplus.systemui.statusbar.phone.OplusPhoneStatusBarPolicyExImpl", lpparam.classLoader);
} catch (Throwable t) {
OplusPhoneStatusBarPolicyExImpl = findClass("com.oplusos.systemui.statusbar.phone.PhoneStatusBarPolicyEx", lpparam.classLoader);
}

// private final void updateBluetoothIcon(int i, int i2, CharSequence charSequence, boolean z) {
findAndHookMethod(OplusPhoneStatusBarPolicyExImpl, "updateBluetoothIcon",
Expand All @@ -46,7 +52,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

if (!enabled || !hideBluetooth) return;

Object bluetoothController = getObjectField(param.thisObject, "bluetoothController");
Object bluetoothController = getObjectField(param.thisObject, Build.VERSION.SDK_INT >= 34 ? "bluetoothController" : "mBluetooth");
boolean connected = (boolean) callMethod(bluetoothController, "isBluetoothConnected");

if (!connected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});
try {
DrawableSize = findClass("com.android.systemui.util.drawable.DrawableSize", lpparam.classLoader);
DrawableSize = findClassIfExists("com.android.systemui.util.drawable.DrawableSize", lpparam.classLoader);
} catch (Throwable ignored) {}
Class<?> StatusBarIconView = findClass("com.android.systemui.statusbar.StatusBarIconView", lpparam.classLoader);
findAndHookMethod(StatusBarIconView,
Expand Down

0 comments on commit b596f20

Please sign in to comment.