Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
门心叼龙
MVPArms
提交
72690953
M
MVPArms
项目概览
门心叼龙
/
MVPArms
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
MVPArms
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
72690953
编写于
7月 23, 2018
作者:
J
JessYan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Autolayout optional
上级
88055fa8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
12 deletion
+23
-12
arms/build.gradle
arms/build.gradle
+1
-3
arms/src/main/java/com/jess/arms/utils/ThirdViewUtil.java
arms/src/main/java/com/jess/arms/utils/ThirdViewUtil.java
+22
-9
未找到文件。
arms/build.gradle
浏览文件 @
72690953
...
...
@@ -42,9 +42,7 @@ dependencies {
api
rootProject
.
ext
.
dependencies
[
"annotations"
]
//view
api
(
rootProject
.
ext
.
dependencies
[
"autolayout"
])
{
exclude
group:
'com.android.support'
}
compileOnly
rootProject
.
ext
.
dependencies
[
"autolayout"
]
api
(
rootProject
.
ext
.
dependencies
[
"butterknife"
])
{
exclude
module:
'support-annotations'
}
...
...
arms/src/main/java/com/jess/arms/utils/ThirdViewUtil.java
浏览文件 @
72690953
...
...
@@ -43,14 +43,26 @@ import static com.jess.arms.base.delegate.ActivityDelegate.LAYOUT_RELATIVELAYOUT
* ================================================
*/
public
class
ThirdViewUtil
{
private
static
int
USE_AUTOLAYOUT
=
-
1
;
//0 说明 AndroidManifest 里面没有使用 AutoLauout 的Meta,即不使用 AutoLayout,1 为有 Meta ,即需要使用
public
static
final
boolean
DEPENDENCY_AUTO_LAYOUT
;
private
static
int
HAS_AUTO_LAYOUT_META
=
-
1
;
//0 说明 AndroidManifest 里面没有使用 AutoLauout 的 Meta, 即不使用 AutoLayout, 1 为有 Meta, 即需要使用
static
{
boolean
hasDependency
;
try
{
Class
.
forName
(
"com.zhy.autolayout.AutoLayoutInfo"
);
hasDependency
=
true
;
}
catch
(
ClassNotFoundException
e
)
{
hasDependency
=
false
;
}
DEPENDENCY_AUTO_LAYOUT
=
hasDependency
;
}
private
ThirdViewUtil
()
{
throw
new
IllegalStateException
(
"you can't instantiate me!"
);
}
public
static
boolean
isUseAutolayout
()
{
return
USE_AUTOLAYOUT
==
1
;
return
DEPENDENCY_AUTO_LAYOUT
&&
HAS_AUTO_LAYOUT_META
==
1
;
}
public
static
Unbinder
bindTarget
(
Object
target
,
Object
source
)
{
...
...
@@ -67,10 +79,11 @@ public class ThirdViewUtil {
@Nullable
public
static
View
convertAutoView
(
String
name
,
Context
context
,
AttributeSet
attrs
)
{
//本框架并不强制你使用 AutoLayout
//如果你不想使用 AutoLayout ,就不要在 AndroidManifest 中声明, AutoLayout 的 Meta属性(design_width,design_height)
if
(
USE_AUTOLAYOUT
==
-
1
)
{
USE_AUTOLAYOUT
=
1
;
//本框架并不强制您使用 AutoLayout
//如果您不想使用 AutoLayout, 请不要依赖 AutoLayout, 也不要在 AndroidManifest 中声明 AutoLayout 的 Meta 属性 (design_width, design_height)
if
(!
DEPENDENCY_AUTO_LAYOUT
)
return
null
;
if
(
HAS_AUTO_LAYOUT_META
==
-
1
)
{
HAS_AUTO_LAYOUT_META
=
1
;
PackageManager
packageManager
=
context
.
getPackageManager
();
ApplicationInfo
applicationInfo
;
try
{
...
...
@@ -79,14 +92,14 @@ public class ThirdViewUtil {
if
(
applicationInfo
==
null
||
applicationInfo
.
metaData
==
null
||
!
applicationInfo
.
metaData
.
containsKey
(
"design_width"
)
||
!
applicationInfo
.
metaData
.
containsKey
(
"design_height"
))
{
USE_AUTOLAYOUT
=
0
;
HAS_AUTO_LAYOUT_META
=
0
;
}
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{
USE_AUTOLAYOUT
=
0
;
HAS_AUTO_LAYOUT_META
=
0
;
}
}
if
(
USE_AUTOLAYOUT
==
0
)
{
if
(
HAS_AUTO_LAYOUT_META
==
0
)
{
return
null
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录