diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/FJEditTextCountLib/src/main/java/fj/edittextcount/lib/FJEditTextCount.java b/FJEditTextCountLib/src/main/java/fj/edittextcount/lib/FJEditTextCount.java index 10602df..231a6b8 100644 --- a/FJEditTextCountLib/src/main/java/fj/edittextcount/lib/FJEditTextCount.java +++ b/FJEditTextCountLib/src/main/java/fj/edittextcount/lib/FJEditTextCount.java @@ -117,6 +117,14 @@ public FJEditTextCount setEtMinHeight(int px){ return this; } + /** + * 获取输入内容 + * @return 内容 + */ + public String getText(){ + return etContent.getText().toString(); + } + private TextWatcher mTextWatcher = new TextWatcher() { private int editStart; private int editEnd; diff --git a/README-En.md b/README-En.md deleted file mode 100644 index 5871b6f..0000000 --- a/README-En.md +++ /dev/null @@ -1,46 +0,0 @@ -> ## Example——Customize EditText - ---- - -> ### Preview - -| PERCENTAGE | SINGULAR | -|:-------------:|:-------------:| -| ![PERCENTAGE.gif](http://upload-images.jianshu.io/upload_images/2071764-b45df6bf1d00205e.gif) | ![SINGULAR.gif](http://upload-images.jianshu.io/upload_images/2071764-7be37be47251b7d4.gif) | - -> ### usage: - -1.Quote - - allprojects { - repositories { - ... - maven { url 'https://jitpack.io' } - } - } - dependencies { - compile 'com.github.FJ917:FJEditTextCount:v1.0.1' - } - - -2.xml Add to - - - -2.java Set up - - fjEdit = (FJEditTextCount) findViewById(R.id.fjEdit); - fjEdit.setEtHint("content")//Set prompt text - .setEtMinHeight(200)//Set minimum height in px - .setLength(50)//Set the total number of words - //type(SINGULAR)(PERCENTAGE) - .setType(AnFQNumEditText.SINGULAR) - .setLineColor("#3F51B5")//Setting horizontal color - .show(); - -> #### [blog Address](http://www.jianshu.com/p/383ba123c201) - -> [English](https://github.com/FTandJYQ/AnFQNumEditText/blob/master/README-En.md)|[中文](https://github.com/FTandJYQ/AnFQNumEditText/blob/master/README.md) \ No newline at end of file diff --git a/README.md b/README.md index 77f5379..4561cee 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,15 @@ |:-------------:|:-------------:| | ![百分比类型.gif](http://upload-images.jianshu.io/upload_images/2071764-b45df6bf1d00205e.gif) | ![单数类型.gif](http://upload-images.jianshu.io/upload_images/2071764-7be37be47251b7d4.gif) | -> ### 用法: +> #### 更新1.0.2版本 + +新增获取输入内容的方法: + + fjEdit.getText(); + +> #### 以下1.0.1版本 + +> #### 用法: 1.引用 @@ -42,5 +50,3 @@ .show(); > #### [博客地址](http://www.jianshu.com/p/383ba123c201) - -> [English](https://github.com/FTandJYQ/AnFQNumEditText/blob/master/README-En.md)|[中文](https://github.com/FTandJYQ/AnFQNumEditText/blob/master/README.md) \ No newline at end of file diff --git a/app/src/main/java/fj/edittextcount/test/MainActivity.java b/app/src/main/java/fj/edittextcount/test/MainActivity.java index 9b6ed2f..70d9cfe 100644 --- a/app/src/main/java/fj/edittextcount/test/MainActivity.java +++ b/app/src/main/java/fj/edittextcount/test/MainActivity.java @@ -1,9 +1,13 @@ package fj.edittextcount.test; -import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; import fj.edittextcount.lib.FJEditTextCount; + /** * ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ * ┃ ╭﹉﹊﹉╮ ╔═════╗╔═════╗╔═════╗┃ @@ -18,11 +22,15 @@ public class MainActivity extends AppCompatActivity { private FJEditTextCount fjEdit; + private Button btnGetText; + private TextView tvText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fjEdit = (FJEditTextCount) findViewById(R.id.fjEdit); + btnGetText = (Button) findViewById(R.id.btnGetText); + tvText = (TextView) findViewById(R.id.tvText); fjEdit.setEtHint("内容")//设置提示文字 .setEtMinHeight(200)//设置最小高度,单位px .setLength(50)//设置总字数 @@ -30,5 +38,12 @@ protected void onCreate(Bundle savedInstanceState) { .setType(FJEditTextCount.SINGULAR) .setLineColor("#3F51B5")//设置横线颜色 .show(); + + btnGetText.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + tvText.setText(fjEdit.getText()); + } + }); } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2e68d7e..7273764 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -10,4 +10,16 @@ android:id="@+id/fjEdit" android:layout_width="match_parent" android:layout_height="wrap_content"/> + +