Merge "Add screen for notification history"

This commit is contained in:
Julia Reynolds
2020-01-21 16:21:30 +00:00
committed by Android (Google) Code Review
19 changed files with 1287 additions and 0 deletions

View File

@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
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.
-->
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:background="@*android:color/material_grey_50">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- TODO: header switch -->
<LinearLayout
android:id="@+id/snoozed_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="10dp">
<LinearLayout
android:id="@+id/snooze_header"
android:layout_height="48dp"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:src="@drawable/ic_snooze"
android:tint="?android:attr/textColorPrimary"
android:padding="6dp"
android:layout_height="36dp"
android:layout_width="36dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/notification_history_snooze"
android:textColor="?android:attr/textColorPrimary"
android:paddingStart="@dimen/notification_history_header_drawable_start" />
</LinearLayout>
<FrameLayout
android:id="@+id/list_container"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:clipChildren="true"
android:elevation="3dp"
android:background="@drawable/rounded_bg">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notification_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="true"
settings:fastScrollEnabled="true"
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/recently_dismissed_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="10dp">
<LinearLayout
android:id="@+id/dismissed_header"
android:layout_height="48dp"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:src="@drawable/ic_clear"
android:tint="?android:attr/textColorPrimary"
android:padding="6dp"
android:layout_height="36dp"
android:layout_width="36dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/notification_history_dismiss"
android:textColor="?android:attr/textColorPrimary"
android:paddingStart="@dimen/notification_history_header_drawable_start" />
</LinearLayout>
<FrameLayout
android:id="@+id/list_container"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:elevation="3dp"
android:clipChildren="true"
android:background="@drawable/rounded_bg">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notification_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="true"
settings:fastScrollEnabled="true"
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/today_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/app_header"
android:layout_height="48dp"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:src="@drawable/ic_today"
android:tint="?android:attr/textColorPrimary"
android:padding="6dp"
android:layout_height="36dp"
android:layout_width="36dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/notification_history_today"
android:textColor="?android:attr/textColorPrimary"
android:paddingStart="@dimen/notification_history_header_drawable_start" />
</LinearLayout>
<LinearLayout
android:id="@+id/apps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="3dp"
android:orientation="vertical"
android:background="@drawable/rounded_bg">
<!-- app based recycler views added here -->
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
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"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/app_header"
android:layout_height="48dp"
android:layout_width="match_parent">
<ImageView
android:id="@+id/icon"
android:padding="6dp"
android:layout_centerVertical="true"
android:layout_height="36dp"
android:layout_width="36dp" />
<TextView
android:id="@+id/label"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:textColor="@color/material_grey_900"
android:layout_toEndOf="@id/icon"
android:paddingStart="@dimen/notification_history_header_drawable_start" />
<ImageButton
android:id="@+id/expand"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_height="48dp"
android:layout_width="48dp"
android:src="@*android:drawable/ic_expand_more"/>
</RelativeLayout>
<FrameLayout
android:id="@+id/list_container"
android:layout_width="match_parent"
android:clipChildren="true"
android:layout_height="300dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notification_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="true"
settings:fastScrollEnabled="true"
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
</FrameLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/material_grey_300" />
</LinearLayout>

View File

@@ -0,0 +1,93 @@
<!--
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.
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingTop="6dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical"
android:background="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="6dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@*android:dimen/status_bar_icon_size"
android:gravity="center_vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/material_grey_900"
android:textAlignment="viewStart"/>
<ImageView
android:id="@+id/alerted_icon"
android:layout_width="@*android:dimen/status_bar_icon_size"
android:layout_height="@*android:dimen/status_bar_icon_size"
android:layout_centerVertical="true"
android:layout_marginStart="6dp"
android:paddingTop="1dp"
android:scaleType="fitCenter"
android:visibility="gone"
android:layout_toEndOf="@id/title"
android:tint="?android:attr/textColorSecondary"
android:src="@drawable/ic_notifications_alert"/>
<DateTimeView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewEnd"
/>
</RelativeLayout>
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:ellipsize="end"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="17dp"
android:background="@color/material_grey_300" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,142 @@
<!--
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.
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingTop="6dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical"
android:background="?android:attr/selectableItemBackground"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/icon"
android:layout_width="@*android:dimen/status_bar_icon_size"
android:layout_height="@*android:dimen/status_bar_icon_size"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/pkgicon"
android:layout_marginStart="0dp"
android:layout_marginEnd="8dp"
android:contentDescription="@null"
android:adjustViewBounds="true"
android:tint="?android:attr/textColorPrimary"
android:maxHeight="@*android:dimen/status_bar_icon_size"
android:maxWidth="@*android:dimen/status_bar_icon_size"
android:scaleType="fitCenter" />
<TextView
android:id="@+id/pkgname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/icon"
android:ellipsize="end"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:textAlignment="viewStart" />
<ImageView
android:id="@+id/alerted_icon"
android:layout_width="@*android:dimen/status_bar_icon_size"
android:layout_height="@*android:dimen/status_bar_icon_size"
android:layout_centerVertical="true"
android:layout_marginStart="6dp"
android:paddingTop="1dp"
android:scaleType="fitCenter"
android:visibility="gone"
android:layout_toEndOf="@id/pkgname"
android:tint="?android:attr/textColorSecondary"
android:src="@drawable/ic_notifications_alert"
/>
<ImageView
android:id="@+id/profile_badge"
android:layout_width="@*android:dimen/status_bar_icon_size"
android:layout_height="@*android:dimen/status_bar_icon_size"
android:layout_centerVertical="true"
android:layout_marginEnd="6dp"
android:paddingTop="1dp"
android:scaleType="fitCenter"
android:visibility="gone"
android:layout_toStartOf="@id/timestamp"
/>
<DateTimeView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="13dp"
android:paddingBottom="13dp"
android:layout_alignBottom="@android:id/widget_frame"
android:layout_alignParentEnd="true"
android:layout_alignTop="@android:id/widget_frame"
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewEnd"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="30dp"
android:layout_marginBottom="6dp"
>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:ellipsize="end"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textAlignment="viewStart"
/>
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:ellipsize="end"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="17dp"
android:background="@color/material_grey_300" />
</LinearLayout>