Merge "Merge "Add rotary support to the nav bar and HUN." into rvc-dev am: 16899978f4 am: 1745f17a07 am: 74c957ba72" into rvc-qpr-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
bb06c7975b
@@ -32,6 +32,7 @@ android_library {
|
|||||||
"SystemUIPluginLib",
|
"SystemUIPluginLib",
|
||||||
"SystemUISharedLib",
|
"SystemUISharedLib",
|
||||||
"SettingsLib",
|
"SettingsLib",
|
||||||
|
"car-ui-lib",
|
||||||
"android.car.userlib",
|
"android.car.userlib",
|
||||||
"androidx.legacy_legacy-support-v4",
|
"androidx.legacy_legacy-support-v4",
|
||||||
"androidx.recyclerview_recyclerview",
|
"androidx.recyclerview_recyclerview",
|
||||||
@@ -95,6 +96,7 @@ android_library {
|
|||||||
"androidx.slice_slice-builders",
|
"androidx.slice_slice-builders",
|
||||||
"androidx.arch.core_core-runtime",
|
"androidx.arch.core_core-runtime",
|
||||||
"androidx.lifecycle_lifecycle-extensions",
|
"androidx.lifecycle_lifecycle-extensions",
|
||||||
|
"car-ui-lib",
|
||||||
"SystemUI-tags",
|
"SystemUI-tags",
|
||||||
"SystemUI-proto",
|
"SystemUI-proto",
|
||||||
"metrics-helper-lib",
|
"metrics-helper-lib",
|
||||||
|
|||||||
@@ -1,26 +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
|
|
||||||
-->
|
|
||||||
|
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:color="@color/nav_bar_ripple_background_color">
|
|
||||||
<item android:id="@android:id/mask">
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="?android:colorAccent"/>
|
|
||||||
<corners android:radius="6dp"/>
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</ripple>
|
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.android.keyguard.AlphaOptimizedImageButton
|
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||||
android:id="@+id/note"
|
android:id="@+id/note"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.android.keyguard.AlphaOptimizedImageButton
|
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||||
android:id="@+id/car_nav_button_icon_image"
|
android:id="@+id/car_nav_button_icon_image"
|
||||||
android:layout_height="@dimen/car_navigation_button_icon_height"
|
android:layout_height="@dimen/car_navigation_button_icon_height"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<com.android.keyguard.AlphaOptimizedImageButton
|
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||||
android:id="@+id/car_nav_button_more_icon"
|
android:id="@+id/car_nav_button_more_icon"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.android.keyguard.AlphaOptimizedImageButton
|
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||||
android:id="@+id/note"
|
android:id="@+id/note"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -29,6 +29,15 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintGuide_begin="@dimen/headsup_scrim_height"/>
|
app:layout_constraintGuide_begin="@dimen/headsup_scrim_height"/>
|
||||||
|
|
||||||
|
<!-- Include a FocusParkingView at the beginning or end. The rotary controller "parks" the
|
||||||
|
focus here when the user navigates to another window. This is also used to prevent
|
||||||
|
wrap-around which is why it must be first or last in Tab order. -->
|
||||||
|
<com.android.car.ui.FocusParkingView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/scrim"
|
android:id="@+id/scrim"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -44,6 +44,6 @@
|
|||||||
<style name="NavigationBarButton">
|
<style name="NavigationBarButton">
|
||||||
<item name="android:layout_height">96dp</item>
|
<item name="android:layout_height">96dp</item>
|
||||||
<item name="android:layout_width">96dp</item>
|
<item name="android:layout_width">96dp</item>
|
||||||
<item name="android:background">@drawable/nav_button_background</item>
|
<item name="android:background">@*android:drawable/item_background_material</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -74,8 +74,10 @@ public class CarNavigationBarView extends LinearLayout {
|
|||||||
mDarkIconManager.setShouldLog(true);
|
mDarkIconManager.setShouldLog(true);
|
||||||
Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
|
Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
|
||||||
}
|
}
|
||||||
// needs to be clickable so that it will receive ACTION_MOVE events
|
// Needs to be clickable so that it will receive ACTION_MOVE events.
|
||||||
setClickable(true);
|
setClickable(true);
|
||||||
|
// Needs to not be focusable so rotary won't highlight the entire nav bar.
|
||||||
|
setFocusable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.keyguard.AlphaOptimizedImageButton;
|
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
|
import com.android.systemui.statusbar.AlphaOptimizedImageView;
|
||||||
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
@@ -53,8 +53,8 @@ public class CarNavigationButton extends LinearLayout {
|
|||||||
private static final String EXTRA_BUTTON_PACKAGES = "packages";
|
private static final String EXTRA_BUTTON_PACKAGES = "packages";
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private AlphaOptimizedImageButton mIcon;
|
private AlphaOptimizedImageView mIcon;
|
||||||
private AlphaOptimizedImageButton mMoreIcon;
|
private AlphaOptimizedImageView mMoreIcon;
|
||||||
private ImageView mUnseenIcon;
|
private ImageView mUnseenIcon;
|
||||||
private String mIntent;
|
private String mIntent;
|
||||||
private String mLongIntent;
|
private String mLongIntent;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.view.ViewGroup;
|
|||||||
|
|
||||||
import androidx.annotation.LayoutRes;
|
import androidx.annotation.LayoutRes;
|
||||||
|
|
||||||
|
import com.android.car.ui.FocusParkingView;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -146,6 +147,12 @@ public class NavigationBarViewFactory {
|
|||||||
|
|
||||||
CarNavigationBarView view = (CarNavigationBarView) View.inflate(mContext, barLayout,
|
CarNavigationBarView view = (CarNavigationBarView) View.inflate(mContext, barLayout,
|
||||||
/* root= */ null);
|
/* root= */ null);
|
||||||
|
|
||||||
|
// Include a FocusParkingView at the end. The rotary controller "parks" the focus here when
|
||||||
|
// the user navigates to another window. This is also used to prevent wrap-around which is
|
||||||
|
// why it must be first or last in Tab order.
|
||||||
|
view.addView(new FocusParkingView(mContext));
|
||||||
|
|
||||||
mCachedViewMap.put(type, view);
|
mCachedViewMap.put(type, view);
|
||||||
return mCachedViewMap.get(type);
|
return mCachedViewMap.get(type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.FrameLayout;
|
|
||||||
|
|
||||||
import com.android.car.notification.R;
|
import com.android.car.notification.R;
|
||||||
import com.android.car.notification.headsup.CarHeadsUpNotificationContainer;
|
import com.android.car.notification.headsup.CarHeadsUpNotificationContainer;
|
||||||
@@ -44,7 +43,7 @@ public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotifica
|
|||||||
private final OverlayViewGlobalStateController mOverlayViewGlobalStateController;
|
private final OverlayViewGlobalStateController mOverlayViewGlobalStateController;
|
||||||
|
|
||||||
private final ViewGroup mWindow;
|
private final ViewGroup mWindow;
|
||||||
private final FrameLayout mHeadsUpContentFrame;
|
private final ViewGroup mHeadsUpContentFrame;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
CarHeadsUpNotificationSystemContainer(Context context,
|
CarHeadsUpNotificationSystemContainer(Context context,
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ import android.widget.LinearLayout;
|
|||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import com.android.keyguard.AlphaOptimizedImageButton;
|
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
|
import com.android.systemui.statusbar.AlphaOptimizedImageView;
|
||||||
import com.android.systemui.tests.R;
|
import com.android.systemui.tests.R;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -74,7 +74,7 @@ public class CarNavigationButtonTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onCreate_iconIsVisible() {
|
public void onCreate_iconIsVisible() {
|
||||||
AlphaOptimizedImageButton icon = mDefaultButton.findViewById(
|
AlphaOptimizedImageView icon = mDefaultButton.findViewById(
|
||||||
R.id.car_nav_button_icon_image);
|
R.id.car_nav_button_icon_image);
|
||||||
|
|
||||||
assertThat(icon.getDrawable()).isNotNull();
|
assertThat(icon.getDrawable()).isNotNull();
|
||||||
@@ -83,12 +83,12 @@ public class CarNavigationButtonTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void onSelected_selectedIconDefined_togglesIcon() {
|
public void onSelected_selectedIconDefined_togglesIcon() {
|
||||||
mDefaultButton.setSelected(true);
|
mDefaultButton.setSelected(true);
|
||||||
Drawable selectedIconDrawable = ((AlphaOptimizedImageButton) mDefaultButton.findViewById(
|
Drawable selectedIconDrawable = ((AlphaOptimizedImageView) mDefaultButton.findViewById(
|
||||||
R.id.car_nav_button_icon_image)).getDrawable();
|
R.id.car_nav_button_icon_image)).getDrawable();
|
||||||
|
|
||||||
|
|
||||||
mDefaultButton.setSelected(false);
|
mDefaultButton.setSelected(false);
|
||||||
Drawable unselectedIconDrawable = ((AlphaOptimizedImageButton) mDefaultButton.findViewById(
|
Drawable unselectedIconDrawable = ((AlphaOptimizedImageView) mDefaultButton.findViewById(
|
||||||
R.id.car_nav_button_icon_image)).getDrawable();
|
R.id.car_nav_button_icon_image)).getDrawable();
|
||||||
|
|
||||||
assertThat(selectedIconDrawable).isNotEqualTo(unselectedIconDrawable);
|
assertThat(selectedIconDrawable).isNotEqualTo(unselectedIconDrawable);
|
||||||
@@ -100,12 +100,12 @@ public class CarNavigationButtonTest extends SysuiTestCase {
|
|||||||
R.id.selected_icon_undefined);
|
R.id.selected_icon_undefined);
|
||||||
|
|
||||||
selectedIconUndefinedButton.setSelected(true);
|
selectedIconUndefinedButton.setSelected(true);
|
||||||
Drawable selectedIconDrawable = ((AlphaOptimizedImageButton) mDefaultButton.findViewById(
|
Drawable selectedIconDrawable = ((AlphaOptimizedImageView) mDefaultButton.findViewById(
|
||||||
R.id.car_nav_button_icon_image)).getDrawable();
|
R.id.car_nav_button_icon_image)).getDrawable();
|
||||||
|
|
||||||
|
|
||||||
selectedIconUndefinedButton.setSelected(false);
|
selectedIconUndefinedButton.setSelected(false);
|
||||||
Drawable unselectedIconDrawable = ((AlphaOptimizedImageButton) mDefaultButton.findViewById(
|
Drawable unselectedIconDrawable = ((AlphaOptimizedImageView) mDefaultButton.findViewById(
|
||||||
R.id.car_nav_button_icon_image)).getDrawable();
|
R.id.car_nav_button_icon_image)).getDrawable();
|
||||||
|
|
||||||
assertThat(selectedIconDrawable).isEqualTo(unselectedIconDrawable);
|
assertThat(selectedIconDrawable).isEqualTo(unselectedIconDrawable);
|
||||||
@@ -150,7 +150,7 @@ public class CarNavigationButtonTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void onSelected_doesNotShowMoreWhenSelected_doesNotShowMoreIcon() {
|
public void onSelected_doesNotShowMoreWhenSelected_doesNotShowMoreIcon() {
|
||||||
mDefaultButton.setSelected(true);
|
mDefaultButton.setSelected(true);
|
||||||
AlphaOptimizedImageButton moreIcon = mDefaultButton.findViewById(
|
AlphaOptimizedImageView moreIcon = mDefaultButton.findViewById(
|
||||||
R.id.car_nav_button_more_icon);
|
R.id.car_nav_button_more_icon);
|
||||||
|
|
||||||
assertThat(moreIcon.getVisibility()).isEqualTo(View.GONE);
|
assertThat(moreIcon.getVisibility()).isEqualTo(View.GONE);
|
||||||
@@ -161,7 +161,7 @@ public class CarNavigationButtonTest extends SysuiTestCase {
|
|||||||
CarNavigationButton showMoreWhenSelected = mTestView.findViewById(
|
CarNavigationButton showMoreWhenSelected = mTestView.findViewById(
|
||||||
R.id.not_highlightable_more_button);
|
R.id.not_highlightable_more_button);
|
||||||
showMoreWhenSelected.setSelected(true);
|
showMoreWhenSelected.setSelected(true);
|
||||||
AlphaOptimizedImageButton moreIcon = showMoreWhenSelected.findViewById(
|
AlphaOptimizedImageView moreIcon = showMoreWhenSelected.findViewById(
|
||||||
R.id.car_nav_button_more_icon);
|
R.id.car_nav_button_more_icon);
|
||||||
|
|
||||||
assertThat(moreIcon.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(moreIcon.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
@@ -173,7 +173,7 @@ public class CarNavigationButtonTest extends SysuiTestCase {
|
|||||||
R.id.highlightable_no_more_button);
|
R.id.highlightable_no_more_button);
|
||||||
showMoreWhenSelected.setSelected(true);
|
showMoreWhenSelected.setSelected(true);
|
||||||
showMoreWhenSelected.setSelected(false);
|
showMoreWhenSelected.setSelected(false);
|
||||||
AlphaOptimizedImageButton moreIcon = showMoreWhenSelected.findViewById(
|
AlphaOptimizedImageView moreIcon = showMoreWhenSelected.findViewById(
|
||||||
R.id.car_nav_button_more_icon);
|
R.id.car_nav_button_more_icon);
|
||||||
|
|
||||||
assertThat(moreIcon.getVisibility()).isEqualTo(View.GONE);
|
assertThat(moreIcon.getVisibility()).isEqualTo(View.GONE);
|
||||||
@@ -187,7 +187,7 @@ public class CarNavigationButtonTest extends SysuiTestCase {
|
|||||||
roleBasedButton.setSelected(false);
|
roleBasedButton.setSelected(false);
|
||||||
roleBasedButton.setAppIcon(appIcon);
|
roleBasedButton.setAppIcon(appIcon);
|
||||||
|
|
||||||
Drawable currentDrawable = ((AlphaOptimizedImageButton) roleBasedButton.findViewById(
|
Drawable currentDrawable = ((AlphaOptimizedImageView) roleBasedButton.findViewById(
|
||||||
R.id.car_nav_button_icon_image)).getDrawable();
|
R.id.car_nav_button_icon_image)).getDrawable();
|
||||||
|
|
||||||
assertThat(currentDrawable).isEqualTo(appIcon);
|
assertThat(currentDrawable).isEqualTo(appIcon);
|
||||||
@@ -212,7 +212,7 @@ public class CarNavigationButtonTest extends SysuiTestCase {
|
|||||||
roleBasedButton.setSelected(true);
|
roleBasedButton.setSelected(true);
|
||||||
roleBasedButton.setAppIcon(appIcon);
|
roleBasedButton.setAppIcon(appIcon);
|
||||||
|
|
||||||
Drawable currentDrawable = ((AlphaOptimizedImageButton) roleBasedButton.findViewById(
|
Drawable currentDrawable = ((AlphaOptimizedImageView) roleBasedButton.findViewById(
|
||||||
R.id.car_nav_button_icon_image)).getDrawable();
|
R.id.car_nav_button_icon_image)).getDrawable();
|
||||||
|
|
||||||
assertThat(currentDrawable).isEqualTo(appIcon);
|
assertThat(currentDrawable).isEqualTo(appIcon);
|
||||||
|
|||||||
Reference in New Issue
Block a user