提交 780427bb 编写于 作者: T Takeshi Hagikura

Fix format (#258)

上级 5b2fff67
......@@ -16,14 +16,6 @@
package com.google.android.flexbox;
import com.google.android.apps.flexbox.R;
import com.google.android.flexbox.validators.DimensionInputValidator;
import com.google.android.flexbox.validators.FixedDimensionInputValidator;
import com.google.android.flexbox.validators.FlexBasisPercentInputValidator;
import com.google.android.flexbox.validators.InputValidator;
import com.google.android.flexbox.validators.IntegerInputValidator;
import com.google.android.flexbox.validators.NonNegativeDecimalInputValidator;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
......@@ -50,6 +42,14 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.apps.flexbox.R;
import com.google.android.flexbox.validators.DimensionInputValidator;
import com.google.android.flexbox.validators.FixedDimensionInputValidator;
import com.google.android.flexbox.validators.FlexBasisPercentInputValidator;
import com.google.android.flexbox.validators.InputValidator;
import com.google.android.flexbox.validators.IntegerInputValidator;
import com.google.android.flexbox.validators.NonNegativeDecimalInputValidator;
/**
* DialogFragment that changes the properties for a flex item.
*/
......@@ -318,7 +318,7 @@ public class FlexItemEditFragment extends DialogFragment {
// https://developer.android.com/training/keyboard-input/navigation.html
// But it requires API level 11 as a minimum sdk version. To support the lower level
// devices,
// doing it programatically.
// doing it programmatically.
for (int i = 0; i < textViews.length; i++) {
final int index = i;
textViews[index].setOnEditorActionListener(new TextView.OnEditorActionListener() {
......
......@@ -16,23 +16,25 @@
package com.google.android.flexbox;
import com.google.android.flexbox.test.FlexboxTestActivity;
import static com.google.android.flexbox.test.IsEqualAllowingError.isEqualAllowingError;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import android.app.Activity;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import static com.google.android.flexbox.test.IsEqualAllowingError.isEqualAllowingError;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import com.google.android.flexbox.test.FlexboxTestActivity;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Unit tests for {@link FlexboxHelper}.
......
......@@ -2275,7 +2275,7 @@ public class FlexboxAndroidTest {
@Override
public void apply(FlexboxLayout flexboxLayout) {
flexboxLayout.setFlexWrap(FlexWrap.WRAP_REVERSE);
}
}
});
TextView textView1 = (TextView) activity.findViewById(R.id.text1);
TextView textView2 = (TextView) activity.findViewById(R.id.text2);
......
......@@ -63,7 +63,8 @@ public class FlexboxLayoutManagerConfigChangeTest {
@Test
@FlakyTest
public void testFlexLinesDiscardedOnOrientationChange_direction_row() throws Throwable {
// Verifies the case that the calculated Flex lines are correctly discarded when a orientation
// Verifies the case that the calculated Flex lines are correctly discarded when a
// orientation
// happens with an Activity that handles configuration changes manually
final ConfigChangeActivity activity = mActivityRule.getActivity();
final FlexboxLayoutManager layoutManager = new FlexboxLayoutManager();
......@@ -122,7 +123,8 @@ public class FlexboxLayoutManagerConfigChangeTest {
@Test
@FlakyTest
public void testFlexLinesDiscardedOnOrientationChange_direction_column() throws Throwable {
// Verifies the case that the calculated Flex lines are correctly discarded when a orientation
// Verifies the case that the calculated Flex lines are correctly discarded when a
// orientation
// happens with an Activity that handles configuration changes manually
final ConfigChangeActivity activity = mActivityRule.getActivity();
final FlexboxLayoutManager layoutManager = new FlexboxLayoutManager();
......
......@@ -53,7 +53,7 @@ interface FlexItem extends Parcelable {
* Sets the width attribute of the flex item.
*
* @param width the width attribute. Can be one of the
* constants MATCH_PARENT(-1) or WRAP_CONTENT(-2), or an exact size.
* constants MATCH_PARENT(-1) or WRAP_CONTENT(-2), or an exact size.
*/
void setWidth(int width);
......@@ -69,7 +69,7 @@ interface FlexItem extends Parcelable {
* Sets the height attribute of the flex item.
*
* @param height the height attribute. Can be one of the
* constants MATCH_PARENT(-1) or WRAP_CONTENT(-2), or an exact size.
* constants MATCH_PARENT(-1) or WRAP_CONTENT(-2), or an exact size.
*/
void setHeight(int height);
......
......@@ -176,10 +176,10 @@ public class FlexLine {
/**
* Updates the position of the flex line from the contained view.
*
* @param view the view contained in this flex line
* @param leftDecoration the length of the decoration on the left of the view
* @param topDecoration the length of the decoration on the top of the view
* @param rightDecoration the length of the decoration on the right of the view
* @param view the view contained in this flex line
* @param leftDecoration the length of the decoration on the left of the view
* @param topDecoration the length of the decoration on the top of the view
* @param rightDecoration the length of the decoration on the right of the view
* @param bottomDecoration the length of the decoration on the bottom of the view
*/
void updatePositionFromView(View view, int leftDecoration, int topDecoration,
......
......@@ -17,6 +17,7 @@
package com.google.android.flexbox;
import static android.support.v7.widget.RecyclerView.NO_POSITION;
import static com.google.android.flexbox.FlexItem.FLEX_BASIS_PERCENT_DEFAULT;
import android.support.annotation.NonNull;
......@@ -819,7 +820,7 @@ class FlexboxHelper {
}
private void addFlexLine(List<FlexLine> flexLines, FlexLine flexLine, int viewIndex,
int usedCrossSizeSoFar) {
int usedCrossSizeSoFar) {
flexLine.mSumCrossSizeBefore = usedCrossSizeSoFar;
mFlexContainer.onNewFlexLineAdded(flexLine);
flexLine.mLastIndex = viewIndex;
......@@ -1441,7 +1442,7 @@ class FlexboxHelper {
// Flex lines should be aligned center like ALIGN_CONTENT_CENTER
mFlexContainer.setFlexLines(
constructFlexLinesForAlignContentCenter(flexLines, size,
totalCrossSize));
totalCrossSize));
break;
}
// The value of free space along the cross axis which needs to be put on top
......
......@@ -32,9 +32,9 @@ import java.util.List;
*
* Orientation for the decoration can be either of:
* <ul>
* <li>Horizontal (setOrientation(HORIZONTAL)</li>
* <li>Vertical (setOrientation(VERTICAL)</li>
* <li>Both orientation (setOrientation(BOTH)</li>
* <li>Horizontal (setOrientation(HORIZONTAL)</li>
* <li>Vertical (setOrientation(VERTICAL)</li>
* <li>Both orientation (setOrientation(BOTH)</li>
* </ul>.
* The default value is set to both.
*/
......@@ -74,9 +74,9 @@ public class FlexboxItemDecoration extends RecyclerView.ItemDecoration {
* Set the orientation for the decoration.
* Orientation for the decoration can be either of:
* <ul>
* <li>Horizontal (setOrientation(HORIZONTAL)</li>
* <li>Vertical (setOrientation(VERTICAL)</li>
* <li>Both orientation (setOrientation(BOTH)</li>
* <li>Horizontal (setOrientation(HORIZONTAL)</li>
* <li>Vertical (setOrientation(VERTICAL)</li>
* <li>Both orientation (setOrientation(BOTH)</li>
* </ul>.
*/
public void setOrientation(int orientation) {
......
......@@ -400,7 +400,7 @@ public class FlexboxLayout extends ViewGroup implements FlexContainer {
// Expand the views if alignItems (or mAlignSelf in each child view) is set to stretch
mFlexboxHelper.stretchViews();
setMeasuredDimensionForFlex(mFlexDirection, widthMeasureSpec, heightMeasureSpec,
flexLinesResult.mChildState);
flexLinesResult.mChildState);
}
/**
......
......@@ -1444,10 +1444,11 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
* The view holders are going to be filled toward the end position (bottom if the main axis
* direction is horizontal, right if the main axis direction if vertical).
*
* @param anchorInfo the anchor information where layout should start
* @param fromNextLine if set to {@code true}, layout starts from the next flex line set to
* the anchor information
* @param considerInfinite if set to {@code true}, the judgement if the infinite available space
* @param anchorInfo the anchor information where layout should start
* @param fromNextLine if set to {@code true}, layout starts from the next flex line set to
* the anchor information
* @param considerInfinite if set to {@code true}, the judgement if the infinite available
* space
* needs to be considered.
*/
private void updateLayoutStateToFillEnd(AnchorInfo anchorInfo, boolean fromNextLine,
......@@ -1483,7 +1484,8 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
* @param anchorInfo the anchor information where layout should start
* @param fromPreviousLine if set to {@code true}, layout starts from the next flex line set to
* the anchor information
* @param considerInfinite if set to {@code true}, the judgement if the infinite available space
* @param considerInfinite if set to {@code true}, the judgement if the infinite available
* space
* needs to be considered.
*/
private void updateLayoutStateToFillStart(AnchorInfo anchorInfo, boolean fromPreviousLine,
......@@ -1884,13 +1886,13 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
}
/**
* @param view the view to be examined if it's visible
* @param view the view to be examined if it's visible
* @param completelyVisible when passed as {@code true}, this method checks if the view bounds
* don't overlap the bounds of the RecyclerView. When passed as
* {@code false}, this method checks if the view bounds are partially
* visible within the RecyclerView.
* @return if the view passed as an argument is visible (view bounds are within the parent
* RecyclerView)
* RecyclerView)
*/
private boolean isViewVisible(View view, boolean completelyVisible) {
int left = getPaddingLeft();
......@@ -1948,7 +1950,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
/**
* Returns the adapter position of the first fully visible view. This position does not include
* adapter changes that were dispatched after the last layout pass.
*
* @return The adapter position of the first fully visible item or
* {@link RecyclerView#NO_POSITION} if there aren't any visible items.
* @see #findFirstVisibleItemPosition()
......@@ -1963,7 +1965,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
/**
* Returns the adapter position of the last visible view. This position does not include
* adapter changes that were dispatched after the last layout pass.
*
* If RecyclerView has item decorators, they will be considered in calculations as well.
* LayoutManager may pre-cache some views that are not necessarily visible. Those views
* are ignored in this method.
......@@ -1982,7 +1984,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
/**
* Returns the adapter position of the last fully visible view. This position does not include
* adapter changes that were dispatched after the last layout pass.
*
* @return The adapter position of the last fully visible view or
* {@link RecyclerView#NO_POSITION} if there aren't any visible items.
* @see #findLastVisibleItemPosition()
......@@ -1998,8 +2000,8 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
* Returns the first child that is visible in the provided index range, i.e. either partially or
* fully visible depending on the arguments provided.
*
* @param fromIndex the start index for searching the visible child
* @param toIndex the last index for searching the visible child
* @param fromIndex the start index for searching the visible child
* @param toIndex the last index for searching the visible child
* @param completelyVisible when passed as {@code true}, this method checks if the view bounds
* don't overlap the bounds of the RecyclerView. When passed as
* {@code false}, this method checks if the view bounds are partially
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册