diff options
author | Jeff Davidson <jpd@google.com> | 2018-02-08 15:30:06 -0800 |
---|---|---|
committer | Jeff Davidson <jpd@google.com> | 2018-02-08 15:30:06 -0800 |
commit | a192cc2a132cb0ee8588e2df755563ec7008c179 (patch) | |
tree | 380e4db22df19c819bd37df34bf06e7568916a50 /android/view/Window.java | |
parent | 98fe7819c6d14f4f464a5cac047f9e82dee5da58 (diff) | |
download | android-28-a192cc2a132cb0ee8588e2df755563ec7008c179.tar.gz |
Update fullsdk to 4575844
/google/data/ro/projects/android/fetch_artifact \
--bid 4575844 \
--target sdk_phone_x86_64-sdk \
sdk-repo-linux-sources-4575844.zip
Test: TreeHugger
Change-Id: I81e0eb157b4ac3b38408d0ef86f9d6286471f87a
Diffstat (limited to 'android/view/Window.java')
-rw-r--r-- | android/view/Window.java | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/android/view/Window.java b/android/view/Window.java index 176927fe..5bd0782d 100644 --- a/android/view/Window.java +++ b/android/view/Window.java @@ -1339,9 +1339,9 @@ public abstract class Window { /** * Finds a view that was identified by the {@code android:id} XML attribute - * that was processed in {@link android.app.Activity#onCreate}. This will - * implicitly call {@link #getDecorView} with all of the associated - * side-effects. + * that was processed in {@link android.app.Activity#onCreate}. + * <p> + * This will implicitly call {@link #getDecorView} with all of the associated side-effects. * <p> * <strong>Note:</strong> In most cases -- depending on compiler support -- * the resulting view is automatically cast to the target class type. If @@ -1351,11 +1351,35 @@ public abstract class Window { * @param id the ID to search for * @return a view with given ID if found, or {@code null} otherwise * @see View#findViewById(int) + * @see Window#requireViewById(int) */ @Nullable public <T extends View> T findViewById(@IdRes int id) { return getDecorView().findViewById(id); } + /** + * Finds a view that was identified by the {@code android:id} XML attribute + * that was processed in {@link android.app.Activity#onCreate}, or throws an + * IllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy. + * <p> + * <strong>Note:</strong> In most cases -- depending on compiler support -- + * the resulting view is automatically cast to the target class type. If + * the target class type is unconstrained, an explicit cast may be + * necessary. + * + * @param id the ID to search for + * @return a view with given ID + * @see View#requireViewById(int) + * @see Window#findViewById(int) + */ + @NonNull + public final <T extends View> T requireViewById(@IdRes int id) { + T view = findViewById(id); + if (view == null) { + throw new IllegalArgumentException("ID does not reference a View inside this Window"); + } + return view; + } /** * Convenience for @@ -2244,9 +2268,36 @@ public abstract class Window { * <p> * The transitionName for the view background will be "android:navigation:background". * </p> + * @attr ref android.R.styleable#Window_navigationBarColor */ public abstract void setNavigationBarColor(@ColorInt int color); + /** + * Shows a thin line of the specified color between the navigation bar and the app + * content. + * <p> + * For this to take effect, + * the window must be drawing the system bar backgrounds with + * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and + * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION} must not be set. + * + * @param dividerColor The color of the thin line. + * @attr ref android.R.styleable#Window_navigationBarDividerColor + */ + public void setNavigationBarDividerColor(@ColorInt int dividerColor) { + } + + /** + * Retrieves the color of the navigation bar divider. + * + * @return The color of the navigation bar divider color. + * @see #setNavigationBarColor(int) + * @attr ref android.R.styleable#Window_navigationBarDividerColor + */ + public @ColorInt int getNavigationBarDividerColor() { + return 0; + } + /** @hide */ public void setTheme(int resId) { } |