diff options
| author | Dake Gu <dake@google.com> | 2018-04-16 12:49:30 -0700 |
|---|---|---|
| committer | Dake Gu <dake@google.com> | 2018-04-25 10:49:14 -0700 |
| commit | 36b86c28f88e4c7853a4255a0fd9b754cbb547c4 (patch) | |
| tree | eb1eaef1854c7d6fe6b4e0dcdd0af06bb168e801 /core/java/android/widget/RemoteViews.java | |
| parent | 7f352dbeaf3921286d996c07fcb038428d51c212 (diff) | |
Autofill: new UX for TV and support themes
1. Define default Themes for autofill window and save dialog.
(http://go/theme_autofill). Phone uses light themes, TV uses
dark themes.
2. Apply autofill theme to RemoteViews passed from autofill service.
So this can make sure the textColor of RemoteViews matches
the background of autofill theme uses.
Updated public javadoc that autofill service should not
hardcode color values.
3. A new TV ux that occupies half screen height (go/autofill-for-tv).
TV autofill now passes unhandled physical keyevent to app window
in the same way phone/tablet does.
4. Fixed ATV autofill window to be SYSTEM_DIALOG, so it wont be
clipped by app activity window (DialogLauncherActivityTest).
Bug: 71720680
Bug: 74072921
Test: CtsAutofillTest
Change-Id: Ib570227b0958b1800e8f0600b8aec36478568d74
Diffstat (limited to 'core/java/android/widget/RemoteViews.java')
| -rw-r--r-- | core/java/android/widget/RemoteViews.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index b6bd14ed5efd..70c48e5cef88 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -21,6 +21,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import android.annotation.ColorInt; import android.annotation.DimenRes; import android.annotation.NonNull; +import android.annotation.StyleRes; import android.app.ActivityOptions; import android.app.ActivityThread; import android.app.Application; @@ -56,6 +57,7 @@ import android.os.UserHandle; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; +import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.LayoutInflater.Filter; import android.view.RemotableViewMethod; @@ -182,6 +184,12 @@ public class RemoteViews implements Parcelable, Filter { private boolean mIsRoot = true; /** + * Optional theme resource id applied in inflateView(). When 0, Theme.DeviceDefault will be + * used. + */ + private int mApplyThemeResId; + + /** * Whether reapply is disallowed on this remoteview. This maybe be true if some actions modify * the layout in a way that isn't recoverable, since views are being removed. */ @@ -3248,6 +3256,14 @@ public class RemoteViews implements Parcelable, Filter { } /** + * Set the theme used in apply() and applyASync(). + * @hide + */ + public void setApplyTheme(@StyleRes int themeResId) { + mApplyThemeResId = themeResId; + } + + /** * Inflates the view hierarchy represented by this object and applies * all of the actions. * @@ -3282,6 +3298,10 @@ public class RemoteViews implements Parcelable, Filter { final Context contextForResources = getContextForResources(context); Context inflationContext = new RemoteViewsContextWrapper(context, contextForResources); + // If mApplyThemeResId is not given, Theme.DeviceDefault will be used. + if (mApplyThemeResId != 0) { + inflationContext = new ContextThemeWrapper(inflationContext, mApplyThemeResId); + } LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
