diff options
| author | 2021-03-11 10:31:42 +0000 | |
|---|---|---|
| committer | 2021-03-11 10:31:42 +0000 | |
| commit | 7dfa3fcee800fb47e37bdaa075f40bc584a7da8b (patch) | |
| tree | a482cc27be28b9ea2babbdcb7738c4f86e624585 | |
| parent | 72522b92b41a9fa083bebcc644eb3f7cf006f49a (diff) | |
| parent | b98280defc0d61691ff0cf697307cc7cf19b9da6 (diff) | |
Merge "Strings for Beta 1" into sc-dev
8 files changed, 141 insertions, 76 deletions
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index b6d942a29d49..e847ac8ef5e7 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -578,7 +578,7 @@ <!-- People Space UI Screen --> <activity android:name=".people.PeopleSpaceActivity" - android:label="People" + android:label="@string/people_tile_title" android:enabled="true" android:exported="true" android:theme="@android:style/Theme.Material.NoActionBar"> @@ -592,7 +592,7 @@ <!-- People Space Widget --> <receiver android:name=".people.widget.PeopleSpaceWidgetProvider" - android:label="People Space" + android:label="@string/people_tile_title" android:enabled="true" android:exported="true"> <intent-filter> diff --git a/packages/SystemUI/res/layout/people_space_activity.xml b/packages/SystemUI/res/layout/people_space_activity.xml index 07af01b0db72..1784cae816ce 100644 --- a/packages/SystemUI/res/layout/people_space_activity.xml +++ b/packages/SystemUI/res/layout/people_space_activity.xml @@ -25,19 +25,30 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:orientation="vertical" - android:padding="16dp" + android:padding="24dp" android:clipChildren="false" android:clipToPadding="false"> <TextView + android:id="@+id/select_conversation_title" + android:gravity="center" + android:text="@string/select_conversation_title" + android:layout_width="wrap_content" + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" + android:textSize="24sp" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal"/> + + <TextView android:id="@+id/select_conversation" + android:gravity="center" android:text="@string/select_conversation_text" android:layout_width="match_parent" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" - android:textSize="24sp" + android:textSize="16sp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" - android:paddingBottom="16dp" /> + android:padding="24dp" /> </LinearLayout> </androidx.core.widget.NestedScrollView>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/people_space_placeholder_layout.xml b/packages/SystemUI/res/layout/people_space_placeholder_layout.xml new file mode 100644 index 000000000000..3ced1ff6c74b --- /dev/null +++ b/packages/SystemUI/res/layout/people_space_placeholder_layout.xml @@ -0,0 +1,75 @@ +<!-- + ~ 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: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:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:orientation="horizontal" + android:gravity="center" + android:paddingVertical="2dp" + android:paddingHorizontal="8dp" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <ImageView + android:background="@drawable/ic_person" + android:id="@+id/person_icon_only" + android:layout_width="60dp" + android:layout_height="60dp"/> + + <LinearLayout + android:orientation="vertical" + android:paddingStart="8dp" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <ImageView + android:id="@+id/availability" + android:layout_width="10dp" + android:layout_height="10dp" + android:background="@drawable/circle_green_10dp"/> + <TextView + android:id="@+id/name" + android:text="@string/empty_user_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/last_interaction" + android:text="@string/empty_status" + android:textColor="?android:attr/textColorSecondary" + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" + android:textSize="12sp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxLines="3" + android:ellipsize="end"/> + </LinearLayout> + </LinearLayout> + </LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index fcda80dd5f15..6207449d63e6 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -2811,44 +2811,44 @@ <!-- Text to display when copying the build number off QS [CHAR LIMIT=NONE]--> <string name="build_number_copy_toast">Build number copied to clipboard.</string> - <!-- Status for last interaction with exact time [CHAR LIMIT=120] --> - <string name="last_interaction_status" translatable="false">Last chatted <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string> - <!-- Status for last interaction when less than a certain time window [CHAR LIMIT=120] --> - <string name="last_interaction_status_less_than" translatable="false">Last chatted less than <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string> - <!-- Status for last interaction when over a certain time window [CHAR LIMIT=120] --> - <string name="last_interaction_status_over" translatable="false">Last chatted over <xliff:g id="duration" example="1 week">%1$s</xliff:g> ago</string> - <!-- Status for conversation without interaction data [CHAR LIMIT=120] --> - <string name="basic_status" translatable="false">Open conversation</string> - <!-- Status for conversation without interaction data [CHAR LIMIT=120] --> - <string name="select_conversation_text" translatable="false">Select one conversation to show in your widget:</string> - <!-- Timestamp for notification with exact time [CHAR LIMIT=120] --> - <string name="timestamp" translatable="false"><xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string> - <!-- Timestamp for notification when less than a certain time window [CHAR LIMIT=120] --> - <string name="less_than_timestamp" translatable="false">Less than <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string> - <!-- Timestamp for notification when over a certain time window [CHAR LIMIT=120] --> - <string name="over_timestamp" translatable="false">Over <xliff:g id="duration" example="1 week">%1$s</xliff:g> ago</string> - <!-- Status text for a birthday today [CHAR LIMIT=30] --> - <string name="birthday_status" translatable="false">Birthday</string> - <!-- Status text for an upcoming birthday [CHAR LIMIT=30] --> - <string name="upcoming_birthday_status" translatable="false">Birthday soon</string> - <!-- Status text for an anniversary [CHAR LIMIT=30] --> - <string name="anniversary_status" translatable="false">Anniversary</string> - <!-- Status text for sharing location [CHAR LIMIT=30] --> - <string name="location_status" translatable="false">Sharing location</string> - <!-- Status text for a new story posted [CHAR LIMIT=30] --> - <string name="new_story_status" translatable="false">New story</string> - <!-- Status text for watching a video [CHAR LIMIT=30] --> - <string name="video_status" translatable="false">Watching</string> - <!-- Status text for listening to audio [CHAR LIMIT=30] --> - <string name="audio_status" translatable="false">Listening</string> - <!-- Status text for playing a game [CHAR LIMIT=30] --> - <string name="game_status" translatable="false">Playing</string> - <!-- Empty user name before user has selected a friend [CHAR LIMIT=30] --> - <string name="empty_user_name" translatable="false">Your friend</string> - <!-- Empty status shown before user has selected a friend [CHAR LIMIT=30] --> - <string name="empty_status" translatable="false">Their status</string> - <!-- Default text for missed call notifications [CHAR LIMIT=30] --> - <string name="missed_call" translatable="false">Missed call</string> + <!-- Status for conversation without interaction data [CHAR LIMIT=120] --> + <string name="basic_status">Open conversation</string> + <!--Title text for Conversation widget set up screen [CHAR LIMIT=180] --> + <string name="select_conversation_title">Conversation widgets</string> + <!--Text explaining to tap a conversation to select it show in their Conversation widget [CHAR LIMIT=180] --> + <string name="select_conversation_text">Tap a conversation to add it to your Home screen</string> + <!-- Timestamp for notification with exact time [CHAR LIMIT=25] --> + <string name="timestamp"><xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string> + <!-- Timestamp for notification when less than a certain time window [CHAR LIMIT=25] --> + <string name="less_than_timestamp">Less than <xliff:g id="duration" example="5 hours">%1$s</xliff:g> ago</string> + <!-- Timestamp for notification when over a certain time window [CHAR LIMIT=25] --> + <string name="over_timestamp">Over <xliff:g id="duration" example="1 week">%1$s</xliff:g> ago</string> + <!-- Status text on the Conversation widget for a birthday today [CHAR LIMIT=20] --> + <string name="birthday_status">Birthday</string> + <!-- Status text on the Conversation widget for an upcoming birthday [CHAR LIMIT=20] --> + <string name="upcoming_birthday_status">Birthday soon</string> + <!-- Status text on the Conversation widget for an anniversary [CHAR LIMIT=20] --> + <string name="anniversary_status">Anniversary</string> + <!-- Status text on the Conversation widget for sharing location [CHAR LIMIT=20] --> + <string name="location_status">Sharing location</string> + <!-- Status text on the Conversation widget for a new story posted [CHAR LIMIT=20] --> + <string name="new_story_status">New story</string> + <!-- Status text on the Conversation widget for watching a video [CHAR LIMIT=20] --> + <string name="video_status">Watching</string> + <!-- Status text on the Conversation widget for listening to audio [CHAR LIMIT=20] --> + <string name="audio_status">Listening</string> + <!-- Status text on the Conversation widget for playing a game [CHAR LIMIT=20] --> + <string name="game_status">Playing</string> + <!-- Empty user name before user has selected a friend for their Conversation widget [CHAR LIMIT=20] --> + <string name="empty_user_name">Friends</string> + <!-- Empty status shown before user has selected a friend for their Conversation widget [CHAR LIMIT=20] --> + <string name="empty_status">Let’s chat tonight!</string> + <!-- Default text for missed call notifications on their Conversation widget [CHAR LIMIT=20] --> + <string name="missed_call">Missed call</string> + <!-- Description text for adding a Conversation widget [CHAR LIMIT=100] --> + <string name="people_tile_description">See recent messages, missed calls, and status updates</string> + <!-- Title text displayed for the Conversation widget [CHAR LIMIT=50] --> + <string name="people_tile_title">Conversation</string> <!-- Title to display in a notification when ACTION_BATTERY_CHANGED.EXTRA_PRESENT field is false [CHAR LIMIT=NONE] --> diff --git a/packages/SystemUI/res/xml/people_space_widget_info.xml b/packages/SystemUI/res/xml/people_space_widget_info.xml index fbdac5e1789b..35188d8e11ad 100644 --- a/packages/SystemUI/res/xml/people_space_widget_info.xml +++ b/packages/SystemUI/res/xml/people_space_widget_info.xml @@ -20,8 +20,9 @@ android:minResizeWidth="110dp" android:minResizeHeight="55dp" android:updatePeriodMillis="60000" - android:previewImage="@drawable/ic_person" + android:description="@string/people_tile_description" + android:previewLayout="@layout/people_space_placeholder_layout" android:resizeMode="horizontal|vertical" android:configure="com.android.systemui.people.PeopleSpaceActivity" - android:initialLayout="@layout/people_space_widget"> + android:initialLayout="@layout/people_space_placeholder_layout"> </appwidget-provider> diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceActivity.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceActivity.java index a69ec278be91..ff32b6993d5b 100644 --- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceActivity.java +++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceActivity.java @@ -117,7 +117,7 @@ public class PeopleSpaceActivity extends Activity { String pkg = tile.getPackageName(); String status = PeopleSpaceUtils.getLastInteractionString(mContext, - tile.getLastInteractionTimestamp(), true); + tile.getLastInteractionTimestamp()); tileView.setStatus(status); tileView.setName(tile.getUserName().toString()); diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java index 502c95c47d03..c0595eb5924f 100644 --- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java +++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java @@ -653,7 +653,7 @@ public class PeopleSpaceUtils { } // TODO: Set subtext as Group Sender name once storing the name in PeopleSpaceTile. views.setTextViewText(R.id.subtext, PeopleSpaceUtils.getLastInteractionString( - context, tile.getLastInteractionTimestamp(), false)); + context, tile.getLastInteractionTimestamp())); return views; } @@ -662,7 +662,7 @@ public class PeopleSpaceUtils { RemoteViews views = new RemoteViews( context.getPackageName(), R.layout.people_space_large_avatar_tile); String status = PeopleSpaceUtils.getLastInteractionString( - context, tile.getLastInteractionTimestamp(), true); + context, tile.getLastInteractionTimestamp()); views.setTextViewText(R.id.last_interaction, status); return views; } @@ -808,8 +808,7 @@ public class PeopleSpaceUtils { } /** Returns a readable status describing the {@code lastInteraction}. */ - public static String getLastInteractionString(Context context, long lastInteraction, - boolean includeLastChatted) { + public static String getLastInteractionString(Context context, long lastInteraction) { if (lastInteraction == 0L) { Log.e(TAG, "Could not get valid last interaction"); return context.getString(R.string.basic_status); @@ -818,41 +817,20 @@ public class PeopleSpaceUtils { Duration durationSinceLastInteraction = Duration.ofMillis(now - lastInteraction); MeasureFormat formatter = MeasureFormat.getInstance(Locale.getDefault(), MeasureFormat.FormatWidth.WIDE); - MeasureFormat shortFormatter = MeasureFormat.getInstance(Locale.getDefault(), - MeasureFormat.FormatWidth.SHORT); if (durationSinceLastInteraction.toHours() < MIN_HOUR) { - if (includeLastChatted) { - return context.getString(R.string.last_interaction_status_less_than, - formatter.formatMeasures(new Measure(MIN_HOUR, MeasureUnit.HOUR))); - } - return context.getString(R.string.timestamp, shortFormatter.formatMeasures( + return context.getString(R.string.timestamp, formatter.formatMeasures( new Measure(durationSinceLastInteraction.toMinutes(), MeasureUnit.MINUTE))); } else if (durationSinceLastInteraction.toDays() < ONE_DAY) { - if (includeLastChatted) { - return context.getString(R.string.last_interaction_status, - formatter.formatMeasures( - new Measure(durationSinceLastInteraction.toHours(), - MeasureUnit.HOUR))); - } - return context.getString(R.string.timestamp, shortFormatter.formatMeasures( + return context.getString(R.string.timestamp, formatter.formatMeasures( new Measure(durationSinceLastInteraction.toHours(), MeasureUnit.HOUR))); } else if (durationSinceLastInteraction.toDays() < DAYS_IN_A_WEEK) { - if (includeLastChatted) { - return context.getString(R.string.last_interaction_status, - formatter.formatMeasures( - new Measure(durationSinceLastInteraction.toDays(), - MeasureUnit.DAY))); - } - return context.getString(R.string.timestamp, shortFormatter.formatMeasures( + return context.getString(R.string.timestamp, formatter.formatMeasures( new Measure(durationSinceLastInteraction.toHours(), MeasureUnit.DAY))); } else { return context.getString(durationSinceLastInteraction.toDays() == DAYS_IN_A_WEEK - ? (includeLastChatted ? R.string.last_interaction_status : - R.string.timestamp) : - (includeLastChatted ? R.string.last_interaction_status_over - : R.string.over_timestamp), + ? R.string.timestamp : R.string.over_timestamp, formatter.formatMeasures( new Measure(durationSinceLastInteraction.toDays() / DAYS_IN_A_WEEK, MeasureUnit.WEEK))); diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetRemoteViewsFactory.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetRemoteViewsFactory.java index 050352292b38..87b2a15d1c55 100644 --- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetRemoteViewsFactory.java +++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetRemoteViewsFactory.java @@ -106,7 +106,7 @@ public class PeopleSpaceWidgetRemoteViewsFactory implements RemoteViewsService.R PeopleSpaceTile tile = mTiles.get(i); String status = PeopleSpaceUtils.getLastInteractionString(mContext, - tile.getLastInteractionTimestamp(), true); + tile.getLastInteractionTimestamp()); personView.setTextViewText(R.id.status, status); personView.setTextViewText(R.id.name, tile.getUserName().toString()); |