Merge "Fix for delayed rounding animation on notification" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f10f6630ea
@@ -251,6 +251,21 @@ interface Roundable {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request the roundness 0f for a [SourceType].
|
||||||
|
*
|
||||||
|
* The top/bottom roundness of a [Roundable] can be defined by different [sourceType]. In case
|
||||||
|
* more origins require different roundness, for the same property, the maximum value will
|
||||||
|
* always be chosen.
|
||||||
|
*
|
||||||
|
* @param sourceType the source from which the request for roundness comes.
|
||||||
|
* @param animate true if it should animate to that value.
|
||||||
|
*/
|
||||||
|
@JvmDefault
|
||||||
|
fun requestRoundnessReset(sourceType: SourceType, animate: Boolean) {
|
||||||
|
requestRoundness(top = 0f, bottom = 0f, sourceType = sourceType, animate = animate)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request the roundness 0f for a [SourceType]. Animate the roundness if the view is shown.
|
* Request the roundness 0f for a [SourceType]. Animate the roundness if the view is shown.
|
||||||
*
|
*
|
||||||
@@ -262,7 +277,7 @@ interface Roundable {
|
|||||||
*/
|
*/
|
||||||
@JvmDefault
|
@JvmDefault
|
||||||
fun requestRoundnessReset(sourceType: SourceType) {
|
fun requestRoundnessReset(sourceType: SourceType) {
|
||||||
requestRoundness(top = 0f, bottom = 0f, sourceType = sourceType)
|
requestRoundnessReset(sourceType = sourceType, animate = roundableState.targetView.isShown)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Apply the roundness changes, usually means invalidate the [RoundableState.targetView]. */
|
/** Apply the roundness changes, usually means invalidate the [RoundableState.targetView]. */
|
||||||
|
|||||||
@@ -3487,7 +3487,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
mChildrenContainer.requestRoundness(
|
mChildrenContainer.requestRoundness(
|
||||||
/* top = */ getTopRoundness(),
|
/* top = */ getTopRoundness(),
|
||||||
/* bottom = */ getBottomRoundness(),
|
/* bottom = */ getBottomRoundness(),
|
||||||
FROM_PARENT);
|
/* sourceType = */ FROM_PARENT,
|
||||||
|
/* animate = */ false);
|
||||||
} else {
|
} else {
|
||||||
mChildrenContainer.requestBottomRoundness(
|
mChildrenContainer.requestBottomRoundness(
|
||||||
getBottomRoundness(),
|
getBottomRoundness(),
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ public class NotificationChildrenContainer extends ViewGroup
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mUseRoundnessSourceTypes) {
|
if (mUseRoundnessSourceTypes) {
|
||||||
row.requestRoundnessReset(FROM_PARENT);
|
row.requestRoundnessReset(FROM_PARENT, /* animate = */ false);
|
||||||
applyRoundnessAndInvalidate();
|
applyRoundnessAndInvalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1440,7 +1440,8 @@ public class NotificationChildrenContainer extends ViewGroup
|
|||||||
child.requestRoundness(
|
child.requestRoundness(
|
||||||
/* top = */ 0f,
|
/* top = */ 0f,
|
||||||
/* bottom = */ last ? getBottomRoundness() : 0f,
|
/* bottom = */ last ? getBottomRoundness() : 0f,
|
||||||
FROM_PARENT);
|
/* sourceType = */ FROM_PARENT,
|
||||||
|
/* animate = */ false);
|
||||||
} else {
|
} else {
|
||||||
child.requestRoundness(
|
child.requestRoundness(
|
||||||
/* top = */ 0f,
|
/* top = */ 0f,
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
|
|||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.statusbar.notification.AboveShelfChangedListener;
|
import com.android.systemui.statusbar.notification.AboveShelfChangedListener;
|
||||||
import com.android.systemui.statusbar.notification.FeedbackIcon;
|
import com.android.systemui.statusbar.notification.FeedbackIcon;
|
||||||
|
import com.android.systemui.statusbar.notification.SourceType;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||||
import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener;
|
import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener;
|
||||||
import com.android.systemui.statusbar.notification.stack.NotificationChildrenContainer;
|
import com.android.systemui.statusbar.notification.stack.NotificationChildrenContainer;
|
||||||
@@ -534,4 +535,28 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
|
|||||||
/*oldParent=*/ any()
|
/*oldParent=*/ any()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void applyRoundnessAndInv_should_be_immediately_applied_on_childrenContainer_legacy() {
|
||||||
|
mGroupRow.useRoundnessSourceTypes(false);
|
||||||
|
Assert.assertEquals(0f, mGroupRow.getBottomRoundness(), 0.001f);
|
||||||
|
Assert.assertEquals(0f, mGroupRow.getChildrenContainer().getBottomRoundness(), 0.001f);
|
||||||
|
|
||||||
|
mGroupRow.requestBottomRoundness(1f, SourceType.from(""), false);
|
||||||
|
|
||||||
|
Assert.assertEquals(1f, mGroupRow.getBottomRoundness(), 0.001f);
|
||||||
|
Assert.assertEquals(1f, mGroupRow.getChildrenContainer().getBottomRoundness(), 0.001f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_childrenContainer() {
|
||||||
|
mGroupRow.useRoundnessSourceTypes(true);
|
||||||
|
Assert.assertEquals(0f, mGroupRow.getBottomRoundness(), 0.001f);
|
||||||
|
Assert.assertEquals(0f, mGroupRow.getChildrenContainer().getBottomRoundness(), 0.001f);
|
||||||
|
|
||||||
|
mGroupRow.requestBottomRoundness(1f, SourceType.from(""), false);
|
||||||
|
|
||||||
|
Assert.assertEquals(1f, mGroupRow.getBottomRoundness(), 0.001f);
|
||||||
|
Assert.assertEquals(1f, mGroupRow.getChildrenContainer().getBottomRoundness(), 0.001f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import androidx.test.filters.SmallTest;
|
|||||||
|
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.statusbar.notification.LegacySourceType;
|
import com.android.systemui.statusbar.notification.LegacySourceType;
|
||||||
|
import com.android.systemui.statusbar.notification.SourceType;
|
||||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||||
import com.android.systemui.statusbar.notification.row.NotificationTestHelper;
|
import com.android.systemui.statusbar.notification.row.NotificationTestHelper;
|
||||||
|
|
||||||
@@ -34,6 +35,8 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
@RunWithLooper
|
@RunWithLooper
|
||||||
@@ -185,4 +188,32 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
|
|||||||
Assert.assertEquals(1f, row2.getTopRoundness(), /* delta = */ 0f);
|
Assert.assertEquals(1f, row2.getTopRoundness(), /* delta = */ 0f);
|
||||||
Assert.assertEquals(1f, row2.getBottomRoundness(), /* delta = */ 0f);
|
Assert.assertEquals(1f, row2.getBottomRoundness(), /* delta = */ 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_last_child_legacy() {
|
||||||
|
mChildrenContainer.useRoundnessSourceTypes(false);
|
||||||
|
List<ExpandableNotificationRow> children = mChildrenContainer.getAttachedChildren();
|
||||||
|
ExpandableNotificationRow notificationRow = children.get(children.size() - 1);
|
||||||
|
Assert.assertEquals(0f, mChildrenContainer.getBottomRoundness(), 0.001f);
|
||||||
|
Assert.assertEquals(0f, notificationRow.getBottomRoundness(), 0.001f);
|
||||||
|
|
||||||
|
mChildrenContainer.requestBottomRoundness(1f, SourceType.from(""), false);
|
||||||
|
|
||||||
|
Assert.assertEquals(1f, mChildrenContainer.getBottomRoundness(), 0.001f);
|
||||||
|
Assert.assertEquals(1f, notificationRow.getBottomRoundness(), 0.001f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_last_child() {
|
||||||
|
mChildrenContainer.useRoundnessSourceTypes(true);
|
||||||
|
List<ExpandableNotificationRow> children = mChildrenContainer.getAttachedChildren();
|
||||||
|
ExpandableNotificationRow notificationRow = children.get(children.size() - 1);
|
||||||
|
Assert.assertEquals(0f, mChildrenContainer.getBottomRoundness(), 0.001f);
|
||||||
|
Assert.assertEquals(0f, notificationRow.getBottomRoundness(), 0.001f);
|
||||||
|
|
||||||
|
mChildrenContainer.requestBottomRoundness(1f, SourceType.from(""), false);
|
||||||
|
|
||||||
|
Assert.assertEquals(1f, mChildrenContainer.getBottomRoundness(), 0.001f);
|
||||||
|
Assert.assertEquals(1f, notificationRow.getBottomRoundness(), 0.001f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user