public class WindowInsetsCompat extends Object
WindowInsetsCompats are immutable and may be expanded to include more inset types in the future. To adjust insets, use one of the supplied clone methods to obtain a new WindowInsetsCompat instance with the adjusted properties.
Constructor and Description |
---|
WindowInsetsCompat(WindowInsetsCompat src)
Constructs a new WindowInsetsCompat, copying all values from a source WindowInsetsCompat.
|
Modifier and Type | Method and Description |
---|---|
WindowInsetsCompat |
consumeStableInsets()
Returns a copy of this WindowInsets with the stable insets fully consumed.
|
WindowInsetsCompat |
consumeSystemWindowInsets()
Returns a copy of this WindowInsets with the system window insets fully consumed.
|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
int |
getStableInsetBottom()
Returns the bottom stable inset in pixels.
|
int |
getStableInsetLeft()
Returns the left stable inset in pixels.
|
int |
getStableInsetRight()
Returns the right stable inset in pixels.
|
int |
getStableInsetTop()
Returns the top stable inset in pixels.
|
int |
getSystemWindowInsetBottom()
Returns the bottom system window inset in pixels.
|
int |
getSystemWindowInsetLeft()
Returns the left system window inset in pixels.
|
int |
getSystemWindowInsetRight()
Returns the right system window inset in pixels.
|
int |
getSystemWindowInsetTop()
Returns the top system window inset in pixels.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
hasInsets()
Returns true if this WindowInsets has any nonzero insets.
|
boolean |
hasStableInsets()
Returns true if this WindowInsets has nonzero stable insets.
|
boolean |
hasSystemWindowInsets()
Returns true if this WindowInsets has nonzero system window insets.
|
boolean |
isConsumed()
Check if these insets have been fully consumed.
|
boolean |
isRound()
Returns true if the associated window has a round shape.
|
WindowInsetsCompat |
replaceSystemWindowInsets(int left,
int top,
int right,
int bottom)
Returns a copy of this WindowInsets with selected system window insets replaced
with new values.
|
WindowInsetsCompat |
replaceSystemWindowInsets(Rect systemWindowInsets)
Returns a copy of this WindowInsets with selected system window insets replaced
with new values.
|
public WindowInsetsCompat(WindowInsetsCompat src)
src
- source from which values are copiedpublic int getSystemWindowInsetLeft()
The system window inset represents the area of a full-screen window that is partially or fully obscured by the status bar, navigation bar, IME or other system windows.
public int getSystemWindowInsetTop()
The system window inset represents the area of a full-screen window that is partially or fully obscured by the status bar, navigation bar, IME or other system windows.
public int getSystemWindowInsetRight()
The system window inset represents the area of a full-screen window that is partially or fully obscured by the status bar, navigation bar, IME or other system windows.
public int getSystemWindowInsetBottom()
The system window inset represents the area of a full-screen window that is partially or fully obscured by the status bar, navigation bar, IME or other system windows.
public boolean hasSystemWindowInsets()
The system window inset represents the area of a full-screen window that is partially or fully obscured by the status bar, navigation bar, IME or other system windows.
public boolean hasInsets()
public boolean isConsumed()
Insets are considered "consumed" if the applicable consume*
methods
have been called such that all insets have been set to zero. This affects propagation of
insets through the view hierarchy; insets that have not been fully consumed will continue
to propagate down to child views.
The result of this method is equivalent to the return value of
View.fitSystemWindows(android.graphics.Rect)
.
public boolean isRound()
A round window's left, top, right and bottom edges reach all the way to the associated edges of the window but the corners may not be visible. Views responding to round insets should take care to not lay out critical elements within the corners where they may not be accessible.
public WindowInsetsCompat consumeSystemWindowInsets()
public WindowInsetsCompat replaceSystemWindowInsets(int left, int top, int right, int bottom)
left
- New left inset in pixelstop
- New top inset in pixelsright
- New right inset in pixelsbottom
- New bottom inset in pixelspublic WindowInsetsCompat replaceSystemWindowInsets(Rect systemWindowInsets)
systemWindowInsets
- New system window insets. Each field is the inset in pixels
for that edgepublic int getStableInsetTop()
The stable inset represents the area of a full-screen window that may be partially or fully obscured by the system UI elements. This value does not change based on the visibility state of those elements; for example, if the status bar is normally shown, but temporarily hidden, the stable inset will still provide the inset associated with the status bar being shown.
public int getStableInsetLeft()
The stable inset represents the area of a full-screen window that may be partially or fully obscured by the system UI elements. This value does not change based on the visibility state of those elements; for example, if the status bar is normally shown, but temporarily hidden, the stable inset will still provide the inset associated with the status bar being shown.
public int getStableInsetRight()
The stable inset represents the area of a full-screen window that may be partially or fully obscured by the system UI elements. This value does not change based on the visibility state of those elements; for example, if the status bar is normally shown, but temporarily hidden, the stable inset will still provide the inset associated with the status bar being shown.
public int getStableInsetBottom()
The stable inset represents the area of a full-screen window that may be partially or fully obscured by the system UI elements. This value does not change based on the visibility state of those elements; for example, if the status bar is normally shown, but temporarily hidden, the stable inset will still provide the inset associated with the status bar being shown.
public boolean hasStableInsets()
The stable inset represents the area of a full-screen window that may be partially or fully obscured by the system UI elements. This value does not change based on the visibility state of those elements; for example, if the status bar is normally shown, but temporarily hidden, the stable inset will still provide the inset associated with the status bar being shown.
public WindowInsetsCompat consumeStableInsets()
public boolean equals(Object o)
Object
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
equals
in class Object
o
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap
public int hashCode()
Object
HashMap
.
The general contract of hashCode
is:
hashCode
method
must consistently return the same integer, provided no information
used in equals
comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode
method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object
does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)