diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index d6989753f16e6..8c092ae372229 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -588,13 +588,15 @@
android:label="@string/people_tile_title"
android:enabled="true"
android:exported="true"
+ android:windowDisablePreview="true"
android:theme="@style/Theme.PeopleTileConfigActivity">
-
+
-
-
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="oval">
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/people_space_messages_count_background.xml b/packages/SystemUI/res/drawable/people_space_messages_count_background.xml
index 0fc112e16ee4d..97752d05836a6 100644
--- a/packages/SystemUI/res/drawable/people_space_messages_count_background.xml
+++ b/packages/SystemUI/res/drawable/people_space_messages_count_background.xml
@@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
-
+
+
diff --git a/packages/SystemUI/res/layout/people_tile_large_empty.xml b/packages/SystemUI/res/layout/people_tile_large_empty.xml
index 69e277015c82e..2c6acbc4602ea 100644
--- a/packages/SystemUI/res/layout/people_tile_large_empty.xml
+++ b/packages/SystemUI/res/layout/people_tile_large_empty.xml
@@ -14,30 +14,28 @@
~ limitations under the License.
-->
+ android:layout_height="match_parent"
+ android:paddingHorizontal="16dp"
+ android:paddingTop="14dp"
+ android:paddingBottom="16dp">
+ android:layout_height="wrap_content"
+ android:gravity="top|center_horizontal"
+ android:orientation="vertical">
+ android:textSize="@dimen/name_text_size_for_large" />
-
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/people_tile_large_with_content.xml b/packages/SystemUI/res/layout/people_tile_large_with_content.xml
index b77670e3795b8..4994c696e9022 100644
--- a/packages/SystemUI/res/layout/people_tile_large_with_content.xml
+++ b/packages/SystemUI/res/layout/people_tile_large_with_content.xml
@@ -13,147 +13,136 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:padding="16dp"
+ android:orientation="vertical">
-
-
-
+ android:layout_height="wrap_content"
+ android:gravity="start|top">
-
+ android:layout_alignParentStart="true"
+ android:gravity="start|top"
+ android:orientation="horizontal">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:id="@+id/predefined_icon"
+ android:tint="?android:attr/colorAccent"
+ android:gravity="start|center_vertical"
+ android:layout_width="@dimen/regular_predefined_icon"
+ android:layout_height="@dimen/regular_predefined_icon" />
-
-
-
-
-
-
-
-
-
-
-
+ android:textColor="?android:attr/textColorSecondary"
+ android:textSize="12sp" />
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/layout/people_tile_large_with_notification_content.xml b/packages/SystemUI/res/layout/people_tile_large_with_notification_content.xml
new file mode 100644
index 0000000000000..60ff68edc3f47
--- /dev/null
+++ b/packages/SystemUI/res/layout/people_tile_large_with_notification_content.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/people_tile_large_with_status_content.xml b/packages/SystemUI/res/layout/people_tile_large_with_status_content.xml
new file mode 100644
index 0000000000000..cbc6ea8600443
--- /dev/null
+++ b/packages/SystemUI/res/layout/people_tile_large_with_status_content.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/people_tile_medium_empty.xml b/packages/SystemUI/res/layout/people_tile_medium_empty.xml
index 4236493dce91c..bebc872be5141 100644
--- a/packages/SystemUI/res/layout/people_tile_medium_empty.xml
+++ b/packages/SystemUI/res/layout/people_tile_medium_empty.xml
@@ -35,13 +35,14 @@
android:layout_height="64dp" />
+ android:background="@drawable/availability_dot_10dp" />
@@ -50,7 +51,7 @@
android:text="@string/empty_user_name"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
- android:textSize="14sp"
+ android:textSize="@dimen/empty_name_text_size_for_medium"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
@@ -60,7 +61,7 @@
android:text="@string/empty_status"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
- android:textSize="12sp"
+ android:textSize="@dimen/content_text_size_for_medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
diff --git a/packages/SystemUI/res/layout/people_tile_medium_with_content.xml b/packages/SystemUI/res/layout/people_tile_medium_with_content.xml
index 8df0bf87efd22..a7a635482cc66 100644
--- a/packages/SystemUI/res/layout/people_tile_medium_with_content.xml
+++ b/packages/SystemUI/res/layout/people_tile_medium_with_content.xml
@@ -57,12 +57,14 @@
android:layout_marginStart="-2dp"
android:layout_width="10dp"
android:layout_height="10dp"
- android:background="@drawable/circle_green_10dp" />
+ android:background="@drawable/availability_dot_10dp" />
@@ -72,7 +74,7 @@
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
- android:paddingBottom="4dp"
+ android:paddingBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
@@ -104,9 +106,9 @@
android:gravity="bottom"
android:layout_gravity="center_vertical"
android:orientation="horizontal"
- android:paddingTop="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:minHeight="18dp"
android:clipToOutline="true">
+ android:layout_width="@dimen/regular_predefined_icon"
+ android:layout_height="@dimen/regular_predefined_icon" />
diff --git a/packages/SystemUI/res/layout/people_tile_small.xml b/packages/SystemUI/res/layout/people_tile_small.xml
index 7c28fc10c1849..4e5c04cb5ad6a 100644
--- a/packages/SystemUI/res/layout/people_tile_small.xml
+++ b/packages/SystemUI/res/layout/people_tile_small.xml
@@ -48,12 +48,11 @@
android:id="@+id/messages_count"
android:layout_gravity="center"
android:gravity="center"
- android:paddingStart="8dp"
- android:paddingEnd="8dp"
+ android:paddingHorizontal="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:textSize="@dimen/name_text_size_for_small"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
@@ -71,6 +70,6 @@
android:paddingHorizontal="4dp"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
android:textColor="?android:attr/textColorPrimary"
- android:textSize="14sp" />
+ android:textSize="@dimen/name_text_size_for_small" />
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index e7d714e60076e..915b62791f585 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1433,19 +1433,29 @@
20dp
12dp
6dp
- 146dp
+ 136dp
138dp
- 182dp
+ 168dp
146dp
92dp
52dp
64dp
108dp
14sp
- 14sp
- 24sp
+ 12sp
+ 12sp
+ 14sp
+ 104dp
+ 16sp
12sp
14sp
+ 16dp
+ 22dp
+ 18dp
+ 24dp
+ 8dp
+ 12dp
+ 4dp
5dp
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 36a1bb3a5d897..71382f3d0a95d 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2881,12 +2881,16 @@
Recent conversations
Okay
-
- %1$s ago
-
- Less than %1$s ago
-
- Over %1$s ago
+
+ %1$s days ago
+
+ 1 week ago
+
+ 2 weeks ago
+
+ Over 1 week ago
+
+ Over 2 weeks ago
Birthday
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleStoryIconFactory.java b/packages/SystemUI/src/com/android/systemui/people/PeopleStoryIconFactory.java
index 81df107836b97..f3cb35959ed45 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleStoryIconFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleStoryIconFactory.java
@@ -28,7 +28,6 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.IconDrawableFactory;
import android.util.Log;
-import android.util.TypedValue;
import com.android.settingslib.Utils;
import com.android.systemui.R;
@@ -37,7 +36,7 @@ class PeopleStoryIconFactory implements AutoCloseable {
private static final int PADDING = 2;
private static final int RING_WIDTH = 2;
- private static final int MAX_BADGE_SIZE = 36;
+ private static final int MAX_BADGE_SIZE = 40;
final PackageManager mPackageManager;
final IconDrawableFactory mIconDrawableFactory;
@@ -51,15 +50,15 @@ class PeopleStoryIconFactory implements AutoCloseable {
PeopleStoryIconFactory(Context context, PackageManager pm,
IconDrawableFactory iconDrawableFactory, int iconSizeDp) {
+ context.setTheme(android.R.style.Theme_DeviceDefault_DayNight);
mIconBitmapSize = (int) (iconSizeDp * context.getResources().getDisplayMetrics().density);
mDensity = context.getResources().getDisplayMetrics().density;
mIconSize = mDensity * iconSizeDp;
mPackageManager = pm;
mIconDrawableFactory = iconDrawableFactory;
mImportantConversationColor = context.getColor(R.color.important_conversation);
- TypedValue typedValue = new TypedValue();
- context.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true);
- mAccentColor = context.getColor(typedValue.resourceId);
+ mAccentColor = Utils.getColorAttr(context,
+ com.android.internal.R.attr.colorAccentPrimary).getDefaultColor();
mContext = context;
}
diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java b/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
index 9fc9cad0a690e..59c7fd197c8b9 100644
--- a/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/people/PeopleTileViewHelper.java
@@ -55,6 +55,7 @@ import android.text.TextUtils;
import android.util.IconDrawableFactory;
import android.util.Log;
import android.util.Pair;
+import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.RemoteViews;
@@ -87,7 +88,6 @@ public class PeopleTileViewHelper {
private static final int DAYS_IN_A_WEEK = 7;
private static final int ONE_DAY = 1;
- private static final int MAX_WEEKS = 2;
public static final int LAYOUT_SMALL = 0;
public static final int LAYOUT_MEDIUM = 1;
@@ -95,10 +95,11 @@ public class PeopleTileViewHelper {
private static final int MIN_CONTENT_MAX_LINES = 2;
- private static final int FIXED_HEIGHT_DIMENS_FOR_LARGE_CONTENT = 14 + 12 + 4 + 16;
+ private static final int FIXED_HEIGHT_DIMENS_FOR_LARGE_NOTIF_CONTENT = 16 + 22 + 8 + 16;
+ private static final int FIXED_HEIGHT_DIMENS_FOR_LARGE_STATUS_CONTENT = 16 + 16 + 24 + 4 + 16;
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 = 4 + 4;
+ 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;
@@ -276,12 +277,15 @@ public class PeopleTileViewHelper {
}
private void setMaxLines(RemoteViews views, boolean showSender) {
- int textSize = mLayoutSize == LAYOUT_LARGE ? getSizeInDp(
- R.dimen.content_text_size_for_large)
- : getSizeInDp(R.dimen.content_text_size_for_medium);
- int lineHeight = getLineHeight(textSize);
- int notificationContentHeight = getContentHeightForLayout(lineHeight);
- int maxAdaptiveLines = Math.floorDiv(notificationContentHeight, lineHeight);
+ int nameHeight = getLineHeightFromResource(R.dimen.name_text_size_for_content);
+ boolean isStatusLayout =
+ views.getLayoutId() == R.layout.people_tile_large_with_status_content;
+ int contentHeight = getContentHeightForLayout(nameHeight, isStatusLayout);
+ int textSizeResId = mLayoutSize == LAYOUT_LARGE
+ ? R.dimen.content_text_size_for_large
+ : R.dimen.content_text_size_for_medium;
+ int lineHeight = getLineHeightFromResource(textSizeResId);
+ int maxAdaptiveLines = Math.floorDiv(contentHeight, lineHeight);
int maxLines = Math.max(MIN_CONTENT_MAX_LINES, maxAdaptiveLines);
// Save a line for sender's name, if present.
@@ -289,10 +293,12 @@ public class PeopleTileViewHelper {
views.setInt(R.id.text_content, "setMaxLines", maxLines);
}
- private int getLineHeight(int textSize) {
+ private int getLineHeightFromResource(int resId) {
try {
TextView text = new TextView(mContext);
- text.setTextSize(textSize);
+ text.setTextSize(TypedValue.COMPLEX_UNIT_PX,
+ mContext.getResources().getDimension(resId));
+ text.setTextAppearance(android.R.style.TextAppearance_DeviceDefault);
int lineHeight = (int) (text.getLineHeight() / mDensity);
return lineHeight;
} catch (Exception e) {
@@ -310,15 +316,17 @@ public class PeopleTileViewHelper {
return (int) (context.getResources().getDimension(dimenResourceId) / density);
}
- private int getContentHeightForLayout(int lineHeight) {
+ private int getContentHeightForLayout(int lineHeight, boolean hasPredefinedIcon) {
switch (mLayoutSize) {
case LAYOUT_MEDIUM:
return mHeight - (lineHeight + FIXED_HEIGHT_DIMENS_FOR_MEDIUM_CONTENT_BEFORE_PADDING
+ mMediumVerticalPadding * 2);
case LAYOUT_LARGE:
+ int fixedHeight = hasPredefinedIcon ? FIXED_HEIGHT_DIMENS_FOR_LARGE_STATUS_CONTENT
+ : FIXED_HEIGHT_DIMENS_FOR_LARGE_NOTIF_CONTENT;
return mHeight - (getSizeInDp(
R.dimen.max_people_avatar_size_for_large_content) + lineHeight
- + FIXED_HEIGHT_DIMENS_FOR_LARGE_CONTENT);
+ + fixedHeight);
default:
return -1;
}
@@ -326,7 +334,7 @@ public class PeopleTileViewHelper {
/** Calculates the best layout relative to the size in {@code options}. */
private int getLayoutSize() {
- if (mHeight >= getSizeInDp(R.dimen.required_width_for_large)
+ if (mHeight >= getSizeInDp(R.dimen.required_height_for_large)
&& mWidth >= getSizeInDp(R.dimen.required_width_for_large)) {
if (DEBUG) Log.d(TAG, "Large view for mWidth: " + mWidth + " mHeight: " + mHeight);
return LAYOUT_LARGE;
@@ -334,8 +342,9 @@ public class PeopleTileViewHelper {
// Small layout used below a certain minimum mWidth with any mHeight.
if (mWidth >= getSizeInDp(R.dimen.required_width_for_medium)) {
int spaceAvailableForPadding =
- mHeight - (getSizeInDp(R.dimen.avatar_size_for_medium) + 4 + getLineHeight(
- getSizeInDp(R.dimen.name_text_size_for_medium)));
+ mHeight - (getSizeInDp(R.dimen.avatar_size_for_medium)
+ + getLineHeightFromResource(
+ R.dimen.name_text_size_for_content));
if (DEBUG) {
Log.d(TAG, "Medium view for mWidth: " + mWidth + " mHeight: " + mHeight
+ " with padding space: " + spaceAvailableForPadding);
@@ -365,26 +374,32 @@ 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,
- getLineHeight(getSizeInDp(
- R.dimen.name_text_size_for_small))));
+ getLineHeightFromResource(
+ R.dimen.name_text_size_for_small)));
int avatarWidthSpace = mWidth - FIXED_WIDTH_DIMENS_FOR_SMALL;
avatarSize = Math.min(avatarHeightSpace, avatarWidthSpace);
}
- if (layoutId == R.layout.people_tile_large_with_content) {
- avatarSize = mHeight - (FIXED_HEIGHT_DIMENS_FOR_LARGE_CONTENT + (getLineHeight(
- getSizeInDp(R.dimen.content_text_size_for_large))
- * 3));
+ if (layoutId == R.layout.people_tile_large_with_notification_content) {
+ avatarSize = mHeight - (FIXED_HEIGHT_DIMENS_FOR_LARGE_NOTIF_CONTENT + (
+ getLineHeightFromResource(
+ R.dimen.content_text_size_for_large)
+ * 3));
+ return Math.min(avatarSize, getSizeInDp(
+ R.dimen.max_people_avatar_size_for_large_content));
+ } else if (layoutId == R.layout.people_tile_large_with_status_content) {
+ avatarSize = mHeight - (FIXED_HEIGHT_DIMENS_FOR_LARGE_STATUS_CONTENT + (
+ getLineHeightFromResource(R.dimen.content_text_size_for_large)
+ * 3));
return Math.min(avatarSize, getSizeInDp(
R.dimen.max_people_avatar_size_for_large_content));
}
if (layoutId == R.layout.people_tile_large_empty) {
- int avatarHeightSpace = mHeight - (14 + 14 + getLineHeight(
- getSizeInDp(R.dimen.name_text_size_for_large))
- + getLineHeight(
- getSizeInDp(R.dimen.content_text_size_for_large))
- + 16 + 10 + 14);
+ int avatarHeightSpace = mHeight - (14 + 14 + getLineHeightFromResource(
+ R.dimen.name_text_size_for_large)
+ + getLineHeightFromResource(R.dimen.content_text_size_for_large)
+ + 16 + 10 + 16);
int avatarWidthSpace = mWidth - (14 + 14);
avatarSize = Math.min(avatarHeightSpace, avatarWidthSpace);
}
@@ -449,17 +464,28 @@ public class PeopleTileViewHelper {
}
private RemoteViews createMissedCallRemoteViews() {
- RemoteViews views = getViewForContentLayout();
+ RemoteViews views = setViewForContentLayout(new RemoteViews(mContext.getPackageName(),
+ getLayoutForContent()));
views.setViewVisibility(R.id.predefined_icon, View.VISIBLE);
+ views.setViewVisibility(R.id.text_content, View.VISIBLE);
views.setViewVisibility(R.id.messages_count, View.GONE);
setMaxLines(views, false);
views.setTextViewText(R.id.text_content, mTile.getNotificationContent());
+ views.setColorAttr(R.id.text_content, "setTextColor", android.R.attr.colorError);
+ views.setColorAttr(R.id.predefined_icon, "setColorFilter", android.R.attr.colorError);
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_phone_missed);
+ if (mLayoutSize == LAYOUT_LARGE) {
+ views.setInt(R.id.content, "setGravity", Gravity.BOTTOM);
+ views.setViewLayoutHeightDimen(R.id.predefined_icon, R.dimen.large_predefined_icon);
+ views.setViewLayoutWidthDimen(R.id.predefined_icon, R.dimen.large_predefined_icon);
+ }
+ setAvailabilityDotPadding(views, R.dimen.availability_dot_notification_padding);
return views;
}
private RemoteViews createNotificationRemoteViews() {
- RemoteViews views = getViewForContentLayout();
+ RemoteViews views = setViewForContentLayout(new RemoteViews(mContext.getPackageName(),
+ getLayoutForNotificationContent()));
CharSequence sender = mTile.getNotificationSender();
Uri image = mTile.getNotificationDataUri();
if (image != null) {
@@ -474,6 +500,11 @@ public class PeopleTileViewHelper {
views = decorateBackground(views, content);
views.setColorAttr(R.id.text_content, "setTextColor", android.R.attr.textColorPrimary);
views.setTextViewText(R.id.text_content, mTile.getNotificationContent());
+ if (mLayoutSize == LAYOUT_LARGE) {
+ views.setViewPadding(R.id.name, 0, 0, 0,
+ mContext.getResources().getDimensionPixelSize(
+ R.dimen.above_notification_text_padding));
+ }
views.setViewVisibility(R.id.image, View.GONE);
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_message);
}
@@ -491,6 +522,7 @@ public class PeopleTileViewHelper {
} else {
views.setViewVisibility(R.id.subtext, View.GONE);
}
+ setAvailabilityDotPadding(views, R.dimen.availability_dot_notification_padding);
return views;
}
@@ -513,7 +545,8 @@ public class PeopleTileViewHelper {
}
private RemoteViews createStatusRemoteViews(ConversationStatus status) {
- RemoteViews views = getViewForContentLayout();
+ RemoteViews views = setViewForContentLayout(new RemoteViews(mContext.getPackageName(),
+ getLayoutForContent()));
CharSequence statusText = status.getDescription();
if (TextUtils.isEmpty(statusText)) {
statusText = getStatusTextByType(status.getActivity());
@@ -545,11 +578,27 @@ public class PeopleTileViewHelper {
android.R.attr.textColorSecondary);
setMaxLines(views, false);
}
+ setAvailabilityDotPadding(views, R.dimen.availability_dot_status_padding);
// TODO: Set status pre-defined icons
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_person);
return views;
}
+ /**
+ * Update the padding of the availability dot. The padding on the availability dot decreases
+ * on the status layouts compared to all other layouts.
+ */
+ private void setAvailabilityDotPadding(RemoteViews views, int resId) {
+ boolean isLeftToRight = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())
+ == View.LAYOUT_DIRECTION_LTR;
+ int startPadding = mContext.getResources().getDimensionPixelSize(resId);
+ int bottomPadding = mContext.getResources().getDimensionPixelSize(
+ R.dimen.medium_content_padding_above_name);
+ views.setViewPadding(R.id.medium_content,
+ isLeftToRight ? startPadding : 0, 0, isLeftToRight ? 0 : startPadding,
+ bottomPadding);
+ }
+
@Nullable
private ConversationStatus getBirthdayStatus(
List statuses) {
@@ -718,9 +767,7 @@ public class PeopleTileViewHelper {
return null;
}
- private RemoteViews getViewForContentLayout() {
- RemoteViews views = new RemoteViews(mContext.getPackageName(),
- getLayoutForContent());
+ private RemoteViews setViewForContentLayout(RemoteViews views) {
if (mLayoutSize == LAYOUT_SMALL) {
views.setViewVisibility(R.id.predefined_icon, View.VISIBLE);
views.setViewVisibility(R.id.name, View.GONE);
@@ -734,13 +781,34 @@ public class PeopleTileViewHelper {
}
if (mLayoutSize == LAYOUT_MEDIUM) {
+ // Maximize vertical padding with an avatar size of 48dp and name on 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.content, horizontalPadding, verticalPadding,
horizontalPadding,
verticalPadding);
+ // Expand the name font on medium if there's space.
+ int heightRequiredForMaxContentText = (int) (mContext.getResources().getDimension(
+ R.dimen.medium_height_for_max_name_text_size) / mDensity);
+ if (mHeight > heightRequiredForMaxContentText) {
+ views.setTextViewTextSize(R.id.name, TypedValue.COMPLEX_UNIT_PX,
+ (int) mContext.getResources().getDimension(
+ R.dimen.max_name_text_size_for_medium));
+ }
}
+
+ if (mLayoutSize == LAYOUT_LARGE) {
+ // Decrease the view padding below the name on all layouts besides notification "text".
+ views.setViewPadding(R.id.name, 0, 0, 0,
+ mContext.getResources().getDimensionPixelSize(
+ R.dimen.below_name_text_padding));
+ }
+
+ // For all layouts except Missed Calls, ensure predefined icon is regular sized.
+ views.setViewLayoutHeightDimen(R.id.predefined_icon, R.dimen.regular_predefined_icon);
+ views.setViewLayoutWidthDimen(R.id.predefined_icon, R.dimen.regular_predefined_icon);
+
views.setViewVisibility(R.id.messages_count, View.GONE);
if (mTile.getUserName() != null) {
views.setTextViewText(R.id.name, mTile.getUserName());
@@ -784,12 +852,24 @@ public class PeopleTileViewHelper {
}
}
+ private int getLayoutForNotificationContent() {
+ switch (mLayoutSize) {
+ case LAYOUT_MEDIUM:
+ return R.layout.people_tile_medium_with_content;
+ case LAYOUT_LARGE:
+ return R.layout.people_tile_large_with_notification_content;
+ case LAYOUT_SMALL:
+ default:
+ return R.layout.people_tile_small;
+ }
+ }
+
private int getLayoutForContent() {
switch (mLayoutSize) {
case LAYOUT_MEDIUM:
return R.layout.people_tile_medium_with_content;
case LAYOUT_LARGE:
- return R.layout.people_tile_large_with_content;
+ return R.layout.people_tile_large_with_status_content;
case LAYOUT_SMALL:
default:
return R.layout.people_tile_small;
@@ -832,19 +912,18 @@ public class PeopleTileViewHelper {
if (durationSinceLastInteraction.toDays() <= ONE_DAY) {
return null;
} else if (durationSinceLastInteraction.toDays() < DAYS_IN_A_WEEK) {
- return context.getString(R.string.timestamp, formatter.formatMeasures(
+ return context.getString(R.string.days_timestamp, formatter.formatMeasures(
new Measure(durationSinceLastInteraction.toDays(),
MeasureUnit.DAY)));
- } else if (durationSinceLastInteraction.toDays() <= DAYS_IN_A_WEEK * 2) {
- return context.getString(durationSinceLastInteraction.toDays() == DAYS_IN_A_WEEK
- ? R.string.timestamp : R.string.over_timestamp,
- formatter.formatMeasures(
- new Measure(durationSinceLastInteraction.toDays() / DAYS_IN_A_WEEK,
- MeasureUnit.WEEK)));
+ } else if (durationSinceLastInteraction.toDays() == DAYS_IN_A_WEEK) {
+ return context.getString(R.string.one_week_timestamp);
+ } else if (durationSinceLastInteraction.toDays() < DAYS_IN_A_WEEK * 2) {
+ return context.getString(R.string.over_one_week_timestamp);
+ } else if (durationSinceLastInteraction.toDays() == DAYS_IN_A_WEEK * 2) {
+ return context.getString(R.string.two_weeks_timestamp);
} else {
// Over 2 weeks ago
- return context.getString(R.string.over_timestamp,
- formatter.formatMeasures(new Measure(MAX_WEEKS, MeasureUnit.WEEK)));
+ return context.getString(R.string.over_two_weeks_timestamp);
}
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleSpaceUtilsTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleSpaceUtilsTest.java
index 8983ff8dd30ff..fd28c2c9e64c9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleSpaceUtilsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleSpaceUtilsTest.java
@@ -220,8 +220,8 @@ public class PeopleSpaceUtilsTest extends SysuiTestCase {
when(mMockContext.getString(R.string.basic_status)).thenReturn(
mContext.getString(R.string.basic_status));
when(mMockContext.getPackageManager()).thenReturn(mPackageManager);
- when(mMockContext.getString(R.string.over_timestamp)).thenReturn(
- mContext.getString(R.string.over_timestamp));
+ when(mMockContext.getString(R.string.over_two_weeks_timestamp)).thenReturn(
+ mContext.getString(R.string.over_two_weeks_timestamp));
when(mPackageManager.getApplicationIcon(anyString())).thenReturn(null);
when(mNotificationEntryManager.getVisibleNotifications())
.thenReturn(List.of(mNotificationEntry1, mNotificationEntry2, mNotificationEntry3));
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 71723075dda37..3b56f225ba046 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/people/PeopleTileViewHelperTest.java
@@ -148,8 +148,8 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
when(mMockContext.getString(R.string.birthday_status)).thenReturn(
mContext.getString(R.string.birthday_status));
when(mMockContext.getPackageManager()).thenReturn(mPackageManager);
- when(mMockContext.getString(R.string.over_timestamp)).thenReturn(
- mContext.getString(R.string.over_timestamp));
+ when(mMockContext.getString(R.string.over_two_weeks_timestamp)).thenReturn(
+ mContext.getString(R.string.over_two_weeks_timestamp));
Configuration configuration = mock(Configuration.class);
DisplayMetrics displayMetrics = mock(DisplayMetrics.class);
Resources resources = mock(Resources.class);
@@ -325,7 +325,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), mContext.getString(R.string.birthday_status));
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
getSizeInDp(R.dimen.required_width_for_medium) - 1);
@@ -364,7 +364,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), mContext.getString(R.string.birthday_status));
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
}
@Test
@@ -390,7 +390,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
// Has status.
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(statusContent.getText(), GAME_DESCRIPTION);
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
getSizeInDp(R.dimen.required_width_for_medium) - 1);
@@ -431,7 +431,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), GAME_DESCRIPTION);
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
}
@Test
@@ -620,7 +620,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), MISSED_CALL);
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
mOptions.putInt(OPTION_APPWIDGET_MIN_WIDTH,
getSizeInDp(R.dimen.required_width_for_medium) - 1);
@@ -658,7 +658,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), MISSED_CALL);
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
}
@Test
@@ -684,7 +684,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
// Has a single message, no count shown.
assertEquals(View.GONE, result.findViewById(R.id.messages_count).getVisibility());
@@ -718,7 +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());
+ assertEquals(largeResult.findViewById(R.id.scrim_layout), null);
// Has availability.
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.availability).getVisibility());
// Has person icon.
@@ -728,7 +728,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
// Has a single message, no count shown.
assertEquals(View.GONE, largeResult.findViewById(R.id.messages_count).getVisibility());
@@ -761,7 +761,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
// Subtract one from lines because sender is included.
- assertThat(statusContent.getMaxLines()).isEqualTo(2);
+ assertThat(statusContent.getMaxLines()).isEqualTo(1);
// Has a single message, no count shown.
assertEquals(View.GONE, result.findViewById(R.id.messages_count).getVisibility());
@@ -808,7 +808,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
// Subtract one from lines because sender is included.
- assertThat(statusContent.getMaxLines()).isEqualTo(2);
+ assertThat(statusContent.getMaxLines()).isEqualTo(1);
// Has a single message, no count shown.
assertEquals(View.GONE, largeResult.findViewById(R.id.messages_count).getVisibility());
@@ -838,7 +838,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
TextView statusContent = (TextView) result.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
// Has two messages, show count.
assertEquals(View.VISIBLE, result.findViewById(R.id.messages_count).getVisibility());
@@ -881,7 +881,7 @@ public class PeopleTileViewHelperTest extends SysuiTestCase {
statusContent = (TextView) largeResult.findViewById(R.id.text_content);
assertEquals(View.VISIBLE, statusContent.getVisibility());
assertEquals(statusContent.getText(), NOTIFICATION_CONTENT);
- assertThat(statusContent.getMaxLines()).isEqualTo(3);
+ assertThat(statusContent.getMaxLines()).isEqualTo(2);
// Has two messages, show count.
assertEquals(View.VISIBLE, largeResult.findViewById(R.id.messages_count).getVisibility());