Skip to content

Commit

Permalink
Revert all zIndex work
Browse files Browse the repository at this point in the history
  • Loading branch information
tuckerconnelly committed Jun 15, 2016
1 parent 66a51eb commit f0a62d9
Show file tree
Hide file tree
Showing 20 changed files with 14 additions and 213 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.graphics.Color;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;

import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.annotations.ReactProp;
Expand All @@ -28,7 +27,6 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
private static final String PROP_DECOMPOSED_MATRIX_TRANSLATE_Y = "translateY";
private static final String PROP_TRANSFORM = "transform";
private static final String PROP_OPACITY = "opacity";
private static final String PROP_Z_INDEX = "zIndex";
private static final String PROP_ELEVATION = "elevation";
private static final String PROP_RENDER_TO_HARDWARE_TEXTURE = "renderToHardwareTextureAndroid";
private static final String PROP_ACCESSIBILITY_LABEL = "accessibilityLabel";
Expand Down Expand Up @@ -78,14 +76,6 @@ public void setOpacity(T view, float opacity) {
view.setAlpha(opacity);
}

@ReactProp(name = PROP_Z_INDEX)
public void setZIndex(T view, float zIndex) {
if (view instanceof ReactZIndexView) {
((ReactZIndexView)view).setZIndex(zIndex);
ViewGroupManager.reorderChildrenByZIndex((ViewGroup) view.getParent());
}
}

