Merge changes Ibb8c7f54,I27462acf into rvc-dev am: ca08959072
Change-Id: I6eb13c9415489a69f184857c5ff4ecc2578ce95d
This commit is contained in:
@@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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.
|
||||
-->
|
||||
<!-- extends RelativeLayout -->
|
||||
<com.android.systemui.qs.car.CarQSFooter
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/qs_footer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/car_qs_footer_height"
|
||||
android:baselineAligned="false"
|
||||
android:clickable="false"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="@dimen/car_qs_footer_padding_bottom"
|
||||
android:paddingTop="@dimen/car_qs_footer_padding_top"
|
||||
android:paddingEnd="@dimen/car_qs_footer_padding_end"
|
||||
android:paddingStart="@dimen/car_qs_footer_padding_start"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<com.android.systemui.statusbar.phone.MultiUserSwitch
|
||||
android:id="@+id/multi_user_switch"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="@dimen/car_qs_footer_icon_width"
|
||||
android:layout_height="@dimen/car_qs_footer_icon_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/multi_user_avatar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="fitCenter"/>
|
||||
</com.android.systemui.statusbar.phone.MultiUserSwitch>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/user_switch_expand_icon"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="@dimen/car_qs_footer_user_switch_icon_width"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/multi_user_switch"
|
||||
android:layout_marginLeft="@dimen/car_qs_footer_user_switch_icon_margin"
|
||||
android:layout_marginRight="@dimen/car_qs_footer_user_switch_icon_margin"
|
||||
android:src="@drawable/car_ic_arrow_drop_up"
|
||||
android:scaleType="fitCenter">
|
||||
</ImageView>
|
||||
|
||||
<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/car_qs_footer_user_name_color"
|
||||
android:gravity="start|center_vertical"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@id/user_switch_expand_icon" />
|
||||
|
||||
<com.android.systemui.statusbar.phone.SettingsButton
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="@dimen/car_qs_footer_icon_width"
|
||||
android:layout_height="@dimen/car_qs_footer_icon_height"
|
||||
android:background="@drawable/ripple_drawable"
|
||||
android:contentDescription="@string/accessibility_quick_settings_settings"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_settings_16dp"
|
||||
android:tint="?android:attr/colorForeground"
|
||||
style="@android:style/Widget.Material.Button.Borderless" />
|
||||
|
||||
</com.android.systemui.qs.car.CarQSFooter>
|
||||
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/quick_settings_container"
|
||||
android:clipChildren="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/car_qs_background_primary"
|
||||
android:orientation="vertical"
|
||||
android:elevation="4dp">
|
||||
|
||||
<include layout="@layout/car_status_bar_header"/>
|
||||
<include layout="@layout/car_qs_footer"/>
|
||||
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/user_switcher_container"
|
||||
android:clipChildren="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/car_user_switcher_container_height">
|
||||
|
||||
<com.android.systemui.car.userswitcher.UserGridRecyclerView
|
||||
android:id="@+id/user_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -15,7 +15,7 @@
|
||||
~ limitations under the License
|
||||
-->
|
||||
<!-- Extends LinearLayout -->
|
||||
<com.android.systemui.qs.car.CarStatusBarHeader
|
||||
<com.android.systemui.car.userswitcher.CarStatusBarHeader
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
@@ -27,4 +27,4 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
</com.android.systemui.qs.car.CarStatusBarHeader>
|
||||
</com.android.systemui.car.userswitcher.CarStatusBarHeader>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<color name="car_user_switcher_background_color">#000000</color>
|
||||
<color name="car_user_switcher_name_text_color">@*android:color/car_body1_light</color>
|
||||
<color name="car_user_switcher_add_user_background_color">#131313</color>
|
||||
<color name="car_user_switcher_add_user_add_sign_color">@*android:color/car_body1_light</color>
|
||||
<color name="car_nav_icon_fill_color">#8Fffffff</color>
|
||||
<color name="car_nav_icon_fill_color_selected">#ffffff</color>
|
||||
<!-- colors for seekbar -->
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2018, 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>
|
||||
<color name="car_qs_background_primary">#263238</color> <!-- Blue Gray 900 -->
|
||||
<color name="car_qs_footer_user_name_color">@*android:color/car_grey_50</color>
|
||||
|
||||
<!-- colors for user switcher -->
|
||||
<color name="car_user_switcher_background_color">@*android:color/car_card_dark</color>
|
||||
<color name="car_user_switcher_name_text_color">@*android:color/car_body1_light</color>
|
||||
<color name="car_user_switcher_add_user_background_color">@*android:color/car_dark_blue_grey_600</color>
|
||||
<color name="car_user_switcher_add_user_add_sign_color">@*android:color/car_body1_light</color>
|
||||
</resources>
|
||||
@@ -22,16 +22,11 @@
|
||||
|
||||
<dimen name="status_bar_icon_drawing_size_dark">36dp</dimen>
|
||||
<dimen name="status_bar_icon_drawing_size">36dp</dimen>
|
||||
<dimen name="car_qs_header_system_icons_area_height">96dp</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>
|
||||
|
||||
<dimen name="car_primary_icon_size">@*android:dimen/car_primary_icon_size</dimen>
|
||||
|
||||
<!-- dimensions for the car user switcher -->
|
||||
<dimen name="car_user_switcher_name_text_size">@dimen/car_body1_size</dimen>
|
||||
<dimen name="car_user_switcher_vertical_spacing_between_users">124dp</dimen>
|
||||
|
||||
<!--These values represent MIN and MAX for hvac-->
|
||||
<item name="hvac_min_value" format="float" type="dimen">0</item>
|
||||
<item name="hvac_max_value" format="float" type="dimen">126</item>
|
||||
@@ -90,9 +85,6 @@
|
||||
<!-- The width of panel holding the notification card. -->
|
||||
<dimen name="notification_panel_width">522dp</dimen>
|
||||
|
||||
<!-- The width of the quick settings panel. -1 for match_parent. -->
|
||||
<dimen name="qs_panel_width">-1px</dimen>
|
||||
|
||||
<!-- Height of a small notification in the status bar-->
|
||||
<dimen name="notification_min_height">192dp</dimen>
|
||||
|
||||
@@ -149,7 +141,19 @@
|
||||
child closer so there is less wasted space. -->
|
||||
<dimen name="notification_children_container_margin_top">68dp</dimen>
|
||||
|
||||
<!-- The height of the quick settings footer that holds the user switcher, settings icon,
|
||||
etc. in the car setting.-->
|
||||
<dimen name="qs_footer_height">74dp</dimen>
|
||||
<!-- dimensions for the car user switcher -->
|
||||
<dimen name="car_user_switcher_name_text_size">@*android:dimen/car_body1_size</dimen>
|
||||
<dimen name="car_user_switcher_image_avatar_size">@*android:dimen/car_large_avatar_size</dimen>
|
||||
<dimen name="car_user_switcher_vertical_spacing_between_users">@*android:dimen/car_padding_5</dimen>
|
||||
<dimen name="car_user_switcher_vertical_spacing_between_name_and_avatar">@*android:dimen/car_padding_4</dimen>
|
||||
<dimen name="car_user_switcher_margin_top">@*android:dimen/car_padding_4</dimen>
|
||||
|
||||
<dimen name="car_navigation_button_width">64dp</dimen>
|
||||
<dimen name="car_navigation_bar_width">760dp</dimen>
|
||||
<dimen name="car_left_navigation_bar_width">96dp</dimen>
|
||||
<dimen name="car_right_navigation_bar_width">96dp</dimen>
|
||||
|
||||
<dimen name="car_user_switcher_container_height">420dp</dimen>
|
||||
<!-- This must be the negative of car_user_switcher_container_height for the animation. -->
|
||||
<dimen name="car_user_switcher_container_anim_height">-420dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
* Copyright (c) 2018, 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>
|
||||
<!-- dimensions for the car user switcher -->
|
||||
<dimen name="car_user_switcher_name_text_size">@*android:dimen/car_body1_size</dimen>
|
||||
<dimen name="car_user_switcher_image_avatar_size">@*android:dimen/car_large_avatar_size</dimen>
|
||||
<dimen name="car_user_switcher_vertical_spacing_between_users">@*android:dimen/car_padding_5</dimen>
|
||||
<dimen name="car_user_switcher_vertical_spacing_between_name_and_avatar">@*android:dimen/car_padding_4</dimen>
|
||||
<dimen name="car_user_switcher_margin_top">@*android:dimen/car_padding_4</dimen>
|
||||
|
||||
<dimen name="car_navigation_button_width">64dp</dimen>
|
||||
<dimen name="car_navigation_bar_width">760dp</dimen>
|
||||
<dimen name="car_left_navigation_bar_width">96dp</dimen>
|
||||
<dimen name="car_right_navigation_bar_width">96dp</dimen>
|
||||
|
||||
<dimen name="car_qs_footer_height">112dp</dimen>
|
||||
<dimen name="car_qs_footer_padding_bottom">16dp</dimen>
|
||||
<dimen name="car_qs_footer_padding_top">16dp</dimen>
|
||||
<dimen name="car_qs_footer_padding_end">46dp</dimen>
|
||||
<dimen name="car_qs_footer_padding_start">46dp</dimen>
|
||||
<dimen name="car_qs_footer_icon_width">56dp</dimen>
|
||||
<dimen name="car_qs_footer_icon_height">56dp</dimen>
|
||||
<dimen name="car_qs_footer_user_switch_icon_margin">5dp</dimen>
|
||||
<dimen name="car_qs_footer_user_switch_icon_width">36dp</dimen>
|
||||
<dimen name="car_qs_footer_user_name_text_size">@*android:dimen/car_body2_size</dimen>
|
||||
|
||||
<dimen name="car_user_switcher_container_height">420dp</dimen>
|
||||
<!-- This must be the negative of car_user_switcher_container_height for the animation. -->
|
||||
<dimen name="car_user_switcher_container_anim_height">-420dp</dimen>
|
||||
</resources>
|
||||
@@ -16,5 +16,19 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<integer name="user_fullscreen_switcher_num_col">2</integer>
|
||||
<!-- Full screen user switcher column number -->
|
||||
<integer name="user_fullscreen_switcher_num_col">3</integer>
|
||||
|
||||
<!--Percentage of the screen height, from the bottom, that a notification panel being
|
||||
partially closed at will result in it remaining open if released-->
|
||||
<integer name="notification_settle_open_percentage">20</integer>
|
||||
<!--Percentage of the screen height, from the bottom, that a notification panel being peeked
|
||||
at will result in remaining closed the panel if released-->
|
||||
<integer name="notification_settle_close_percentage">80</integer>
|
||||
|
||||
<!-- Timeout values in milliseconds for displaying volume dialog-->
|
||||
<integer name="car_volume_dialog_display_normal_timeout">3000</integer>
|
||||
<integer name="car_volume_dialog_display_hovering_timeout">16000</integer>
|
||||
<integer name="car_volume_dialog_display_expanded_normal_timeout">6000</integer>
|
||||
<integer name="car_volume_dialog_display_expanded_hovering_timeout">32000</integer>
|
||||
</resources>
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (c) 2018, 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 xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Full screen user switcher column number TODO: move to support library-->
|
||||
<integer name="user_fullscreen_switcher_num_col">3</integer>
|
||||
|
||||
<!--Percentage of the screen height, from the bottom, that a notification panel being
|
||||
partially closed at will result in it remaining open if released-->
|
||||
<integer name="notification_settle_open_percentage">20</integer>
|
||||
<!--Percentage of the screen height, from the bottom, that a notification panel being peeked
|
||||
at will result in remaining closed the panel if released-->
|
||||
<integer name="notification_settle_close_percentage">80</integer>
|
||||
|
||||
<!-- Timeout values in milliseconds for displaying volume dialog-->
|
||||
<integer name="car_volume_dialog_display_normal_timeout">3000</integer>
|
||||
<integer name="car_volume_dialog_display_hovering_timeout">16000</integer>
|
||||
<integer name="car_volume_dialog_display_expanded_normal_timeout">6000</integer>
|
||||
<integer name="car_volume_dialog_display_expanded_hovering_timeout">32000</integer>
|
||||
</resources>
|
||||
@@ -22,4 +22,16 @@
|
||||
<string name="hvac_max_text">Max</string>
|
||||
<!-- Text for voice recognition toast. [CHAR LIMIT=60] -->
|
||||
<string name="voice_recognition_toast">Voice recognition now handled by connected Bluetooth device</string>
|
||||
<!-- Name of Guest Profile. [CHAR LIMIT=30] -->
|
||||
<string name="car_guest">Guest</string>
|
||||
<!-- Title for button that starts a guest session. [CHAR LIMIT=30] -->
|
||||
<string name="start_guest_session">Guest</string>
|
||||
<!-- Title for button that adds a new user. [CHAR LIMIT=30] -->
|
||||
<string name="car_add_user">Add User</string>
|
||||
<!-- Default name of the new user created. [CHAR LIMIT=30] -->
|
||||
<string name="car_new_user">New User</string>
|
||||
<!-- Message to inform user that creation of new user requires that user to set up their space. [CHAR LIMIT=100] -->
|
||||
<string name="user_add_user_message_setup">When you add a new user, that person needs to set up their space.</string>
|
||||
<!-- Message to inform user that the newly created user will have permissions to update apps for all other users. [CHAR LIMIT=100] -->
|
||||
<string name="user_add_user_message_update">Any user can update apps for all other users.</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright (c) 2018, 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>
|
||||
<!-- Name of Guest Profile. [CHAR LIMIT=30] -->
|
||||
<string name="car_guest">Guest</string>
|
||||
<!-- Title for button that starts a guest session. [CHAR LIMIT=30] -->
|
||||
<string name="start_guest_session">Guest</string>
|
||||
<!-- Title for button that adds a new user. [CHAR LIMIT=30] -->
|
||||
<string name="car_add_user">Add User</string>
|
||||
<!-- Default name of the new user created. [CHAR LIMIT=30] -->
|
||||
<string name="car_new_user">New User</string>
|
||||
<!-- Message to inform user that creation of new user requires that user to set up their space. [CHAR LIMIT=100] -->
|
||||
<string name="user_add_user_message_setup">When you add a new user, that person needs to set up their space.</string>
|
||||
<!-- Message to inform user that the newly created user will have permissions to update apps for all other users. [CHAR LIMIT=100] -->
|
||||
<string name="user_add_user_message_update">Any user can update apps for all other users.</string>
|
||||
</resources>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
* 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.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.qs.car;
|
||||
package com.android.systemui.car.userswitcher;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package com.android.systemui.qs.car;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.qs.QSFooter;
|
||||
import com.android.systemui.qs.QSPanel;
|
||||
import com.android.systemui.statusbar.phone.MultiUserSwitch;
|
||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||
import com.android.systemui.statusbar.policy.UserInfoController;
|
||||
|
||||
/**
|
||||
* The footer view that displays below the status bar in the auto use-case. This view shows the
|
||||
* user switcher and access to settings.
|
||||
*/
|
||||
public class CarQSFooter extends RelativeLayout implements QSFooter,
|
||||
UserInfoController.OnUserInfoChangedListener {
|
||||
private static final String TAG = "CarQSFooter";
|
||||
|
||||
private UserInfoController mUserInfoController;
|
||||
|
||||
private MultiUserSwitch mMultiUserSwitch;
|
||||
private TextView mUserName;
|
||||
private ImageView mMultiUserAvatar;
|
||||
private CarQSFragment.UserSwitchCallback mUserSwitchCallback;
|
||||
|
||||
public CarQSFooter(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
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);
|
||||
|
||||
mMultiUserSwitch.setOnClickListener(v -> {
|
||||
if (mUserSwitchCallback == null) {
|
||||
Log.e(TAG, "CarQSFooter not properly set up; cannot display user switcher.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mUserSwitchCallback.isShowing()) {
|
||||
mUserSwitchCallback.show();
|
||||
} else {
|
||||
mUserSwitchCallback.hide();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.settings_button).setOnClickListener(v -> {
|
||||
ActivityStarter activityStarter = Dependency.get(ActivityStarter.class);
|
||||
|
||||
if (!Dependency.get(DeviceProvisionedController.class).isCurrentUserSetup()) {
|
||||
// If user isn't setup just unlock the device and dump them back at SUW.
|
||||
activityStarter.postQSRunnableDismissingKeyguard(() -> { });
|
||||
return;
|
||||
}
|
||||
|
||||
activityStarter.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS),
|
||||
true /* dismissShade */);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserInfoChanged(String name, Drawable picture, String userAccount) {
|
||||
mMultiUserAvatar.setImageDrawable(picture);
|
||||
mUserName.setText(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQSPanel(@Nullable QSPanel panel) {
|
||||
if (panel != null) {
|
||||
mMultiUserSwitch.setQsPanel(panel);
|
||||
}
|
||||
}
|
||||
|
||||
public void setUserSwitchCallback(CarQSFragment.UserSwitchCallback callback) {
|
||||
mUserSwitchCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListening(boolean listening) {
|
||||
if (listening) {
|
||||
mUserInfoController.addCallback(this);
|
||||
} else {
|
||||
mUserInfoController.removeCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpandClickListener(OnClickListener onClickListener) {
|
||||
// No view that should expand/collapse the quick settings.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpanded(boolean expanded) {
|
||||
// Do nothing because the quick settings cannot be expanded.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpansion(float expansion) {
|
||||
// Do nothing because the quick settings cannot be expanded.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKeyguardShowing(boolean keyguardShowing) {
|
||||
// Do nothing because the footer will not be shown when the keyguard is up.
|
||||
}
|
||||
}
|
||||
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package com.android.systemui.qs.car;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorInflater;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.car.userswitcher.UserGridRecyclerView;
|
||||
import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.qs.QSFooter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A quick settings fragment for the car. For auto, there is no row for quick settings or ability
|
||||
* to expand the quick settings panel. Instead, the only thing is that displayed is the
|
||||
* status bar, and a static row with access to the user switcher and settings.
|
||||
*/
|
||||
public class CarQSFragment extends Fragment implements QS {
|
||||
private View mHeader;
|
||||
private View mUserSwitcherContainer;
|
||||
private CarQSFooter mFooter;
|
||||
private View mFooterUserName;
|
||||
private View mFooterExpandIcon;
|
||||
private UserGridRecyclerView mUserGridView;
|
||||
private AnimatorSet mAnimatorSet;
|
||||
private UserSwitchCallback mUserSwitchCallback;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.car_qs_panel, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mHeader = view.findViewById(R.id.header);
|
||||
mFooter = view.findViewById(R.id.qs_footer);
|
||||
mFooterUserName = mFooter.findViewById(R.id.user_name);
|
||||
mFooterExpandIcon = mFooter.findViewById(R.id.user_switch_expand_icon);
|
||||
|
||||
mUserSwitcherContainer = view.findViewById(R.id.user_switcher_container);
|
||||
|
||||
updateUserSwitcherHeight(0);
|
||||
|
||||
Context context = getContext();
|
||||
mUserGridView = mUserSwitcherContainer.findViewById(R.id.user_grid);
|
||||
GridLayoutManager layoutManager = new GridLayoutManager(context,
|
||||
context.getResources().getInteger(R.integer.user_fullscreen_switcher_num_col));
|
||||
mUserGridView.setLayoutManager(layoutManager);
|
||||
mUserGridView.buildAdapter();
|
||||
|
||||
mUserSwitchCallback = new UserSwitchCallback();
|
||||
mFooter.setUserSwitchCallback(mUserSwitchCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideImmediately() {
|
||||
getView().setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQsExpansion(float qsExpansionFraction, float headerTranslation) {
|
||||
// If the header is to be completed translated down, then set it to be visible.
|
||||
getView().setVisibility(headerTranslation == 0 ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getHeader() {
|
||||
return mHeader;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
QSFooter getFooter() {
|
||||
return mFooter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeaderListening(boolean listening) {
|
||||
mFooter.setListening(listening);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListening(boolean listening) {
|
||||
mFooter.setListening(listening);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getQsMinExpansionHeight() {
|
||||
return getView().getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDesiredHeight() {
|
||||
return getView().getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPanelView(HeightListener notificationPanelView) {
|
||||
// No quick settings panel.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeightOverride(int desiredHeight) {
|
||||
// No ability to expand quick settings.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeaderClickable(boolean qsExpansionEnabled) {
|
||||
// Usually this sets the expand button to be clickable, but there is no quick settings to
|
||||
// expand.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCustomizing() {
|
||||
// No ability to customize the quick settings.
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverscrolling(boolean overscrolling) {
|
||||
// No overscrolling to reveal quick settings.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpanded(boolean qsExpanded) {
|
||||
// No quick settings to expand
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowingDetail() {
|
||||
// No detail panel to close.
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeDetail() {
|
||||
// No detail panel to close.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateHeaderSlidingIn(long delay) {
|
||||
// No header to animate.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateHeaderSlidingOut() {
|
||||
// No header to animate.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyCustomizeChanged() {
|
||||
// There is no ability to customize quick settings.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainer(ViewGroup container) {
|
||||
// No quick settings, so no container to set.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpandClickListener(OnClickListener onClickListener) {
|
||||
// No ability to expand the quick settings.
|
||||
}
|
||||
|
||||
public class UserSwitchCallback {
|
||||
private boolean mShowing;
|
||||
|
||||
public boolean isShowing() {
|
||||
return mShowing;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
mShowing = true;
|
||||
animateHeightChange(true /* opening */);
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
mShowing = false;
|
||||
animateHeightChange(false /* opening */);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUserSwitcherHeight(int height) {
|
||||
ViewGroup.LayoutParams layoutParams = mUserSwitcherContainer.getLayoutParams();
|
||||
layoutParams.height = height;
|
||||
mUserSwitcherContainer.requestLayout();
|
||||
}
|
||||
|
||||
private void animateHeightChange(boolean opening) {
|
||||
// Animation in progress; cancel it to avoid contention.
|
||||
if (mAnimatorSet != null) {
|
||||
mAnimatorSet.cancel();
|
||||
}
|
||||
|
||||
List<Animator> allAnimators = new ArrayList<>();
|
||||
ValueAnimator heightAnimator = (ValueAnimator) AnimatorInflater.loadAnimator(getContext(),
|
||||
opening ? R.anim.car_user_switcher_open_animation
|
||||
: R.anim.car_user_switcher_close_animation);
|
||||
heightAnimator.addUpdateListener(valueAnimator -> {
|
||||
updateUserSwitcherHeight((Integer) valueAnimator.getAnimatedValue());
|
||||
});
|
||||
allAnimators.add(heightAnimator);
|
||||
|
||||
Animator nameAnimator = AnimatorInflater.loadAnimator(getContext(),
|
||||
opening ? R.anim.car_user_switcher_open_name_animation
|
||||
: R.anim.car_user_switcher_close_name_animation);
|
||||
nameAnimator.setTarget(mFooterUserName);
|
||||
allAnimators.add(nameAnimator);
|
||||
|
||||
Animator iconAnimator = AnimatorInflater.loadAnimator(getContext(),
|
||||
opening ? R.anim.car_user_switcher_open_icon_animation
|
||||
: R.anim.car_user_switcher_close_icon_animation);
|
||||
iconAnimator.setTarget(mFooterExpandIcon);
|
||||
allAnimators.add(iconAnimator);
|
||||
|
||||
mAnimatorSet = new AnimatorSet();
|
||||
mAnimatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mAnimatorSet = null;
|
||||
}
|
||||
});
|
||||
mAnimatorSet.playTogether(allAnimators.toArray(new Animator[0]));
|
||||
|
||||
// Setup all values to the start values in the animations, since there are delays, but need
|
||||
// to have all values start at the beginning.
|
||||
setupInitialValues(mAnimatorSet);
|
||||
|
||||
mAnimatorSet.start();
|
||||
}
|
||||
|
||||
private void setupInitialValues(Animator anim) {
|
||||
if (anim instanceof AnimatorSet) {
|
||||
for (Animator a : ((AnimatorSet) anim).getChildAnimations()) {
|
||||
setupInitialValues(a);
|
||||
}
|
||||
} else if (anim instanceof ObjectAnimator) {
|
||||
((ObjectAnimator) anim).setCurrentFraction(0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,6 @@ import com.android.systemui.plugins.DarkIconDispatcher;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
import com.android.systemui.plugins.PluginDependencyProvider;
|
||||
import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.qs.car.CarQSFragment;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.ScreenPinningRequest;
|
||||
import com.android.systemui.shared.plugins.PluginManager;
|
||||
@@ -407,7 +406,7 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
|
||||
|
||||
@Override
|
||||
protected QS createDefaultQSFragment() {
|
||||
return new CarQSFragment();
|
||||
return null;
|
||||
}
|
||||
|
||||
private BatteryController createBatteryController() {
|
||||
|
||||
Reference in New Issue
Block a user