Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
woxingxiao committed Mar 22, 2017
1 parent 04b0dcb commit 55b003f
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 44 deletions.
85 changes: 41 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,54 @@
[![Download](https://api.bintray.com/packages/woxingxiao/maven/XEditText/images/download.svg)](https://bintray.com/woxingxiao/maven/XEditText/_latestVersion)
[ ![Download](https://api.bintray.com/packages/woxingxiao/maven/xedittext/images/download.svg) ](https://bintray.com/woxingxiao/maven/xedittext/_latestVersion)

[**中文说明**](https://github.com/woxingxiao/XEditText/blob/master/README_zh.md)

##What can I do ?
- Deleting function is available. Click the `drawableRight` icon to clear all contents.
- Insert **separator** automatically during inputting. You can customize the **separator** whatever you want (`""`, `-`, etc.). But you have to set **pattern**, which is kind of a rule you are going to separate the contents.
- Can disable **Emoji** input easily. You don't need to exclude the **Emoji** by yourself in codes anymore.
- `drawableRight` icon, which be called **Marker**, can also be customized. When you do that, for example, you can turn it as an input tips option with a `PopUpWindow` by listening to the **Marker**'s `onMarkerClickListener`.
- iOS style is available. `drawableLeft` and `hint` are both at the center of `EditText` when it has not be focused.
# XEditText
Wrapped common usage of `EditText`.

## Screenshot
***
![demo1](https://github.com/woxingxiao/XEditText/blob/master/screenshots/demo1.gif) ![demo2](https://github.com/woxingxiao/XEditText/blob/master/screenshots/demo2.gif)

##How to use ?
![demo3](https://github.com/woxingxiao/XEditText/blob/master/screenshots/demo3.gif)

###Gradle
## Gradle
```groovy
dependencies{
compile 'com.xw.repo:xedittext:1.0.6@aar'
}
dependencies{
// 'com.xw.repo:xedittext:2.0.0@aar'
compile 'com.xw.repo:xedittext:${LATEST_VERSION}@aar'
}
```

![demo3](https://github.com/woxingxiao/XEditText/blob/master/screenshots/demo3.gif) ![demo4](https://github.com/woxingxiao/XEditText/blob/master/screenshots/demo4.gif)

![demo5](https://github.com/woxingxiao/XEditText/blob/master/screenshots/demo5.gif) ![demo6](https://github.com/woxingxiao/XEditText/blob/master/screenshots/demo6.gif)
***
###Attributes
attr | format | describe
-------- | ---|---
x_separator|String|**separator**, insert automatically during inputting. `""` by default.
x_disableEmoji|boolean|disable **Emoji** or not, `false` by default.
x_customizeMarkerEnable|boolean|customize **Marker** or not, `false` by default.
x_showMarkerTime|enum|set when **Marker** shows, 3 options: `after_input`(by default), `before_input`, `always`
x_iOSStyleEnable|boolean|enable **iOS style** or not, `false` by default.
***
###Methods:
name | describe
-------- | ---
setSeparator(String separator)| what **separator** you want to set.
setHasNoSeparator(boolean hasNoSeparator)| set none **separator** or not, if set `true`, **separator** equals `""`.
setPattern(int[] pattern) |**pattern** is a kind of rules that you want to separate the contents, for example, credit card input: **separator** = `"-"`, **pattern** = `int[]{4,4,4,4}`, result = xxxx-xxxx-xxxx-xxxx.
setRightMarkerDrawable(Drawable drawable)|set `drawable` to replace the default clear icon.When `drawable == null`, **Marker** is invisible.
setRightMarkerDrawableRes(int resId)|set `drawableResId` to replace the default clear icon.
setTextToSeparate(CharSequence c)|set normal strings to `EditText`, then show separated strings according to **separator** and **pattern** you've set already.
getNonSeparatorText()|get none **separator**s contents, no matter you've set **separator** or not.
setOnTextChangeListener(OnTextChangeListener listener)|the same as `EditText`'s addOnTextChangeListener() method.
setDisableEmoji(boolean disableEmoji)|disable **Emoji** or not.
setCustomizeMarkerEnable(boolean customizeMarkerEnable)|customize **Marker** or not.
setOnMarkerClickListener(OnMarkerClickListener markerClickListener)|listen to **Marker**'s `onTouch` event.
setShowMarkerTime(ShowMarkerTime showMarkerTime)|set when the **Marker** shows.
setiOSStyleEnable(boolean iOSStyleEnable)|enable **iOS style** or not.
setMaxLength(int maxLength)|set max length of contents.
## Usage
```xml
<com.xw.repo.XEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="default, just likes EditText"
app:x_disableClear="true"/>

<com.xw.repo.XEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="clear drawable"/>

<com.xw.repo.XEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="default password input"
android:inputType="textPassword"/>

<com.xw.repo.XEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="pwd input, custom drawables"
android:inputType="textPassword"
app:x_clearDrawable="@mipmap/ic_clear" <!--support svg-->
app:x_hidePwdDrawable="@mipmap/ic_hide" <!--support svg-->
app:x_showPwdDrawable="@mipmap/ic_show"/> <!--support svg-->
```
Check the sample for more detail.

###License
## License
```
The MIT License (MIT)
Expand Down
Binary file added screenshots/demo1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/demo2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/demo3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshots/demo4.gif
Binary file not shown.
Binary file removed screenshots/demo5.gif
Binary file not shown.
Binary file removed screenshots/demo6.gif
Binary file not shown.

0 comments on commit 55b003f

Please sign in to comment.