Update scrim if insets are added later.
If insets are set after the activity requests the foreground scrim to be shown, the scrim will not be correctly added. This is an issue for fallback recents which requests the foreground scrim right after initialization. To fix this, we save the request to show the scrim in a local variable and check this on inset updates to determine whether we should show the scrim or not. Bug: 131853975 Test: Fallback recents now has foreground scrim added correctly Change-Id: I15a19a3184bbc97a20fbcbba2106fd7221410df0
This commit is contained in:
parent
7b48548546
commit
b35b7dee18
|
@ -154,6 +154,7 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
|
|||
private boolean mTransitionedFromApp;
|
||||
private boolean mUsingRemoteAnimation;
|
||||
private boolean mStartedEnterAnimation;
|
||||
private boolean mShowStatusBarForegroundScrim;
|
||||
private AnimatorSet mLayoutAnimation;
|
||||
private final ArraySet<View> mLayingOutViews = new ArraySet<>();
|
||||
private Rect mInsets;
|
||||
|
@ -409,7 +410,14 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
|
|||
* @param showStatusBarForegroundScrim true to show the scrim, false to hide
|
||||
*/
|
||||
public void setShowStatusBarForegroundScrim(boolean showStatusBarForegroundScrim) {
|
||||
boolean shouldShow = mInsets.top != 0 && showStatusBarForegroundScrim;
|
||||
mShowStatusBarForegroundScrim = showStatusBarForegroundScrim;
|
||||
if (mShowStatusBarForegroundScrim != showStatusBarForegroundScrim) {
|
||||
updateStatusBarScrim();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStatusBarScrim() {
|
||||
boolean shouldShow = mInsets.top != 0 && mShowStatusBarForegroundScrim;
|
||||
mActivity.getDragLayer().setForeground(shouldShow ? mStatusBarForegroundScrim : null);
|
||||
}
|
||||
|
||||
|
@ -838,6 +846,9 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
|
|||
mInsets = insets;
|
||||
mTaskRecyclerView.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
||||
mTaskRecyclerView.invalidateItemDecorations();
|
||||
if (mInsets.top != 0) {
|
||||
updateStatusBarScrim();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue