Fix corner cases with "not merge" bug

This commit is contained in:
Alexander Lobas
2017-06-06 11:24:31 +03:00
parent f2dff6085b
commit ebe81ca2c6
2 changed files with 4 additions and 20 deletions
@@ -325,10 +325,8 @@ public class NotificationsManagerImpl extends NotificationsManager {
@NotNull Disposable parentDisposable) {
final BalloonLayoutData layoutData = layoutDataRef.isNull() ? new BalloonLayoutData() : layoutDataRef.get();
if (layoutData.groupId == null) {
if (NotificationsConfigurationImpl.getSettings(notification.getGroupId()).isShouldLog()) {
layoutData.groupId = notification.getGroupId();
layoutData.id = notification.id;
}
layoutData.groupId = notification.getGroupId();
layoutData.id = notification.id;
}
else {
layoutData.groupId = null;
@@ -134,22 +134,8 @@ public class BalloonLayoutImpl implements BalloonLayout {
ApplicationManager.getApplication().assertIsDispatchThread();
Balloon merge = merge(layoutData);
if (merge == null) {
if (getVisibleCount() > 0 && layoutData instanceof BalloonLayoutData && ((BalloonLayoutData)layoutData).groupId != null) {
int index = -1;
int count = 0;
for (int i = 0, size = myBalloons.size(); i < size; i++) {
BalloonLayoutData ld = myLayoutData.get(myBalloons.get(i));
if (ld != null && ld.groupId != null) {
if (index == -1) {
index = i;
}
count++;
}
}
if (count > 0 && count == getVisibleCount()) {
remove(myBalloons.get(index));
}
if (!myBalloons.isEmpty() && myBalloons.size() == getVisibleCount()) {
remove(myBalloons.get(0));
}
myBalloons.add(balloon);
}