Commandeer full screen user switcher for auto.

The full screen user switcher wasn't needed by the original
author so adapt it for the auto use case because it fits
really well. This change adds in some legal text (TBR - legal)
and tweaks the layout a bit.

Bug: 26559008
Change-Id: Ib78d0ec8a8d4ec8411dbbffe5852c5307c2cf42f
This commit is contained in:
Rakesh Iyer
2016-01-14 13:37:15 -08:00
parent bcd2b7179a
commit 4d5343ea3a
8 changed files with 118 additions and 42 deletions

View File

@@ -26,13 +26,13 @@
<ImageView android:id="@+id/user_avatar"
android:padding="10dp"
android:layout_gravity="center"
android:layout_width="160dp"
android:layout_height="160dp" />
android:layout_width="@dimen/car_fullscreen_user_pod_image_avatar_width"
android:layout_height="@dimen/car_fullscreen_user_pod_image_avatar_height" />
<TextView android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/qs_detail_item_secondary_text_size"
android:textSize="@dimen/car_fullscreen_user_pod_text_size"
android:textColor="@color/qs_user_detail_name"
android:gravity="center_horizontal" />
</LinearLayout>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/car_lockscreen_disclaimer_title"
android:textSize="@dimen/car_lockscreen_disclaimer_title_size"
android:paddingStart="@dimen/car_lockscreen_disclaimer_title_padding_start"
android:paddingTop="@dimen/car_lockscreen_disclaimer_title_padding_top" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/car_lockscreen_disclaimer_text"
android:textSize="@dimen/car_lockscreen_disclaimer_text_size"
android:paddingStart="@dimen/car_lockscreen_disclaimer_text_padding_start"
android:paddingEnd="@dimen/car_lockscreen_disclaimer_text_padding_end"
android:paddingTop="@dimen/car_lockscreen_disclaimer_text_padding_top" />
<com.android.systemui.statusbar.UserGridView
android:id="@+id/user_grid"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/car_lockscreen_user_grid_view_padding_top"
android:stretchMode="columnWidth">
</com.android.systemui.statusbar.UserGridView>
</LinearLayout>
</FrameLayout>

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<com.android.systemui.statusbar.UserGridView
android:id="@+id/user_grid"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:columnWidth="180dp"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center">
</com.android.systemui.statusbar.UserGridView>
</FrameLayout>

View File

@@ -43,4 +43,4 @@
sysui:frameWidth="@dimen/keyguard_user_switcher_border_thickness"
sysui:framePadding="6dp"
sysui:activeFrameColor="@color/current_user_border_color" />
</com.android.systemui.qs.tiles.UserDetailItemView>
</com.android.systemui.qs.tiles.UserDetailItemView>

View File

@@ -80,7 +80,7 @@
</FrameLayout>
<ViewStub android:id="@+id/fullscreen_user_switcher_stub"
android:layout="@layout/fullscreen_user_switcher"
android:layout="@layout/car_fullscreen_user_switcher"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (c) 2016, 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_lockscreen_disclaimer_title_size">48sp</dimen>
<dimen name="car_lockscreen_disclaimer_title_padding_start">96dp</dimen>
<dimen name="car_lockscreen_disclaimer_title_padding_top">96dp</dimen>
<dimen name="car_lockscreen_disclaimer_text_size">28sp</dimen>
<dimen name="car_lockscreen_disclaimer_text_padding_start">96dp</dimen>
<dimen name="car_lockscreen_disclaimer_text_padding_end">96dp</dimen>
<dimen name="car_lockscreen_disclaimer_text_padding_top">32dp</dimen>
<dimen name="car_lockscreen_user_grid_view_padding_start">10dp</dimen>
<dimen name="car_lockscreen_user_grid_view_padding_end">10dp</dimen>
<dimen name="car_lockscreen_user_grid_view_padding_top">128dp</dimen>
<dimen name="car_fullscreen_user_pod_image_avatar_width">128dp</dimen>
<dimen name="car_fullscreen_user_pod_image_avatar_height">128dp</dimen>
<dimen name="car_fullscreen_user_pod_text_size">24sp</dimen>
</resources>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2016, 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>
<string name="car_lockscreen_disclaimer_title">Drive safely</string>
<string name="car_lockscreen_disclaimer_text">
Stay fully aware of driving conditions and always obey applicable laws. Directions may be
inaccurate, incomplete, dangerous, not suitable, prohibited, or involve crossing
administrative areas. Business information may also be inaccurate or incomplete. Data is
not real-time, and location accuracy cannot be guaranteed. Do not handle your mobile device
or use apps not intended for Android Auto while driving.
</string>
</resources>

View File

@@ -137,7 +137,7 @@ public class UserGridView extends GridView {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater)getContext().getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.fullscreen_user_pod, null);
convertView = inflater.inflate(R.layout.car_fullscreen_user_pod, null);
}
UserSwitcherController.UserRecord record = getItem(position);