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

Commit 740459fa authored by Evan Laird's avatar Evan Laird Committed by Android (Google) Code Review
Browse files

Merge "[sb] Use BatteryCanvas composable in the battery chip" into main

parents 4644695f a2029c19
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -24,21 +24,13 @@

    <LinearLayout
        android:id="@+id/rounded_container"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minHeight="@dimen/ongoing_appops_chip_height"
        android:layout_gravity="center"
        android:background="@drawable/statusbar_chip_bg"
        android:clipToOutline="true"
        android:gravity="center"
        android:maxWidth="@dimen/ongoing_appops_chip_max_width"
        android:minWidth="@dimen/ongoing_appops_chip_min_width">
        style="@style/StatusBar.EventChip">

        <com.android.systemui.battery.BatteryMeterView
            android:id="@+id/battery_meter_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="10dp" />
            android:layout_marginHorizontal="@dimen/ongoing_appops_chip_content_horizontal_margin" />

    </LinearLayout>
</merge>
 No newline at end of file
+34 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2025 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<merge xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="center_vertical|end">

    <LinearLayout
        android:id="@+id/rounded_container"
        style="@style/StatusBar.EventChip">

        <!-- Stub for the composable -->
        <androidx.compose.ui.platform.ComposeView
            android:id="@+id/compose_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="@dimen/ongoing_appops_chip_content_horizontal_margin" />

    </LinearLayout>
</merge>
+2 −0
Original line number Diff line number Diff line
@@ -1254,6 +1254,8 @@
    <dimen name="ongoing_appops_chip_side_padding">8dp</dimen>
    <!-- Margin between icons of Ongoing App Ops chip -->
    <dimen name="ongoing_appops_chip_icon_margin">4dp</dimen>
    <!-- Side margins for the content of an appops chip -->
    <dimen name="ongoing_appops_chip_content_horizontal_margin">10dp</dimen>
    <!-- Icon size of Ongoing App Ops chip -->
    <dimen name="ongoing_appops_chip_icon_size">16sp</dimen>
    <!-- Radius of Ongoing App Ops chip corners -->
+13 −0
Original line number Diff line number Diff line
@@ -93,6 +93,19 @@
        <item name="android:textColor">?android:attr/colorPrimary</item>
    </style>

    <style name="StatusBar.EventChip">
        <item name="android:orientation">horizontal</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_gravity">center</item>
        <item name="android:gravity">center</item>
        <item name="android:clipToOutline">true</item>
        <item name="android:background">@drawable/statusbar_chip_bg</item>
        <item name="android:minHeight">@dimen/ongoing_appops_chip_height</item>
        <item name="android:maxWidth">@dimen/ongoing_appops_chip_max_width</item>
        <item name="android:minWidth">@dimen/ongoing_appops_chip_min_width</item>
    </style>

    <style name="Chipbar" />

    <style name="Chipbar.Text" parent="@*android:style/TextAppearance.DeviceDefault.Notification.Title">
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.settingslib.flags.Flags.newStatusBarIcons
import com.android.systemui.battery.BatteryMeterView
import com.android.systemui.battery.unified.BatteryColors
import com.android.systemui.res.R
import com.android.systemui.statusbar.core.NewStatusBarIcons
import com.android.systemui.statusbar.events.BackgroundAnimatableView

class BatteryStatusChip @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
@@ -37,6 +38,8 @@ class BatteryStatusChip @JvmOverloads constructor(context: Context, attrs: Attri
        get() = batteryMeterView

    init {
        NewStatusBarIcons.assertInLegacyMode()

        inflate(context, R.layout.battery_status_chip, this)
        roundedContainer = requireViewById(R.id.rounded_container)
        batteryMeterView = requireViewById(R.id.battery_meter_view)
Loading