From 4a0f13c969ec6bd05a2910eabcab845bdf60c669 Mon Sep 17 00:00:00 2001 From: chanthuang Date: Tue, 10 Oct 2017 15:44:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20QMUIFloatLayout=20=E5=B1=85=E5=B7=A6?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E6=97=B6=E6=8D=A2=E8=A1=8C=E6=97=B6=E7=9A=84?= =?UTF-8?q?Y=E8=BD=B4=E5=81=8F=E7=A7=BB=E5=80=BC=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20#61?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/qmuiteam/qmui/widget/QMUIFloatLayout.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIFloatLayout.java b/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIFloatLayout.java index f806d7260..79a01a297 100644 --- a/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIFloatLayout.java +++ b/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIFloatLayout.java @@ -300,14 +300,15 @@ private void layoutWithGravityLeft(int parentWidth) { } final int childw = child.getMeasuredWidth(); final int childh = child.getMeasuredHeight(); - lineHeight = Math.max(lineHeight, childh); if (childPositionX + childw > childMaxRight) { + // 换行 childPositionX = getPaddingLeft(); childPositionY += (lineHeight + mChildVerticalSpacing); lineHeight = 0; } child.layout(childPositionX, childPositionY, childPositionX + childw, childPositionY + childh); childPositionX += childw + mChildHorizontalSpacing; + lineHeight = Math.max(lineHeight, childh); } // 如果布局的子View少于childCount,则表示有一些子View不需要布局 From bfa296a30a2eec8f20100cb002d848c194ce5253 Mon Sep 17 00:00:00 2001 From: kayo5994 <330956999@qq.com> Date: Mon, 16 Oct 2017 15:58:38 +0800 Subject: [PATCH 2/2] update: re-weigh priority of custom lint --- qmuidemo/build.gradle | 2 +- qmuilint/build.gradle | 2 +- qmuilintrule/build.gradle | 3 --- .../main/java/com/qmuiteam/qmui/lint/QMUIFWordDetector.java | 2 +- .../java/com/qmuiteam/qmui/lint/QMUIImageScaleDetector.java | 2 +- .../java/com/qmuiteam/qmui/lint/QMUIImageSizeDetector.java | 2 +- .../com/qmuiteam/qmui/lint/QMUIJavaVectorDrawableDetector.java | 2 +- .../com/qmuiteam/qmui/lint/QMUIXmlVectorDrawableDetector.java | 2 +- 8 files changed, 7 insertions(+), 10 deletions(-) diff --git a/qmuidemo/build.gradle b/qmuidemo/build.gradle index 63aaddcf5..472240bfd 100644 --- a/qmuidemo/build.gradle +++ b/qmuidemo/build.gradle @@ -60,7 +60,7 @@ configurations.all { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':qmuilint') -// compile 'com.qmuiteam:qmuilint:1.0.0' +// compile 'com.qmuiteam:qmuilint:1.0.1' compile "com.android.support:appcompat-v7:$supportVersion" compile 'com.jakewharton:butterknife:8.4.0' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' diff --git a/qmuilint/build.gradle b/qmuilint/build.gradle index ac2811a58..97f259ea4 100644 --- a/qmuilint/build.gradle +++ b/qmuilint/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' group = 'com.qmuiteam' -version = "1.0.0" // QMUI Lint 发布到 bintray 的版本号 +version = "1.0.1" // QMUI Lint 发布到 bintray 的版本号 android { compileSdkVersion project.ext.compileSdkVersion diff --git a/qmuilintrule/build.gradle b/qmuilintrule/build.gradle index 7ccab3290..c5f742594 100644 --- a/qmuilintrule/build.gradle +++ b/qmuilintrule/build.gradle @@ -1,8 +1,5 @@ apply plugin: 'java' -sourceCompatibility = "1.7" -targetCompatibility = "1.7" - configurations { lintChecks } diff --git a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIFWordDetector.java b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIFWordDetector.java index 909fadea5..0aaee2ef4 100644 --- a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIFWordDetector.java +++ b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIFWordDetector.java @@ -29,7 +29,7 @@ public class QMUIFWordDetector extends Detector Issue.create("QMUIDontUseTheFWordInLog", "Please, don't use the f word, type something more nicely.", "Do I need to explain this? \uD83D\uDD95", - Category.MESSAGES, 5, Severity.WARNING, + Category.MESSAGES, 2, Severity.WARNING, new Implementation(QMUIFWordDetector.class, Scope.JAVA_FILE_SCOPE)); @Override diff --git a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIImageScaleDetector.java b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIImageScaleDetector.java index 7263741a7..310d429b6 100644 --- a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIImageScaleDetector.java +++ b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIImageScaleDetector.java @@ -28,7 +28,7 @@ public class QMUIImageScaleDetector extends Detector implements Detector.BinaryR Issue.create("QMUIImageSizeDisproportionate", "The size of this image is disproportionate.", "Please check the size of the image, for example, the height and width of the 3x plot should be 1.5 times 2x plot.", - Category.CORRECTNESS, 5, Severity.WARNING, + Category.ICONS, 4, Severity.WARNING, new Implementation(QMUIImageScaleDetector.class, Scope.BINARY_RESOURCE_FILE_SCOPE)); private static final String IGNORE_IMAGE_NIGHT_PNG = ".9.png"; diff --git a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIImageSizeDetector.java b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIImageSizeDetector.java index d437f2750..b4102b31e 100644 --- a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIImageSizeDetector.java +++ b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIImageSizeDetector.java @@ -27,7 +27,7 @@ public class QMUIImageSizeDetector extends Detector implements Detector.BinaryRe Issue.create("QMUIImageSizeInvalid", "The size of this image is not correct.", "Please check the size of the image, for example, the height and width of the 2x plot should be even.", - Category.CORRECTNESS, 5, Severity.WARNING, + Category.ICONS, 2, Severity.WARNING, new Implementation(QMUIImageSizeDetector.class, Scope.BINARY_RESOURCE_FILE_SCOPE)); private static final String IGNORE_IMAGE_NIGHT_PNG = ".9.png"; diff --git a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIJavaVectorDrawableDetector.java b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIJavaVectorDrawableDetector.java index 232f25088..119bd48b8 100644 --- a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIJavaVectorDrawableDetector.java +++ b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIJavaVectorDrawableDetector.java @@ -33,7 +33,7 @@ public class QMUIJavaVectorDrawableDetector extends Detector implements Detector Issue.create("QMUIGetVectorDrawableWithWrongFunction", "Should use the corresponding method to get vector drawable.", "Using the normal method to get the vector drawable will cause a crash on Android versions below 4.0", - Category.ICONS, 2, Severity.ERROR, + Category.CORRECTNESS, 8, Severity.ERROR, new Implementation(QMUIJavaVectorDrawableDetector.class, Scope.JAVA_FILE_SCOPE)); @Override diff --git a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIXmlVectorDrawableDetector.java b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIXmlVectorDrawableDetector.java index 41bba35e2..490feee07 100644 --- a/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIXmlVectorDrawableDetector.java +++ b/qmuilintrule/src/main/java/com/qmuiteam/qmui/lint/QMUIXmlVectorDrawableDetector.java @@ -37,7 +37,7 @@ public class QMUIXmlVectorDrawableDetector extends ResourceXmlDetector { Issue.create("QMUIGetVectorDrawableWithWrongProperty", "Should use the corresponding property to get vector drawable.", "Using the normal property to get the vector drawable will cause a crash on Android versions below 4.0.", - Category.ICONS, 2, Severity.ERROR, + Category.CORRECTNESS, 8, Severity.ERROR, new Implementation(QMUIXmlVectorDrawableDetector.class, Scope.RESOURCE_FILE_SCOPE)); private static final Collection mAttrList = Lists.newArrayList(ATTR_DRAWABLE_LEFT, ATTR_DRAWABLE_RIGHT, ATTR_DRAWABLE_TOP, ATTR_DRAWABLE_BOTTOM);