Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
门心叼龙
flexbox-layout
提交
a085da39
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 搜索 >>
提交
a085da39
编写于
5月 25, 2016
作者:
T
Takeshi Hagikura
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #45 from google/lower_minsdk_to_9
Lower the minSdkVersion to 9.
上级
30a429ee
e14f589c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
102 addition
and
60 deletion
+102
-60
app/build.gradle
app/build.gradle
+3
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+7
-5
app/src/main/java/com/google/android/apps/flexbox/SettingsActivity.java
...ava/com/google/android/apps/flexbox/SettingsActivity.java
+9
-9
app/src/main/res/layout/fragment_flex_item_edit.xml
app/src/main/res/layout/fragment_flex_item_edit.xml
+27
-28
app/src/main/res/values-v14/styles.xml
app/src/main/res/values-v14/styles.xml
+26
-0
app/src/main/res/values-v21/styles.xml
app/src/main/res/values-v21/styles.xml
+2
-0
app/src/main/res/values/styles.xml
app/src/main/res/values/styles.xml
+6
-2
build.gradle
build.gradle
+1
-1
flexbox/src/main/java/com/google/android/flexbox/FlexboxLayout.java
...c/main/java/com/google/android/flexbox/FlexboxLayout.java
+21
-15
未找到文件。
app/build.gradle
浏览文件 @
a085da39
...
...
@@ -39,7 +39,10 @@ android {
dependencies
{
compile
project
(
":flexbox"
)
compile
"com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
compile
"com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile
"com.android.support:preference-v7:${rootProject.ext.supportLibVersion}"
compile
"com.android.support:preference-v14:${rootProject.ext.supportLibVersion}"
compile
"com.android.support:design:${rootProject.ext.supportLibVersion}"
testCompile
"junit:junit:${rootProject.ext.junitVersion}"
...
...
app/src/main/AndroidManifest.xml
浏览文件 @
a085da39
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
...
...
@@ -15,18 +14,21 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.google.android.apps.flexbox"
>
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.google.android.apps.flexbox"
>
<uses-sdk
tools:overrideLibrary=
"android.support.v14.preference"
/>
<application
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".MainActivity"
android:label=
"@string/app_name"
android:theme=
"@style/AppTheme.NoActionBar"
>
android:theme=
"@style/AppTheme.NoActionBar"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
app/src/main/java/com/google/android/apps/flexbox/SettingsActivity.java
浏览文件 @
a085da39
...
...
@@ -22,32 +22,31 @@ import com.google.android.apps.flexbox.validators.InputValidator;
import
com.google.android.apps.flexbox.validators.IntegerInputValidator
;
import
com.google.android.apps.flexbox.validators.NonNegativeDecimalInputValidator
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.preference.EditTextPreference
;
import
android.preference.Preference
;
import
android.preference.PreferenceFragment
;
import
android.support.v4.app.FragmentActivity
;
import
android.support.v7.preference.EditTextPreference
;
import
android.support.v7.preference.Preference
;
import
android.support.v7.preference.PreferenceFragmentCompat
;
import
android.widget.Toast
;
public
class
SettingsActivity
extends
Activity
{
public
class
SettingsActivity
extends
Fragment
Activity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// Display the fragment as the main content.
getFragmentManager
().
beginTransaction
().
replace
(
android
.
R
.
id
.
content
,
get
Support
FragmentManager
().
beginTransaction
().
replace
(
android
.
R
.
id
.
content
,
new
SettingsFragment
()).
commit
();
}
/**
* Fragment for settings.
*/
public
static
class
SettingsFragment
extends
PreferenceFragment
{
public
static
class
SettingsFragment
extends
PreferenceFragment
Compat
{
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
public
void
onCreatePreferences
(
Bundle
savedInstanceState
,
String
s
)
{
addPreferencesFromResource
(
R
.
xml
.
new_flex_item_preferences
);
EditTextPreference
orderPreference
=
(
EditTextPreference
)
findPreference
(
...
...
@@ -152,5 +151,6 @@ public class SettingsActivity extends Activity {
}
});
}
}
}
app/src/main/res/layout/fragment_flex_item_edit.xml
浏览文件 @
a085da39
...
...
@@ -21,8 +21,8 @@ limitations under the License.
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:padding
Start
=
"@dimen/activity_horizontal_margin"
android:padding
End
=
"@dimen/activity_horizontal_margin"
>
android:padding
End
=
"@dimen/activity_horizontal_margin"
android:padding
Start
=
"@dimen/activity_horizontal_margin"
>
<android.support.design.widget.TextInputLayout
android:id=
"@+id/input_layout_order"
...
...
@@ -33,10 +33,10 @@ limitations under the License.
android:id=
"@+id/edit_text_order"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:lines=
"1"
android:singleLine=
"true"
android:hint=
"@string/hint_order"
android:inputType=
"numberSigned"
android:hint=
"@string/hint_order"
/>
android:lines=
"1"
android:singleLine=
"true"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
...
...
@@ -48,10 +48,10 @@ limitations under the License.
android:id=
"@+id/edit_text_flex_grow"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:lines=
"1"
android:singleLine=
"true"
android:hint=
"@string/hint_flex_grow"
android:inputType=
"numberDecimal"
android:hint=
"@string/hint_flex_grow"
/>
android:lines=
"1"
android:singleLine=
"true"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
...
...
@@ -63,10 +63,10 @@ limitations under the License.
android:id=
"@+id/edit_text_flex_shrink"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:lines=
"1"
android:singleLine=
"true"
android:hint=
"@string/hint_flex_shrink"
android:inputType=
"numberDecimal"
android:hint=
"@string/hint_flex_shrink"
/>
android:lines=
"1"
android:singleLine=
"true"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
...
...
@@ -78,10 +78,10 @@ limitations under the License.
android:id=
"@+id/edit_text_flex_basis_percent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:lines=
"1"
android:singleLine=
"true"
android:hint=
"@string/hint_flex_basis_percent"
android:inputType=
"numberSigned"
android:hint=
"@string/hint_flex_basis_percent"
/>
android:lines=
"1"
android:singleLine=
"true"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
...
...
@@ -93,10 +93,10 @@ limitations under the License.
android:id=
"@+id/edit_text_width"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:lines=
"1"
android:singleLine=
"true"
android:hint=
"@string/hint_width"
android:inputType=
"numberSigned"
android:hint=
"@string/hint_width"
/>
android:lines=
"1"
android:singleLine=
"true"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
...
...
@@ -108,10 +108,10 @@ limitations under the License.
android:id=
"@+id/edit_text_height"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:lines=
"1"
android:singleLine=
"true"
android:hint=
"@string/hint_height"
android:inputType=
"numberSigned"
android:hint=
"@string/hint_height"
/>
android:lines=
"1"
android:singleLine=
"true"
/>
</android.support.design.widget.TextInputLayout>
<LinearLayout
...
...
@@ -122,17 +122,17 @@ limitations under the License.
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingStart=
"@dimen/margin_tiny"
android:paddingLeft=
"@dimen/margin_tiny"
android:paddingEnd=
"@dimen/margin_tiny"
android:paddingLeft=
"@dimen/margin_tiny"
android:paddingRight=
"@dimen/margin_tiny"
android:paddingStart=
"@dimen/margin_tiny"
android:text=
"@string/hint_align_self"
/>
<Spinner
android:id=
"@+id/spinner_align_self"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:gravity=
"end"
/>
</LinearLayout>
...
...
@@ -140,11 +140,10 @@ limitations under the License.
android:id=
"@+id/button_panel"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"bottom"
android:orientation=
"horizontal"
android:paddingTop=
"@dimen/margin_small"
android:paddingBottom=
"@dimen/margin_small"
android:gravity=
"bottom"
style=
"?android:attr/buttonBarStyle"
>
android:paddingTop=
"@dimen/margin_small"
>
<View
android:id=
"@+id/spacer"
...
...
@@ -155,14 +154,14 @@ limitations under the License.
<Button
android:id=
"@+id/button_cancel"
style=
"
?android:attr/buttonBarStyle
"
style=
"
@style/DialogButton
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/cancel"
/>
<Button
android:id=
"@+id/button_ok"
style=
"
?android:attr/buttonBarStyle
"
style=
"
@style/DialogButton
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/ok"
/>
...
...
app/src/main/res/values-v14/styles.xml
0 → 100644
浏览文件 @
a085da39
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<resources>
<style
name=
"AppTheme"
parent=
"AppThemeBase"
>
<!--
This is needed to make the app work with the preference-v7 library while keeping
material theme on API level 14+.
See http://stackoverflow.com/questions/32070670/preferencefragmentcompat-requires-preferencetheme-to-be-set
-->
<item
name=
"preferenceTheme"
>
@style/PreferenceThemeOverlay.v14.Material
</item>
</style>
</resources>
app/src/main/res/values-v21/styles.xml
浏览文件 @
a085da39
...
...
@@ -21,4 +21,6 @@ limitations under the License.
<item
name=
"android:windowDrawsSystemBarBackgrounds"
>
true
</item>
<item
name=
"android:statusBarColor"
>
@android:color/transparent
</item>
</style>
<style
name=
"DialogButton"
parent=
"@android:style/Widget.Material.Button.Borderless.Colored"
/>
</resources>
app/src/main/res/values/styles.xml
浏览文件 @
a085da39
...
...
@@ -16,13 +16,16 @@ limitations under the License.
<resources>
<!-- Base application theme. -->
<style
name=
"AppTheme"
parent=
"Theme.AppCompat.Light.DarkActionBar"
>
<!-- Customize your theme here. -->
<style
name=
"AppThemeBase"
parent=
"Theme.AppCompat.Light.DarkActionBar"
>
<item
name=
"colorPrimary"
>
@color/colorPrimary
</item>
<item
name=
"colorPrimaryDark"
>
@color/colorPrimaryDark
</item>
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
</style>
<style
name=
"AppTheme"
parent=
"AppThemeBase"
>
<item
name=
"preferenceTheme"
>
@style/PreferenceThemeOverlay
</item>
</style>
<style
name=
"AppTheme.NoActionBar"
>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowNoTitle"
>
true
</item>
...
...
@@ -37,4 +40,5 @@ limitations under the License.
<item
name=
"android:gravity"
>
center
</item>
</style>
<style
name=
"DialogButton"
/>
</resources>
build.gradle
浏览文件 @
a085da39
...
...
@@ -30,7 +30,7 @@ buildscript {
}
ext
{
minSdkVersion
=
14
minSdkVersion
=
9
targetSdkVersion
=
23
compileSdkVersion
=
23
buildToolsVersion
=
"23.0.3"
...
...
flexbox/src/main/java/com/google/android/flexbox/FlexboxLayout.java
浏览文件 @
a085da39
...
...
@@ -359,7 +359,8 @@ public class FlexboxLayout extends ViewGroup {
getPaddingTop
()
+
getPaddingBottom
()
+
lp
.
topMargin
+
lp
.
bottomMargin
,
lp
.
height
);
child
.
measure
(
childWidthMeasureSpec
,
childHeightMeasureSpec
);
childState
=
combineMeasuredStates
(
childState
,
child
.
getMeasuredState
());
childState
=
ViewCompat
.
combineMeasuredStates
(
childState
,
ViewCompat
.
getMeasuredState
(
child
));
largestHeightInRow
=
Math
.
max
(
largestHeightInRow
,
child
.
getMeasuredHeight
()
+
lp
.
topMargin
+
lp
.
bottomMargin
);
...
...
@@ -501,7 +502,8 @@ public class FlexboxLayout extends ViewGroup {
getPaddingTop
()
+
getPaddingBottom
()
+
lp
.
topMargin
+
lp
.
bottomMargin
,
childHeight
);
child
.
measure
(
childWidthMeasureSpec
,
childHeightMeasureSpec
);
childState
=
combineMeasuredStates
(
childState
,
child
.
getMeasuredState
());
childState
=
ViewCompat
.
combineMeasuredStates
(
childState
,
ViewCompat
.
getMeasuredState
(
child
));
largestWidthInColumn
=
Math
.
max
(
largestWidthInColumn
,
child
.
getMeasuredWidth
()
+
lp
.
leftMargin
+
lp
.
rightMargin
);
...
...
@@ -1058,24 +1060,26 @@ public class FlexboxLayout extends ViewGroup {
switch
(
widthMode
)
{
case
MeasureSpec
.
EXACTLY
:
if
(
widthSize
<
calculatedMaxWidth
)
{
childState
=
combineMeasuredStates
(
childState
,
MEASURED_STATE_TOO_SMALL
);
childState
=
ViewCompat
.
combineMeasuredStates
(
childState
,
ViewCompat
.
MEASURED_STATE_TOO_SMALL
);
}
widthSizeAndState
=
resolveSizeAndState
(
widthSize
,
widthMeasureSpec
,
widthSizeAndState
=
ViewCompat
.
resolveSizeAndState
(
widthSize
,
widthMeasureSpec
,
childState
);
break
;
case
MeasureSpec
.
AT_MOST
:
{
if
(
widthSize
<
calculatedMaxWidth
)
{
childState
=
combineMeasuredStates
(
childState
,
MEASURED_STATE_TOO_SMALL
);
childState
=
ViewCompat
.
combineMeasuredStates
(
childState
,
ViewCompat
.
MEASURED_STATE_TOO_SMALL
);
}
else
{
widthSize
=
calculatedMaxWidth
;
}
widthSizeAndState
=
resolveSizeAndState
(
widthSize
,
widthMeasureSpec
,
widthSizeAndState
=
ViewCompat
.
resolveSizeAndState
(
widthSize
,
widthMeasureSpec
,
childState
);
break
;
}
case
MeasureSpec
.
UNSPECIFIED
:
{
widthSizeAndState
=
resolveSizeAndState
(
calculatedMaxWidth
,
widthMeasureSpec
,
childState
);
widthSizeAndState
=
ViewCompat
.
resolveSizeAndState
(
calculatedMaxWidth
,
widthMeasureSpec
,
childState
);
break
;
}
default
:
...
...
@@ -1085,25 +1089,27 @@ public class FlexboxLayout extends ViewGroup {
switch
(
heightMode
)
{
case
MeasureSpec
.
EXACTLY
:
if
(
heightSize
<
calculatedMaxHeight
)
{
childState
=
combineMeasuredStates
(
childState
,
MEASURED_STATE_TOO_SMALL
>>
MEASURED_HEIGHT_STATE_SHIFT
);
childState
=
ViewCompat
.
combineMeasuredStates
(
childState
,
ViewCompat
.
MEASURED_STATE_TOO_SMALL
>>
ViewCompat
.
MEASURED_HEIGHT_STATE_SHIFT
);
}
heightSizeAndState
=
resolveSizeAndState
(
heightSize
,
heightMeasureSpec
,
heightSizeAndState
=
ViewCompat
.
resolveSizeAndState
(
heightSize
,
heightMeasureSpec
,
childState
);
break
;
case
MeasureSpec
.
AT_MOST
:
{
if
(
heightSize
<
calculatedMaxHeight
)
{
childState
=
combineMeasuredStates
(
childState
,
MEASURED_STATE_TOO_SMALL
>>
MEASURED_HEIGHT_STATE_SHIFT
);
childState
=
ViewCompat
.
combineMeasuredStates
(
childState
,
ViewCompat
.
MEASURED_STATE_TOO_SMALL
>>
ViewCompat
.
MEASURED_HEIGHT_STATE_SHIFT
);
}
else
{
heightSize
=
calculatedMaxHeight
;
}
heightSizeAndState
=
resolveSizeAndState
(
heightSize
,
heightMeasureSpec
,
heightSizeAndState
=
ViewCompat
.
resolveSizeAndState
(
heightSize
,
heightMeasureSpec
,
childState
);
break
;
}
case
MeasureSpec
.
UNSPECIFIED
:
{
heightSizeAndState
=
resolveSizeAndState
(
calculatedMaxHeight
,
heightSizeAndState
=
ViewCompat
.
resolveSizeAndState
(
calculatedMaxHeight
,
heightMeasureSpec
,
childState
);
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录