Merge "Clean up WindowInsets API for release" into klp-modular-dev
This commit is contained in:
@ -28772,26 +28772,17 @@ package android.view {
|
|||||||
method public abstract void onFocusLost(android.view.WindowId);
|
method public abstract void onFocusLost(android.view.WindowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WindowInsets {
|
public final class WindowInsets {
|
||||||
ctor public WindowInsets(android.view.WindowInsets);
|
ctor public WindowInsets(android.view.WindowInsets);
|
||||||
method public android.view.WindowInsets cloneWithSystemWindowInsets(int, int, int, int);
|
method public android.view.WindowInsets consumeSystemWindowInsets();
|
||||||
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 getSystemWindowInsetBottom();
|
||||||
method public int getSystemWindowInsetLeft();
|
method public int getSystemWindowInsetLeft();
|
||||||
method public int getSystemWindowInsetRight();
|
method public int getSystemWindowInsetRight();
|
||||||
method public int getSystemWindowInsetTop();
|
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 hasInsets();
|
||||||
method public boolean hasSystemWindowInsets();
|
method public boolean hasSystemWindowInsets();
|
||||||
method public boolean hasWindowDecorInsets();
|
|
||||||
method public boolean isRound();
|
method public boolean isRound();
|
||||||
|
method public android.view.WindowInsets replaceSystemWindowInsets(int, int, int, int);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface WindowManager implements android.view.ViewManager {
|
public abstract interface WindowManager implements android.view.ViewManager {
|
||||||
|
@ -5989,12 +5989,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
// call into it as a fallback in case we're in a class that overrides it
|
// call into it as a fallback in case we're in a class that overrides it
|
||||||
// and has logic to perform.
|
// and has logic to perform.
|
||||||
if (fitSystemWindows(insets.getSystemWindowInsets())) {
|
if (fitSystemWindows(insets.getSystemWindowInsets())) {
|
||||||
return insets.cloneWithSystemWindowInsetsConsumed();
|
return insets.consumeSystemWindowInsets();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We were called from within a direct call to fitSystemWindows.
|
// We were called from within a direct call to fitSystemWindows.
|
||||||
if (fitSystemWindowsInt(insets.getSystemWindowInsets())) {
|
if (fitSystemWindowsInt(insets.getSystemWindowInsets())) {
|
||||||
return insets.cloneWithSystemWindowInsetsConsumed();
|
return insets.consumeSystemWindowInsets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return insets;
|
return insets;
|
||||||
|
@ -29,7 +29,7 @@ import android.graphics.Rect;
|
|||||||
* @see View.OnApplyWindowInsetsListener
|
* @see View.OnApplyWindowInsetsListener
|
||||||
* @see View#onApplyWindowInsets(WindowInsets)
|
* @see View#onApplyWindowInsets(WindowInsets)
|
||||||
*/
|
*/
|
||||||
public class WindowInsets {
|
public final class WindowInsets {
|
||||||
private Rect mSystemWindowInsets;
|
private Rect mSystemWindowInsets;
|
||||||
private Rect mWindowDecorInsets;
|
private Rect mWindowDecorInsets;
|
||||||
private Rect mTempRect;
|
private Rect mTempRect;
|
||||||
@ -151,6 +151,7 @@ public class WindowInsets {
|
|||||||
* This can include action bars, title bars, toolbars, etc.</p>
|
* This can include action bars, title bars, toolbars, etc.</p>
|
||||||
*
|
*
|
||||||
* @return The left window decor inset
|
* @return The left window decor inset
|
||||||
|
* @hide pending API
|
||||||
*/
|
*/
|
||||||
public int getWindowDecorInsetLeft() {
|
public int getWindowDecorInsetLeft() {
|
||||||
return mWindowDecorInsets.left;
|
return mWindowDecorInsets.left;
|
||||||
@ -164,6 +165,7 @@ public class WindowInsets {
|
|||||||
* This can include action bars, title bars, toolbars, etc.</p>
|
* This can include action bars, title bars, toolbars, etc.</p>
|
||||||
*
|
*
|
||||||
* @return The top window decor inset
|
* @return The top window decor inset
|
||||||
|
* @hide pending API
|
||||||
*/
|
*/
|
||||||
public int getWindowDecorInsetTop() {
|
public int getWindowDecorInsetTop() {
|
||||||
return mWindowDecorInsets.top;
|
return mWindowDecorInsets.top;
|
||||||
@ -177,6 +179,7 @@ public class WindowInsets {
|
|||||||
* This can include action bars, title bars, toolbars, etc.</p>
|
* This can include action bars, title bars, toolbars, etc.</p>
|
||||||
*
|
*
|
||||||
* @return The right window decor inset
|
* @return The right window decor inset
|
||||||
|
* @hide pending API
|
||||||
*/
|
*/
|
||||||
public int getWindowDecorInsetRight() {
|
public int getWindowDecorInsetRight() {
|
||||||
return mWindowDecorInsets.right;
|
return mWindowDecorInsets.right;
|
||||||
@ -190,6 +193,7 @@ public class WindowInsets {
|
|||||||
* This can include action bars, title bars, toolbars, etc.</p>
|
* This can include action bars, title bars, toolbars, etc.</p>
|
||||||
*
|
*
|
||||||
* @return The bottom window decor inset
|
* @return The bottom window decor inset
|
||||||
|
* @hide pending API
|
||||||
*/
|
*/
|
||||||
public int getWindowDecorInsetBottom() {
|
public int getWindowDecorInsetBottom() {
|
||||||
return mWindowDecorInsets.bottom;
|
return mWindowDecorInsets.bottom;
|
||||||
@ -217,6 +221,7 @@ public class WindowInsets {
|
|||||||
* This can include action bars, title bars, toolbars, etc.</p>
|
* This can include action bars, title bars, toolbars, etc.</p>
|
||||||
*
|
*
|
||||||
* @return true if any of the window decor inset values are nonzero
|
* @return true if any of the window decor inset values are nonzero
|
||||||
|
* @hide pending API
|
||||||
*/
|
*/
|
||||||
public boolean hasWindowDecorInsets() {
|
public boolean hasWindowDecorInsets() {
|
||||||
return mWindowDecorInsets.left != 0 || mWindowDecorInsets.top != 0 ||
|
return mWindowDecorInsets.left != 0 || mWindowDecorInsets.top != 0 ||
|
||||||
@ -246,13 +251,28 @@ public class WindowInsets {
|
|||||||
return mIsRound;
|
return mIsRound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowInsets cloneWithSystemWindowInsetsConsumed() {
|
/**
|
||||||
|
* Returns a copy of this WindowInsets with the system window insets fully consumed.
|
||||||
|
*
|
||||||
|
* @return A modified copy of this WindowInsets
|
||||||
|
*/
|
||||||
|
public WindowInsets consumeSystemWindowInsets() {
|
||||||
final WindowInsets result = new WindowInsets(this);
|
final WindowInsets result = new WindowInsets(this);
|
||||||
result.mSystemWindowInsets = new Rect(0, 0, 0, 0);
|
result.mSystemWindowInsets = new Rect(0, 0, 0, 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowInsets cloneWithSystemWindowInsetsConsumed(boolean left, boolean top,
|
/**
|
||||||
|
* Returns a copy of this WindowInsets with selected system window insets fully consumed.
|
||||||
|
*
|
||||||
|
* @param left true to consume the left system window inset
|
||||||
|
* @param top true to consume the top system window inset
|
||||||
|
* @param right true to consume the right system window inset
|
||||||
|
* @param bottom true to consume the bottom system window inset
|
||||||
|
* @return A modified copy of this WindowInsets
|
||||||
|
* @hide pending API
|
||||||
|
*/
|
||||||
|
public WindowInsets consumeSystemWindowInsets(boolean left, boolean top,
|
||||||
boolean right, boolean bottom) {
|
boolean right, boolean bottom) {
|
||||||
if (left || top || right || bottom) {
|
if (left || top || right || bottom) {
|
||||||
final WindowInsets result = new WindowInsets(this);
|
final WindowInsets result = new WindowInsets(this);
|
||||||
@ -265,19 +285,36 @@ public class WindowInsets {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowInsets cloneWithSystemWindowInsets(int left, int top, int right, int bottom) {
|
/**
|
||||||
|
* Returns a copy of this WindowInsets with selected system window insets replaced
|
||||||
|
* with new values.
|
||||||
|
*
|
||||||
|
* @param left New left inset in pixels
|
||||||
|
* @param top New top inset in pixels
|
||||||
|
* @param right New right inset in pixels
|
||||||
|
* @param bottom New bottom inset in pixels
|
||||||
|
* @return A modified copy of this WindowInsets
|
||||||
|
*/
|
||||||
|
public WindowInsets replaceSystemWindowInsets(int left, int top,
|
||||||
|
int right, int bottom) {
|
||||||
final WindowInsets result = new WindowInsets(this);
|
final WindowInsets result = new WindowInsets(this);
|
||||||
result.mSystemWindowInsets = new Rect(left, top, right, bottom);
|
result.mSystemWindowInsets = new Rect(left, top, right, bottom);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowInsets cloneWithWindowDecorInsetsConsumed() {
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public WindowInsets consumeWindowDecorInsets() {
|
||||||
final WindowInsets result = new WindowInsets(this);
|
final WindowInsets result = new WindowInsets(this);
|
||||||
result.mWindowDecorInsets.set(0, 0, 0, 0);
|
result.mWindowDecorInsets.set(0, 0, 0, 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowInsets cloneWithWindowDecorInsetsConsumed(boolean left, boolean top,
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public WindowInsets consumeWindowDecorInsets(boolean left, boolean top,
|
||||||
boolean right, boolean bottom) {
|
boolean right, boolean bottom) {
|
||||||
if (left || top || right || bottom) {
|
if (left || top || right || bottom) {
|
||||||
final WindowInsets result = new WindowInsets(this);
|
final WindowInsets result = new WindowInsets(this);
|
||||||
@ -290,7 +327,10 @@ public class WindowInsets {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowInsets cloneWithWindowDecorInsets(int left, int top, int right, int bottom) {
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public WindowInsets replaceWindowDecorInsets(int left, int top, int right, int bottom) {
|
||||||
final WindowInsets result = new WindowInsets(this);
|
final WindowInsets result = new WindowInsets(this);
|
||||||
result.mWindowDecorInsets = new Rect(left, top, right, bottom);
|
result.mWindowDecorInsets = new Rect(left, top, right, bottom);
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user