Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
update readme
  • Loading branch information
zillachan committed Sep 18, 2017
1 parent 60b3830 commit 0d61e9e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,37 @@ repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.zillachan:ValiZilla:0.1'
compile 'com.github.zillachan:ValiZilla:1.0'
}
```
Example
```
public class MainActivity extends AppCompatActivity {
@Reg(error = R.string.reg_error,reg = "^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$")
@NotNull(error = R.string.input_need)
@BindView(R.id.inputLayout)
TextInputLayout inputLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
}
@OnClick(R.id.button)
public void onViewClicked() {
ValiZilla.vali(this);
}
@ValiSuccess
void onValiSuccess(){
Toast.makeText(this,R.string.vali_success,Toast.LENGTH_LONG).show();
}
}
```
## Step1
Inject your TextInputLayout with @NotNull or @Reg

Expand All @@ -22,4 +49,5 @@ Inject your callback method with @ValidSuccess

## Setp3

Call ValiZilla.vali(Object target);
Call ValiZilla.vali(Object target);

6 changes: 0 additions & 6 deletions example/src/main/java/pub/zilla/example/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import android.os.Bundle;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.EditText;
import android.widget.Toast;

import butterknife.BindView;
Expand All @@ -17,10 +15,6 @@

public class MainActivity extends AppCompatActivity {


@BindView(R.id.editText)
EditText editText;

@Reg(error = R.string.reg_error,reg = "^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$")
@NotNull(error = R.string.input_need)
@BindView(R.id.inputLayout)
Expand Down

0 comments on commit 0d61e9e

Please sign in to comment.