Reword is a android library to update the texts of views when the apps texts have changed due to a language change or an update of the apps string resources.
Apache License 2.0
32
stars
7
forks
source link
Unable to use the actual ViewTransformer, it's always using the parent one #25
ViewTransformerManager has predefined ViewTransformers, so based on the code viewTransformer.viewType.isInstance(view), it finds always the first viewTransformers, so it means that the order is important.
For instance, we have CustomEditText with CustomEditTextViewTransformer, and due to the fact that EditText inherits classic Android TextView, ViewTransformerManager always return TextViewViewTransformer, but not the specific one CustomEditTextViewTransformer
Suggestion
During the search, try to find the most specific and then call isInstance()
Description
ViewTransformerManager
has predefinedViewTransformers
, so based on the code viewTransformer.viewType.isInstance(view), it finds always the first viewTransformers, so it means that the order is important.For instance, we have
CustomEditText
withCustomEditTextViewTransformer
, and due to the fact thatEditText
inherits classic AndroidTextView
,ViewTransformerManager
always returnTextViewViewTransformer
, but not the specific oneCustomEditTextViewTransformer
Suggestion
isInstance()
Link To PR
Created PR: https://github.com/B3nedikt/reword/pull/24