@@ -578,7 +578,7 @@ class ViewAttributes {
578
578
view.setTag(ComponentHost .COMPONENT_NODE_INFO_ID , nodeInfo)
579
579
}
580
580
581
- private fun unsetAccessibilityDelegate (view : View ) {
581
+ fun unsetAccessibilityDelegate (view : View ) {
582
582
if (view !is ComponentHost && view.getTag(ComponentHost .COMPONENT_NODE_INFO_ID ) == null ) {
583
583
return
584
584
}
@@ -600,7 +600,7 @@ class ViewAttributes {
600
600
view.isClickable = true
601
601
}
602
602
603
- private fun unsetClickHandler (view : View ) {
603
+ fun unsetClickHandler (view : View ) {
604
604
view.setOnClickListener(null )
605
605
view.isClickable = false
606
606
}
@@ -621,7 +621,7 @@ class ViewAttributes {
621
621
}
622
622
}
623
623
624
- private fun unsetLongClickHandler (view : View ) {
624
+ fun unsetLongClickHandler (view : View ) {
625
625
val listener = getComponentLongClickListener(view)
626
626
if (listener != null ) {
627
627
listener.eventHandler = null
@@ -665,7 +665,7 @@ class ViewAttributes {
665
665
listener.eventHandler = focusChangeHandler
666
666
}
667
667
668
- private fun unsetFocusChangeHandler (view : View ) {
668
+ fun unsetFocusChangeHandler (view : View ) {
669
669
val listener = getComponentFocusChangeListener(view)
670
670
if (listener != null ) {
671
671
listener.eventHandler = null
@@ -705,7 +705,7 @@ class ViewAttributes {
705
705
}
706
706
}
707
707
708
- private fun unsetTouchHandler (view : View ) {
708
+ fun unsetTouchHandler (view : View ) {
709
709
val listener = getComponentTouchListener(view)
710
710
if (listener != null ) {
711
711
listener.eventHandler = null
@@ -725,7 +725,7 @@ class ViewAttributes {
725
725
}
726
726
}
727
727
728
- private fun unsetInterceptTouchEventHandler (view : View ) {
728
+ fun unsetInterceptTouchEventHandler (view : View ) {
729
729
if (view is ComponentHost ) {
730
730
view.setInterceptTouchEventHandler(null )
731
731
}
@@ -755,7 +755,7 @@ class ViewAttributes {
755
755
}
756
756
}
757
757
758
- private fun unsetViewId (view : View ) {
758
+ fun unsetViewId (view : View ) {
759
759
view.id = View .NO_ID
760
760
}
761
761
@@ -776,11 +776,11 @@ class ViewAttributes {
776
776
}
777
777
}
778
778
779
- private fun unsetViewTag (view : View ) {
779
+ fun unsetViewTag (view : View ) {
780
780
view.tag = null
781
781
}
782
782
783
- private fun unsetViewTags (view : View , viewTags : SparseArray <Any >? ) {
783
+ fun unsetViewTags (view : View , viewTags : SparseArray <Any >? ) {
784
784
if (view is ComponentHost ) {
785
785
view.setViewTags(null )
786
786
} else {
@@ -816,15 +816,15 @@ class ViewAttributes {
816
816
}
817
817
}
818
818
819
- private fun unsetAmbientShadowColor (view : View , @ColorInt ambientShadowColor : Int ) {
819
+ fun unsetAmbientShadowColor (view : View , @ColorInt ambientShadowColor : Int ) {
820
820
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P && ambientShadowColor != Color .BLACK ) {
821
821
// Android documentation says black is the default:
822
822
// https://developer.android.com/reference/android/view/View#getOutlineAmbientShadowColor()
823
823
view.outlineAmbientShadowColor = Color .BLACK
824
824
}
825
825
}
826
826
827
- private fun unsetSpotShadowColor (view : View , @ColorInt spotShadowColor : Int ) {
827
+ fun unsetSpotShadowColor (view : View , @ColorInt spotShadowColor : Int ) {
828
828
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P && spotShadowColor != Color .BLACK ) {
829
829
// Android documentation says black is the default:
830
830
// https://developer.android.com/reference/android/view/View#getOutlineSpotShadowColor()
@@ -878,7 +878,7 @@ class ViewAttributes {
878
878
view.contentDescription = contentDescription
879
879
}
880
880
881
- private fun unsetContentDescription (view : View ) {
881
+ fun unsetContentDescription (view : View ) {
882
882
view.contentDescription = null
883
883
}
884
884
@@ -899,7 +899,7 @@ class ViewAttributes {
899
899
}
900
900
}
901
901
902
- private fun unsetFocusable (view : View , flags : Int ) {
902
+ fun unsetFocusable (view : View , flags : Int ) {
903
903
view.isFocusable = LithoMountData .isViewFocusable(flags)
904
904
}
905
905
@@ -950,7 +950,7 @@ class ViewAttributes {
950
950
ViewCompat .setTooltipText(view, tooltipText)
951
951
}
952
952
953
- private fun unsetTooltipText (view : View ) {
953
+ fun unsetTooltipText (view : View ) {
954
954
ViewCompat .setTooltipText(view, null )
955
955
}
956
956
@@ -1036,7 +1036,7 @@ class ViewAttributes {
1036
1036
}
1037
1037
1038
1038
@Suppress(" deprecation" )
1039
- private fun setBackgroundCompat (view : View , drawable : Drawable ? ) {
1039
+ fun setBackgroundCompat (view : View , drawable : Drawable ? ) {
1040
1040
if (Build .VERSION .SDK_INT < Build .VERSION_CODES .JELLY_BEAN ) {
1041
1041
view.setBackgroundDrawable(drawable)
1042
1042
} else {
@@ -1047,11 +1047,15 @@ class ViewAttributes {
1047
1047
private fun unsetViewForeground (view : View , attributes : ViewAttributes ) {
1048
1048
val foreground = attributes.foreground
1049
1049
if (foreground != null ) {
1050
- check(Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ) {
1051
- (" MountState has a ViewAttributes with foreground however the current Android version doesn't support foreground on Views" )
1052
- }
1053
- view.foreground = null
1050
+ unsetForeground(view)
1051
+ }
1052
+ }
1053
+
1054
+ fun unsetForeground (view : View ) {
1055
+ check(Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ) {
1056
+ (" MountState has a ViewAttributes with foreground however the current Android version doesn't support foreground on Views" )
1054
1057
}
1058
+ view.foreground = null
1055
1059
}
1056
1060
1057
1061
private fun setViewLayoutDirection (view : View , attributes : ViewAttributes ) {
@@ -1061,7 +1065,7 @@ class ViewAttributes {
1061
1065
view.layoutDirection = attributes.layoutDirection.getLayoutDirectionForView()
1062
1066
}
1063
1067
1064
- private fun unsetViewLayoutDirection (view : View ) {
1068
+ fun unsetViewLayoutDirection (view : View ) {
1065
1069
if (Build .VERSION .SDK_INT < Build .VERSION_CODES .JELLY_BEAN_MR1 ) {
1066
1070
return
1067
1071
}
@@ -1101,11 +1105,17 @@ class ViewAttributes {
1101
1105
if (attributes.stateListAnimator == null && attributes.stateListAnimatorRes == 0 ) {
1102
1106
return
1103
1107
}
1108
+ unsetViewStateListAnimator(view)
1109
+ }
1110
+
1111
+ fun unsetViewStateListAnimator (view : View ) {
1104
1112
check(Build .VERSION .SDK_INT >= Build .VERSION_CODES .LOLLIPOP ) {
1105
1113
(" MountState has a ViewAttributes with stateListAnimator, however the current Android version doesn't support stateListAnimator on Views" )
1106
1114
}
1107
- view.stateListAnimator.jumpToCurrentState()
1108
- view.stateListAnimator = null
1115
+ if (view.stateListAnimator != null ) {
1116
+ view.stateListAnimator.jumpToCurrentState()
1117
+ view.stateListAnimator = null
1118
+ }
1109
1119
}
1110
1120
1111
1121
private fun setViewLayerType (view : View , attributes : ViewAttributes ) {
0 commit comments