Fix layout for full-screen floating windows
am: 9f6798a936
* commit '9f6798a9367cc6134f956c422107361db43c4212':
Fix layout for full-screen floating windows
This commit is contained in:
@@ -86,6 +86,7 @@ import static android.view.Window.DECOR_CAPTION_SHADE_DARK;
|
||||
import static android.view.Window.DECOR_CAPTION_SHADE_LIGHT;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
|
||||
@@ -1002,13 +1003,25 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
||||
&& (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0
|
||||
&& (sysUiVisibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
|
||||
|
||||
// If we didn't request fullscreen layout, but we still got it because of the
|
||||
// mForceWindowDrawsStatusBarBackground flag, also consume top inset.
|
||||
boolean consumingStatusBar = (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == 0
|
||||
&& (sysUiVisibility & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0
|
||||
&& (attrs.flags & FLAG_LAYOUT_IN_SCREEN) == 0
|
||||
&& (attrs.flags & FLAG_LAYOUT_INSET_DECOR) == 0
|
||||
&& mForceWindowDrawsStatusBarBackground
|
||||
&& mLastTopInset != 0;
|
||||
|
||||
int consumedTop = consumingStatusBar ? mLastTopInset : 0;
|
||||
int consumedRight = consumingNavBar ? mLastRightInset : 0;
|
||||
int consumedBottom = consumingNavBar ? mLastBottomInset : 0;
|
||||
|
||||
if (mContentRoot != null
|
||||
&& mContentRoot.getLayoutParams() instanceof MarginLayoutParams) {
|
||||
MarginLayoutParams lp = (MarginLayoutParams) mContentRoot.getLayoutParams();
|
||||
if (lp.rightMargin != consumedRight || lp.bottomMargin != consumedBottom) {
|
||||
if (lp.topMargin != consumedTop || lp.rightMargin != consumedRight
|
||||
|| lp.bottomMargin != consumedBottom) {
|
||||
lp.topMargin = consumedTop;
|
||||
lp.rightMargin = consumedRight;
|
||||
lp.bottomMargin = consumedBottom;
|
||||
mContentRoot.setLayoutParams(lp);
|
||||
@@ -1022,7 +1035,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
||||
if (insets != null) {
|
||||
insets = insets.replaceSystemWindowInsets(
|
||||
insets.getSystemWindowInsetLeft(),
|
||||
insets.getSystemWindowInsetTop(),
|
||||
insets.getSystemWindowInsetTop() - consumedTop,
|
||||
insets.getSystemWindowInsetRight() - consumedRight,
|
||||
insets.getSystemWindowInsetBottom() - consumedBottom);
|
||||
}
|
||||
|
||||
@@ -4397,6 +4397,23 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
+ mUnrestrictedScreenWidth;
|
||||
pf.bottom = df.bottom = of.bottom = cf.bottom = mUnrestrictedScreenTop
|
||||
+ mUnrestrictedScreenHeight;
|
||||
} else if ((sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) != 0) {
|
||||
pf.left = df.left = of.left = mRestrictedScreenLeft;
|
||||
pf.top = df.top = of.top = mRestrictedScreenTop;
|
||||
pf.right = df.right = of.right = mRestrictedScreenLeft + mRestrictedScreenWidth;
|
||||
pf.bottom = df.bottom = of.bottom = mRestrictedScreenTop
|
||||
+ mRestrictedScreenHeight;
|
||||
if (adjust != SOFT_INPUT_ADJUST_RESIZE) {
|
||||
cf.left = mDockLeft;
|
||||
cf.top = mDockTop;
|
||||
cf.right = mDockRight;
|
||||
cf.bottom = mDockBottom;
|
||||
} else {
|
||||
cf.left = mContentLeft;
|
||||
cf.top = mContentTop;
|
||||
cf.right = mContentRight;
|
||||
cf.bottom = mContentBottom;
|
||||
}
|
||||
} else {
|
||||
pf.left = df.left = of.left = cf.left = mRestrictedScreenLeft;
|
||||
pf.top = df.top = of.top = cf.top = mRestrictedScreenTop;
|
||||
|
||||
Reference in New Issue
Block a user