Merge "Initialize sourceless insets with Insets.NONE" into rvc-dev am: fe2228aa89 am: ce24761577
Change-Id: I9bd3d0543b2c8c017789c8eb23e12e5782be348c
This commit is contained in:
@@ -172,6 +172,10 @@ public class InsetsState implements Parcelable {
|
|||||||
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
||||||
InsetsSource source = mSources.get(type);
|
InsetsSource source = mSources.get(type);
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
|
int index = indexOf(toPublicType(type));
|
||||||
|
if (typeInsetsMap[index] == null) {
|
||||||
|
typeInsetsMap[index] = Insets.NONE;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -835,12 +835,24 @@ public final class WindowInsets {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "WindowInsets{systemWindowInsets=" + getSystemWindowInsets()
|
StringBuilder result = new StringBuilder("WindowInsets{\n ");
|
||||||
+ " stableInsets=" + getStableInsets()
|
for (int i = 0; i < SIZE; i++) {
|
||||||
+ " sysGestureInsets=" + getSystemGestureInsets()
|
Insets insets = mTypeInsetsMap[i];
|
||||||
+ (mDisplayCutout != null ? " cutout=" + mDisplayCutout : "")
|
Insets maxInsets = mTypeMaxInsetsMap[i];
|
||||||
+ (isRound() ? " round" : "")
|
boolean visible = mTypeVisibilityMap[i];
|
||||||
+ "}";
|
if (!Insets.NONE.equals(insets) || !Insets.NONE.equals(maxInsets) || visible) {
|
||||||
|
result.append(Type.toString(1 << i)).append("=").append(insets)
|
||||||
|
.append(" max=").append(maxInsets)
|
||||||
|
.append(" vis=").append(visible)
|
||||||
|
.append("\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(mDisplayCutout != null ? "cutout=" + mDisplayCutout : "");
|
||||||
|
result.append("\n ");
|
||||||
|
result.append(isRound() ? "round" : "");
|
||||||
|
result.append("}");
|
||||||
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1309,6 +1321,32 @@ public final class WindowInsets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String toString(@InsetsType int type) {
|
||||||
|
switch (type) {
|
||||||
|
case STATUS_BARS:
|
||||||
|
return "statusBars";
|
||||||
|
case NAVIGATION_BARS:
|
||||||
|
return "navigationBars";
|
||||||
|
case CAPTION_BAR:
|
||||||
|
return "captionBar";
|
||||||
|
case IME:
|
||||||
|
return "ime";
|
||||||
|
case SYSTEM_GESTURES:
|
||||||
|
return "systemGestures";
|
||||||
|
case MANDATORY_SYSTEM_GESTURES:
|
||||||
|
return "mandatorySystemGestures";
|
||||||
|
case TAPPABLE_ELEMENT:
|
||||||
|
return "tappableElement";
|
||||||
|
case DISPLAY_CUTOUT:
|
||||||
|
return "displayCutout";
|
||||||
|
case WINDOW_DECOR:
|
||||||
|
return "windowDecor";
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST,"
|
||||||
|
+ " type=" + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Type() {
|
private Type() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user