Merge "Add status scrim for full-bleed and update empty" into sc-dev
This commit is contained in:
47
packages/SystemUI/res/drawable/ic_conversation_icon.xml
Normal file
47
packages/SystemUI/res/drawable/ic_conversation_icon.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M24,24m-24,0a24,24 0,1 1,48 0a24,24 0,1 1,-48 0"
|
||||
android:fillColor="#81C995"/>
|
||||
<path
|
||||
android:pathData="M27,34C23.134,34 20,30.866 20,27C20,23.134 23.134,20 27,20C30.866,20 34,23.134 34,27C34,28.4872 33.5362,29.8662 32.7453,31"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#3C4043"/>
|
||||
<path
|
||||
android:pathData="M35,33l-8,0l-0,2l8,0z"
|
||||
android:fillColor="#3C4043"/>
|
||||
<path
|
||||
android:pathData="M21,21m-6,0a6,6 0,1 1,12 0a6,6 0,1 1,-12 0"
|
||||
android:fillColor="#81C995"/>
|
||||
<path
|
||||
android:pathData="M16,25h5v2h-5z"
|
||||
android:fillColor="#81C995"/>
|
||||
<path
|
||||
android:pathData="M21,28C24.866,28 28,24.866 28,21C28,17.134 24.866,14 21,14C17.134,14 14,17.134 14,21C14,22.4872 14.4638,23.8662 15.2547,25"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M13,27h8v2h-8z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
28
packages/SystemUI/res/drawable/ic_corp_badge_off.xml
Normal file
28
packages/SystemUI/res/drawable/ic_corp_badge_off.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20.0"
|
||||
android:viewportHeight="20.0">
|
||||
<path
|
||||
android:pathData="M10,10m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"
|
||||
android:fillColor="#607D8B"/>
|
||||
<path
|
||||
android:pathData="M16.42,15.68l-0.85,-0.85L7.21,6.47L4.9,4.16L4.16,4.9l1.57,1.57H5.36c-0.65,0 -1.16,0.52 -1.16,1.17L4.2,14.05c0,0.65 0.52,1.17 1.17,1.17h9.12l1.2,1.2L16.42,15.68zM15.83,7.64c0.03,-0.65 -0.49,-1.17 -1.14,-1.14h-2.33V5.3c0,-0.65 -0.52,-1.17 -1.17,-1.14H8.86C8.22,4.14 7.7,4.66 7.7,5.3v0.19l8.14,8.17V7.64zM11.2,6.5H8.83V5.3h2.36V6.5z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
|
||||
<solid android:color="?androidprv:attr/colorSurface" />
|
||||
<corners android:radius="@dimen/people_space_widget_radius" />
|
||||
</shape>
|
||||
23
packages/SystemUI/res/drawable/people_tile_status_scrim.xml
Normal file
23
packages/SystemUI/res/drawable/people_tile_status_scrim.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
|
||||
<gradient
|
||||
android:type="linear"
|
||||
android:angle="90"
|
||||
android:endColor="@android:color/transparent"
|
||||
android:startColor="?androidprv:attr/colorSurfaceHeader" />
|
||||
</shape>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
|
||||
<solid android:color="?androidprv:attr/colorSurfaceVariant" />
|
||||
<corners android:radius="@dimen/people_space_widget_radius" />
|
||||
</shape>
|
||||
58
packages/SystemUI/res/layout/people_status_scrim_layout.xml
Normal file
58
packages/SystemUI/res/layout/people_status_scrim_layout.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/scrim_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status_icon"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="1"
|
||||
android:orientation="vertical">
|
||||
<ImageView
|
||||
android:layout_weight=".2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp" />
|
||||
<ImageView
|
||||
android:background="@drawable/people_tile_status_scrim"
|
||||
android:layout_weight=".8"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="1"
|
||||
android:orientation="vertical">
|
||||
<ImageView
|
||||
android:layout_weight=".66"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp" />
|
||||
<ImageView
|
||||
android:background="@drawable/people_tile_status_scrim"
|
||||
android:layout_weight=".33"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -14,16 +14,17 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item"
|
||||
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||
android:background="@drawable/people_space_tile_view_card"
|
||||
android:background="@drawable/people_tile_empty_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item"
|
||||
android:id="@+id/icon"
|
||||
android:src="@drawable/ic_conversation_icon"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:padding="8dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"/>
|
||||
</FrameLayout>
|
||||
@@ -1,145 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2021 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:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||
android:id="@+id/item"
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:background="@drawable/people_space_tile_view_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/item"
|
||||
android:clipToOutline="true"
|
||||
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||
android:layout_gravity="center"
|
||||
android:padding="16dp"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
<include layout="@layout/people_status_scrim_layout" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start|top">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:padding="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:gravity="start|top"
|
||||
android:orientation="horizontal">
|
||||
android:gravity="start|top">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/person_icon"
|
||||
android:layout_marginStart="-2dp"
|
||||
android:layout_marginTop="-2dp"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_alignParentStart="true"
|
||||
android:gravity="start|top"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/availability"
|
||||
android:layout_marginStart="-2dp"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:background="@drawable/circle_green_10dp" />
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/person_icon"
|
||||
android:layout_marginStart="-2dp"
|
||||
android:layout_marginTop="-2dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/messages_count"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:background="@drawable/people_space_messages_count_background"
|
||||
android:textSize="14sp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<include layout="@layout/people_tile_punctuation_background_large" />
|
||||
<include layout="@layout/people_tile_emoji_background_large" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="12dp"
|
||||
android:gravity="start"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/empty_user_name"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/predefined_icon"
|
||||
android:tint="?android:attr/colorAccent"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingEnd="6dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="18dp" />
|
||||
<ImageView
|
||||
android:id="@+id/availability"
|
||||
android:layout_marginStart="-2dp"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:background="@drawable/circle_green_10dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/subtext"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="@string/empty_user_name"
|
||||
android:id="@+id/messages_count"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:background="@drawable/people_space_messages_count_background"
|
||||
android:textSize="14sp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/people_space_content_background"
|
||||
android:gravity="center"
|
||||
android:scaleType="centerCrop" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/text_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:singleLine="false"
|
||||
android:text="@string/empty_status"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/people_tile_punctuation_background_large" />
|
||||
|
||||
<include layout="@layout/people_tile_emoji_background_large" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="12dp"
|
||||
android:gravity="start"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/empty_user_name"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/status_icon_and_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/predefined_icon"
|
||||
android:tint="?android:attr/colorAccent"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingEnd="6dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="18dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/subtext"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="@string/empty_user_name"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/people_space_content_background"
|
||||
android:gravity="center"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<TextView
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/text_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:singleLine="false"
|
||||
android:text="@string/empty_status"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/content_text_size_for_large" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -17,18 +17,20 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||
android:id="@+id/item"
|
||||
android:background="@drawable/people_space_tile_view_card"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:background="@drawable/people_space_tile_view_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<include layout="@layout/people_tile_punctuation_background_medium" />
|
||||
<include layout="@layout/people_tile_emoji_background_medium" />
|
||||
<include layout="@layout/people_tile_punctuation_background_medium" />
|
||||
<include layout="@layout/people_status_scrim_layout" />
|
||||
<LinearLayout
|
||||
android:id="@+id/item"
|
||||
android:id="@+id/content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center"
|
||||
android:padding="8dp"
|
||||
@@ -89,7 +91,7 @@
|
||||
android:text="@string/empty_status"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="12sp"
|
||||
android:textSize="@dimen/content_text_size_for_medium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item"
|
||||
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||
android:background="@drawable/people_tile_suppressed_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"/>
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,39 @@
|
||||
<!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
android:id="@+id/item"
|
||||
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||
android:background="@drawable/people_tile_suppressed_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"/>
|
||||
|
||||
<ImageView android:id="@+id/work_widget_badge_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:src="@drawable/ic_corp_badge_off"
|
||||
android:clickable="false" />
|
||||
</FrameLayout>
|
||||
@@ -416,9 +416,8 @@ public class PeopleSpaceUtils {
|
||||
&& birthdayString == null;
|
||||
boolean addBirthdayStatus = !hasBirthdayStatus(storedTile, context)
|
||||
&& birthdayString != null;
|
||||
boolean shouldUpdate =
|
||||
storedTile.getContactAffinity() != affinity || outdatedBirthdayStatus
|
||||
|| addBirthdayStatus;
|
||||
boolean shouldUpdate = storedTile.getContactAffinity() != affinity || outdatedBirthdayStatus
|
||||
|| addBirthdayStatus;
|
||||
if (shouldUpdate) {
|
||||
if (DEBUG) Log.d(TAG, "Update " + storedTile.getUserName() + " from contacts");
|
||||
manager.updateAppWidgetOptionsAndView(appWidgetId,
|
||||
|
||||
@@ -41,8 +41,6 @@ import android.app.people.ConversationStatus;
|
||||
import android.app.people.PeopleSpaceTile;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -57,13 +55,13 @@ import android.text.TextUtils;
|
||||
import android.util.IconDrawableFactory;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.RemoteViews;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.people.widget.LaunchConversationActivity;
|
||||
import com.android.systemui.people.widget.PeopleSpaceWidgetProvider;
|
||||
@@ -195,16 +193,10 @@ public class PeopleTileViewHelper {
|
||||
*/
|
||||
private RemoteViews getViewForTile() {
|
||||
if (DEBUG) Log.d(TAG, "Creating view for tile key: " + mKey.toString());
|
||||
if (mTile == null || mTile.isPackageSuspended() || mTile.isUserQuieted()) {
|
||||
if (DEBUG) Log.d(TAG, "Create empty view: " + mTile);
|
||||
return createEmptyView();
|
||||
}
|
||||
|
||||
boolean dndBlockingTileData = isDndBlockingTileData(mTile);
|
||||
if (dndBlockingTileData) {
|
||||
if (DEBUG) Log.d(TAG, "Create DND view: " + mTile.getNotificationPolicyState());
|
||||
// TODO: Create DND view.
|
||||
return createEmptyView();
|
||||
if (mTile == null || mTile.isPackageSuspended() || mTile.isUserQuieted()
|
||||
|| isDndBlockingTileData(mTile)) {
|
||||
if (DEBUG) Log.d(TAG, "Create suppressed view: " + mTile);
|
||||
return createSuppressedView();
|
||||
}
|
||||
|
||||
if (Objects.equals(mTile.getNotificationCategory(), CATEGORY_MISSED_CALL)) {
|
||||
@@ -265,34 +257,27 @@ public class PeopleTileViewHelper {
|
||||
return !tile.canBypassDnd();
|
||||
}
|
||||
|
||||
private RemoteViews createEmptyView() {
|
||||
RemoteViews views = new RemoteViews(mContext.getPackageName(),
|
||||
R.layout.people_tile_empty_layout);
|
||||
Drawable appIcon = getAppBadge(mKey.getPackageName(), mKey.getUserId());
|
||||
private RemoteViews createSuppressedView() {
|
||||
RemoteViews views;
|
||||
if (mTile.isUserQuieted()) {
|
||||
views = new RemoteViews(mContext.getPackageName(),
|
||||
R.layout.people_tile_work_profile_quiet_layout);
|
||||
} else {
|
||||
views = new RemoteViews(mContext.getPackageName(),
|
||||
R.layout.people_tile_suppressed_layout);
|
||||
}
|
||||
Drawable appIcon = mContext.getDrawable(R.drawable.ic_conversation_icon);
|
||||
Bitmap appIconAsBitmap = convertDrawableToBitmap(appIcon);
|
||||
FastBitmapDrawable drawable = new FastBitmapDrawable(
|
||||
appIconAsBitmap);
|
||||
FastBitmapDrawable drawable = new FastBitmapDrawable(appIconAsBitmap);
|
||||
drawable.setIsDisabled(true);
|
||||
Bitmap convertedBitmap = convertDrawableToBitmap(drawable);
|
||||
views.setImageViewBitmap(R.id.item, convertedBitmap);
|
||||
views.setImageViewBitmap(R.id.icon, convertedBitmap);
|
||||
return views;
|
||||
}
|
||||
|
||||
private Drawable getAppBadge(String packageName, int userId) {
|
||||
Drawable badge = null;
|
||||
try {
|
||||
final ApplicationInfo appInfo = mContext.getPackageManager().getApplicationInfoAsUser(
|
||||
packageName, PackageManager.GET_META_DATA, userId);
|
||||
badge = Utils.getBadgedIcon(mContext, appInfo);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
badge = mContext.getPackageManager().getDefaultActivityIcon();
|
||||
}
|
||||
return badge;
|
||||
}
|
||||
|
||||
private void setMaxLines(RemoteViews views, boolean showSender) {
|
||||
int textSize = mLayoutSize == LAYOUT_LARGE ? getSizeInDp(
|
||||
R.dimen.content_text_size_for_medium)
|
||||
R.dimen.content_text_size_for_large)
|
||||
: getSizeInDp(R.dimen.content_text_size_for_medium);
|
||||
int lineHeight = getLineHeight(textSize);
|
||||
int notificationContentHeight = getContentHeightForLayout(lineHeight);
|
||||
@@ -422,9 +407,6 @@ public class PeopleTileViewHelper {
|
||||
views.setViewVisibility(R.id.availability, View.GONE);
|
||||
}
|
||||
|
||||
if (mTile.getUserName() != null) {
|
||||
views.setTextViewText(R.id.name, mTile.getUserName().toString());
|
||||
}
|
||||
views.setBoolean(R.id.image, "setClipToOutline", true);
|
||||
views.setImageViewBitmap(R.id.person_icon,
|
||||
getPersonIconBitmap(mContext, mTile, maxAvatarSize));
|
||||
@@ -537,25 +519,31 @@ public class PeopleTileViewHelper {
|
||||
statusText = getStatusTextByType(status.getActivity());
|
||||
}
|
||||
views.setViewVisibility(R.id.predefined_icon, View.VISIBLE);
|
||||
views.setViewVisibility(R.id.messages_count, View.GONE);
|
||||
setMaxLines(views, false);
|
||||
// Secondary text color for statuses.
|
||||
views.setColorAttr(R.id.text_content, "setTextColor", android.R.attr.textColorSecondary);
|
||||
views.setTextViewText(R.id.text_content, statusText);
|
||||
if (mLayoutSize == LAYOUT_LARGE) {
|
||||
views.setInt(R.id.content, "setGravity", Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
Icon statusIcon = status.getIcon();
|
||||
if (statusIcon != null) {
|
||||
// No multi-line text with status images on medium layout.
|
||||
views.setViewVisibility(R.id.text_content, View.GONE);
|
||||
// No text content styled text on medium or large.
|
||||
views.setViewVisibility(R.id.scrim_layout, View.VISIBLE);
|
||||
views.setImageViewIcon(R.id.status_icon, statusIcon);
|
||||
// Show 1-line subtext on large layout with status images.
|
||||
if (mLayoutSize == LAYOUT_LARGE) {
|
||||
views.setViewVisibility(R.id.subtext, View.VISIBLE);
|
||||
views.setTextViewText(R.id.subtext, statusText);
|
||||
if (DEBUG) Log.d(TAG, "Remove name for large");
|
||||
views.setViewVisibility(R.id.name, View.GONE);
|
||||
views.setColorAttr(R.id.text_content, "setTextColor",
|
||||
android.R.attr.textColorPrimary);
|
||||
} else if (mLayoutSize == LAYOUT_MEDIUM) {
|
||||
views.setViewVisibility(R.id.text_content, View.GONE);
|
||||
views.setTextViewText(R.id.name, statusText);
|
||||
}
|
||||
views.setViewVisibility(R.id.image, View.VISIBLE);
|
||||
views.setImageViewIcon(R.id.image, statusIcon);
|
||||
} else {
|
||||
views.setViewVisibility(R.id.image, View.GONE);
|
||||
// Secondary text color for statuses without icons.
|
||||
views.setColorAttr(R.id.text_content, "setTextColor",
|
||||
android.R.attr.textColorSecondary);
|
||||
setMaxLines(views, false);
|
||||
}
|
||||
// TODO: Set status pre-defined icons
|
||||
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_person);
|
||||
@@ -741,16 +729,23 @@ public class PeopleTileViewHelper {
|
||||
views.setViewVisibility(R.id.name, View.VISIBLE);
|
||||
views.setViewVisibility(R.id.text_content, View.VISIBLE);
|
||||
views.setViewVisibility(R.id.subtext, View.GONE);
|
||||
views.setViewVisibility(R.id.image, View.GONE);
|
||||
views.setViewVisibility(R.id.scrim_layout, View.GONE);
|
||||
}
|
||||
|
||||
if (mLayoutSize == LAYOUT_MEDIUM) {
|
||||
if (DEBUG) Log.d(TAG, "Set vertical padding: " + mMediumVerticalPadding);
|
||||
int horizontalPadding = (int) Math.floor(MAX_MEDIUM_PADDING * mDensity);
|
||||
int verticalPadding = (int) Math.floor(mMediumVerticalPadding * mDensity);
|
||||
views.setViewPadding(R.id.item, horizontalPadding, verticalPadding, horizontalPadding,
|
||||
views.setViewPadding(R.id.content, horizontalPadding, verticalPadding,
|
||||
horizontalPadding,
|
||||
verticalPadding);
|
||||
}
|
||||
views.setViewVisibility(R.id.messages_count, View.GONE);
|
||||
if (mTile.getUserName() != null) {
|
||||
views.setTextViewText(R.id.name, mTile.getUserName());
|
||||
}
|
||||
|
||||
return views;
|
||||
}
|
||||
|
||||
@@ -761,6 +756,9 @@ public class PeopleTileViewHelper {
|
||||
views.setViewVisibility(R.id.predefined_icon, View.GONE);
|
||||
views.setViewVisibility(R.id.messages_count, View.GONE);
|
||||
}
|
||||
if (mTile.getUserName() != null) {
|
||||
views.setTextViewText(R.id.name, mTile.getUserName());
|
||||
}
|
||||
String status = getLastInteractionString(mContext,
|
||||
mTile.getLastInteractionTimestamp());
|
||||
if (status != null) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.people;
|
||||
|
||||
import static android.app.Notification.CATEGORY_MISSED_CALL;
|
||||
import static android.app.people.ConversationStatus.ACTIVITY_ANNIVERSARY;
|
||||
import static android.app.people.ConversationStatus.ACTIVITY_BIRTHDAY;
|
||||
import static android.app.people.ConversationStatus.ACTIVITY_GAME;
|
||||
import static android.app.people.ConversationStatus.ACTIVITY_NEW_STORY;
|
||||
@@ -25,6 +26,7 @@ import static android.app.people.PeopleSpaceTile.BLOCK_CONVERSATIONS;
|
||||
import static android.app.people.PeopleSpaceTile.SHOW_CONTACTS;
|
||||
import static android.app.people.PeopleSpaceTile.SHOW_IMPORTANT_CONVERSATIONS;
|
||||
import static android.app.people.PeopleSpaceTile.SHOW_STARRED_CONTACTS;
|
||||
import static android.appwidget.AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT;
|
||||
import static android.appwidget.AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH;
|
||||
|
||||
import static com.android.systemui.people.PeopleSpaceUtils.STARRED_CONTACT;
|
||||
@@ -126,6 +128,9 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
.setAvailability(AVAILABILITY_AVAILABLE)
|
||||
.build();
|
||||
|
||||
@Mock
|
||||
private Icon mIcon;
|
||||
|
||||
@Mock
|
||||
private Context mMockContext;
|
||||
@Mock
|
||||
@@ -169,7 +174,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
PERSON_TILE_WITHOUT_NOTIFICATION, mOptions).getViews();
|
||||
@@ -218,7 +223,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithLastInteraction, mOptions).getViews();
|
||||
@@ -278,7 +283,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithAvailabilityAndNewStory, mOptions).getViews();
|
||||
@@ -340,7 +345,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithStatusTemplate, mOptions).getViews();
|
||||
@@ -376,6 +381,8 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
assertEquals(name.getText(), NAME);
|
||||
assertEquals(View.GONE, result.findViewById(R.id.subtext).getVisibility());
|
||||
assertEquals(View.VISIBLE, result.findViewById(R.id.predefined_icon).getVisibility());
|
||||
assertEquals(View.GONE, result.findViewById(R.id.scrim_layout).getVisibility());
|
||||
assertEquals(View.GONE, result.findViewById(R.id.image).getVisibility());
|
||||
// Has availability.
|
||||
assertEquals(View.VISIBLE, result.findViewById(R.id.availability).getVisibility());
|
||||
// Has person icon.
|
||||
@@ -403,7 +410,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithStatusTemplate, mOptions).getViews();
|
||||
@@ -413,6 +420,8 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
assertEquals(name.getText(), NAME);
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.subtext).getVisibility());
|
||||
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.predefined_icon).getVisibility());
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.scrim_layout).getVisibility());
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.image).getVisibility());
|
||||
// Has availability.
|
||||
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.availability).getVisibility());
|
||||
// Has person icon.
|
||||
@@ -425,6 +434,55 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
assertThat(statusContent.getMaxLines()).isEqualTo(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRemoteViewsWithStatusTemplateWithImageOnMediumAndLarge() {
|
||||
PeopleSpaceTile tileWithIconInStatusTemplate =
|
||||
PERSON_TILE_WITHOUT_NOTIFICATION.toBuilder().setStatuses(
|
||||
Arrays.asList(new ConversationStatus.Builder(PERSON_TILE.getId(),
|
||||
ACTIVITY_ANNIVERSARY).setDescription("Anniversary").setAvailability(
|
||||
AVAILABILITY_AVAILABLE).setIcon(mIcon).build())).build();
|
||||
RemoteViews views = getPeopleTileViewHelper(
|
||||
tileWithIconInStatusTemplate, mOptions).getViews();
|
||||
View result = views.apply(mContext, null);
|
||||
|
||||
assertEquals(View.GONE, result.findViewById(R.id.subtext).getVisibility());
|
||||
assertEquals(View.VISIBLE, result.findViewById(R.id.predefined_icon).getVisibility());
|
||||
assertEquals(View.VISIBLE, result.findViewById(R.id.scrim_layout).getVisibility());
|
||||
assertEquals(View.GONE, result.findViewById(R.id.image).getVisibility());
|
||||
// Has availability.
|
||||
assertEquals(View.VISIBLE, result.findViewById(R.id.availability).getVisibility());
|
||||
// Has person icon.
|
||||
assertEquals(View.VISIBLE, result.findViewById(R.id.person_icon).getVisibility());
|
||||
// Has status.
|
||||
TextView statusContent = (TextView) result.findViewById(R.id.name);
|
||||
assertEquals(statusContent.getText(), "Anniversary");
|
||||
assertThat(statusContent.getMaxLines()).isEqualTo(1);
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithIconInStatusTemplate, mOptions).getViews();
|
||||
View largeResult = largeView.apply(mContext, null);
|
||||
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.subtext).getVisibility());
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.name).getVisibility());
|
||||
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.predefined_icon).getVisibility());
|
||||
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.scrim_layout).getVisibility());
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.image).getVisibility());
|
||||
// Has availability.
|
||||
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.availability).getVisibility());
|
||||
// Has person icon.
|
||||
View personIcon = largeResult.findViewById(R.id.person_icon);
|
||||
assertEquals(View.VISIBLE, personIcon.getVisibility());
|
||||
// Has status content.
|
||||
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
|
||||
assertEquals(View.VISIBLE, statusContent.getVisibility());
|
||||
assertEquals(statusContent.getText(), "Anniversary");
|
||||
assertThat(statusContent.getMaxLines()).isEqualTo(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRemoteViewsWithPackageSuspended() {
|
||||
PeopleSpaceTile tile = PERSON_TILE.toBuilder()
|
||||
@@ -434,7 +492,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tile, mOptions).getViews();
|
||||
View result = views.apply(mContext, null);
|
||||
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -446,7 +504,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tile, mOptions).getViews();
|
||||
View result = views.apply(mContext, null);
|
||||
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_work_profile_quiet_layout);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -458,7 +516,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
View result = views.apply(mContext, null);
|
||||
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
|
||||
tileWithDndBlocking = PERSON_TILE.toBuilder()
|
||||
.setNotificationPolicyState(BLOCK_CONVERSATIONS)
|
||||
@@ -468,7 +526,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
result = views.apply(mContext, null);
|
||||
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
|
||||
tileWithDndBlocking = PERSON_TILE.toBuilder()
|
||||
.setNotificationPolicyState(SHOW_IMPORTANT_CONVERSATIONS)
|
||||
@@ -477,7 +535,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
result = views.apply(mContext, null);
|
||||
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
|
||||
tileWithDndBlocking = PERSON_TILE.toBuilder()
|
||||
.setNotificationPolicyState(SHOW_IMPORTANT_CONVERSATIONS)
|
||||
@@ -487,7 +545,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
result = views.apply(mContext, null);
|
||||
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
|
||||
tileWithDndBlocking = PERSON_TILE.toBuilder()
|
||||
.setNotificationPolicyState(SHOW_STARRED_CONTACTS)
|
||||
@@ -497,7 +555,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
result = views.apply(mContext, null);
|
||||
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
|
||||
tileWithDndBlocking = PERSON_TILE.toBuilder()
|
||||
.setNotificationPolicyState(SHOW_STARRED_CONTACTS)
|
||||
@@ -507,7 +565,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
result = views.apply(mContext, null);
|
||||
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
|
||||
tileWithDndBlocking = PERSON_TILE.toBuilder()
|
||||
.setNotificationPolicyState(SHOW_CONTACTS)
|
||||
@@ -517,7 +575,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
result = views.apply(mContext, null);
|
||||
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
|
||||
tileWithDndBlocking = PERSON_TILE.toBuilder()
|
||||
.setNotificationPolicyState(SHOW_CONTACTS)
|
||||
@@ -527,7 +585,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
result = views.apply(mContext, null);
|
||||
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertNotEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
|
||||
tileWithDndBlocking = PERSON_TILE.toBuilder()
|
||||
.setNotificationPolicyState(SHOW_CONTACTS)
|
||||
@@ -536,7 +594,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
tileWithDndBlocking, mOptions).getViews();
|
||||
result = views.apply(mContext, null);
|
||||
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_empty_layout);
|
||||
assertEquals(result.getSourceLayoutResId(), R.layout.people_tile_suppressed_layout);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -581,7 +639,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithMissedCallNotification, mOptions).getViews();
|
||||
@@ -617,6 +675,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
assertEquals(name.getText(), NAME);
|
||||
assertEquals(View.GONE, result.findViewById(R.id.subtext).getVisibility());
|
||||
assertEquals(View.GONE, result.findViewById(R.id.predefined_icon).getVisibility());
|
||||
assertEquals(View.GONE, result.findViewById(R.id.scrim_layout).getVisibility());
|
||||
// Has availability.
|
||||
assertEquals(View.VISIBLE, result.findViewById(R.id.availability).getVisibility());
|
||||
// Has person icon.
|
||||
@@ -649,7 +708,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithStatusAndNotification, mOptions).getViews();
|
||||
@@ -659,6 +718,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
assertEquals(name.getText(), NAME);
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.subtext).getVisibility());
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.predefined_icon).getVisibility());
|
||||
assertEquals(View.GONE, largeResult.findViewById(R.id.scrim_layout).getVisibility());
|
||||
// Has availability.
|
||||
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.availability).getVisibility());
|
||||
// Has person icon.
|
||||
@@ -725,7 +785,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithStatusAndNotification, mOptions).getViews();
|
||||
@@ -802,7 +862,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
|
||||
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
getSizeInDp(R.dimen.required_width_for_large));
|
||||
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
|
||||
mOptions.putInt(OPTION_APPWIDGET_MAX_HEIGHT,
|
||||
getSizeInDp(R.dimen.required_height_for_large));
|
||||
RemoteViews largeView = getPeopleTileViewHelper(
|
||||
tileWithStatusAndNotification, mOptions).getViews();
|
||||
|
||||
Reference in New Issue
Block a user