Merge "Remove scaffolding for multiple dots" into tm-qpr-dev
This commit is contained in:
@@ -805,7 +805,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
iconState.hidden = isAppearing
|
iconState.hidden = isAppearing
|
||||||
|| (view instanceof ExpandableNotificationRow
|
|| (view instanceof ExpandableNotificationRow
|
||||||
&& ((ExpandableNotificationRow) view).isLowPriority()
|
&& ((ExpandableNotificationRow) view).isLowPriority()
|
||||||
&& mShelfIcons.hasMaxNumDot())
|
&& mShelfIcons.areIconsOverflowing())
|
||||||
|| (transitionAmount == 0.0f && !iconState.isAnimating(icon))
|
|| (transitionAmount == 0.0f && !iconState.isAnimating(icon))
|
||||||
|| row.isAboveShelf()
|
|| row.isAboveShelf()
|
||||||
|| row.showingPulsing()
|
|| row.showingPulsing()
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ public class NotificationIconContainer extends ViewGroup {
|
|||||||
/* Maximum number of icons in short shelf on lockscreen when also showing overflow dot. */
|
/* Maximum number of icons in short shelf on lockscreen when also showing overflow dot. */
|
||||||
public static final int MAX_ICONS_ON_LOCKSCREEN = 3;
|
public static final int MAX_ICONS_ON_LOCKSCREEN = 3;
|
||||||
public static final int MAX_STATIC_ICONS = 4;
|
public static final int MAX_STATIC_ICONS = 4;
|
||||||
private static final int MAX_DOTS = 1;
|
|
||||||
|
|
||||||
private boolean mIsStaticLayout = true;
|
private boolean mIsStaticLayout = true;
|
||||||
private final HashMap<View, IconState> mIconStates = new HashMap<>();
|
private final HashMap<View, IconState> mIconStates = new HashMap<>();
|
||||||
@@ -166,8 +165,7 @@ public class NotificationIconContainer extends ViewGroup {
|
|||||||
private IconState mLastVisibleIconState;
|
private IconState mLastVisibleIconState;
|
||||||
private IconState mFirstVisibleIconState;
|
private IconState mFirstVisibleIconState;
|
||||||
private float mVisualOverflowStart;
|
private float mVisualOverflowStart;
|
||||||
// Keep track of overflow in range [0, 3]
|
private boolean mIsShowingOverflowDot;
|
||||||
private int mNumDots;
|
|
||||||
private StatusBarIconView mIsolatedIcon;
|
private StatusBarIconView mIsolatedIcon;
|
||||||
private Rect mIsolatedIconLocation;
|
private Rect mIsolatedIconLocation;
|
||||||
private int[] mAbsolutePosition = new int[2];
|
private int[] mAbsolutePosition = new int[2];
|
||||||
@@ -387,8 +385,8 @@ public class NotificationIconContainer extends ViewGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMaxNumDot() {
|
public boolean areIconsOverflowing() {
|
||||||
return mNumDots >= MAX_DOTS;
|
return mIsShowingOverflowDot;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean areAnimationsEnabled(StatusBarIconView icon) {
|
private boolean areAnimationsEnabled(StatusBarIconView icon) {
|
||||||
@@ -494,7 +492,7 @@ public class NotificationIconContainer extends ViewGroup {
|
|||||||
: 1f;
|
: 1f;
|
||||||
translationX += iconState.iconAppearAmount * view.getWidth() * drawingScale;
|
translationX += iconState.iconAppearAmount * view.getWidth() * drawingScale;
|
||||||
}
|
}
|
||||||
mNumDots = 0;
|
mIsShowingOverflowDot = false;
|
||||||
if (firstOverflowIndex != -1) {
|
if (firstOverflowIndex != -1) {
|
||||||
translationX = mVisualOverflowStart;
|
translationX = mVisualOverflowStart;
|
||||||
for (int i = firstOverflowIndex; i < childCount; i++) {
|
for (int i = firstOverflowIndex; i < childCount; i++) {
|
||||||
@@ -502,15 +500,14 @@ public class NotificationIconContainer extends ViewGroup {
|
|||||||
IconState iconState = mIconStates.get(view);
|
IconState iconState = mIconStates.get(view);
|
||||||
int dotWidth = mStaticDotDiameter + mDotPadding;
|
int dotWidth = mStaticDotDiameter + mDotPadding;
|
||||||
iconState.setXTranslation(translationX);
|
iconState.setXTranslation(translationX);
|
||||||
if (mNumDots < MAX_DOTS) {
|
if (!mIsShowingOverflowDot) {
|
||||||
if (mNumDots == 0 && iconState.iconAppearAmount < 0.8f) {
|
if (iconState.iconAppearAmount < 0.8f) {
|
||||||
iconState.visibleState = StatusBarIconView.STATE_ICON;
|
iconState.visibleState = StatusBarIconView.STATE_ICON;
|
||||||
} else {
|
} else {
|
||||||
iconState.visibleState = StatusBarIconView.STATE_DOT;
|
iconState.visibleState = StatusBarIconView.STATE_DOT;
|
||||||
mNumDots++;
|
mIsShowingOverflowDot = true;
|
||||||
}
|
}
|
||||||
translationX += (mNumDots == MAX_DOTS ? MAX_DOTS * dotWidth : dotWidth)
|
translationX += dotWidth * iconState.iconAppearAmount;
|
||||||
* iconState.iconAppearAmount;
|
|
||||||
mLastVisibleIconState = iconState;
|
mLastVisibleIconState = iconState;
|
||||||
} else {
|
} else {
|
||||||
iconState.visibleState = StatusBarIconView.STATE_HIDDEN;
|
iconState.visibleState = StatusBarIconView.STATE_HIDDEN;
|
||||||
@@ -618,10 +615,6 @@ public class NotificationIconContainer extends ViewGroup {
|
|||||||
return Math.min(getWidth(), translation);
|
return Math.min(getWidth(), translation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getMaxOverflowStart() {
|
|
||||||
return getLayoutEnd() - mIconSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChangingViewPositions(boolean changingViewPositions) {
|
public void setChangingViewPositions(boolean changingViewPositions) {
|
||||||
mChangingViewPositions = changingViewPositions;
|
mChangingViewPositions = changingViewPositions;
|
||||||
}
|
}
|
||||||
@@ -645,25 +638,6 @@ public class NotificationIconContainer extends ViewGroup {
|
|||||||
mSpeedBumpIndex = speedBumpIndex;
|
mSpeedBumpIndex = speedBumpIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasOverflow() {
|
|
||||||
return mNumDots > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Give some extra room for btw notifications if we can
|
|
||||||
public int getNoOverflowExtraPadding() {
|
|
||||||
if (mNumDots != 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int collapsedPadding = mIconSize;
|
|
||||||
|
|
||||||
if (collapsedPadding + getFinalTranslationX() > getWidth()) {
|
|
||||||
collapsedPadding = getWidth() - getFinalTranslationX();
|
|
||||||
}
|
|
||||||
|
|
||||||
return collapsedPadding;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIconSize() {
|
public int getIconSize() {
|
||||||
return mIconSize;
|
return mIconSize;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class NotificationIconContainerTest : SysuiTestCase() {
|
|||||||
|
|
||||||
iconContainer.calculateIconXTranslations()
|
iconContainer.calculateIconXTranslations()
|
||||||
assertEquals(10f, iconState.xTranslation)
|
assertEquals(10f, iconState.xTranslation)
|
||||||
assertFalse(iconContainer.hasOverflow())
|
assertFalse(iconContainer.areIconsOverflowing())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -121,7 +121,7 @@ class NotificationIconContainerTest : SysuiTestCase() {
|
|||||||
assertEquals(30f, iconContainer.getIconState(iconThree).xTranslation)
|
assertEquals(30f, iconContainer.getIconState(iconThree).xTranslation)
|
||||||
assertEquals(40f, iconContainer.getIconState(iconFour).xTranslation)
|
assertEquals(40f, iconContainer.getIconState(iconFour).xTranslation)
|
||||||
|
|
||||||
assertFalse(iconContainer.hasOverflow())
|
assertFalse(iconContainer.areIconsOverflowing())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -150,7 +150,7 @@ class NotificationIconContainerTest : SysuiTestCase() {
|
|||||||
assertEquals(10f, iconContainer.getIconState(iconOne).xTranslation)
|
assertEquals(10f, iconContainer.getIconState(iconOne).xTranslation)
|
||||||
assertEquals(20f, iconContainer.getIconState(iconTwo).xTranslation)
|
assertEquals(20f, iconContainer.getIconState(iconTwo).xTranslation)
|
||||||
assertEquals(30f, iconContainer.getIconState(iconThree).xTranslation)
|
assertEquals(30f, iconContainer.getIconState(iconThree).xTranslation)
|
||||||
assertTrue(iconContainer.hasOverflow())
|
assertTrue(iconContainer.areIconsOverflowing())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user