Add username beside user switch.

In car QS footer, show the username beside the user avatar/switch
button.

Bug: 63593747
Tested on Mojave

Change-Id: I62387b75951235350ee6d9326eba281374ebea69
This commit is contained in:
Bryan Eyler
2017-08-31 17:57:45 -07:00
parent 6f8afdc501
commit cade225395
4 changed files with 38 additions and 1 deletions

View File

@@ -46,6 +46,15 @@
android:scaleType="centerInside"/>
</com.android.systemui.statusbar.phone.MultiUserSwitch>
<TextView android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/car_qs_footer_user_name_text_size"
android:textColor="@color/qs_user_detail_name"
android:gravity="start|center_vertical"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/multi_user_switch" />
<com.android.systemui.statusbar.phone.SettingsButton
android:id="@+id/settings_button"
android:layout_alignParentEnd="true"

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (c) 2017, 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.
*/
-->
<resources>
<dimen name="car_body2_size">32sp</dimen> <!-- B2 -->
</resources>

View File

@@ -37,5 +37,9 @@
<dimen name="car_start_driving_corner_radius">16dp</dimen>
<dimen name="car_start_driving_padding_side">30dp</dimen>
<dimen name="car_start_driving_height">80dp</dimen>
<dimen name="car_start_driving_text_size">32sp</dimen> <!-- B2 -->
<dimen name="car_start_driving_text_size">@dimen/car_body2_size</dimen>
<dimen name="car_qs_footer_user_name_text_size">@dimen/car_body2_size</dimen>
<dimen name="car_body2_size">26sp</dimen>
</resources>

View File

@@ -22,6 +22,7 @@ import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -44,6 +45,7 @@ public class CarQSFooter extends RelativeLayout implements QSFooter,
private UserInfoController mUserInfoController;
private MultiUserSwitch mMultiUserSwitch;
private TextView mUserName;
private ImageView mMultiUserAvatar;
private UserGridView mUserGridView;
@@ -56,6 +58,7 @@ public class CarQSFooter extends RelativeLayout implements QSFooter,
super.onFinishInflate();
mMultiUserSwitch = findViewById(R.id.multi_user_switch);
mMultiUserAvatar = mMultiUserSwitch.findViewById(R.id.multi_user_avatar);
mUserName = findViewById(R.id.user_name);
mUserInfoController = Dependency.get(UserInfoController.class);
@@ -89,6 +92,7 @@ public class CarQSFooter extends RelativeLayout implements QSFooter,
@Override
public void onUserInfoChanged(String name, Drawable picture, String userAccount) {
mMultiUserAvatar.setImageDrawable(picture);
mUserName.setText(name);
}
@Override