Breaking: Move ReactClippingViewGroup + Helper to uimanager package

Summary: This is to be able to depend on ReactClippingViewGroup from BaseViewManager. Devs using ReactClippingViewGroup may need to update their imports when updating past this commit.

Reviewed By: lexs

Differential Revision: D3835328

fbshipit-source-id: 290c08b130d837e553b68a90377bd9a30b7ec6dc
This commit is contained in:
Andy Street 2016-09-13 06:02:05 -07:00 committed by Facebook Github Bot 3
parent a4916b8c98
commit e2cf37a5a6
8 changed files with 18 additions and 25 deletions

View File

@ -7,13 +7,11 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.react.views.view;
package com.facebook.react.uimanager;
import android.graphics.Rect;
import android.view.View;
import com.facebook.react.uimanager.ReactStylesDiffMap;
/**
* Interface that should be implemented by {@link View} subclasses that support
* {@code removeClippedSubviews} property. When this property is set for the {@link ViewGroup}

View File

@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.react.views.view;
package com.facebook.react.uimanager;
import javax.annotation.concurrent.NotThreadSafe;
@ -15,8 +15,6 @@ import android.graphics.Rect;
import android.view.View;
import android.view.ViewParent;
import com.facebook.react.uimanager.ReactStylesDiffMap;
/**
* Provides implementation of common tasks for view and it's view manager supporting property
* {@code removeClippedSubviews}.

View File

@ -25,8 +25,8 @@ import android.widget.HorizontalScrollView;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.uimanager.MeasureSpecAssertions;
import com.facebook.react.uimanager.events.NativeGestureUtil;
import com.facebook.react.views.view.ReactClippingViewGroup;
import com.facebook.react.views.view.ReactClippingViewGroupHelper;
import com.facebook.react.uimanager.ReactClippingViewGroup;
import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
/**
* Similar to {@link ReactScrollView} but only supports horizontal scrolling.

View File

@ -17,7 +17,7 @@ import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.views.view.ReactClippingViewGroupHelper;
import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
/**
* View manager for {@link ReactHorizontalScrollView} components.

View File

@ -28,8 +28,8 @@ import android.widget.ScrollView;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.uimanager.MeasureSpecAssertions;
import com.facebook.react.uimanager.events.NativeGestureUtil;
import com.facebook.react.views.view.ReactClippingViewGroup;
import com.facebook.react.views.view.ReactClippingViewGroupHelper;
import com.facebook.react.uimanager.ReactClippingViewGroup;
import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
import com.facebook.infer.annotation.Assertions;
/**

View File

@ -20,7 +20,7 @@ import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.views.view.ReactClippingViewGroupHelper;
import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
/**
* View manager for {@link ReactScrollView} components.

View File

@ -26,16 +26,15 @@ import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.touch.ReactHitSlopView;
import com.facebook.react.touch.ReactInterceptingViewGroup;
import com.facebook.react.touch.OnInterceptTouchEventListener;
import com.facebook.react.uimanager.MeasureSpecAssertions;
import com.facebook.react.uimanager.PointerEvents;
import com.facebook.react.uimanager.ReactPointerEventsView;
import com.facebook.react.uimanager.*;
import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
/**
* Backing for a React View. Has support for borders, but since borders aren't common, lazy
* initializes most of the storage needed for them.
*/
public class ReactViewGroup extends ViewGroup implements
ReactInterceptingViewGroup, ReactClippingViewGroup, ReactPointerEventsView, ReactHitSlopView {
ReactInterceptingViewGroup, com.facebook.react.uimanager.ReactClippingViewGroup, ReactPointerEventsView, ReactHitSlopView {
private static final int ARRAY_CAPACITY_INCREMENT = 12;
private static final int DEFAULT_BACKGROUND_COLOR = Color.TRANSPARENT;
@ -225,7 +224,8 @@ public class ReactViewGroup extends ViewGroup implements
mRemoveClippedSubviews = removeClippedSubviews;
if (removeClippedSubviews) {
mClippingRect = new Rect();
ReactClippingViewGroupHelper.calculateClippingRect(this, mClippingRect);
com.facebook.react.uimanager.ReactClippingViewGroupHelper
.calculateClippingRect(this, mClippingRect);
mAllChildrenCount = getChildCount();
int initialSize = Math.max(12, mAllChildrenCount);
mAllChildren = new View[initialSize];
@ -315,10 +315,11 @@ public class ReactViewGroup extends ViewGroup implements
needUpdateClippingRecursive = true;
}
if (needUpdateClippingRecursive) {
if (child instanceof ReactClippingViewGroup) {
if (child instanceof com.facebook.react.uimanager.ReactClippingViewGroup) {
// we don't use {@link sHelperRect} until the end of this loop, therefore it's safe
// to call this method that may write to the same {@link sHelperRect} object.
ReactClippingViewGroup clippingChild = (ReactClippingViewGroup) child;
com.facebook.react.uimanager.ReactClippingViewGroup
clippingChild = (com.facebook.react.uimanager.ReactClippingViewGroup) child;
if (clippingChild.getRemoveClippedSubviews()) {
clippingChild.updateClippingRect();
}

View File

@ -25,13 +25,9 @@ import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.PointerEvents;
import com.facebook.react.uimanager.*;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.annotations.ReactPropGroup;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.uimanager.ViewProps;
/**
* View manager for AndroidViews (plain React Views).
@ -105,7 +101,7 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
null : ReactDrawableHelper.createDrawableFromJSDescription(view.getContext(), bg));
}
@ReactProp(name = ReactClippingViewGroupHelper.PROP_REMOVE_CLIPPED_SUBVIEWS)
@ReactProp(name = com.facebook.react.uimanager.ReactClippingViewGroupHelper.PROP_REMOVE_CLIPPED_SUBVIEWS)
public void setRemoveClippedSubviews(ReactViewGroup view, boolean removeClippedSubviews) {
view.setRemoveClippedSubviews(removeClippedSubviews);
}