Remove all QS related code from CarSystemUI
QS is not used in Car System UI Bug: 154357193 Test: mp carsysui (on hawk) Change-Id: I27462acf821dca61a007a4e1506beb06b4ddc7e5
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>
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
*/
|
||||
-->
|
||||
<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>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
@@ -28,17 +28,6 @@
|
||||
<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>
|
||||
|
||||
@@ -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