Merge "Fix notification shelf icon showing on top of snooze leave behind"

This commit is contained in:
TreeHugger Robot
2017-02-16 18:34:56 +00:00
committed by Android (Google) Code Review
7 changed files with 26 additions and 4 deletions

View File

@@ -43,6 +43,8 @@ public interface NotificationMenuRowProvider extends Plugin {
public View getContentView();
public boolean handleCloseControls(boolean save);
public boolean willBeRemoved();
}
public interface SnoozeGutsContent extends GutsContent {

View File

@@ -902,6 +902,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
* @return whether the notification is currently showing a view with an icon.
*/
public boolean isShowingIcon() {
if (areGutsExposed()) {
return false;
}
if (mIsSummaryWithChildren) {
return true;
}

View File

@@ -244,6 +244,10 @@ public class NotificationGuts extends FrameLayout
}
}
public boolean willBeRemoved() {
return mGutsContent != null ? mGutsContent.willBeRemoved() : false;
}
public boolean isExposed() {
return mExposed;
}

View File

@@ -273,6 +273,11 @@ public class NotificationInfo extends LinearLayout implements GutsContent {
mGutsInteractionListener = listener;
}
@Override
public boolean willBeRemoved() {
return !mChannelEnabledSwitch.isChecked();
}
@Override
public View getContentView() {
return this;

View File

@@ -380,11 +380,12 @@ public class NotificationShelf extends ActivatableNotificationView {
: 0.0f;
row.setContentTransformationAmount(contentTransformationAmount, isLastChild);
setIconTransformationAmount(row, transitionAmount, iconTransformDistance,
clampedAmount != transitionAmount);
clampedAmount != transitionAmount, isLastChild);
}
private void setIconTransformationAmount(ExpandableNotificationRow row,
float transitionAmount, float iconTransformDistance, boolean usingLinearInterpolation) {
float transitionAmount, float iconTransformDistance, boolean usingLinearInterpolation,
boolean isLastChild) {
StatusBarIconView icon = row.getEntry().expandedIcon;
NotificationIconContainer.IconState iconState = getIconState(icon);
@@ -437,7 +438,7 @@ public class NotificationShelf extends ActivatableNotificationView {
iconState.scaleY = 1.0f;
iconState.hidden = false;
}
if (row.isAboveShelf()) {
if (row.isAboveShelf() || (!row.isInShelf() && isLastChild && row.areGutsExposed())) {
iconState.hidden = true;
}
int shelfColor = icon.getStaticDrawableColor();

View File

@@ -56,6 +56,7 @@ public class NotificationSnooze extends LinearLayout
private TextView mUndoButton;
private ViewGroup mSnoozeOptionView;
private List<SnoozeOption> mSnoozeOptions;
private boolean mSnoozing;
private SnoozeOption mSelectedOption;
@@ -174,6 +175,11 @@ public class NotificationSnooze extends LinearLayout
mGutsInteractionListener.closeGuts(this);
}
@Override
public boolean willBeRemoved() {
return mSnoozing;
}
@Override
public View getContentView() {
return this;
@@ -199,6 +205,7 @@ public class NotificationSnooze extends LinearLayout
// When snooze is closed (i.e. there was interaction outside of the notification)
// then we commit the snooze action.
if (mSnoozeListener != null && mSelectedOption != null) {
mSnoozing = true;
mSnoozeListener.snoozeNotification(mSbn, mSelectedOption);
return true;
} else {

View File

@@ -5760,7 +5760,7 @@ public class StatusBar extends SystemUI implements DemoMode,
row.setTag(sbn.getPackageName());
final NotificationGuts guts = row.getGuts();
guts.setClosedListener((NotificationGuts g) -> {
if (!row.isRemoved()) {
if (!g.willBeRemoved() && !row.isRemoved()) {
mStackScroller.onHeightChanged(row, !isPanelFullyCollapsed() /* needsAnimation */);
}
mNotificationGutsExposed = null;