DO NOT MERGE Refactoring of fitSystemWindows to applyWindowInsets for views

Applying insets is now handled by:

* WindowInsets class - Encapsulate system insets and local decor
  insets into a single object, written specifically so that new inset
  categories may be added later. Apps cannot construct their own
  WindowInsets, only clone with optional modifications. This is to
  prevent losing data in the event of new insets added in the future.

* onApplyWindowInsets - Actually perform the application of insets.

* OnApplyWindowInsetsListener - Allow an app to use a separate
  Listener object to apply insets to a View. This allows for things
  like support lib integration in custom views written for older
  versions where the verifier would otherwise complain about the use
  of the new WindowInsets class as a method parameter. It also allows
  for applying insets in a custom way without writing a custom view.

* dispatchApplyWindowInsets - Dispatch the call to self and children
  in turn, if applicable. An OnApplyWindowInsetsListener will override
  the behavior of the view's default onApplyWindowInsets method; a
  listener wishing to call down to the 'superclass' implementation as
  part of its own operation should call view.onApplyWindowInsets. App
  code should generally not override this method and instead override
  onApplyWindowInsets or provide a listener.

Compatibility support with the existing fitSystemWindows method has
been provided in both directions: for code that previously called
fitSystemWindows on arbitrary views and also for code that overrode
the fitSystemWindows method in custom views. A view that supports the
newer onApplyWindowInsets mechanism should not mix that behavior with
other calls to fitSystemWindows or vice versa. Support lib-style code
should take care to consistently use one mechanism or the other at
runtime.

Change-Id: Ie88b96e0382beb5d3c3f6cd013f7043acbc0a105
This commit is contained in:
Adam Powell
2014-02-03 10:16:49 -08:00
parent 66e99c4654
commit 50d7bfd822
5 changed files with 486 additions and 20 deletions

View File

@@ -27748,6 +27748,7 @@ package android.view {
method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo();
method public void createContextMenu(android.view.ContextMenu);
method public void destroyDrawingCache();
method public android.view.WindowInsets dispatchApplyWindowInsets(android.view.WindowInsets);
method public void dispatchConfigurationChanged(android.content.res.Configuration);
method public void dispatchDisplayHint(int);
method public boolean dispatchDragEvent(android.view.DragEvent);
@@ -27779,7 +27780,7 @@ package android.view {
method public final android.view.View findViewById(int);
method public final android.view.View findViewWithTag(java.lang.Object);
method public void findViewsWithText(java.util.ArrayList<android.view.View>, java.lang.CharSequence, int);
method protected boolean fitSystemWindows(android.graphics.Rect);
method protected deprecated boolean fitSystemWindows(android.graphics.Rect);
method public android.view.View focusSearch(int);
method public void forceLayout();
method public static int generateViewId();
@@ -27961,6 +27962,7 @@ package android.view {
method public void offsetTopAndBottom(int);
method protected void onAnimationEnd();
method protected void onAnimationStart();
method public android.view.WindowInsets onApplyWindowInsets(android.view.WindowInsets);
method protected void onAttachedToWindow();
method public void onCancelPendingInputEvents();
method public boolean onCheckIsTextEditor();
@@ -28027,7 +28029,8 @@ package android.view {
method public boolean removeCallbacks(java.lang.Runnable);
method public void removeOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener);
method public void removeOnLayoutChangeListener(android.view.View.OnLayoutChangeListener);
method public void requestFitSystemWindows();
method public void requestApplyInsets();
method public deprecated void requestFitSystemWindows();
method public final boolean requestFocus();
method public final boolean requestFocus(int);
method public boolean requestFocus(int, android.graphics.Rect);
@@ -28091,6 +28094,7 @@ package android.view {
method public void setNextFocusLeftId(int);
method public void setNextFocusRightId(int);
method public void setNextFocusUpId(int);
method public void setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener);
method public void setOnClickListener(android.view.View.OnClickListener);
method public void setOnCreateContextMenuListener(android.view.View.OnCreateContextMenuListener);
method public void setOnDragListener(android.view.View.OnDragListener);
@@ -28309,6 +28313,10 @@ package android.view {
field public static final int UNSPECIFIED = 0; // 0x0
}
public static abstract interface View.OnApplyWindowInsetsListener {
method public abstract android.view.WindowInsets onApplyWindowInsets(android.view.View, android.view.WindowInsets);
}
public static abstract interface View.OnAttachStateChangeListener {
method public abstract void onViewAttachedToWindow(android.view.View);
method public abstract void onViewDetachedFromWindow(android.view.View);
@@ -28918,6 +28926,27 @@ package android.view {
method public abstract void onFocusLost(android.view.WindowId);
}
public class WindowInsets {
ctor public WindowInsets(android.view.WindowInsets);
method public android.view.WindowInsets cloneWithSystemWindowInsets(int, int, int, int);
method public android.view.WindowInsets cloneWithSystemWindowInsetsConsumed();
method public android.view.WindowInsets cloneWithSystemWindowInsetsConsumed(boolean, boolean, boolean, boolean);
method public android.view.WindowInsets cloneWithWindowDecorInsets(int, int, int, int);
method public android.view.WindowInsets cloneWithWindowDecorInsetsConsumed();
method public android.view.WindowInsets cloneWithWindowDecorInsetsConsumed(boolean, boolean, boolean, boolean);
method public int getSystemWindowInsetBottom();
method public int getSystemWindowInsetLeft();
method public int getSystemWindowInsetRight();
method public int getSystemWindowInsetTop();
method public int getWindowDecorInsetBottom();
method public int getWindowDecorInsetLeft();
method public int getWindowDecorInsetRight();
method public int getWindowDecorInsetTop();
method public boolean hasInsets();
method public boolean hasSystemWindowInsets();
method public boolean hasWindowDecorInsets();
}
public abstract interface WindowManager implements android.view.ViewManager {
method public abstract android.view.Display getDefaultDisplay();
method public abstract void removeViewImmediate(android.view.View);