Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
EditText: fix bug measure view with null layout params.
Browse files Browse the repository at this point in the history
  • Loading branch information
rey5137 authored and rey5137 committed Jul 25, 2015
1 parent 2eb0b0d commit 223c303
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Material.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="Material" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.github.rey5137" external.system.module.version="1.2.0.5-SNAPSHOT" type="JAVA_MODULE" version="4">
<module external.linked.project.id="Material" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.github.rey5137" external.system.module.version="1.2.0" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down
2 changes: 1 addition & 1 deletion app/app.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=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rey5137" external.system.module.version="1.2.0.5-SNAPSHOT" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rey5137" external.system.module.version="1.2.0" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.rey.material.demo"
minSdkVersion 9
targetSdkVersion 21
versionCode 3
versionName "0.0.3"
versionCode 5
versionName "0.0.5"
}

signingConfigs {
Expand Down
2 changes: 1 addition & 1 deletion lib/lib.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=":lib" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rey5137" external.system.module.version="1.2.0.5-SNAPSHOT" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":lib" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rey5137" external.system.module.version="1.2.0" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down
8 changes: 4 additions & 4 deletions lib/src/main/java/com/rey/material/widget/EditText.java
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int supportWidth = 0;
int supportHeight = 0;

if(mLabelView != null){
if(mLabelView != null && mLabelView.getLayoutParams() != null){
mLabelView.measure(tempWidthSpec, tempHeightSpec);
labelWidth = mLabelView.getMeasuredWidth();
labelHeight = mLabelView.getMeasuredHeight();
Expand All @@ -524,7 +524,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
inputWidth = mInputView.getMeasuredWidth();
inputHeight = mInputView.getMeasuredHeight();

if(mSupportView != null){
if(mSupportView != null && mSupportView.getLayoutParams() != null){
mSupportView.measure(tempWidthSpec, tempHeightSpec);
supportWidth = mSupportView.getMeasuredWidth();
supportHeight = mSupportView.getMeasuredHeight();
Expand Down Expand Up @@ -560,12 +560,12 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(width, height);

tempWidthSpec = MeasureSpec.makeMeasureSpec(width - getPaddingLeft() - getPaddingRight(), MeasureSpec.EXACTLY);
if(mLabelView != null)
if(mLabelView != null && mLabelView.getLayoutParams() != null)
mLabelView.measure(tempWidthSpec, tempHeightSpec);

mInputView.measure(tempWidthSpec, tempHeightSpec);

if(mSupportView != null)
if(mSupportView != null && mSupportView.getLayoutParams() != null)
mSupportView.measure(tempWidthSpec, tempHeightSpec);
}

Expand Down

0 comments on commit 223c303

Please sign in to comment.