Fixed that the expandButton was sometimes visible when it shouldnt

This happened when the collapsed height had the same height as the
expanded one.

Bug: 26185377
Change-Id: I9c37a8239cc87bf2192f48bc008700faf4afb5d9
This commit is contained in:
Selim Cinek
2015-12-17 16:39:06 -08:00
parent 28387895ab
commit 98be3f375b
2 changed files with 11 additions and 1 deletions

View File

@@ -49,7 +49,7 @@
<dimen name="notification_max_heads_up_height_legacy">128dp</dimen>
<!-- Height of a heads up notification in the status bar -->
<dimen name="notification_max_heads_up_height">140dp</dimen>
<dimen name="notification_max_heads_up_height">141dp</dimen>
<!-- Height of a the summary ("more card") notification on keyguard. -->
<dimen name="notification_summary_height">44dp</dimen>

View File

@@ -107,6 +107,8 @@ public class NotificationContentView extends FrameLayout {
};
private OnClickListener mExpandClickListener;
private boolean mBeforeN;
private boolean mExpandable;
public NotificationContentView(Context context, AttributeSet attrs) {
super(context, attrs);
mHybridViewManager = new HybridNotificationViewManager(getContext(), this);
@@ -491,6 +493,7 @@ public class NotificationContentView extends FrameLayout {
public void setHeadsUp(boolean headsUp) {
mIsHeadsUp = headsUp;
selectLayout(false /* animate */, true /* force */);
updateExpandButtons(mExpandable);
}
@Override
@@ -610,6 +613,13 @@ public class NotificationContentView extends FrameLayout {
}
public void updateExpandButtons(boolean expandable) {
mExpandable = expandable;
// if the expanded child has the same height as the collapsed one we hide it.
if (mExpandedChild != null && mExpandedChild.getHeight() != 0 &&
((mIsHeadsUp && mExpandedChild.getHeight() == mHeadsUpChild.getHeight()) ||
(!mIsHeadsUp && mExpandedChild.getHeight() == mContractedChild.getHeight()))) {
expandable = false;
}
if (mExpandedChild != null) {
mExpandedWrapper.updateExpandability(expandable, mExpandClickListener);
}