Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 028dbf43 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Rename Key.name to Key.debugName

This CL simply renames (Element|Scene|Value)Key.name to .debugName to
make it more obvious that the name is only used for debugging/printing
and does not change anything in the correctness of the code.

Bug: 291053742
Test: atest PlatformComposeCoreTests
Change-Id: I6b4d256db3e0ad5dd995fcd2b95b73efb4919350
parent fca32d54
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import androidx.annotation.VisibleForTesting
 * A base class to create unique keys, associated to an [identity] that is used to check the
 * equality of two key instances.
 */
sealed class Key(val name: String, val identity: Any) {
sealed class Key(val debugName: String, val identity: Any) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (this.javaClass != other?.javaClass) return false
@@ -34,7 +34,7 @@ sealed class Key(val name: String, val identity: Any) {
    }

    override fun toString(): String {
        return "Key(name=$name)"
        return "Key(debugName=$debugName)"
    }
}

@@ -49,7 +49,7 @@ class SceneKey(
    val rootElementKey = ElementKey(name, identity)

    override fun toString(): String {
        return "SceneKey(name=$name)"
        return "SceneKey(debugName=$debugName)"
    }
}

@@ -71,7 +71,7 @@ class ElementKey(
    }

    override fun toString(): String {
        return "ElementKey(name=$name)"
        return "ElementKey(debugName=$debugName)"
    }

    companion object {
@@ -89,6 +89,6 @@ class ElementKey(
/** Key for a shared value of an element. */
class ValueKey(name: String, identity: Any = Object()) : Key(name, identity) {
    override fun toString(): String {
        return "ValueKey(name=$name)"
        return "ValueKey(debugName=$debugName)"
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ class SceneTransitionLayoutTest {
                .size(size)
                .background(Color.Red)
                .element(TestElements.Foo)
                .testTag(TestElements.Foo.name)
                .testTag(TestElements.Foo.debugName)
        ) {
            // Offset the single child of Foo by some animated shared offset.
            val offset by animateSharedDpAsState(childOffset, TestValues.Value1, TestElements.Foo)
@@ -129,7 +129,7 @@ class SceneTransitionLayoutTest {
                    }
                    .size(30.dp)
                    .background(Color.Blue)
                    .testTag(TestElements.Bar.name)
                    .testTag(TestElements.Bar.debugName)
            )
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ class SwipeToSceneTest {
            { currentScene = it },
            EmptyTestTransitions,
            state = layoutState,
            modifier = Modifier.size(LayoutWidth, LayoutHeight).testTag(TestElements.Foo.name),
            modifier = Modifier.size(LayoutWidth, LayoutHeight).testTag(TestElements.Foo.debugName),
        ) {
            scene(
                TestScenes.SceneA,