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

Commit 224c81c6 authored by Julia Kawano's avatar Julia Kawano Committed by Julia Kawano
Browse files

Add username to status bar and update layout

Update the status bar with the new UX designs:
- Remove driver and passenger HVAC views
- Add driver icon (placeholder) and username aligned to start of bar
- Move system icons aligned to end of bar (previously next to clock)
- Add AM/PM to clock

HVAC will be moved into the navigation bar in a separate change.

Test: manual - change to guest, change username, change to long username (truncates before clock view)
Test: atest :carsysui-presubmit
Bug: 162598687
Change-Id: I5b9095adce7fee0970e8b15d307f01eb4adf2b40
parent cf259d52
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 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.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="@dimen/system_bar_icon_drawing_size"
    android:height="@dimen/system_bar_icon_drawing_size"
    android:viewportWidth="24"
    android:viewportHeight="24">
  <path
      android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"
      android:fillColor="@color/system_bar_user_icon_color"/>
</vector>
 No newline at end of file
+34 −66
Original line number Diff line number Diff line
@@ -31,39 +31,44 @@
        android:layoutDirection="ltr">

        <FrameLayout
            android:id="@+id/left_hvac_container"
            android:id="@+id/user_name_container"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentStart="true"
            android:layout_toStartOf="@+id/clock_container"
        >

            <com.android.systemui.car.navigationbar.CarNavigationButton
                android:id="@+id/hvacleft"
                android:id="@+id/user_name"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@null"
                systemui:broadcast="true"
                systemui:intent="intent:#Intent;action=android.car.intent.action.TOGGLE_HVAC_CONTROLS;end"
                systemui:icon="@null"
                systemui:intent="intent:#Intent;component=com.android.car.settings/.users.UserSwitcherActivity;launchFlags=0x24000000;end"
            >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal"
                    android:gravity="center_vertical"
                >
                    <ImageView
                        android:id="@+id/user_avatar"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:src="@drawable/car_ic_user_icon"
                        android:paddingLeft="@dimen/system_bar_user_icon_padding"
                        android:paddingRight="@dimen/system_bar_user_icon_padding"
                    />

            <com.android.systemui.car.hvac.AnimatedTemperatureView
                android:id="@+id/lefttext"
                    <TextView
                        android:id="@+id/user_name_text"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                android:paddingStart="@*android:dimen/car_padding_4"
                android:paddingEnd="16dp"
                android:gravity="center_vertical|start"
                android:minEms="4"
                android:textAppearance="@style/TextAppearance.CarStatus"
                systemui:hvacAreaId="49"
                systemui:hvacMaxText="@string/hvac_max_text"
                systemui:hvacMaxValue="@dimen/hvac_max_value"
                systemui:hvacMinText="@string/hvac_min_text"
                systemui:hvacMinValue="@dimen/hvac_min_value"
                systemui:hvacPivotOffset="60dp"
                systemui:hvacPropertyId="358614275"
                systemui:hvacTempFormat="%.0f\u00B0"
                        android:gravity="center_vertical"
                        android:textAppearance="@style/TextAppearance.SystemBar.Username"
                        android:maxLines="1"
                    />
                </LinearLayout>
            </com.android.systemui.car.navigationbar.CarNavigationButton>
        </FrameLayout>

        <FrameLayout
@@ -86,7 +91,8 @@
                android:layout_gravity="center"
                android:elevation="5dp"
                android:singleLine="true"
                android:textAppearance="@style/TextAppearance.StatusBar.Clock"
                android:textAppearance="@style/TextAppearance.SystemBar.Clock"
                systemui:amPmStyle="normal"
            />
        </FrameLayout>

@@ -94,10 +100,9 @@
            android:id="@+id/system_icon_area"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_centerHorizontal="true"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            android:layout_toEndOf="@+id/clock_container"
            android:paddingStart="@*android:dimen/car_padding_1"
            android:paddingEnd="@*android:dimen/car_padding_1"
            android:gravity="center_vertical"
            android:orientation="horizontal"
        >
@@ -107,46 +112,9 @@
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingStart="4dp"
                android:gravity="center_vertical"
            />
        </LinearLayout>

        <FrameLayout
            android:id="@+id/right_hvac_container"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentEnd="true"
        >

            <com.android.systemui.car.navigationbar.CarNavigationButton
                android:id="@+id/hvacright"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@null"
                systemui:broadcast="true"
                systemui:intent="intent:#Intent;action=android.car.intent.action.TOGGLE_HVAC_CONTROLS;end"
            />

            <com.android.systemui.car.hvac.AnimatedTemperatureView
                android:id="@+id/righttext"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:paddingStart="16dp"
                android:paddingEnd="@*android:dimen/car_padding_4"
                android:gravity="center_vertical|end"
                android:minEms="4"
                android:textAppearance="@style/TextAppearance.CarStatus"
                systemui:hvacAreaId="68"
                systemui:hvacMaxText="@string/hvac_max_text"
                systemui:hvacMaxValue="@dimen/hvac_max_value"
                systemui:hvacMinText="@string/hvac_min_text"
                systemui:hvacMinValue="@dimen/hvac_min_value"
                systemui:hvacPivotOffset="60dp"
                systemui:hvacPropertyId="358614275"
                systemui:hvacTempFormat="%.0f\u00B0"
            />
        </FrameLayout>
    </RelativeLayout>

</com.android.systemui.car.navigationbar.CarNavigationBarView>
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@
    <color name="docked_divider_background">@*android:color/car_grey_50</color>
    <color name="system_bar_background_opaque">#ff172026</color>

    <!-- colors for status bar -->
    <color name="system_bar_user_icon_color">#ffffff</color>
    <color name="status_bar_background_color">#33000000</color>
    <drawable name="system_bar_background">@color/status_bar_background_color</drawable>

+3 −2
Original line number Diff line number Diff line
@@ -46,8 +46,9 @@
       in frameworks/base/core package and thus will have no effect if
       set here. See car_product overlay for car specific defaults-->

    <dimen name="status_bar_icon_drawing_size_dark">36dp</dimen>
    <dimen name="status_bar_icon_drawing_size">36dp</dimen>
    <dimen name="system_bar_user_icon_padding">16dp</dimen>
    <dimen name="system_bar_icon_drawing_size_dark">36dp</dimen>
    <dimen name="system_bar_icon_drawing_size">36dp</dimen>
    <!-- The amount by which to scale up the status bar icons. -->
    <item name="status_bar_icon_scale_factor" format="float" type="dimen">1.75</item>

+10 −5
Original line number Diff line number Diff line
@@ -25,11 +25,16 @@
        <item name="android:padding">22dp</item>
    </style>

    <style name="TextAppearance.StatusBar.Clock"
    <style name="TextAppearance.SystemBar.Clock"
           parent="@*android:style/TextAppearance.StatusBar.Icon">
        <item name="android:textSize">42sp</item>
        <item name="android:fontFamily">sans-serif-regular</item>
        <item name="android:textColor">@*android:color/car_grey_50</item>
        <item name="android:textSize">@dimen/car_body1_size</item>
        <item name="android:textColor">@*android:color/car_headline3</item>
    </style>

    <style name="TextAppearance.SystemBar.Username"
           parent="@android:style/TextAppearance.DeviceDefault">
        <item name="android:textSize">@dimen/car_body3_size</item>
        <item name="android:textColor">@*android:color/car_headline3</item>
    </style>

    <style name="TextAppearance.CarStatus" parent="@android:style/TextAppearance.DeviceDefault">
Loading