Skip to content

ViewIdentifierResolver

Xavier F. Gouchet edited this page Sep 4, 2024 · 1 revision

interface ViewIdentifierResolver

A utility interface to assign a unique id to the child of a View. This interface is meant for internal usage, please use it carefully.

Inheritors

DefaultViewIdentifierResolver

Functions

resolveChildUniqueIdentifier

abstract fun resolveChildUniqueIdentifier(parent: View, childName: String): Long?

Generates a persistent unique identifier for a virtual child view based on its unique name and its physical parent. The identifier will only be created once and persisted in the parent View tag to provide consistency. In case there was already a value with the same key in the tags and this was used by a different party we will try to use this value as identifier if it's a Long, in other case we will return null. This last scenario is highly unlikely but we are doing this in order to safely treat possible collisions with client tags.

Return

the unique identifier as Long or null if the identifier could not be created

Parameters
parent the parent View of the virtual child
childName the unique name of the virtual child

resolveViewId

abstract fun resolveViewId(view: View): Long

Resolves a persistent, unique id for the given view.

Return

an identifier unquely mapping a view to a wireframe, allowing accurate diffs

Parameters
view the view
Clone this wiki locally