@ReactProp(name = PROP_ELEVATION)
public void setElevation(T view, float elevation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

/**
* Class providing children management API for view managers of classes extending ViewGroup.
*/
Expand All @@ -38,38 +34,6 @@ public void updateExtraData(T root, Object extraData) {

public void addView(T parent, View child, int index) {
parent.addView(child, index);
reorderChildrenByZIndex(parent);
}

public static void reorderChildrenByZIndex(ViewGroup view) {
// This gets called in a ReactZIndexView in setIndex with
// the view.getParent(). The view may not have been added
// to the window yet though, so the parent might be null
if (view == null) {
return;
}

// Collect all the children that are ZIndexViews
ArrayList<ReactZIndexView> zIndexViewsToSort = new ArrayList<ReactZIndexView>();
for (int i = 0; i < view.getChildCount(); i++) {
View sibling = view.getChildAt(i);
if (sibling instanceof ReactZIndexView) {
zIndexViewsToSort.add((ReactZIndexView)sibling);
}
}
// Sort the views by zindex
Collections.sort(zIndexViewsToSort, new Comparator<ReactZIndexView>() {
@Override
public int compare(ReactZIndexView view1, ReactZIndexView view2) {
return (int)view1.getZIndex() - (int)view2.getZIndex();
}
});
// Call .bringToFront on the sorted list of views
for (int i = 0; i < zIndexViewsToSort.size(); i++) {
View sortedView = (View)zIndexViewsToSort.get(i);
sortedView.bringToFront();
}
view.invalidate();
}

public int getChildCount(T parent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,14 @@
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.common.SystemClock;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.ReactZIndexView;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.events.EventDispatcher;

/**
* Wrapper class around Fresco's GenericDraweeView, enabling persisting props across multiple view
* update and consistent processing of both static and network images.
*/
public class ReactImageView extends GenericDraweeView implements ReactZIndexView {
public class ReactImageView extends GenericDraweeView {

public static final int REMOTE_IMAGE_FADE_DURATION_MS = 300;

Expand Down Expand Up @@ -160,7 +159,6 @@ public void process(Bitmap output, Bitmap source) {
private final @Nullable Object mCallerContext;
private int mFadeDurationMs = -1;
private boolean mProgressiveRenderingEnabled;
private @Nullable float mZIndex;

// We can't specify rounding in XML, so have to do so here
private static GenericDraweeHierarchy buildHierarchy(Context context) {
Expand Down Expand Up @@ -494,12 +492,4 @@ public void setZIndex(float zIndex) {
public float getZIndex() {
return mZIndex;
}

public void setZIndex(float zIndex) {
mZIndex = zIndex;
}

public float getZIndex() {
return mZIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@
import android.widget.Spinner;

import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.uimanager.ReactZIndexView;

public class ReactPicker extends Spinner implements ReactZIndexView {
public class ReactPicker extends Spinner {

private int mMode = MODE_DIALOG;
private @Nullable Integer mPrimaryColor;
private boolean mSuppressNextEvent;
private @Nullable OnSelectListener mOnSelectListener;
private @Nullable Integer mStagedSelection;
private @Nullable float mZIndex;

/**
* Listener interface for ReactPicker events.
Expand Down Expand Up @@ -147,12 +145,4 @@ public void setPrimaryColor(@Nullable Integer primaryColor) {
public int getMode() {
return mMode;
}

public void setZIndex(float zIndex) {
mZIndex = zIndex;
}

public float getZIndex() {
return mZIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@
import android.widget.ProgressBar;

import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.uimanager.ReactZIndexView;

/**
* Controls an enclosing ProgressBar. Exists so that the ProgressBar can be recreated if
* the style would change.
*/
/* package */ class ProgressBarContainerView extends FrameLayout implements ReactZIndexView {
/* package */ class ProgressBarContainerView extends FrameLayout {
private static final int MAX_PROGRESS = 1000;

private @Nullable Integer mColor;
private boolean mIndeterminate = true;
private boolean mAnimating = true;
private double mProgress;
private @Nullable ProgressBar mProgressBar;
private @Nullable float mZIndex;

public ProgressBarContainerView(Context context) {
super(context);
Expand Down Expand Up @@ -94,12 +92,4 @@ private void setColor(ProgressBar progressBar) {
drawable.clearColorFilter();
}
}

public void setZIndex(float zIndex) {
mZIndex = zIndex;
}

public float getZIndex() {
return mZIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import android.widget.ScrollView;

import com.facebook.react.uimanager.MeasureSpecAssertions;
import com.facebook.react.uimanager.ReactZIndexView;
import com.facebook.react.uimanager.events.NativeGestureUtil;
import com.facebook.react.views.view.ReactClippingViewGroup;
import com.facebook.react.views.view.ReactClippingViewGroupHelper;
Expand All @@ -35,7 +34,7 @@
* <p>ReactScrollView only supports vertical scrolling. For horizontal scrolling,
* use {@link ReactHorizontalScrollView}.
*/
public class ReactScrollView extends ScrollView implements ReactClippingViewGroup, ReactZIndexView {
public class ReactScrollView extends ScrollView implements ReactClippingViewGroup {

private final OnScrollDispatchHelper mOnScrollDispatchHelper = new OnScrollDispatchHelper();

Expand All @@ -50,7 +49,6 @@ public class ReactScrollView extends ScrollView implements ReactClippingViewGrou
private @Nullable String mScrollPerfTag;
private @Nullable Drawable mEndBackground;
private int mEndFillColor = Color.TRANSPARENT;
private @Nullable float mZIndex;

public ReactScrollView(Context context) {
this(context, null);
Expand Down Expand Up @@ -249,12 +247,4 @@ public void setEndFillColor(int color) {
mEndBackground = new ColorDrawable(mEndFillColor);
}
}

public void setZIndex(float zIndex) {
mZIndex = zIndex;
}

public float getZIndex() {
return mZIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import android.util.AttributeSet;
import android.widget.SeekBar;

import com.facebook.react.uimanager.ReactZIndexView;

import javax.annotation.Nullable;

/**
Expand All @@ -27,12 +25,12 @@
* Note that the slider is _not_ a controlled component (setValue isn't called
* during dragging).
*/
public class ReactSlider extends SeekBar implements ReactZIndexView {
public class ReactSlider extends SeekBar {

/**
* If step is 0 (unset) we default to this total number of steps.
* Don't use 100 which leads to rounding errors (0.200000000001).
*/
*/
private static int DEFAULT_TOTAL_STEPS = 128;

/**
Expand All @@ -53,8 +51,6 @@ public class ReactSlider extends SeekBar implements ReactZIndexView {
*/
private double mStep = 0;

private @Nullable float mZIndex;

public ReactSlider(Context context, @Nullable AttributeSet attrs, int style) {
super(context, attrs, style);
}
Expand Down Expand Up @@ -112,12 +108,4 @@ private void updateValue() {
private int getTotalSteps() {
return (int) Math.ceil((mMaxValue - mMinValue) / mStep);
}

public void setZIndex(float zIndex) {
mZIndex = zIndex;
}

public float getZIndex() {
return mZIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@
import android.support.v7.widget.SwitchCompat;
import android.widget.Switch;

import com.facebook.react.uimanager.ReactZIndexView;

import javax.annotation.Nullable;

/**
* Switch that has its value controlled by JS. Whenever the value of the switch changes, we do not
* allow any other changes to that switch until JS sets a value explicitly. This stops the Switch
* from changing its value multiple times, when those changes have not been processed by JS first.
*/
/*package*/ class ReactSwitch extends SwitchCompat implements ReactZIndexView {
/*package*/ class ReactSwitch extends SwitchCompat {

private boolean mAllowChange;
private @Nullable float mZIndex;

public ReactSwitch(Context context) {
super(context);
Expand All @@ -47,12 +42,4 @@ public void setChecked(boolean checked) {
}
mAllowChange = true;
}

public void setZIndex(float zIndex) {
mZIndex = zIndex;
}

public float getZIndex() {
return mZIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@
import android.text.Layout;
import android.text.Spanned;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.react.uimanager.ReactCompoundView;
import com.facebook.react.uimanager.ReactZIndexView;
import com.facebook.react.uimanager.ViewGroupManager;

import javax.annotation.Nullable;

public class ReactTextView extends TextView implements ReactCompoundView, ReactZIndexView {
public class ReactTextView extends TextView implements ReactCompoundView {

private boolean mContainsImages;
private int mDefaultGravityHorizontal;
private int mDefaultGravityVertical;
private boolean mTextIsSelectable;
private @Nullable float zIndex;

public ReactTextView(Context context) {
super(context);
Expand Down Expand Up @@ -122,15 +116,6 @@ public void invalidateDrawable(Drawable drawable) {
super.invalidateDrawable(drawable);
}

public void setZIndex(float targetZIndex) {
zIndex = targetZIndex;
ViewGroupManager.reorderChildrenByZIndex((ViewGroup) this.getParent());
}

public float getZIndex() {
return zIndex;
}

@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
Expand Down
Loading

0 comments on commit f0a62d9

Please sign in to comment.