Changes to notification shade.

1. Clip the shade with the glass pane
2. Add handle bar to bottom
3. Change the background color to #DD0000

Bug: 132908271
Test: Manual
Change-Id: I577ec7132d9ad37e951e07c6f1ce3c5a2a814d90
This commit is contained in:
Priyank Singh 2019-05-16 15:19:53 -07:00
parent 70e0438d59
commit 647f9e61ee
6 changed files with 93 additions and 17 deletions

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 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="@android:color/white">
<item>
<shape android:shape="rectangle">
<corners android:radius="@dimen/clear_all_button_radius"/>
<solid android:color="@android:color/white"/>
</shape>
</item>
</ripple>

View File

@ -23,24 +23,27 @@
android:background="@color/notification_shade_background_color">
<View
android:id="@+id/glass_pane"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:translationZ="2dp"
/>
android:id="@+id/glass_pane"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:translationZ="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notifications"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent"
android:paddingStart="@dimen/notification_shade_list_padding_bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
app:layout_constraintTop_toTopOf="parent"/>
<include layout="@layout/notification_handle_bar"/>
</com.android.car.notification.CarNotificationView>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2019, 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.
*/
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<View
android:id="@+id/handle_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/notification_shade_handle_bar_height"
android:layout_marginBottom="@dimen/notification_shade_handle_bar_margin_bottom"
android:layout_marginEnd="@dimen/notification_shade_handle_bar_margin_start"
android:layout_marginStart="@dimen/notification_shade_handle_bar_margin_end"
android:layout_marginTop="@dimen/notification_shade_handle_bar_margin_top"
android:background="@drawable/notification_handle_bar"/>
</merge>

View File

@ -34,7 +34,7 @@
<drawable name="system_bar_background">@color/status_bar_background_color</drawable>
<!-- The background color of the notification shade -->
<color name="notification_shade_background_color">#99000000</color>
<color name="notification_shade_background_color">#DD000000</color>
<!-- The color of the dividing line between grouped notifications. -->
<color name="notification_divider_color">@*android:color/notification_action_list</color>

View File

@ -88,4 +88,14 @@
<dimen name="car_volume_item_divider_width">1dp</dimen>
<dimen name="car_volume_item_divider_margin_end">@*android:dimen/car_padding_4</dimen>
<dimen name="car_volume_item_corner_radius">@*android:dimen/car_radius_3</dimen>
<!-- Car notification shade-->
<dimen name="notification_shade_handle_bar_height">10dp</dimen>
<dimen name="notification_shade_handle_bar_radius">20dp</dimen>
<dimen name="notification_shade_handle_bar_margin_start">500dp</dimen>
<dimen name="notification_shade_handle_bar_margin_end">500dp</dimen>
<dimen name="notification_shade_handle_bar_margin_top">20dp</dimen>
<dimen name="notification_shade_handle_bar_margin_bottom">10dp</dimen>
<dimen name="notification_shade_list_padding_bottom">0dp</dimen>
</resources>

View File

@ -131,6 +131,8 @@ public class CarStatusBar extends StatusBar implements
// The container for the notifications.
private CarNotificationView mNotificationView;
private RecyclerView mNotificationList;
// The handler bar view at the bottom of notification shade.
private View mHandleBar;
// The controller for the notification view.
private NotificationViewController mNotificationViewController;
// The state of if the notification list is currently showing the bottom.
@ -464,6 +466,7 @@ public class CarStatusBar extends StatusBar implements
mNotificationView = mStatusBarWindow.findViewById(R.id.notification_view);
View glassPane = mStatusBarWindow.findViewById(R.id.glass_pane);
mHandleBar = mStatusBarWindow.findViewById(R.id.handle_bar);
mNotificationView.setClickHandlerFactory(mNotificationClickHandlerFactory);
mNotificationView.setNotificationDataManager(mNotificationDataManager);
@ -521,7 +524,7 @@ public class CarStatusBar extends StatusBar implements
boolean handled = closeGestureDetector.onTouchEvent(event);
boolean isTracking = mIsTracking;
Rect rect = mNotificationList.getClipBounds();
Rect rect = mNotificationView.getClipBounds();
float clippedHeight = 0;
if (rect != null) {
clippedHeight = rect.bottom;
@ -609,7 +612,7 @@ public class CarStatusBar extends StatusBar implements
to = mNotificationView.getHeight();
}
Rect rect = mNotificationList.getClipBounds();
Rect rect = mNotificationView.getClipBounds();
if (rect != null) {
float from = rect.bottom;
animate(from, to, velocity, isClosing);
@ -653,7 +656,7 @@ public class CarStatusBar extends StatusBar implements
if (isClosing) {
mStatusBarWindowController.setPanelVisible(false);
mNotificationView.setVisibility(View.INVISIBLE);
mNotificationList.setClipBounds(null);
mNotificationView.setClipBounds(null);
mNotificationViewController.setIsInForeground(false);
// let the status bar know that the panel is closed
setPanelExpanded(false);
@ -1012,8 +1015,12 @@ public class CarStatusBar extends StatusBar implements
Rect clipBounds = new Rect();
clipBounds.set(0, 0, mNotificationView.getWidth(), height);
// Sets the clip region on the notification list view.
mNotificationList.setClipBounds(clipBounds);
mNotificationView.setClipBounds(clipBounds);
if (mHandleBar != null) {
ViewGroup.MarginLayoutParams lp =
(ViewGroup.MarginLayoutParams) mHandleBar.getLayoutParams();
mHandleBar.setTranslationY(height - mHandleBar.getHeight() - lp.bottomMargin);
}
if (mNotificationView.getHeight() > 0) {
// Calculates the alpha value for the background based on how much of the notification
// shade is visible to the user. When the notification shade is completely open then