Skip to content

Commit

Permalink
Update sample
Browse files Browse the repository at this point in the history
  • Loading branch information
rengwuxian committed Mar 29, 2015
1 parent 714eaf1 commit c77141c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ private void initSetErrorEt() {
setErrorBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomTextEt.setError("1-Line Error!");
bottomTextEt.setError("1-line Error!");
}
});
final Button setError2Bt = (Button) findViewById(R.id.setError2Bt);
setError2Bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomTextEt.setError("2-Line\nError!");
bottomTextEt.setError("2-line\nError!");
}
});
final Button setError3Bt = (Button) findViewById(R.id.setError3Bt);
Expand All @@ -66,28 +66,6 @@ public void onClick(View v) {
bottomTextEt.setError("So Many Errors! So Many Errors! So Many Errors! So Many Errors! So Many Errors! So Many Errors! So Many Errors! So Many Errors!");
}
});
final EditText bottomTextWithMinLinesEt = (EditText) findViewById(R.id.bottomTextWithMinLinesEt);
final Button setErrorWithMinLinesBt = (Button) findViewById(R.id.setErrorWithMinLinesBt);
setErrorWithMinLinesBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomTextWithMinLinesEt.setError("1-Line Error!");
}
});
final Button setErrorWithMinLines2Bt = (Button) findViewById(R.id.setErrorWithMinLines2Bt);
setErrorWithMinLines2Bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomTextWithMinLinesEt.setError("2-Line\nError!");
}
});
final Button setErrorWithMinLines3Bt = (Button) findViewById(R.id.setErrorWithMinLines3Bt);
setErrorWithMinLines3Bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomTextWithMinLinesEt.setError("So Many Errors! So Many Errors! So Many Errors! So Many Errors! So Many Errors! So Many Errors! So Many Errors! So Many Errors!");
}
});
}

