Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cd423a5 authored by LuK1337's avatar LuK1337 Committed by Bruno Martins
Browse files

fixup! SystemUI: Add customization to show battery percent

I don't understand the point of hiding attribution.
Reformat with ktfmt while we are at it.

Change-Id: Ibaf09804baed4be781b72edc09dc8a129b52d741
parent 3d66a583
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -175,8 +175,10 @@ constructor(

                fun readMode(): Int {
                    return LineageSettings.System.getIntForUser(
                        resolver, LineageSettings.System.STATUS_BAR_SHOW_BATTERY_PERCENT,
                        BatteryRepository.SHOW_PERCENT_HIDDEN, UserHandle.USER_CURRENT
                        resolver,
                        LineageSettings.System.STATUS_BAR_SHOW_BATTERY_PERCENT,
                        BatteryRepository.SHOW_PERCENT_HIDDEN,
                        UserHandle.USER_CURRENT,
                    )
                }

@@ -187,8 +189,12 @@ constructor(
                        }
                    }

                resolver.registerContentObserver(uri, /* notifyForDescendants = */ false,
                    observer, UserHandle.USER_ALL)
                resolver.registerContentObserver(
                    uri,
                    /* notifyForDescendants = */ false,
                    observer,
                    UserHandle.USER_ALL,
                )

                // Emit current value immediately
                trySend(readMode())
@@ -200,7 +206,7 @@ constructor(
            .stateIn(
                scope = scope,
                started = SharingStarted.Lazily,
                initialValue = BatteryRepository.SHOW_PERCENT_HIDDEN
                initialValue = BatteryRepository.SHOW_PERCENT_HIDDEN,
            )

    /** Get and re-fetch the estimate every 2 minutes while active */
+0 −1
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ fun BatteryWithPercent(
                viewModel = viewModel,
                isDarkProvider = isDarkProvider,
                modifier = Modifier.height(batteryHeight).wrapContentWidth(),
                suppressAttribution = showPercent,
            )
        }

+1 −2
Original line number Diff line number Diff line
@@ -162,7 +162,6 @@ fun UnifiedBattery(
    viewModel: BatteryViewModel,
    isDarkProvider: () -> IsAreaDark,
    modifier: Modifier,
    suppressAttribution: Boolean = false,
) {
    var bounds by remember { mutableStateOf(Rect()) }

@@ -175,7 +174,7 @@ fun UnifiedBattery(
    }

    BatteryLayout(
        attribution = if (suppressAttribution) null else viewModel.attribution,
        attribution = viewModel.attribution,
        levelProvider = { viewModel.level },
        isFullProvider = { viewModel.isFull },
        glyphsProvider = { viewModel.glyphList },