Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2642357b authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

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

parents 76466c7b d72068b3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -33653,6 +33653,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();
@@ -34978,6 +34979,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 {
+22 −0
Original line number Diff line number Diff line
@@ -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
+15 −0
Original line number Diff line number Diff line
@@ -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
     */