private void initValidationEt() {
Expand Down
5 changes: 5 additions & 0 deletions sample/src/main/res/color/text_color.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#ff0000" android:state_enabled="false"/>
<item android:color="@color/accent_material_light"/>
</selector>
94 changes: 34 additions & 60 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Basic"
app:met_underlineColor="@android:color/holo_purple"/>
android:textColor="@color/text_color"/>

<Button
android:id="@+id/enableBt"
Expand Down Expand Up @@ -275,14 +275,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Helper/Error Text with Min Lines Count:"
android:text="Validation:"
android:textColor="#333333"
android:textSize="14sp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="app:met_helperText=&quot;helper is here&quot;\napp:met_minBottomTextLines=&quot;2&quot; (in xml)\nsetError(&quot;Error!&quot;) (in java)"
android:text="addValidator(new RegexValidator(&quot;Only Integer Valid!&quot;, &quot;\\\\d+&quot;)); (in java)"
android:textColor="#888888"
android:textSize="14sp" />

Expand All @@ -292,83 +292,73 @@
android:gravity="center_vertical">

<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/bottomTextWithMinLinesEt"
android:id="@+id/validationEt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Helper/Error Text"
app:met_helperText="helper is here"
app:met_minBottomTextLines="2" />

<Button
android:id="@+id/setErrorWithMinLinesBt"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="1" />

<Button
android:id="@+id/setErrorWithMinLines2Bt"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="2" />
android:hint="Validation"
app:met_helperText="Integer" />

<Button
android:id="@+id/setErrorWithMinLines3Bt"
android:layout_width="48dp"
android:id="@+id/validateBt"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="3" />
android:text="VALIDATE" />

</LinearLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Custom Base/Primary/Error/HelperText Color:"
android:text="Custom Colors:"
android:textColor="#333333"
android:textSize="14sp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="app:met_baseColor=&quot;#009688&quot;\napp:met_primaryColor=&quot;#2196F3&quot;\napp:met_errorColor=&quot;#ddaa00&quot;\napp:met_helperTextColor=&quot;#795548&quot;"
android:text="app:met_baseColor=&quot;#007688&quot;\napp:met_primaryColor=&quot;#2196F3&quot;\napp:met_textColor=&quot;@color/text_color&quot;\napp:met_textColorHint=&quot;#33ff0000&quot;\napp:met_errorColor=&quot;#ddaa00&quot;\napp:met_helperTextColor=&quot;#795548&quot;\napp:met_underlineColor=&quot;#003587&quot;\napp:met_floatingLabelTextColor=&quot;#8805ad&quot;"
android:textColor="#888888"
android:textSize="14sp" />

<com.rengwuxian.materialedittext.MaterialEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Custom Colors"
app:met_baseColor="#009688"
app:met_errorColor="#ddaa00"
app:met_floatingLabel="highlight"
app:met_floatingLabel="normal"
app:met_helperText="Helper Text"
app:met_helperTextColor="#795548"
app:met_maxCharacters="5"
app:met_primaryColor="#2196F3" />
app:met_baseColor="#007688"
app:met_primaryColor="#2196F3"
app:met_textColor="@color/text_color"
app:met_textColorHint="#33ff0000"
app:met_errorColor="#ddaa00"
app:met_helperTextColor="#795548"
app:met_underlineColor="#003587"
app:met_floatingLabelTextColor="#8805ad"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Custom Accent Typeface:"
android:text="Custom Typeface:"
android:textColor="#333333"
android:textSize="14sp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="app:met_floatingLabel=&quot;normal&quot;\napp:met_helperText=&quot;Helper Text&quot;\napp:met_maxCharacters=&quot;5&quot;\napp:met_accentTypeface=&quot;fonts/Roboto-LightItalic.ttf&quot;"
android:text="app:met_typeface=&quot;fonts/Roboto-LightItalic.ttf&quot;\napp:met_accentTypeface=&quot;fonts/Roboto-LightItalic.ttf&quot;"
android:textColor="#888888"
android:textSize="14sp" />

<com.rengwuxian.materialedittext.MaterialEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Custom Accent Typeface"
app:met_typeface="fonts/Roboto-LightItalic.ttf"
app:met_accentTypeface="fonts/Roboto-LightItalic.ttf"
app:met_floatingLabel="normal"
app:met_helperText="Helper Text"
Expand Down Expand Up @@ -399,61 +389,45 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Material Design Icon"
android:text="Clear Button"
android:textColor="#333333"
android:textSize="14sp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="app:met_iconLeft=&quot;@drawable/ic_phone&quot;\napp:met_iconPadding=&quot;0dp&quot; (Note: 8dp by default, not 0)"
android:text="app:met_clearButton=&quot;true&quot;"
android:textColor="#888888"
android:textSize="14sp" />

<com.rengwuxian.materialedittext.MaterialEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Material Design Icon"
app:met_iconLeft="@drawable/ic_phone"
app:met_iconPadding="0dp"
app:met_maxCharacters="5" />
android:hint="Clear Button"
app:met_clearButton="true" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Validation:"
android:text="Material Design Icon"
android:textColor="#333333"
android:textSize="14sp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="app:met_helperText=&quot;Integer&quot; (in xml)\naddValidator(new RegexValidator(&quot;Only Integer Valid!&quot;, &quot;\\\\d+&quot;)); (in java)"
android:text="app:met_iconLeft=&quot;@drawable/ic_phone&quot;\napp:met_iconPadding=&quot;0dp&quot; (Note: 16dp by default, not 0)"
android:textColor="#888888"
android:textSize="14sp" />

<LinearLayout
<com.rengwuxian.materialedittext.MaterialEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">

<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/validationEt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Validation"
app:met_helperText="Integer" />

<Button
android:id="@+id/validateBt"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="VALIDATE" />

</LinearLayout>
android:hint="Material Design Icon"
app:met_iconLeft="@drawable/ic_phone"
app:met_iconPadding="0dp"
app:met_maxCharacters="5" />

</LinearLayout>
</LinearLayout>
Expand Down

0 comments on commit c77141c

Please sign in to comment.