Skip to content

Commit e28c8cd

Browse files
committed
StatusbarClock: revert updateMinWidth
1 parent dc5e211 commit e28c8cd

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

app/src/main/java/it/dhd/oxygencustomizer/xposed/hooks/systemui/statusbar/StatusbarClock.java

+24-24
Original file line numberDiff line numberDiff line change
@@ -350,30 +350,30 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
350350
setClockSize();
351351
});
352352

353-
// if (StatClock != null) {
354-
// try {
355-
//// StatClock
356-
//// .after("updateMinWidth")
357-
//// .run(param -> {
358-
//// // StatClock has a method to update the minimum width of the clock
359-
//// // we can use it to update the clock width
360-
//// // Based on our custom formats
361-
//// TextView tv = (TextView) param.thisObject;
362-
//// tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, mClockSize);
363-
//// if (!mShowSeconds) {
364-
//// float totalWidth = measureTextWithSpans();
365-
//// totalWidth += mClockView.getPaddingStart();
366-
//// totalWidth += mClockView.getPaddingEnd();
367-
//// int calculatedMinWidth = (int) totalWidth;
368-
//// if (tv.getMinimumWidth() != calculatedMinWidth) {
369-
//// tv.setMinimumWidth(calculatedMinWidth);
370-
//// }
371-
//// }
372-
//// });
373-
// } catch (Throwable ignored) {
374-
// log("updateMinWidth in StatClock not found");
375-
// }
376-
// }
353+
if (StatClock != null) {
354+
try {
355+
StatClock
356+
.after("updateMinWidth")
357+
.run(param -> {
358+
// StatClock has a method to update the minimum width of the clock
359+
// we can use it to update the clock width
360+
// Based on our custom formats
361+
TextView tv = (TextView) param.thisObject;
362+
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, mClockSize);
363+
if (!mShowSeconds) {
364+
float totalWidth = measureTextWithSpans();
365+
totalWidth += rightClockPadding;
366+
totalWidth += rightClockPadding*2;
367+
int calculatedMinWidth = (int) totalWidth;
368+
if (tv.getMinimumWidth() != calculatedMinWidth) {
369+
tv.setMinimumWidth(calculatedMinWidth);
370+
}
371+
}
372+
});
373+
} catch (Throwable ignored) {
374+
log("updateMinWidth in StatClock not found");
375+
}
376+
}
377377

378378
CollapsedStatusBarFragmentClass
379379
.after("animateShow")

0 commit comments

Comments
 (0)