Skip to content

Commit

Permalink
Code style unified.
Browse files Browse the repository at this point in the history
  • Loading branch information
rengwuxian committed Jan 17, 2015
1 parent a0c338a commit 8f20a7d
Show file tree
Hide file tree
Showing 19 changed files with 725 additions and 706 deletions.
23 changes: 21 additions & 2 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions build.gradle
@@ -1,25 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
return version.contains("SNAPSHOT") == false
}

allprojects {
version = VERSION_NAME
group = GROUP
version = VERSION_NAME
group = GROUP

repositories {
jcenter()
maven { url 'https://oss.sonatype.org/content/groups/public' }
}
repositories {
jcenter()
maven { url 'https://oss.sonatype.org/content/groups/public' }
}
}

apply plugin: 'android-reporting'
28 changes: 14 additions & 14 deletions library/build.gradle
@@ -1,25 +1,25 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

defaultConfig {
minSdkVersion 7
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
defaultConfig {
minSdkVersion 7
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile 'com.android.support:support-annotations:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-annotations:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:appcompat-v7:21.0.3'
}

// Used to push in maven
Expand Down
Expand Up @@ -7,7 +7,7 @@
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
public ApplicationTest() {
super(Application.class);
}
}
Expand Up @@ -9,20 +9,20 @@
*/
public class MaterialEditTextSetErrorTest extends AndroidTestCase {

private MaterialEditText editTextUnderTest;
private MaterialEditText editTextUnderTest;

@Override
protected void setUp() throws Exception {
super.setUp();
editTextUnderTest = new MaterialEditText(getContext());
}
@Override
protected void setUp() throws Exception {
super.setUp();
editTextUnderTest = new MaterialEditText(getContext());
}

public void testGetErrorReturnsNullIfNoErrorMessageWasSet() {
assertNull(editTextUnderTest.getError());
}
public void testGetErrorReturnsNullIfNoErrorMessageWasSet() {
assertNull(editTextUnderTest.getError());
}

public void testGetErrorReturnsMessageSetEarlierViaSetError() {
editTextUnderTest.setError("Error!");
assertEquals("Error!", editTextUnderTest.getError().toString());
}
public void testGetErrorReturnsMessageSetEarlierViaSetError() {
editTextUnderTest.setError("Error!");
assertEquals("Error!", editTextUnderTest.getError().toString());
}
}
4 changes: 1 addition & 3 deletions library/src/main/AndroidManifest.xml
@@ -1,3 +1 @@
<manifest
package="com.rengwuxian.materialedittext">
</manifest>
<manifest package="com.rengwuxian.materialedittext"/>
Expand Up @@ -8,9 +8,9 @@
* Created by Zhukai on 2014/5/29 0029.
*/
class Density {
public static int dp2px(Context context, float dp) {
Resources r = context.getResources();
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
return (int) px;
}
public static int dp2px(Context context, float dp) {
Resources r = context.getResources();
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
return (int) px;
}
}
Expand Up @@ -9,14 +9,14 @@ public abstract class METValidator {

/**
* Error message that the view will display if validation fails.
*
* <p/>
* This is protected, so you can change this dynamically in your {@link #isValid(CharSequence, boolean)}
* implementation. If necessary, you can also interact with this via its getter and setter.
*/
protected String errorMessage;

public METValidator(@NonNull String errorMessage) {
this.errorMessage = errorMessage;
this.errorMessage = errorMessage;
}

public void setErrorMessage(@NonNull String errorMessage) {
Expand All @@ -31,7 +31,7 @@ public String getErrorMessage() {
/**
* Abstract method to implement your own validation checking.
*
* @param text The CharSequence representation of the text in the EditText field. Cannot be null, but may be empty.
* @param text The CharSequence representation of the text in the EditText field. Cannot be null, but may be empty.
* @param isEmpty Boolean indicating whether or not the text param is empty
* @return True if valid, false if not
*/
Expand Down
54 changes: 27 additions & 27 deletions library/src/main/res/values/attrs.xml
Expand Up @@ -2,48 +2,48 @@
<resources>
<declare-styleable name="MaterialEditText">
<!-- The base color of the line and the texts. Default is black. -->
<attr name="baseColor" format="color"/>
<attr name="baseColor" format="color" />
<!-- The highlight color of the line, and the floating label if the highlightFloatingLabel is true. -->
<attr name="primaryColor" format="color"/>
<attr name="primaryColor" format="color" />
<!-- How the floating label should be shown. Default is none -->
<attr name="floatingLabel">
<enum name="none" value="0"/>
<enum name="normal" value="1"/>
<enum name="highlight" value="2"/>
<enum name="none" value="0" />
<enum name="normal" value="1" />
<enum name="highlight" value="2" />
</attr>
<!-- The color for when something is wrong.(e.g. exceeding max characters) -->
<attr name="errorColor" format="color"/>
<attr name="errorColor" format="color" />
<!-- Min characters count limit. 0 means no limit. -->
<attr name="minCharacters" format="integer"/>
<attr name="minCharacters" format="integer" />
<!-- max Characters count limit. 0 means no limit. -->
<attr name="maxCharacters" format="integer"/>
<attr name="maxCharacters" format="integer" />
<!-- Whether to show the bottom ellipsis in singleLine mode -->
<attr name="singleLineEllipsis" format="boolean"/>
<attr name="singleLineEllipsis" format="boolean" />
<!-- Reserved bottom text lines count, no matter if there is some helper/error text. -->
<attr name="minBottomTextLines" format="integer"/>
<attr name="minBottomTextLines" format="integer" />
<!-- Helper text at the bottom -->
<attr name="helperText" format="string"/>
<attr name="helperText" format="string" />
<!-- Helper text color -->
<attr name="helperTextColor" format="color"/>
<attr name="helperTextColor" format="color" />
<!-- Font of the paint used to draw accent texts -->
<attr name="accentTypeface" format="string"/>
<attr name="accentTypeface" format="string" />
<!-- Custom float label text -->
<attr name="floatingLabelText" format="string"/>
<attr name="floatingLabelText" format="string" />
<!-- spacing between the main text and the floating label -->
<attr name="floatingLabelSpacing" format="dimension"/>
<attr name="floatingLabelSpacing" format="dimension" />
<!-- Hide underline -->
<attr name="hideUnderline" format="boolean"/>
<attr name="hideUnderline" format="boolean" />
<!-- Auto validate -->
<attr name="autoValidate" format="boolean"/>
<!-- Left icon -->
<attr name="iconLeft" format="reference"/>
<!-- Right icon -->
<attr name="iconRight" format="reference"/>
<!-- Padding between icon(s) and the main area. 8dp by default. -->
<attr name="iconPadding" format="dimension"/>
<!-- The floating label's text size. 12sp by default. -->
<attr name="floatingLabelTextSize" format="dimension"/>
<!-- The bottom texts' size. 12sp by default. -->
<attr name="bottomTextSize" format="dimension"/>
<attr name="autoValidate" format="boolean" />
<!-- Left icon -->
<attr name="iconLeft" format="reference" />
<!-- Right icon -->
<attr name="iconRight" format="reference" />
<!-- Padding between icon(s) and the main area. 8dp by default. -->
<attr name="iconPadding" format="dimension" />
<!-- The floating label's text size. 12sp by default. -->
<attr name="floatingLabelTextSize" format="dimension" />
<!-- The bottom texts' size. 12sp by default. -->
<attr name="bottomTextSize" format="dimension" />
</declare-styleable>
</resources>

0 comments on commit 8f20a7d

Please sign in to comment.