Merge "Revert "Support tuning sysui_rounded_size"" into tm-dev
This commit is contained in:
@@ -125,18 +125,17 @@ class RoundedCornerResDelegate(
|
|||||||
bottomRoundedSize = Size(bottomRadius, bottomRadius)
|
bottomRoundedSize = Size(bottomRadius, bottomRadius)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (roundedSizeFactor != null && roundedSizeFactor > 0) {
|
||||||
|
val length: Int = (roundedSizeFactor * density).toInt()
|
||||||
|
roundedSize = Size(length, length)
|
||||||
|
}
|
||||||
|
|
||||||
if (topRoundedSize.width == 0) {
|
if (topRoundedSize.width == 0) {
|
||||||
topRoundedSize = roundedSize
|
topRoundedSize = roundedSize
|
||||||
}
|
}
|
||||||
if (bottomRoundedSize.width == 0) {
|
if (bottomRoundedSize.width == 0) {
|
||||||
bottomRoundedSize = roundedSize
|
bottomRoundedSize = roundedSize
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roundedSizeFactor != null && roundedSizeFactor > 0) {
|
|
||||||
val length: Int = (roundedSizeFactor * density).toInt()
|
|
||||||
topRoundedSize = Size(length, length)
|
|
||||||
bottomRoundedSize = Size(length, length)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateTuningSizeFactor(factor: Int?, newReloadToken: Int) {
|
fun updateTuningSizeFactor(factor: Int?, newReloadToken: Int) {
|
||||||
|
|||||||
@@ -102,9 +102,8 @@ class RoundedCornerResDelegateTest : SysuiTestCase() {
|
|||||||
fun testUpdateTuningSizeFactor() {
|
fun testUpdateTuningSizeFactor() {
|
||||||
mContext.orCreateTestableResources.addOverrides(
|
mContext.orCreateTestableResources.addOverrides(
|
||||||
mockTypeArray = mockTypedArray,
|
mockTypeArray = mockTypedArray,
|
||||||
radius = 1,
|
|
||||||
radiusTop = 0,
|
radiusTop = 0,
|
||||||
radiusBottom = 2,
|
radiusBottom = 0,
|
||||||
multipleRadius = false)
|
multipleRadius = false)
|
||||||
|
|
||||||
roundedCornerResDelegate = RoundedCornerResDelegate(mContext.resources, null)
|
roundedCornerResDelegate = RoundedCornerResDelegate(mContext.resources, null)
|
||||||
@@ -116,6 +115,11 @@ class RoundedCornerResDelegateTest : SysuiTestCase() {
|
|||||||
assertEquals(Size(length, length), roundedCornerResDelegate.topRoundedSize)
|
assertEquals(Size(length, length), roundedCornerResDelegate.topRoundedSize)
|
||||||
assertEquals(Size(length, length), roundedCornerResDelegate.bottomRoundedSize)
|
assertEquals(Size(length, length), roundedCornerResDelegate.bottomRoundedSize)
|
||||||
|
|
||||||
|
mContext.orCreateTestableResources.addOverrides(
|
||||||
|
mockTypeArray = mockTypedArray,
|
||||||
|
radiusTop = 1,
|
||||||
|
radiusBottom = 2,
|
||||||
|
multipleRadius = false)
|
||||||
roundedCornerResDelegate.updateTuningSizeFactor(null, 2)
|
roundedCornerResDelegate.updateTuningSizeFactor(null, 2)
|
||||||
|
|
||||||
assertEquals(Size(1, 1), roundedCornerResDelegate.topRoundedSize)
|
assertEquals(Size(1, 1), roundedCornerResDelegate.topRoundedSize)
|
||||||
|
|||||||
Reference in New Issue
Block a user