Loading packages/SystemUI/res/layout/people_tile_small_horizontal.xml 0 → 100644 +79 −0 Original line number Diff line number Diff line <?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. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:theme="@android:style/Theme.DeviceDefault.DayNight" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@android:id/background" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:background="@drawable/people_space_tile_view_card" android:clipToOutline="true" android:orientation="horizontal" android:paddingHorizontal="8dp" android:paddingTop="4dp" android:paddingBottom="6dp"> <ImageView android:id="@+id/person_icon" android:layout_gravity="start|center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:paddingEnd="4dp"/> <ImageView android:id="@+id/predefined_icon" android:layout_weight="1" android:tint="?android:attr/textColorSecondary" android:layout_gravity="start|center_vertical" android:layout_width="18dp" android:layout_height="18dp" /> <TextView android:id="@+id/messages_count" android:layout_weight="1" android:layout_gravity="start|center_vertical" android:gravity="center" android:paddingHorizontal="8dp" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title" android:textColor="?androidprv:attr/textColorOnAccent" android:background="@drawable/people_space_messages_count_background" android:textSize="@dimen/name_text_size_for_small" android:maxLines="1" android:ellipsize="end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" /> <TextView android:id="@+id/name" android:layout_weight="1" android:layout_gravity="start|center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/name_text_size_for_small" /> </LinearLayout> </FrameLayout> No newline at end of file packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1457,6 +1457,7 @@ <dimen name="people_space_messages_count_radius">12dp</dimen> <dimen name="people_space_widget_background_padding">6dp</dimen> <dimen name="required_width_for_medium">136dp</dimen> <dimen name="required_height_for_medium">80dp</dimen> <dimen name="required_width_for_large">120dp</dimen> <dimen name="required_height_for_large">168dp</dimen> <dimen name="default_width">146dp</dimen> Loading packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java +2 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,8 @@ import java.util.stream.Stream; /** Utils class for People Space. */ public class PeopleSpaceUtils { /** Turns on debugging information about People Space. */ public static final boolean DEBUG = true; public static final boolean DEBUG = false; public static final String PACKAGE_NAME = "package_name"; public static final String USER_ID = "user_id"; public static final String SHORTCUT_ID = "shortcut_id"; Loading packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java +25 −10 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ import java.util.stream.Collectors; /** Functions that help creating the People tile layouts. */ public class PeopleTileViewHelper { /** Turns on debugging information about People Space. */ public static final boolean DEBUG = true; private static final boolean DEBUG = PeopleSpaceUtils.DEBUG; private static final String TAG = "PeopleTileView"; private static final int DAYS_IN_A_WEEK = 7; Loading @@ -116,8 +116,10 @@ public class PeopleTileViewHelper { private static final int MIN_MEDIUM_VERTICAL_PADDING = 4; private static final int MAX_MEDIUM_PADDING = 16; private static final int FIXED_HEIGHT_DIMENS_FOR_MEDIUM_CONTENT_BEFORE_PADDING = 8 + 4; private static final int FIXED_HEIGHT_DIMENS_FOR_SMALL = 6 + 4 + 8; private static final int FIXED_WIDTH_DIMENS_FOR_SMALL = 4 + 4; private static final int FIXED_HEIGHT_DIMENS_FOR_SMALL_VERTICAL = 6 + 4 + 8; private static final int FIXED_WIDTH_DIMENS_FOR_SMALL_VERTICAL = 4 + 4; private static final int FIXED_HEIGHT_DIMENS_FOR_SMALL_HORIZONTAL = 6 + 4; private static final int FIXED_WIDTH_DIMENS_FOR_SMALL_HORIZONTAL = 8 + 8; private static final int MESSAGES_COUNT_OVERFLOW = 6; Loading Loading @@ -404,7 +406,8 @@ public class PeopleTileViewHelper { return LAYOUT_LARGE; } // Small layout used below a certain minimum mWidth with any mHeight. if (mWidth >= getSizeInDp(R.dimen.required_width_for_medium)) { if (mHeight >= getSizeInDp(R.dimen.required_height_for_medium) && mWidth >= getSizeInDp(R.dimen.required_width_for_medium)) { int spaceAvailableForPadding = mHeight - (getSizeInDp(R.dimen.avatar_size_for_medium) + 4 + getLineHeightFromResource( Loading Loading @@ -437,10 +440,15 @@ public class PeopleTileViewHelper { // Calculate adaptive avatar size for remaining layouts. if (layoutId == R.layout.people_tile_small) { int avatarHeightSpace = mHeight - (FIXED_HEIGHT_DIMENS_FOR_SMALL + Math.max(18, int avatarHeightSpace = mHeight - (FIXED_HEIGHT_DIMENS_FOR_SMALL_VERTICAL + Math.max(18, getLineHeightFromResource( R.dimen.name_text_size_for_small))); int avatarWidthSpace = mWidth - FIXED_WIDTH_DIMENS_FOR_SMALL; int avatarWidthSpace = mWidth - FIXED_WIDTH_DIMENS_FOR_SMALL_VERTICAL; avatarSize = Math.min(avatarHeightSpace, avatarWidthSpace); } if (layoutId == R.layout.people_tile_small_horizontal) { int avatarHeightSpace = mHeight - FIXED_HEIGHT_DIMENS_FOR_SMALL_HORIZONTAL; int avatarWidthSpace = mWidth - FIXED_WIDTH_DIMENS_FOR_SMALL_HORIZONTAL; avatarSize = Math.min(avatarHeightSpace, avatarWidthSpace); } Loading Loading @@ -1033,7 +1041,7 @@ public class PeopleTileViewHelper { return R.layout.people_tile_large_empty; case LAYOUT_SMALL: default: return R.layout.people_tile_small; return getLayoutSmallByHeight(); } } Loading @@ -1045,7 +1053,7 @@ public class PeopleTileViewHelper { return R.layout.people_tile_large_with_notification_content; case LAYOUT_SMALL: default: return R.layout.people_tile_small; return getLayoutSmallByHeight(); } } Loading @@ -1057,8 +1065,15 @@ public class PeopleTileViewHelper { return R.layout.people_tile_large_with_status_content; case LAYOUT_SMALL: default: return getLayoutSmallByHeight(); } } private int getLayoutSmallByHeight() { if (mHeight >= getSizeInDp(R.dimen.required_height_for_medium)) { return R.layout.people_tile_small; } return R.layout.people_tile_small_horizontal; } /** Returns a bitmap with the user icon and package icon. */ Loading packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ public class PeopleSpaceWidgetManager { ConversationChannel channel = mIPeopleManager.getConversation( key.getPackageName(), key.getUserId(), key.getShortcutId()); if (channel == null) { Log.d(TAG, "Could not retrieve conversation from storage"); if (DEBUG) Log.d(TAG, "Could not retrieve conversation from storage"); return null; } Loading Loading @@ -586,7 +586,7 @@ public class PeopleSpaceWidgetManager { @Nullable public Optional<PeopleSpaceTile> getAugmentedTileForExistingWidget(int widgetId, Map<PeopleTileKey, Set<NotificationEntry>> notifications) { Log.d(TAG, "Augmenting tile for existing widget: " + widgetId); if (DEBUG) Log.d(TAG, "Augmenting tile for existing widget: " + widgetId); PeopleSpaceTile tile = getTileForExistingWidget(widgetId); if (tile == null) { if (DEBUG) { Loading Loading
packages/SystemUI/res/layout/people_tile_small_horizontal.xml 0 → 100644 +79 −0 Original line number Diff line number Diff line <?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. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:theme="@android:style/Theme.DeviceDefault.DayNight" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@android:id/background" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:background="@drawable/people_space_tile_view_card" android:clipToOutline="true" android:orientation="horizontal" android:paddingHorizontal="8dp" android:paddingTop="4dp" android:paddingBottom="6dp"> <ImageView android:id="@+id/person_icon" android:layout_gravity="start|center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:paddingEnd="4dp"/> <ImageView android:id="@+id/predefined_icon" android:layout_weight="1" android:tint="?android:attr/textColorSecondary" android:layout_gravity="start|center_vertical" android:layout_width="18dp" android:layout_height="18dp" /> <TextView android:id="@+id/messages_count" android:layout_weight="1" android:layout_gravity="start|center_vertical" android:gravity="center" android:paddingHorizontal="8dp" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title" android:textColor="?androidprv:attr/textColorOnAccent" android:background="@drawable/people_space_messages_count_background" android:textSize="@dimen/name_text_size_for_small" android:maxLines="1" android:ellipsize="end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" /> <TextView android:id="@+id/name" android:layout_weight="1" android:layout_gravity="start|center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/name_text_size_for_small" /> </LinearLayout> </FrameLayout> No newline at end of file
packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1457,6 +1457,7 @@ <dimen name="people_space_messages_count_radius">12dp</dimen> <dimen name="people_space_widget_background_padding">6dp</dimen> <dimen name="required_width_for_medium">136dp</dimen> <dimen name="required_height_for_medium">80dp</dimen> <dimen name="required_width_for_large">120dp</dimen> <dimen name="required_height_for_large">168dp</dimen> <dimen name="default_width">146dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java +2 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,8 @@ import java.util.stream.Stream; /** Utils class for People Space. */ public class PeopleSpaceUtils { /** Turns on debugging information about People Space. */ public static final boolean DEBUG = true; public static final boolean DEBUG = false; public static final String PACKAGE_NAME = "package_name"; public static final String USER_ID = "user_id"; public static final String SHORTCUT_ID = "shortcut_id"; Loading
packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java +25 −10 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ import java.util.stream.Collectors; /** Functions that help creating the People tile layouts. */ public class PeopleTileViewHelper { /** Turns on debugging information about People Space. */ public static final boolean DEBUG = true; private static final boolean DEBUG = PeopleSpaceUtils.DEBUG; private static final String TAG = "PeopleTileView"; private static final int DAYS_IN_A_WEEK = 7; Loading @@ -116,8 +116,10 @@ public class PeopleTileViewHelper { private static final int MIN_MEDIUM_VERTICAL_PADDING = 4; private static final int MAX_MEDIUM_PADDING = 16; private static final int FIXED_HEIGHT_DIMENS_FOR_MEDIUM_CONTENT_BEFORE_PADDING = 8 + 4; private static final int FIXED_HEIGHT_DIMENS_FOR_SMALL = 6 + 4 + 8; private static final int FIXED_WIDTH_DIMENS_FOR_SMALL = 4 + 4; private static final int FIXED_HEIGHT_DIMENS_FOR_SMALL_VERTICAL = 6 + 4 + 8; private static final int FIXED_WIDTH_DIMENS_FOR_SMALL_VERTICAL = 4 + 4; private static final int FIXED_HEIGHT_DIMENS_FOR_SMALL_HORIZONTAL = 6 + 4; private static final int FIXED_WIDTH_DIMENS_FOR_SMALL_HORIZONTAL = 8 + 8; private static final int MESSAGES_COUNT_OVERFLOW = 6; Loading Loading @@ -404,7 +406,8 @@ public class PeopleTileViewHelper { return LAYOUT_LARGE; } // Small layout used below a certain minimum mWidth with any mHeight. if (mWidth >= getSizeInDp(R.dimen.required_width_for_medium)) { if (mHeight >= getSizeInDp(R.dimen.required_height_for_medium) && mWidth >= getSizeInDp(R.dimen.required_width_for_medium)) { int spaceAvailableForPadding = mHeight - (getSizeInDp(R.dimen.avatar_size_for_medium) + 4 + getLineHeightFromResource( Loading Loading @@ -437,10 +440,15 @@ public class PeopleTileViewHelper { // Calculate adaptive avatar size for remaining layouts. if (layoutId == R.layout.people_tile_small) { int avatarHeightSpace = mHeight - (FIXED_HEIGHT_DIMENS_FOR_SMALL + Math.max(18, int avatarHeightSpace = mHeight - (FIXED_HEIGHT_DIMENS_FOR_SMALL_VERTICAL + Math.max(18, getLineHeightFromResource( R.dimen.name_text_size_for_small))); int avatarWidthSpace = mWidth - FIXED_WIDTH_DIMENS_FOR_SMALL; int avatarWidthSpace = mWidth - FIXED_WIDTH_DIMENS_FOR_SMALL_VERTICAL; avatarSize = Math.min(avatarHeightSpace, avatarWidthSpace); } if (layoutId == R.layout.people_tile_small_horizontal) { int avatarHeightSpace = mHeight - FIXED_HEIGHT_DIMENS_FOR_SMALL_HORIZONTAL; int avatarWidthSpace = mWidth - FIXED_WIDTH_DIMENS_FOR_SMALL_HORIZONTAL; avatarSize = Math.min(avatarHeightSpace, avatarWidthSpace); } Loading Loading @@ -1033,7 +1041,7 @@ public class PeopleTileViewHelper { return R.layout.people_tile_large_empty; case LAYOUT_SMALL: default: return R.layout.people_tile_small; return getLayoutSmallByHeight(); } } Loading @@ -1045,7 +1053,7 @@ public class PeopleTileViewHelper { return R.layout.people_tile_large_with_notification_content; case LAYOUT_SMALL: default: return R.layout.people_tile_small; return getLayoutSmallByHeight(); } } Loading @@ -1057,8 +1065,15 @@ public class PeopleTileViewHelper { return R.layout.people_tile_large_with_status_content; case LAYOUT_SMALL: default: return getLayoutSmallByHeight(); } } private int getLayoutSmallByHeight() { if (mHeight >= getSizeInDp(R.dimen.required_height_for_medium)) { return R.layout.people_tile_small; } return R.layout.people_tile_small_horizontal; } /** Returns a bitmap with the user icon and package icon. */ Loading
packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ public class PeopleSpaceWidgetManager { ConversationChannel channel = mIPeopleManager.getConversation( key.getPackageName(), key.getUserId(), key.getShortcutId()); if (channel == null) { Log.d(TAG, "Could not retrieve conversation from storage"); if (DEBUG) Log.d(TAG, "Could not retrieve conversation from storage"); return null; } Loading Loading @@ -586,7 +586,7 @@ public class PeopleSpaceWidgetManager { @Nullable public Optional<PeopleSpaceTile> getAugmentedTileForExistingWidget(int widgetId, Map<PeopleTileKey, Set<NotificationEntry>> notifications) { Log.d(TAG, "Augmenting tile for existing widget: " + widgetId); if (DEBUG) Log.d(TAG, "Augmenting tile for existing widget: " + widgetId); PeopleSpaceTile tile = getTileForExistingWidget(widgetId); if (tile == null) { if (DEBUG) { Loading