am dd9488c1: Merge "Provide a public API for View#computeFitSystemWindows" into lmp-dev

* commit 'dd9488c13f16699d190e399324c18b557b6a5b38':
  Provide a public API for View#computeFitSystemWindows
This commit is contained in:
Adam Powell
2014-09-13 00:35:40 +00:00
committed by Android Git Automerger
3 changed files with 39 additions and 0 deletions

View File

@@ -33693,6 +33693,7 @@ package android.view {
method protected int computeHorizontalScrollOffset();
method protected int computeHorizontalScrollRange();
method public void computeScroll();
method public android.view.WindowInsets computeSystemWindowInsets(android.view.WindowInsets, android.graphics.Rect);
method protected int computeVerticalScrollExtent();
method protected int computeVerticalScrollOffset();
method protected int computeVerticalScrollRange();
@@ -35018,6 +35019,7 @@ package android.view {
method public boolean isConsumed();
method public boolean isRound();
method public android.view.WindowInsets replaceSystemWindowInsets(int, int, int, int);
method public android.view.WindowInsets replaceSystemWindowInsets(android.graphics.Rect);
}
public abstract interface WindowManager implements android.view.ViewManager {

View File

@@ -6524,6 +6524,28 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
}
/**
* Compute insets that should be consumed by this view and the ones that should propagate
* to those under it.
*
* @param in Insets currently being processed by this View, likely received as a parameter
* to {@link #onApplyWindowInsets(WindowInsets)}.
* @param outLocalInsets A Rect that will receive the insets that should be consumed
* by this view
* @return Insets that should be passed along to views under this one
*/
public WindowInsets computeSystemWindowInsets(WindowInsets in, Rect outLocalInsets) {
if ((mViewFlags & OPTIONAL_FITS_SYSTEM_WINDOWS) == 0
|| mAttachInfo == null
|| (mAttachInfo.mSystemUiVisibility & SYSTEM_UI_LAYOUT_FLAGS) == 0) {
outLocalInsets.set(in.getSystemWindowInsets());
return in.consumeSystemWindowInsets();
} else {
outLocalInsets.set(0, 0, 0, 0);
return in;
}
}
/**
* Sets whether or not this view should account for system screen decorations
* such as the status bar and inset its content; that is, controlling whether

View File

@@ -340,6 +340,21 @@ public final class WindowInsets {
return result;
}
/**
* Returns a copy of this WindowInsets with selected system window insets replaced
* with new values.
*
* @param systemWindowInsets New system window insets. Each field is the inset in pixels
* for that edge
* @return A modified copy of this WindowInsets
*/
public WindowInsets replaceSystemWindowInsets(Rect systemWindowInsets) {
final WindowInsets result = new WindowInsets(this);
result.mSystemWindowInsets = new Rect(systemWindowInsets);
result.mSystemWindowInsetsConsumed = !hasSystemWindowInsets();
return result;
}
/**
* @hide
*/