Merge "Do not reset roundness on ExpandableOutlineView.initDimens()" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f37fea9336
@@ -306,9 +306,12 @@ interface Roundable {
|
|||||||
*/
|
*/
|
||||||
class RoundableState(
|
class RoundableState(
|
||||||
internal val targetView: View,
|
internal val targetView: View,
|
||||||
roundable: Roundable,
|
private val roundable: Roundable,
|
||||||
internal val maxRadius: Float,
|
maxRadius: Float,
|
||||||
) {
|
) {
|
||||||
|
internal var maxRadius = maxRadius
|
||||||
|
private set
|
||||||
|
|
||||||
/** Animatable for top roundness */
|
/** Animatable for top roundness */
|
||||||
private val topAnimatable = topAnimatable(roundable)
|
private val topAnimatable = topAnimatable(roundable)
|
||||||
|
|
||||||
@@ -356,6 +359,13 @@ class RoundableState(
|
|||||||
PropertyAnimator.setProperty(targetView, bottomAnimatable, value, DURATION, animated)
|
PropertyAnimator.setProperty(targetView, bottomAnimatable, value, DURATION, animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setMaxRadius(radius: Float) {
|
||||||
|
if (maxRadius != radius) {
|
||||||
|
maxRadius = radius
|
||||||
|
roundable.applyRoundnessAndInvalidate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun debugString() = buildString {
|
fun debugString() = buildString {
|
||||||
append("TargetView: ${targetView.hashCode()} ")
|
append("TargetView: ${targetView.hashCode()} ")
|
||||||
append("Top: $topRoundness ")
|
append("Top: $topRoundness ")
|
||||||
|
|||||||
@@ -214,7 +214,11 @@ public abstract class ExpandableOutlineView extends ExpandableView {
|
|||||||
} else {
|
} else {
|
||||||
maxRadius = res.getDimensionPixelSize(R.dimen.notification_corner_radius);
|
maxRadius = res.getDimensionPixelSize(R.dimen.notification_corner_radius);
|
||||||
}
|
}
|
||||||
|
if (mRoundableState == null) {
|
||||||
mRoundableState = new RoundableState(this, this, maxRadius);
|
mRoundableState = new RoundableState(this, this, maxRadius);
|
||||||
|
} else {
|
||||||
|
mRoundableState.setMaxRadius(maxRadius);
|
||||||
|
}
|
||||||
setClipToOutline(mAlwaysRoundBothCorners);
|
setClipToOutline(mAlwaysRoundBothCorners);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.android.systemui.R
|
|||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.android.systemui.statusbar.notification.FakeShadowView
|
import com.android.systemui.statusbar.notification.FakeShadowView
|
||||||
import com.android.systemui.statusbar.notification.NotificationUtils
|
import com.android.systemui.statusbar.notification.NotificationUtils
|
||||||
|
import com.android.systemui.statusbar.notification.SourceType
|
||||||
import com.android.systemui.util.mockito.mock
|
import com.android.systemui.util.mockito.mock
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
@@ -83,4 +84,17 @@ class ActivatableNotificationViewTest : SysuiTestCase() {
|
|||||||
mView.updateBackgroundColors()
|
mView.updateBackgroundColors()
|
||||||
assertThat(mView.currentBackgroundTint).isEqualTo(mNormalColor)
|
assertThat(mView.currentBackgroundTint).isEqualTo(mNormalColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun roundnessShouldBeTheSame_after_onDensityOrFontScaleChanged() {
|
||||||
|
val roundableState = mView.roundableState
|
||||||
|
assertThat(mView.topRoundness).isEqualTo(0f)
|
||||||
|
mView.requestTopRoundness(1f, SourceType.from(""))
|
||||||
|
assertThat(mView.topRoundness).isEqualTo(1f)
|
||||||
|
|
||||||
|
mView.onDensityOrFontScaleChanged()
|
||||||
|
|
||||||
|
assertThat(mView.topRoundness).isEqualTo(1f)
|
||||||
|
assertThat(mView.roundableState.hashCode()).isEqualTo(roundableState.hashCode())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user