17
17
import android .graphics .Canvas ;
18
18
import android .graphics .Color ;
19
19
import android .graphics .Paint ;
20
- import android .graphics .Path ;
21
20
import android .graphics .Rect ;
22
21
import android .graphics .drawable .Drawable ;
23
22
import android .os .Build ;
54
53
import com .facebook .react .uimanager .ViewGroupDrawingOrderHelper ;
55
54
import com .facebook .react .uimanager .common .UIManagerType ;
56
55
import com .facebook .react .uimanager .common .ViewUtil ;
57
- import com .facebook .react .uimanager .drawable .CSSBackgroundDrawable ;
58
56
import com .facebook .react .uimanager .style .BorderRadiusProp ;
59
57
import com .facebook .react .uimanager .style .BorderStyle ;
60
58
import com .facebook .react .uimanager .style .LogicalEdge ;
@@ -131,13 +129,11 @@ public void shutdown() {
131
129
private @ Nullable Rect mClippingRect ;
132
130
private @ Nullable Rect mHitSlopRect ;
133
131
private Overflow mOverflow ;
134
- private PointerEvents mPointerEvents ;
132
+ private PointerEvents mPointerEvents = PointerEvents . AUTO ;
135
133
private @ Nullable ChildrenLayoutChangeListener mChildrenLayoutChangeListener ;
136
- private @ Nullable CSSBackgroundDrawable mCSSBackgroundDrawable ;
137
134
private @ Nullable OnInterceptTouchEventListener mOnInterceptTouchEventListener ;
138
135
private boolean mNeedsOffscreenAlphaCompositing ;
139
136
private @ Nullable ViewGroupDrawingOrderHelper mDrawingOrderHelper ;
140
- private @ Nullable Path mPath ;
141
137
private float mBackfaceOpacity ;
142
138
private String mBackfaceVisibility ;
143
139
@@ -168,11 +164,9 @@ private void initView() {
168
164
mOverflow = Overflow .VISIBLE ;
169
165
mPointerEvents = PointerEvents .AUTO ;
170
166
mChildrenLayoutChangeListener = null ;
171
- mCSSBackgroundDrawable = null ;
172
167
mOnInterceptTouchEventListener = null ;
173
168
mNeedsOffscreenAlphaCompositing = false ;
174
169
mDrawingOrderHelper = null ;
175
- mPath = null ;
176
170
mBackfaceOpacity = 1.f ;
177
171
mBackfaceVisibility = "visible" ;
178
172
}
@@ -266,7 +260,7 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
266
260
}
267
261
268
262
@ Override
269
- public boolean onTouchEvent (MotionEvent ev ) {
263
+ public boolean onTouchEvent (MotionEvent event ) {
270
264
// We do not accept the touch event if this view is not supposed to receive it.
271
265
if (!PointerEvents .canBeTouchTarget (mPointerEvents )) {
272
266
return false ;
@@ -505,11 +499,6 @@ private void updateSubviewClipStatus(View subview) {
505
499
}
506
500
}
507
501
508
- @ Override
509
- public boolean getChildVisibleRect (View child , Rect r , android .graphics .Point offset ) {
510
- return super .getChildVisibleRect (child , r , offset );
511
- }
512
-
513
502
@ Override
514
503
protected void onSizeChanged (int w , int h , int oldw , int oldh ) {
515
504
super .onSizeChanged (w , h , oldw , oldh );
@@ -685,18 +674,18 @@ View getChildAtWithSubviewClippingEnabled(int index) {
685
674
/*package*/ void addViewWithSubviewClippingEnabled (
686
675
final View child , int index , ViewGroup .LayoutParams params ) {
687
676
Assertions .assertCondition (mRemoveClippedSubviews );
688
- Assertions .assertNotNull (mClippingRect );
689
- Assertions .assertNotNull (mAllChildren );
677
+ Rect clippingRect = Assertions .assertNotNull (mClippingRect );
678
+ View [] childArray = Assertions .assertNotNull (mAllChildren );
690
679
addInArray (child , index );
691
680
// we add view as "clipped" and then run {@link #updateSubviewClipStatus} to conditionally
692
681
// attach it
693
682
int clippedSoFar = 0 ;
694
683
for (int i = 0 ; i < index ; i ++) {
695
- if (mAllChildren [i ].getParent () == null ) {
684
+ if (childArray [i ].getParent () == null ) {
696
685
clippedSoFar ++;
697
686
}
698
687
}
699
- updateSubviewClipStatus (mClippingRect , index , clippedSoFar );
688
+ updateSubviewClipStatus (clippingRect , index , clippedSoFar );
700
689
child .addOnLayoutChangeListener (mChildrenLayoutChangeListener );
701
690
702
691
if (child instanceof ReactClippingProhibitedView ) {
@@ -728,13 +717,13 @@ public void run() {
728
717
729
718
Assertions .assertCondition (mRemoveClippedSubviews );
730
719
Assertions .assertNotNull (mClippingRect );
731
- Assertions .assertNotNull (mAllChildren );
720
+ View [] childArray = Assertions .assertNotNull (mAllChildren );
732
721
view .removeOnLayoutChangeListener (mChildrenLayoutChangeListener );
733
722
int index = indexOfChildInAllChildren (view );
734
- if (mAllChildren [index ].getParent () != null ) {
723
+ if (childArray [index ].getParent () != null ) {
735
724
int clippedSoFar = 0 ;
736
725
for (int i = 0 ; i < index ; i ++) {
737
- if (mAllChildren [i ].getParent () == null ) {
726
+ if (childArray [i ].getParent () == null ) {
738
727
clippedSoFar ++;
739
728
}
740
729
}
@@ -745,60 +734,60 @@ public void run() {
745
734
746
735
/*package*/ void removeAllViewsWithSubviewClippingEnabled () {
747
736
Assertions .assertCondition (mRemoveClippedSubviews );
748
- Assertions .assertNotNull (mAllChildren );
737
+ View [] childArray = Assertions .assertNotNull (mAllChildren );
749
738
for (int i = 0 ; i < mAllChildrenCount ; i ++) {
750
- mAllChildren [i ].removeOnLayoutChangeListener (mChildrenLayoutChangeListener );
739
+ childArray [i ].removeOnLayoutChangeListener (mChildrenLayoutChangeListener );
751
740
}
752
741
removeAllViewsInLayout ();
753
742
mAllChildrenCount = 0 ;
754
743
}
755
744
756
745
private int indexOfChildInAllChildren (View child ) {
757
746
final int count = mAllChildrenCount ;
758
- final View [] children = Assertions .assertNotNull (mAllChildren );
747
+ final View [] childArray = Assertions .assertNotNull (mAllChildren );
759
748
for (int i = 0 ; i < count ; i ++) {
760
- if (children [i ] == child ) {
749
+ if (childArray [i ] == child ) {
761
750
return i ;
762
751
}
763
752
}
764
753
return -1 ;
765
754
}
766
755
767
756
private void addInArray (View child , int index ) {
768
- View [] children = Assertions .assertNotNull (mAllChildren );
757
+ View [] childArray = Assertions .assertNotNull (mAllChildren );
769
758
final int count = mAllChildrenCount ;
770
- final int size = children .length ;
759
+ final int size = childArray .length ;
771
760
if (index == count ) {
772
761
if (size == count ) {
773
762
mAllChildren = new View [size + ARRAY_CAPACITY_INCREMENT ];
774
- System .arraycopy (children , 0 , mAllChildren , 0 , size );
775
- children = mAllChildren ;
763
+ System .arraycopy (childArray , 0 , mAllChildren , 0 , size );
764
+ childArray = mAllChildren ;
776
765
}
777
- children [mAllChildrenCount ++] = child ;
766
+ childArray [mAllChildrenCount ++] = child ;
778
767
} else if (index < count ) {
779
768
if (size == count ) {
780
769
mAllChildren = new View [size + ARRAY_CAPACITY_INCREMENT ];
781
- System .arraycopy (children , 0 , mAllChildren , 0 , index );
782
- System .arraycopy (children , index , mAllChildren , index + 1 , count - index );
783
- children = mAllChildren ;
770
+ System .arraycopy (childArray , 0 , mAllChildren , 0 , index );
771
+ System .arraycopy (childArray , index , mAllChildren , index + 1 , count - index );
772
+ childArray = mAllChildren ;
784
773
} else {
785
- System .arraycopy (children , index , children , index + 1 , count - index );
774
+ System .arraycopy (childArray , index , childArray , index + 1 , count - index );
786
775
}
787
- children [index ] = child ;
776
+ childArray [index ] = child ;
788
777
mAllChildrenCount ++;
789
778
} else {
790
779
throw new IndexOutOfBoundsException ("index=" + index + " count=" + count );
791
780
}
792
781
}
793
782
794
783
private void removeFromArray (int index ) {
795
- final View [] children = Assertions .assertNotNull (mAllChildren );
784
+ final View [] childArray = Assertions .assertNotNull (mAllChildren );
796
785
final int count = mAllChildrenCount ;
797
786
if (index == count - 1 ) {
798
- children [--mAllChildrenCount ] = null ;
787
+ childArray [--mAllChildrenCount ] = null ;
799
788
} else if (index >= 0 && index < count ) {
800
- System .arraycopy (children , index + 1 , children , index , count - index - 1 );
801
- children [--mAllChildrenCount ] = null ;
789
+ System .arraycopy (childArray , index + 1 , childArray , index , count - index - 1 );
790
+ childArray [--mAllChildrenCount ] = null ;
802
791
} else {
803
792
throw new IndexOutOfBoundsException ();
804
793
}
0 commit comments