Merge "Set theme and support dark mode in People widgets" into sc-dev
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||||
android:id="@+id/item"
|
android:id="@+id/item"
|
||||||
android:background="@drawable/people_space_tile_view_card"
|
android:background="@drawable/people_space_tile_view_card"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -90,6 +91,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/predefined_icon"
|
android:id="@+id/predefined_icon"
|
||||||
|
android:tint="?android:attr/colorAccent"
|
||||||
android:gravity="start|center_vertical"
|
android:gravity="start|center_vertical"
|
||||||
android:paddingEnd="6dp"
|
android:paddingEnd="6dp"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
-->
|
-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -129,6 +130,7 @@
|
|||||||
/>
|
/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/predefined_icon"
|
android:id="@+id/predefined_icon"
|
||||||
|
android:tint="?android:attr/colorAccent"
|
||||||
android:gravity="end|center_vertical"
|
android:gravity="end|center_vertical"
|
||||||
android:paddingStart="6dp"
|
android:paddingStart="6dp"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/predefined_icon"
|
android:id="@+id/predefined_icon"
|
||||||
|
android:tint="?android:attr/colorAccent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_width="18dp"
|
android:layout_width="18dp"
|
||||||
android:layout_height="22dp"
|
android:layout_height="22dp"
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import static android.appwidget.AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH;
|
|||||||
import static com.android.systemui.people.PeopleSpaceUtils.convertDrawableToBitmap;
|
import static com.android.systemui.people.PeopleSpaceUtils.convertDrawableToBitmap;
|
||||||
import static com.android.systemui.people.PeopleSpaceUtils.getUserId;
|
import static com.android.systemui.people.PeopleSpaceUtils.getUserId;
|
||||||
|
|
||||||
|
import android.annotation.ColorInt;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.people.ConversationStatus;
|
import android.app.people.ConversationStatus;
|
||||||
@@ -40,6 +41,7 @@ import android.app.people.PeopleSpaceTile;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
@@ -48,12 +50,13 @@ import android.os.Bundle;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.IconDrawableFactory;
|
import android.util.IconDrawableFactory;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
import com.android.settingslib.Utils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.people.widget.LaunchConversationActivity;
|
import com.android.systemui.people.widget.LaunchConversationActivity;
|
||||||
import com.android.systemui.people.widget.PeopleSpaceWidgetProvider;
|
import com.android.systemui.people.widget.PeopleSpaceWidgetProvider;
|
||||||
@@ -344,10 +347,11 @@ class PeopleTileViewHelper {
|
|||||||
setMaxLines(views);
|
setMaxLines(views);
|
||||||
CharSequence content = mTile.getNotificationContent();
|
CharSequence content = mTile.getNotificationContent();
|
||||||
views = setPunctuationRemoteViewsFields(views, content);
|
views = setPunctuationRemoteViewsFields(views, content);
|
||||||
TypedValue typedValue = new TypedValue();
|
// TODO(b/184931139): Update to RemoteViews wrapper to set via attribute once available
|
||||||
mContext.getTheme().resolveAttribute(android.R.attr.textColorPrimary, typedValue, true);
|
@ColorInt int color = Utils.getColorAttr(mContext,
|
||||||
int primaryTextColor = mContext.getColor(typedValue.resourceId);
|
android.R.attr.textColorPrimary).getDefaultColor();
|
||||||
views.setInt(R.id.text_content, "setTextColor", primaryTextColor);
|
views.setInt(R.id.text_content, "setTextColor", color);
|
||||||
|
|
||||||
views.setTextViewText(R.id.text_content, mTile.getNotificationContent());
|
views.setTextViewText(R.id.text_content, mTile.getNotificationContent());
|
||||||
views.setViewVisibility(R.id.image, View.GONE);
|
views.setViewVisibility(R.id.image, View.GONE);
|
||||||
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_message);
|
views.setImageViewResource(R.id.predefined_icon, R.drawable.ic_message);
|
||||||
@@ -394,10 +398,9 @@ class PeopleTileViewHelper {
|
|||||||
views.setViewVisibility(R.id.messages_count, View.GONE);
|
views.setViewVisibility(R.id.messages_count, View.GONE);
|
||||||
setMaxLines(views);
|
setMaxLines(views);
|
||||||
// Secondary text color for statuses.
|
// Secondary text color for statuses.
|
||||||
TypedValue typedValue = new TypedValue();
|
@ColorInt int secondaryColor = Utils.getColorAttr(mContext,
|
||||||
mContext.getTheme().resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
android.R.attr.textColorSecondary).getDefaultColor();
|
||||||
int secondaryTextColor = mContext.getColor(typedValue.resourceId);
|
views.setInt(R.id.text_content, "setTextColor", secondaryColor);
|
||||||
views.setInt(R.id.text_content, "setTextColor", secondaryTextColor);
|
|
||||||
views.setTextViewText(R.id.text_content, statusText);
|
views.setTextViewText(R.id.text_content, statusText);
|
||||||
|
|
||||||
Icon statusIcon = status.getIcon();
|
Icon statusIcon = status.getIcon();
|
||||||
|
|||||||
Reference in New Issue
Block a user