Merge "Update people UX for Demo Day"

This commit is contained in:
Julia Reynolds
2020-12-09 20:52:55 +00:00
committed by Android (Google) Code Review
10 changed files with 279 additions and 14 deletions

View File

@@ -0,0 +1,20 @@
<?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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="?android:attr/colorControlHighlight" />
<corners android:radius="@dimen/people_space_widget_radius" />
</shape>

View File

@@ -0,0 +1,19 @@
<!--
~ 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?android:attr/colorBackground" />
<corners android:radius="@dimen/people_space_widget_round_radius" />
</shape>

View File

@@ -0,0 +1,19 @@
<!--
~ 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="?android:attr/colorBackground" />
</shape>

View File

@@ -14,6 +14,6 @@
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white" />
<solid android:color="?android:attr/colorBackground" />
<corners android:radius="@dimen/people_space_widget_radius" />
</shape>

View File

@@ -18,7 +18,7 @@
android:shape="rectangle" >
<solid
android:color="?android:attr/colorControlNormal" />
<corners android:radius="@dimen/people_space_widget_radius" />
<corners android:radius="@dimen/people_space_widget_background_padding" />
<padding
android:left="@dimen/people_space_widget_background_padding"
android:top="@dimen/people_space_widget_background_padding"

View File

@@ -0,0 +1,89 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:background="@drawable/people_space_round_tile_view_card"
android:id="@+id/item"
android:paddingVertical="6dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/person_icon"
android:layout_width="60dp"
android:layout_height="60dp" />
<LinearLayout
android:background="@drawable/people_space_rounded_border"
android:layout_marginStart="-12dp"
android:layout_marginTop="28dp"
android:layout_marginBottom="14dp"
android:layout_width="16dp"
android:layout_height="16dp">
<ImageView
android:id="@+id/package_icon"
android:layout_width="12dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="2dp"
android:layout_marginTop="2dp"
android:layout_height="12dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:paddingStart="8dp"
android:paddingEnd="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/status"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:paddingVertical="3dp"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
android:ellipsize="end" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,97 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:background="@drawable/people_space_tile_view_card"
android:id="@+id/item"
android:orientation="vertical"
android:paddingTop="6dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:paddingHorizontal="12dp"
android:paddingBottom="4dp"
android:gravity="top"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/person_icon"
android:layout_width="34dp"
android:layout_height="34dp" />
<LinearLayout
android:background="@drawable/people_space_rounded_border"
android:layout_marginStart="-5dp"
android:layout_marginTop="18dp"
android:layout_width="8dp"
android:layout_height="8dp">
<ImageView
android:id="@+id/package_icon"
android:layout_width="6dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:layout_height="6dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:paddingStart="6dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
android:textSize="14sp"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/time"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textSize="10sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/content"
android:paddingVertical="3dp"
android:paddingHorizontal="12dp"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:background="@drawable/people_space_content_background"
android:textSize="14sp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="2"
android:ellipsize="end" />
</LinearLayout>
</LinearLayout>

View File

@@ -16,6 +16,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:padding="4dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
@@ -31,24 +32,37 @@
<LinearLayout
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingStart="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/person_icon"
android:layout_width="42dp"
android:layout_height="42dp" />
android:layout_width="60dp"
android:layout_height="60dp" />
<ImageView
android:id="@+id/package_icon"
android:gravity="bottom|end"
android:layout_width="14dp"
android:layout_marginStart="-8dp"
android:layout_height="14dp" />
<LinearLayout
android:background="@drawable/people_space_rounded_border"
android:layout_marginStart="-12dp"
android:layout_marginTop="28dp"
android:layout_marginBottom="14dp"
android:layout_width="16dp"
android:layout_height="16dp">
<ImageView
android:id="@+id/package_icon"
android:layout_width="12dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="2dp"
android:layout_marginTop="2dp"
android:layout_height="12dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:paddingStart="4dp"
android:paddingStart="8dp"
android:paddingEnd="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

View File

@@ -1303,6 +1303,7 @@
<dimen name="media_output_dialog_icon_corner_radius">16dp</dimen>
<dimen name="media_output_dialog_title_anim_y_delta">12.5dp</dimen>
<dimen name="people_space_widget_radius">10dp</dimen>
<dimen name="people_space_widget_radius">24dp</dimen>
<dimen name="people_space_widget_round_radius">100dp</dimen>
<dimen name="people_space_widget_background_padding">6dp</dimen>
</resources>

View File

@@ -111,8 +111,6 @@ public class PeopleSpaceUtils {
context, notificationManager,
mPeopleManager, mLauncherApps);
for (int appWidgetId : appWidgetIds) {
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.people_space_widget_item);
String shortcutId = sp.getString(String.valueOf(appWidgetId), null);
if (DEBUG) {
Log.d(TAG, "Set widget: " + appWidgetId + " with shortcut ID: " + shortcutId);
@@ -127,6 +125,8 @@ public class PeopleSpaceUtils {
continue;
}
PeopleSpaceTile tile = entry.get().getValue();
RemoteViews views = new RemoteViews(context.getPackageName(),
getLayout(tile));
String status = PeopleSpaceUtils.getLastInteractionString(context,
entry.get().getKey());
@@ -158,6 +158,12 @@ public class PeopleSpaceUtils {
}
}
/** Returns the layout ID for the {@code tile}. */
private static int getLayout(PeopleSpaceTile tile) {
return tile.getNotification() == null ? R.layout.people_space_large_avatar_tile :
R.layout.people_space_small_avatar_tile;
}
/** Returns a list sorted by ascending last interaction time from {@code stream}. */
private static List<Map.Entry<Long, PeopleSpaceTile>> getSortedTiles(
IPeopleManager peopleManager, Stream<PeopleSpaceTile> stream) {