/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.support.v4.view; import android.graphics.Rect; /** * Describes a set of insets for window content. * *
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.
*/ public class WindowInsetsCompat { /** Private ctor */ WindowInsetsCompat() {} /** * Returns the left system window inset in pixels. * *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. *
* * @return The left system window inset */ public int getSystemWindowInsetLeft() { return 0; } /** * Returns the top system window inset in pixels. * *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. *
* * @return The top system window inset */ public int getSystemWindowInsetTop() { return 0; } /** * Returns the right system window inset in pixels. * *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. *
* * @return The right system window inset */ public int getSystemWindowInsetRight() { return 0; } /** * Returns the bottom system window inset in pixels. * *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. *
* * @return The bottom system window inset */ public int getSystemWindowInsetBottom() { return 0; } /** * Returns true if this WindowInsets has nonzero system window insets. * *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. *
* * @return true if any of the system window inset values are nonzero */ public boolean hasSystemWindowInsets() { return false; } /** * Returns true if this WindowInsets has any nonzero insets. * * @return true if any inset values are nonzero */ public boolean hasInsets() { return false; } /** * Check if these insets have been fully consumed. * *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 * {@link android.view.View#fitSystemWindows(android.graphics.Rect)}.
* * @return true if the insets have been fully consumed. */ public boolean isConsumed() { return false; } /** * Returns true if the associated window has a round shape. * *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.
* * @return True if the window is round */ public boolean isRound() { return false; } /** * Returns a copy of this WindowInsets with the system window insets fully consumed. * * @return A modified copy of this WindowInsets */ public WindowInsetsCompat consumeSystemWindowInsets() { return this; } /** * 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 WindowInsetsCompat replaceSystemWindowInsets(int left, int top, int right, int bottom) { return this; } /** * 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 WindowInsetsCompat replaceSystemWindowInsets(Rect systemWindowInsets) { return this; } /** * Returns the top stable inset in pixels. * *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.
* * @return The top stable inset */ public int getStableInsetTop() { return 0; } /** * Returns the left stable inset in pixels. * *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.
* * @return The left stable inset */ public int getStableInsetLeft() { return 0; } /** * Returns the right stable inset in pixels. * *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.
* * @return The right stable inset */ public int getStableInsetRight() { return 0; } /** * Returns the bottom stable inset in pixels. * *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.
* * @return The bottom stable inset */ public int getStableInsetBottom() { return 0; } /** * Returns true if this WindowInsets has nonzero stable insets. * *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.
* * @return true if any of the stable inset values are nonzero */ public boolean hasStableInsets() { return false; } /** * Returns a copy of this WindowInsets with the stable insets fully consumed. * * @return A modified copy of this WindowInsetsCompat */ public WindowInsetsCompat consumeStableInsets() { return this; } }