Skip to content

Commit

Permalink
更新jcenter版本为1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyangAndroid committed Dec 5, 2015
1 parent bb17d06 commit d37260e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {

```
dependencies {
compile 'com.zhy:autolayout:1.2.1'
compile 'com.zhy:autolayout:1.3.0'
}
```

Expand Down
2 changes: 1 addition & 1 deletion autolayout/autolayout.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":autolayout" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.zhy" external.system.module.version="1.2.1" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":autolayout" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.zhy" external.system.module.version="1.3.0" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down
2 changes: 1 addition & 1 deletion autolayout/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

version = "1.2.1"
version = "1.3.0"

android {
compileSdkVersion 23
Expand Down
21 changes: 20 additions & 1 deletion autolayout/src/main/java/com/zhy/autolayout/attr/AutoAttr.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.view.View;

import com.zhy.autolayout.utils.AutoUtils;
import com.zhy.autolayout.utils.L;


/**
Expand All @@ -24,16 +25,34 @@ public AutoAttr(int pxVal, int baseWidth, int baseHeight)
public void apply(View view)
{

boolean log = view.getTag() != null && view.getTag().toString().equals("auto");

if (log)
{
L.e(" pxVal = " + pxVal +" ," + this.getClass().getSimpleName());
}
int val;
if (useDefault())
{
val = defaultBaseWidth() ? getPercentWidthSize() : getPercentHeightSize();
if (log)
{
L.e(" useDefault val= " + val);
}
} else if (baseWidth())
{
val = getPercentWidthSize();
if (log)
{
L.e(" baseWidth val= " + val);
}
} else
{
val = getPercentHeightSize();
if (log)
{
L.e(" baseHeight val= " + val);
}
}
execute(view, val);
}
Expand All @@ -56,7 +75,7 @@ protected boolean baseWidth()

protected boolean useDefault()
{
return !contains(baseHeight, attrVal()) || !contains(baseWidth, attrVal());
return !contains(baseHeight, attrVal()) && !contains(baseWidth, attrVal());
}

protected boolean contains(int baseVal, int flag)
Expand Down
1 change: 0 additions & 1 deletion sample/src/main/res/layout/activity_square.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
android:layout_marginRight="20px"
android:background="#44ff0000"
android:gravity="center"
android:tag="auto"
android:text=""
app:layout_auto_basewidth="height"/>

Expand Down

0 comments on commit d37260e

Please sign in to comment.