Skip to content

Commit

Permalink
更新readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ooftf committed Jan 7, 2018
1 parent 1788013 commit dff1f80
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
60 changes: 40 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,53 @@
# OperationEditTextLayout
在EditText右侧选择性添加密显按钮和删除按钮
# 效果图
## 效果图
![](https://github.com/ooftf/OperationEditTextLayout/raw/master/demoImage/demo.gif)
# Gradle配置
## Gradle配置
```groovy
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.ooftf:OperationEditTextLayout:1.0.2'
compile 'com.github.ooftf:OperationEditTextLayout:1.0.3'
}
```
# 使用方式
1.当OperationEditTextLayout只是一个EditText节点的时候
## 使用方式
* 1.使用OperationEditText
```xml
<com.ooftf.operation.OperationEditText
android:layout_width="match_parent"
android:layout_height="48dp"
android:paddingLeft="16dp"
app:oet_delEnabled="true"
app:oet_drawableMargin="8dp"
app:oet_maskEnabled="false" />
```
* 2.当OperationEditTextLayout只是一个EditText节点的时候
```xml
<com.ooftf.operation.OperationEditTextLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:delOperationEnabled="true"
app:maskOperationEnabled="true">

app:oetl_delEnabled="true"
app:oetl_maskEnabled="true">
<EditText
android:layout_width="match_parent"
android:layout_height="@dimen/layout_item_height"
android:hint="请输入密码"
android:paddingLeft="@dimen/layout_edge_spacing" />
</com.ooftf.operation.OperationEditTextLayout>
```
2.当OperationEditTextLayout在不止只有EditText节点的时候可以使用 editTextId 指定EditText
* 3.当OperationEditTextLayout在不止只有EditText节点的时候可以使用 editTextId 指定EditText
```xml
<com.ooftf.operation.OperationEditTextLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:delOperationEnabled="true"
app:editTextId="@+id/pwd"
app:maskOperationEnabled="true">
app:oetl_delEnabled="true"
app:oetl_editTextId="@+id/pwd"
app:oetl_maskEnabled="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
Expand All @@ -51,13 +60,24 @@ dependencies {
</LinearLayout>
</com.ooftf.operation.OperationEditTextLayout>
```
# XML属性
## OperationEditTextLayout XML属性
|属性名|描述|默认值|
|---|---|---|
|oetl_drawableShow|显示密码icon id |参照效果图|
|oetl_drawableHide|隐藏密码icon id |参照效果图|
|oetl_drawableDel|清除密码icon id |参照效果图|
|oetl_maskEnabled|是否开启密显转换功能 |false|
|oetl_delEnabled|是否开启清除功能 |false|
|oetl_editTextId|指定EditText ||
|oetl_paddingRight|设置图标的右边距 (由于图标本身带有5dp的padding值,所以即使oprationPaddingRight设置为0,视觉上还会有5dp的距离)|0|
## OperationEditText XML属性
|属性名|描述|默认值|
|---|---|---|
|icon_show|显示密码icon id |参照效果图|
|icon_hide|隐藏密码icon id |参照效果图|
|icon_del|清除密码icon id |参照效果图|
|maskOperationEnabled|是否开启密显转换功能 |false|
|delOperationEnabled|是否开启清除功能 |false|
|editTextId|指定EditText ||
|oprationPaddingRight|设置图标的右边距 (由于图标本身带有5dp的padding值,所以即使oprationPaddingRight设置为0,视觉上还会有5dp的距离)|0|
|oet_drawableShow|显示密码icon id |参照效果图|
|oet_drawableHide|隐藏密码icon id |参照效果图|
|oet_drawableDel|清除密码icon id |参照效果图|
|oet_delDrawableSize| 清除图标的大小 ||
|oet_maskDrawableSize|密显图标的大小 ||
|oet_drawableMargin|清除图标和密显转换图标之间的距离|8dp|
|oet_maskEnabled|是否开启密显转换功能 |false|
|oet_delEnabled|是否开启清除功能 |false|
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class OperationEditTextLayout : RelativeLayout {
maskOperationEnabled = attrsArray.getBoolean(R.styleable.OperationEditTextLayout_oetl_maskEnabled, maskOperationEnabled)
delOperationEnabled = attrsArray.getBoolean(R.styleable.OperationEditTextLayout_oetl_delEnabled, delOperationEnabled)
editTextId = attrsArray.getResourceId(R.styleable.OperationEditTextLayout_oetl_editTextId, editTextId)
oprationPaddingRight = attrsArray.getDimension(R.styleable.OperationEditTextLayout_oetl_oprationPaddingRight, oprationPaddingRight)
oprationPaddingRight = attrsArray.getDimension(R.styleable.OperationEditTextLayout_oetl_paddingRight, oprationPaddingRight)
attrsArray.recycle()

}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<attr name="oetl_drawableHide" format="reference" />
<attr name="oetl_drawableShow" format="reference" />
<attr name="oetl_drawableDel" format="reference" />
<attr name="oetl_oprationPaddingRight" format="dimension" />
<attr name="oetl_paddingRight" format="dimension" />
<attr name="oetl_maskEnabled" format="boolean" />
<attr name="oetl_delEnabled" format="boolean" />
<attr name="oetl_editTextId" format="reference" />
Expand Down

0 comments on commit dff1f80

Please sign in to comment.