diff --git a/packages/SystemUI/res/layout/people_tile_small_horizontal.xml b/packages/SystemUI/res/layout/people_tile_small_horizontal.xml
new file mode 100644
index 0000000000000..950d7ac342257
--- /dev/null
+++ b/packages/SystemUI/res/layout/people_tile_small_horizontal.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 3b4651a063780..d9010158d4424 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1457,6 +1457,7 @@
12dp
6dp
136dp
+ 80dp
120dp
168dp
146dp
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
index dcab86bac4061..c01d6dcd7d642 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java
@@ -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";
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java b/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
index d363614830f9b..8194adcd63e27 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
@@ -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;
@@ -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;
@@ -220,7 +222,7 @@ public class PeopleTileViewHelper {
// Otherwise, create a list using the portrait/landscape sizes.
int defaultWidth = getSizeInDp(context, R.dimen.default_width, density);
- int defaultHeight = getSizeInDp(context, R.dimen.default_height, density);
+ int defaultHeight = getSizeInDp(context, R.dimen.default_height, density);
widgetSizes = new ArrayList<>(2);
int portraitWidth = options.getInt(OPTION_APPWIDGET_MIN_WIDTH, defaultWidth);
@@ -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(
@@ -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);
}
@@ -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();
}
}
@@ -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();
}
}
@@ -1057,10 +1065,17 @@ public class PeopleTileViewHelper {
return R.layout.people_tile_large_with_status_content;
case LAYOUT_SMALL:
default:
- return R.layout.people_tile_small;
+ 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. */
public static Bitmap getPersonIconBitmap(
Context context, PeopleSpaceTile tile, int maxAvatarSize) {
diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
index 09c77e1f5fb10..3320fbda6fe5f 100644
--- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
+++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java
@@ -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;
}
@@ -586,7 +586,7 @@ public class PeopleSpaceWidgetManager {
@Nullable
public Optional getAugmentedTileForExistingWidget(int widgetId,
Map> 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) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java
index e4e8cf0b08022..21c592514489b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java
@@ -236,6 +236,21 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
// No messages count.
assertEquals(View.GONE, smallResult.findViewById(R.id.messages_count).getVisibility());
+ mHeight = getSizeInDp(R.dimen.required_height_for_medium) - 1;
+ RemoteViews smallViewHorizontal = getPeopleTileViewHelper(
+ tileWithLastInteraction).getViews();
+ View smallResultHorizontal = smallViewHorizontal.apply(mContext, null);
+
+ // Show name over predefined icon.
+ assertEquals(View.VISIBLE, smallResultHorizontal.findViewById(R.id.name).getVisibility());
+ assertEquals(View.GONE,
+ smallResultHorizontal.findViewById(R.id.predefined_icon).getVisibility());
+ // Shows person icon.
+ assertEquals(View.VISIBLE,
+ smallResultHorizontal.findViewById(R.id.person_icon).getVisibility());
+ // No messages count.
+ assertEquals(View.GONE,
+ smallResultHorizontal.findViewById(R.id.messages_count).getVisibility());
mWidth = getSizeInDp(R.dimen.required_width_for_large);
mHeight = getSizeInDp(R.dimen.required_height_for_large);
@@ -292,6 +307,22 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
// No messages count.
assertEquals(View.GONE, smallResult.findViewById(R.id.messages_count).getVisibility());
+ mHeight = getSizeInDp(R.dimen.required_height_for_medium) - 1;
+ RemoteViews smallViewHorizontal = getPeopleTileViewHelper(
+ tileWithAvailabilityAndNewStory).getViews();
+ View smallResultHorizontal = smallViewHorizontal.apply(mContext, null);
+
+ // Show name over predefined icon.
+ assertEquals(View.VISIBLE, smallResultHorizontal.findViewById(R.id.name).getVisibility());
+ assertEquals(View.GONE,
+ smallResultHorizontal.findViewById(R.id.predefined_icon).getVisibility());
+ // Shows person icon.
+ assertEquals(View.VISIBLE,
+ smallResultHorizontal.findViewById(R.id.person_icon).getVisibility());
+ // No messages count.
+ assertEquals(View.GONE,
+ smallResultHorizontal.findViewById(R.id.messages_count).getVisibility());
+
mWidth = getSizeInDp(R.dimen.required_width_for_large);
mHeight = getSizeInDp(R.dimen.required_height_for_large);
RemoteViews largeView = getPeopleTileViewHelper(tileWithAvailabilityAndNewStory).getViews();
@@ -348,6 +379,22 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
// No messages count.
assertEquals(View.GONE, smallResult.findViewById(R.id.messages_count).getVisibility());
+ mHeight = getSizeInDp(R.dimen.required_height_for_medium) - 1;
+ RemoteViews smallViewHorizontal = getPeopleTileViewHelper(
+ tileWithStatusTemplate).getViews();
+ View smallResultHorizontal = smallViewHorizontal.apply(mContext, null);
+
+ // Show name over predefined icon.
+ assertEquals(View.GONE, smallResultHorizontal.findViewById(R.id.name).getVisibility());
+ assertEquals(View.VISIBLE,
+ smallResultHorizontal.findViewById(R.id.predefined_icon).getVisibility());
+ // Shows person icon.
+ assertEquals(View.VISIBLE,
+ smallResultHorizontal.findViewById(R.id.person_icon).getVisibility());
+ // No messages count.
+ assertEquals(View.GONE,
+ smallResultHorizontal.findViewById(R.id.messages_count).getVisibility());
+
mWidth = getSizeInDp(R.dimen.required_width_for_large);
mHeight = getSizeInDp(R.dimen.required_height_for_large);
RemoteViews largeView = getPeopleTileViewHelper(tileWithStatusTemplate).getViews();
@@ -407,6 +454,22 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
// No messages count.
assertEquals(View.GONE, smallResult.findViewById(R.id.messages_count).getVisibility());
+ mHeight = getSizeInDp(R.dimen.required_height_for_medium) - 1;
+ RemoteViews smallViewHorizontal = getPeopleTileViewHelper(
+ tileWithStatusTemplate).getViews();
+ View smallResultHorizontal = smallViewHorizontal.apply(mContext, null);
+
+ // Show name over predefined icon.
+ assertEquals(View.GONE, smallResultHorizontal.findViewById(R.id.name).getVisibility());
+ assertEquals(View.VISIBLE,
+ smallResultHorizontal.findViewById(R.id.predefined_icon).getVisibility());
+ // Shows person icon.
+ assertEquals(View.VISIBLE,
+ smallResultHorizontal.findViewById(R.id.person_icon).getVisibility());
+ // No messages count.
+ assertEquals(View.GONE,
+ smallResultHorizontal.findViewById(R.id.messages_count).getVisibility());
+
mWidth = getSizeInDp(R.dimen.required_width_for_large);
mHeight = getSizeInDp(R.dimen.required_height_for_large);
RemoteViews largeView = getPeopleTileViewHelper(tileWithStatusTemplate).getViews();