Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
门心叼龙
flexbox-layout
提交
4efa9f55
F
flexbox-layout
项目概览
门心叼龙
/
flexbox-layout
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flexbox-layout
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4efa9f55
编写于
7月 27, 2016
作者:
T
Takeshi Hagikura
提交者:
GitHub
7月 27, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #102 from google/extract_flexline
Expose the FlexLine class and mFlexLines
上级
175e941e
eb2d7fa8
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
307 addition
and
207 deletion
+307
-207
flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxAndroidTest.java
...a/com/google/android/flexbox/test/FlexboxAndroidTest.java
+6
-0
flexbox/src/main/java/com/google/android/flexbox/FlexLine.java
...ox/src/main/java/com/google/android/flexbox/FlexLine.java
+149
-0
flexbox/src/main/java/com/google/android/flexbox/FlexboxLayout.java
...c/main/java/com/google/android/flexbox/FlexboxLayout.java
+152
-207
未找到文件。
flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxAndroidTest.java
浏览文件 @
4efa9f55
...
...
@@ -335,6 +335,7 @@ public class FlexboxAndroidTest {
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isBelow
(
withId
(
R
.
id
.
text1
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isBelow
(
withId
(
R
.
id
.
text2
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isLeftAlignedWith
(
withId
(
R
.
id
.
flexbox_layout
)));
assertThat
(
flexboxLayout
.
getFlexLines
().
size
(),
is
(
2
));
}
@Test
...
...
@@ -363,6 +364,7 @@ public class FlexboxAndroidTest {
// to the right of the second one and overflowing the parent FlexboxLayout.
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isRightOf
(
withId
(
R
.
id
.
text2
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isTopAlignedWith
(
withId
(
R
.
id
.
flexbox_layout
)));
assertThat
(
flexboxLayout
.
getFlexLines
().
size
(),
is
(
1
));
}
@Test
...
...
@@ -390,6 +392,7 @@ public class FlexboxAndroidTest {
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isAbove
(
withId
(
R
.
id
.
text1
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isAbove
(
withId
(
R
.
id
.
text2
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isLeftAlignedWith
(
withId
(
R
.
id
.
flexbox_layout
)));
assertThat
(
flexboxLayout
.
getFlexLines
().
size
(),
is
(
2
));
}
@Test
...
...
@@ -418,6 +421,7 @@ public class FlexboxAndroidTest {
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isRightOf
(
withId
(
R
.
id
.
text1
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isRightOf
(
withId
(
R
.
id
.
text2
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isTopAlignedWith
(
withId
(
R
.
id
.
flexbox_layout
)));
assertThat
(
flexboxLayout
.
getFlexLines
().
size
(),
is
(
2
));
}
@Test
...
...
@@ -448,6 +452,7 @@ public class FlexboxAndroidTest {
// below the second one and overflowing the parent FlexboxLayout.
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isBelow
(
withId
(
R
.
id
.
text2
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isLeftAlignedWith
(
withId
(
R
.
id
.
flexbox_layout
)));
assertThat
(
flexboxLayout
.
getFlexLines
().
size
(),
is
(
1
));
}
@Test
...
...
@@ -478,6 +483,7 @@ public class FlexboxAndroidTest {
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isLeftOf
(
withId
(
R
.
id
.
text1
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isLeftOf
(
withId
(
R
.
id
.
text2
)));
onView
(
withId
(
R
.
id
.
text3
)).
check
(
isTopAlignedWith
(
withId
(
R
.
id
.
flexbox_layout
)));
assertThat
(
flexboxLayout
.
getFlexLines
().
size
(),
is
(
2
));
}
@Test
...
...
flexbox/src/main/java/com/google/android/flexbox/FlexLine.java
0 → 100644
浏览文件 @
4efa9f55
/*
* Copyright 2016 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.google.android.flexbox
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Holds properties related to a single flex line. This class is not expected to be changed outside
* of the {@link FlexboxLayout}, thus only exposing the getter methods that may be useful for
* other classes using the {@link FlexboxLayout}.
*/
public
class
FlexLine
{
FlexLine
()
{
}
/** @see {@link #getLeft()} */
int
mLeft
=
Integer
.
MAX_VALUE
;
/** @see {@link #getTop()} */
int
mTop
=
Integer
.
MAX_VALUE
;
/** @see {@link #getRight()} */
int
mRight
=
Integer
.
MIN_VALUE
;
/** @see {@link #getBottom()} */
int
mBottom
=
Integer
.
MIN_VALUE
;
/** @see {@link #getMainSize()} */
int
mMainSize
;
/**
* The sum of the lengths of dividers along the main axis. This value should be lower or
* than than the value of {@link #mMainSize}.
*/
int
mDividerLengthInMainSize
;
/** @see {@link #getCrossSize()} */
int
mCrossSize
;
/** @see {@link #getItemCount()} */
int
mItemCount
;
/** @see {@link #getTotalFlexGrow()} */
float
mTotalFlexGrow
;
/** @see {@link #getTotalFlexShrink()} */
float
mTotalFlexShrink
;
/**
* The largest value of the individual child's baseline (obtained by View#getBaseline()
* if the {@link FlexboxLayout#mAlignItems} value is not {@link FlexboxLayout#ALIGN_ITEMS_BASELINE}
* or the flex direction is vertical, this value is not used.
* If the alignment direction is from the bottom to top,
* (e.g. flexWrap == FLEX_WRAP_WRAP_REVERSE and flexDirection == FLEX_DIRECTION_ROW)
* store this value from the distance from the bottom of the view minus baseline.
* (Calculated as view.getMeasuredHeight() - view.getBaseline - LayoutParams.bottomMargin)
*/
int
mMaxBaseline
;
/**
* Store the indices of the children views whose alignSelf property is stretch.
* The stored indices are the absolute indices including all children in the Flexbox,
* not the relative indices in this flex line.
*/
List
<
Integer
>
mIndicesAlignSelfStretch
=
new
ArrayList
<>();
/**
* @return the distance in pixels from the top edge of this view's parent
* to the top edge of this FlexLine.
*/
public
int
getLeft
()
{
return
mLeft
;
}
/**
* @return the distance in pixels from the top edge of this view's parent
* to the top edge of this FlexLine.
*/
public
int
getTop
()
{
return
mTop
;
}
/**
* @return the distance in pixels from the right edge of this view's parent
* to the right edge of this FlexLine.
*/
public
int
getRight
()
{
return
mRight
;
}
/**
* @return the distance in pixels from the bottom edge of this view's parent
* to the bottom edge of this FlexLine.
*/
public
int
getBottom
()
{
return
mBottom
;
}
/**
* @return the size of the flex line in pixels along the main axis of the flex container.
*/
public
int
getMainSize
()
{
return
mMainSize
;
}
/**
* @return the size of the flex line in pixels along the cross axis of the flex container.
*/
public
int
getCrossSize
()
{
return
mCrossSize
;
}
/**
* @return the count of the views contained in this flex line.
*/
public
int
getItemCount
()
{
return
mItemCount
;
}
/**
* @return the sum of the flexGrow properties of the children included in this flex line
*/
public
float
getTotalFlexGrow
()
{
return
mTotalFlexGrow
;
}
/**
* @return the sum of the flexShrink properties of the children included in this flex line
*/
public
float
getTotalFlexShrink
()
{
return
mTotalFlexShrink
;
}
}
flexbox/src/main/java/com/google/android/flexbox/FlexboxLayout.java
浏览文件 @
4efa9f55
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录