Skip to content

Commit

Permalink
1.3.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rengwuxian committed Nov 13, 2014
1 parent 44447bf commit 80f5108
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion MaterialEditText.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.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.rengwuxian.materialedittext" external.system.module.version="1.2.1" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.rengwuxian.materialedittext" external.system.module.version="1.3.0" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=1.2.1
VERSION_CODE=10
VERSION_NAME=1.3.0
VERSION_CODE=12
GROUP=com.rengwuxian.materialedittext

POM_DESCRIPTION=Android EditText in Material Design
Expand Down
2 changes: 1 addition & 1 deletion library/library.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.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.rengwuxian.materialedittext" external.system.module.version="1.2.1" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.rengwuxian.materialedittext" 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.rengwuxian.materialedittext;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
Expand Down Expand Up @@ -143,7 +144,8 @@ public MaterialEditText(Context context, AttributeSet attrs, int style) {

TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MaterialEditText);
baseColor = typedArray.getColor(R.styleable.MaterialEditText_baseColor, Color.BLACK);
setTextColor(baseColor & 0x00ffffff | 0xdf000000);
ColorStateList colorStateList = new ColorStateList(new int[][] {new int[] {android.R.attr.state_enabled}, EMPTY_STATE_SET}, new int[] {baseColor & 0x00ffffff | 0xdf000000, baseColor & 0x00ffffff | 0x44000000});
setTextColor(colorStateList);

primaryColor = typedArray.getColor(R.styleable.MaterialEditText_primaryColor, baseColor);
setFloatingLabelInternal(typedArray.getInt(R.styleable.MaterialEditText_floatingLabel, 0));
Expand Down Expand Up @@ -380,7 +382,13 @@ protected void onDraw(@NonNull Canvas canvas) {

// draw the background
float lineStartY = getHeight() - getPaddingBottom() + innerComponentsSpacing;
if (hasFocus()) {
if (!isEnabled()) { // disabled
paint.setColor(baseColor & 0x00ffffff | 0x44000000);
float interval = getPixel(1);
for (float startX = 0; startX < getWidth(); startX += interval * 3) {
canvas.drawRect(getScrollX() + startX, lineStartY, getScrollX() + startX + interval, lineStartY + getPixel(1), paint);
}
} else if (hasFocus()) { // focused
if (isExceedingMaxCharacters()) {
paint.setColor(errorColor);
} else {
Expand All @@ -398,7 +406,7 @@ protected void onDraw(@NonNull Canvas canvas) {
String text = getText().length() + " / " + maxCharacters;
canvas.drawText(text, getWidth() + getScrollX() - paint.measureText(text), lineStartY + innerComponentsSpacing + relativeHeight, paint);
}
} else {
} else { // normal
paint.setColor(baseColor);
canvas.drawRect(getScrollX(), lineStartY, getWidth() + getScrollX(), lineStartY + getPixel(1), paint);
}
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.rengwuxian.materialedittext:library:1.2.1'
compile 'com.rengwuxian.materialedittext:library:1.3.0'
// compile project(':library')
}
4 changes: 2 additions & 2 deletions sample/sample.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.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.rengwuxian.materialedittext" external.system.module.version="1.2.1" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.rengwuxian.materialedittext" 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 Expand Up @@ -85,7 +85,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
<orderEntry type="library" exported="" name="library-1.2.1" level="project" />
<orderEntry type="library" exported="" name="library-1.3.0" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
</component>
Expand Down

0 comments on commit 80f5108

Please sign in to comment.