Merge "Fixed a bug where the positioning on the lockscreen was wrong" into nyc-dev

am: 549a822331

* commit '549a822331a522cabfb854b91b1cad5a0f7128ae':
  Fixed a bug where the positioning on the lockscreen was wrong

Change-Id: Ia1a7619019069599fcde4f3002e44517bb7d4572
This commit is contained in:
Selim Cinek
2016-05-10 23:16:58 +00:00
committed by android-build-merger
5 changed files with 27 additions and 15 deletions

View File

@@ -92,8 +92,8 @@ import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardHostView.OnDismissAction;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.DejankUtils;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
@@ -2193,7 +2193,7 @@ public abstract class BaseStatusBar extends SystemUI implements
} else {
boolean wasGone = entry.row.getVisibility() == View.GONE;
entry.row.setVisibility(View.VISIBLE);
if (!childNotification) {
if (!childNotification && !entry.row.isRemoved()) {
if (wasGone) {
// notify the scroller of a child addition
mStackScroller.generateAddAnimation(entry.row,
@@ -2213,7 +2213,7 @@ public abstract class BaseStatusBar extends SystemUI implements
mStackScroller.getChildCount() - 3);
}
private boolean shouldShowOnKeyguard(StatusBarNotification sbn) {
public boolean shouldShowOnKeyguard(StatusBarNotification sbn) {
return mShowLockscreenNotifications && !mNotificationData.isAmbient(sbn.getKey());
}

View File

@@ -418,11 +418,18 @@ public class NotificationPanelView extends PanelView implements
if (!(child instanceof ExpandableNotificationRow)) {
continue;
}
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup(
((ExpandableNotificationRow) child).getStatusBarNotification());
row.getStatusBarNotification());
if (suppressedSummary) {
continue;
}
if (!mStatusBar.shouldShowOnKeyguard(row.getStatusBarNotification())) {
continue;
}
if (row.isRemoved()) {
continue;
}
availableSpace -= child.getMinHeight() + notificationPadding;
if (availableSpace >= 0 && count < maximum) {
count++;

View File

@@ -1550,6 +1550,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
ArrayList<ExpandableNotificationRow> toRemove = new ArrayList<>(notificationChildren);
for (int i = 0; i < toRemove.size(); i++) {
toRemove.get(i).setKeepInParent(true);
toRemove.get(i).setRemoved(true);
}
for (int i = 0; i < toRemove.size(); i++) {
removeNotification(toRemove.get(i).getStatusBarNotification().getKey(), ranking);

View File

@@ -103,9 +103,8 @@ public class NotificationChildrenContainer extends ViewGroup {
int childCount = Math.min(mChildren.size(), NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED);
for (int i = 0; i < childCount; i++) {
View child = mChildren.get(i);
if (child.getVisibility() == View.GONE) {
continue;
}
// We need to layout all children even the GONE ones, such that the heights are
// calculated correctly as they are used to calculate how many we can fit on the screen
child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight());
mDividers.get(i).layout(0, 0, getWidth(), mDividerHeight);
}
@@ -138,17 +137,19 @@ public class NotificationChildrenContainer extends ViewGroup {
int overflowIndex = childCount > collapsedChildren ? collapsedChildren - 1 : -1;
for (int i = 0; i < childCount; i++) {
ExpandableNotificationRow child = mChildren.get(i);
// We need to measure all children even the GONE ones, such that the heights are
// calculated correctly as they are used to calculate how many we can fit on the screen.
boolean isOverflow = i == overflowIndex;
child.setSingleLineWidthIndention(isOverflow && mOverflowNumber != null
? mOverflowNumber.getMeasuredWidth()
: 0);
child.measure(widthMeasureSpec, newHeightSpec);
height += child.getMeasuredHeight();
// layout the divider
View divider = mDividers.get(i);
divider.measure(widthMeasureSpec, dividerHeightSpec);
height += mDividerHeight;
if (child.getVisibility() != GONE) {
height += child.getMeasuredHeight() + mDividerHeight;
}
}
mRealHeight = height;
if (heightMode != MeasureSpec.UNSPECIFIED) {

View File

@@ -483,19 +483,22 @@ public class NotificationStackScrollLayout extends ViewGroup
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
measureChildren(widthMeasureSpec, heightMeasureSpec);
// We need to measure all children even the GONE ones, such that the heights are calculated
// correctly as they are used to calculate how many we can fit on the screen.
final int size = getChildCount();
for (int i = 0; i < size; i++) {
measureChild(getChildAt(i), widthMeasureSpec, heightMeasureSpec);
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// we layout all our children centered on the top
float centerX = getWidth() / 2.0f;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (child.getVisibility() == GONE) {
continue;
}
// We need to layout all children even the GONE ones, such that the heights are
// calculated correctly as they are used to calculate how many we can fit on the screen
float width = child.getMeasuredWidth();
float height = child.getMeasuredHeight();
child.layout((int) (centerX - width / 2.0f),