mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Format Java code in xplat/js/react-native-github
Summary: This diff formats the Java class files inside xplat/js/react-native-github. Since google-java-format was enabled in D16071401 we want to codemode the existing code so that users don't have to deal with formatter lint noise at diff-time. ```arc f --paths-cmd 'hg files -I "**/*.java"'``` drop-conflicts Reviewed By: cpojer Differential Revision: D16071725 fbshipit-source-id: fc6e3852e45742c109f0c5ac4065d64201c74204
This commit is contained in:
1 parent
61e95e5cbf
commit
6c0f73b322
681 files changed
+14082
-16365
No files matched your search
+29
-32
@@ -1,24 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Helper to handle implementing ViewGroups with custom drawing order based on z-index.
|
||||
*/
|
||||
/** Helper to handle implementing ViewGroups with custom drawing order based on z-index. */
|
||||
public class ViewGroupDrawingOrderHelper {
|
||||
private final ViewGroup mViewGroup;
|
||||
private int mNumberOfChildrenWithZIndex = 0;
|
||||
@@ -30,6 +25,7 @@ public class ViewGroupDrawingOrderHelper {
|
||||
|
||||
/**
|
||||
* This should be called every time a view is added to the ViewGroup in {@link ViewGroup#addView}.
|
||||
*
|
||||
* @param view The view that is being added
|
||||
*/
|
||||
public void handleAddView(View view) {
|
||||
@@ -41,8 +37,9 @@ public class ViewGroupDrawingOrderHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be called every time a view is removed from the ViewGroup in {@link ViewGroup#removeView}
|
||||
* and {@link ViewGroup#removeViewAt}.
|
||||
* This should be called every time a view is removed from the ViewGroup in {@link
|
||||
* ViewGroup#removeView} and {@link ViewGroup#removeViewAt}.
|
||||
*
|
||||
* @param view The view that is being removed.
|
||||
*/
|
||||
public void handleRemoveView(View view) {
|
||||
@@ -54,17 +51,17 @@ public class ViewGroupDrawingOrderHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* If the ViewGroup should enable drawing order. ViewGroups should call
|
||||
* {@link ViewGroup#setChildrenDrawingOrderEnabled} with the value returned from this method when
|
||||
* a view is added or removed.
|
||||
* If the ViewGroup should enable drawing order. ViewGroups should call {@link
|
||||
* ViewGroup#setChildrenDrawingOrderEnabled} with the value returned from this method when a view
|
||||
* is added or removed.
|
||||
*/
|
||||
public boolean shouldEnableCustomDrawingOrder() {
|
||||
return mNumberOfChildrenWithZIndex > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The index of the child view that should be drawn. This should be used in
|
||||
* {@link ViewGroup#getChildDrawingOrder}.
|
||||
* The index of the child view that should be drawn. This should be used in {@link
|
||||
* ViewGroup#getChildDrawingOrder}.
|
||||
*/
|
||||
public int getChildDrawingOrder(int childCount, int index) {
|
||||
if (mDrawingOrderIndices == null) {
|
||||
@@ -73,22 +70,24 @@ public class ViewGroupDrawingOrderHelper {
|
||||
viewsToSort.add(mViewGroup.getChildAt(i));
|
||||
}
|
||||
// Sort the views by zIndex
|
||||
Collections.sort(viewsToSort, new Comparator<View>() {
|
||||
@Override
|
||||
public int compare(View view1, View view2) {
|
||||
Integer view1ZIndex = ViewGroupManager.getViewZIndex(view1);
|
||||
if (view1ZIndex == null) {
|
||||
view1ZIndex = 0;
|
||||
}
|
||||
Collections.sort(
|
||||
viewsToSort,
|
||||
new Comparator<View>() {
|
||||
@Override
|
||||
public int compare(View view1, View view2) {
|
||||
Integer view1ZIndex = ViewGroupManager.getViewZIndex(view1);
|
||||
if (view1ZIndex == null) {
|
||||
view1ZIndex = 0;
|
||||
}
|
||||
|
||||
Integer view2ZIndex = ViewGroupManager.getViewZIndex(view2);
|
||||
if (view2ZIndex == null) {
|
||||
view2ZIndex = 0;
|
||||
}
|
||||
Integer view2ZIndex = ViewGroupManager.getViewZIndex(view2);
|
||||
if (view2ZIndex == null) {
|
||||
view2ZIndex = 0;
|
||||
}
|
||||
|
||||
return view1ZIndex - view2ZIndex;
|
||||
}
|
||||
});
|
||||
return view1ZIndex - view2ZIndex;
|
||||
}
|
||||
});
|
||||
|
||||
mDrawingOrderIndices = new int[childCount];
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
@@ -99,9 +98,7 @@ public class ViewGroupDrawingOrderHelper {
|
||||
return mDrawingOrderIndices[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Recheck all children for z-index changes.
|
||||
*/
|
||||
/** Recheck all children for z-index changes. */
|
||||
public void update() {
|
||||
mNumberOfChildrenWithZIndex = 0;
|
||||
for (int i = 0; i < mViewGroup.getChildCount(); i++) {
|
||||
|
||||
Reference in new issue
Block a user