Browse Source

BaseLib 功能添加

yuwenxinghui 5 years ago
parent
commit
337ea2b8f4

+ 2 - 2
base_library/build.gradle

@@ -87,8 +87,8 @@ dependencies {
     api lib.multidex
 
     //jpush
-    api lib.jpush
-    api lib.jcore
+//    api lib.jpush
+//    api lib.jcore
 
     //room 数据库操作库
     api lib.room

+ 49 - 0
base_library/src/main/java/com/mgtech/base_library/BaseLibApplication.java

@@ -0,0 +1,49 @@
+package com.mgtech.base_library;
+
+import android.app.Application;
+import android.os.Build;
+import android.os.LocaleList;
+import android.text.TextUtils;
+
+import com.mgtech.base_library.contextUtil.ContextUtils;
+import com.mgtech.base_library.router.RouterConfig;
+import com.mgtech.base_library.util.SharePrefUtil;
+import java.util.Locale;
+
+import static com.mgtech.base_library.consts.SharePreConst.LANGUAGE;
+
+/**
+ * @ProjectName: TUA
+ * @Package: com.tennor.base_library
+ * @ClassName: BaseApplication
+ * @Description: BaseApplication
+ * @Author: 牛松涛
+ * @CreateDate: 2020/4/1 11:18
+ * @UpdateUser: 更新者:
+ * @UpdateDate: 2020/4/1 11:18
+ * @UpdateRemark: 更新说明:
+ * @Version: 1.0
+ */
+public class BaseLibApplication extends Application {
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        ContextUtils.initContext(this);
+        setLocale();
+        RouterConfig.init(this,true);
+    }
+
+
+    private void setLocale(){
+        if (!TextUtils.isEmpty(SharePrefUtil.getString(LANGUAGE)))
+            return;
+        Locale locale;
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+            locale = LocaleList.getDefault().get(0);
+        } else {
+            locale = Locale.getDefault();
+        }
+        SharePrefUtil.saveString(LANGUAGE,locale.getLanguage());
+    }
+}

+ 228 - 0
base_library/src/main/java/com/mgtech/base_library/custom/FlowLayout.java

@@ -0,0 +1,228 @@
+package com.mgtech.base_library.custom;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.mgtech.base_library.R;
+
+import java.util.ArrayList;
+
+/**
+ * @ProjectName: ShellApplication
+ * @Package: com.tennor.base_library.custom
+ * @ClassName: FlowLayout
+ * @Description: 流式布局
+ * @Author: 牛松涛
+ * @CreateDate: 2020/5/29 16:41
+ * @UpdateUser: 更新者
+ * @UpdateDate: 2019/5/29 16:41
+ * @UpdateRemark: 更新说明
+ * @Version: 1.0
+ */
+public class FlowLayout extends ViewGroup {
+
+    private int horizontalSpacing = 15;//水平间距
+    private int verticalSpacing = 15;//行与行之间的垂直间距
+
+    //用来存放所有的Line对象
+    private ArrayList<Line> lineList = new ArrayList<>();
+
+    public FlowLayout(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+
+    }
+
+    public FlowLayout(Context context, AttributeSet attrs) {
+        super(context, attrs);
+//        this(context,null,0);
+        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FlowLayout);
+        horizontalSpacing = (int)typedArray.getDimension(R.styleable.FlowLayout_horizontalSpacing,15);
+        verticalSpacing = (int)typedArray.getDimension(R.styleable.FlowLayout_verticalSpacing,15);
+        typedArray.recycle();
+    }
+
+    public FlowLayout(Context context) {
+        super(context);
+//        this(context,null);
+    }
+    /**
+     * 设置水平间距
+     * @param horizontalSpacing
+     */
+    public void setHorizontalSpacing(int horizontalSpacing){
+        this.horizontalSpacing = horizontalSpacing;
+    }
+
+    /**
+     * 设置垂直间距
+     * @param verticalSpacing
+     */
+    public void setVerticalSpacing(int verticalSpacing){
+        this.verticalSpacing = verticalSpacing;
+    }
+
+    /**
+     * 分行:遍历所有的子View,判断哪几个子View在同一行(排座位表)
+     */
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+
+        lineList.clear();
+
+        //1.获取FlowLayout的宽度
+        int width = MeasureSpec.getSize(widthMeasureSpec);
+        //2.获取用于实际比较的宽度,就是除去2边的padding的宽度
+        int noPaddingWidth = width-getPaddingLeft()-getPaddingRight();
+
+        //3.遍历所有的子View,拿子View的宽和noPaddingWidth进行比较
+        Line line = new Line();//准备Line对象
+        for (int i = 0; i < getChildCount(); i++) {
+            View childView = getChildAt(i);
+            childView.measure(0, 0);//保证能够获取到宽高
+
+            //4.如果当前line中木有子View,则不用比较直接放入line中,因为要保证每行至少有一个子View;
+            if(line.getViewList().size()==0){
+                line.addLineView(childView);//直接存入
+            }else if(line.getLineWidth()+horizontalSpacing+childView.getMeasuredWidth()>noPaddingWidth){
+                //5.如果当前line的宽+水平间距+子View的宽大于noPaddingWidth,则child需要换行
+                //需要先存放好之前的line对象,否则会造成丢失
+                lineList.add(line);
+
+                line = new Line();//创建新的Line,
+                line.addLineView(childView);//将当前child放入新的行中
+            }else {
+                //6.说明当前child应该放入当前Line中
+                line.addLineView(childView);
+            }
+
+            //7.如果当前child是最后的子View,那么需要保存最后的line对象
+            if(i==(getChildCount()-1)){
+                lineList.add(line);//保存最后的Line
+            }
+        }
+
+        //for循环结束了,lineList存放了所有的Line,而每个Line又记录了自己行所有的VIew;
+        //计算FLowLayout需要的高度
+        int height = getPaddingTop()+getPaddingBottom();//先计算上下的padding值
+        for (int i = 0; i < lineList.size(); i++) {
+            height += lineList.get(i).getLineHeight();//再加上所有行的高度
+        }
+        height += (lineList.size()-1)*verticalSpacing;//最后加上所有的行间距
+
+        //设置当前控件的宽高,或者向父VIew申请宽高
+        setMeasuredDimension(width, height);
+    }
+    /**
+     * 去摆放所有的子View,让每个人真正的坐到自己的位置上
+     */
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        int paddingLeft = getPaddingLeft();
+        int paddingTop = getPaddingTop();
+        for (int i = 0; i < lineList.size(); i++) {
+            Line line = lineList.get(i);//获取Line对象
+
+            //从第二行开始,每行的top总是比上一行的top多一个行高和垂直间距
+            if(i>0){
+                paddingTop += verticalSpacing+lineList.get(i-1).getLineHeight();
+            }
+
+            ArrayList<View> viewList = line.getViewList();//获取line的view的集合
+
+            //1.获取每行的留白的宽度
+            int remainSpacing = getLineRemainSpacing(line);
+            //2.计算每个view平均得到的值
+            float perSpacing = remainSpacing/viewList.size();
+
+            for (int j = 0; j < viewList.size(); j++) {
+                View childView = viewList.get(j);
+                //3.将得到的perSpacing增加到view的宽度上面
+//                int widthSpec = MeasureSpec.makeMeasureSpec((int) (childView.getMeasuredWidth()+perSpacing),MeasureSpec.EXACTLY);
+                int widthSpec = MeasureSpec.makeMeasureSpec((int) (childView.getMeasuredWidth()), MeasureSpec.EXACTLY);
+                childView.measure(widthSpec,0);
+
+                if(j==0){
+                    //如果是每行的第一行,name直接靠左边摆放
+                    childView.layout(paddingLeft,paddingTop,paddingLeft+childView.getMeasuredWidth(),
+                            paddingTop+childView.getMeasuredHeight());
+                }else {
+                    //如果不是第一个,需要参考前一个view的right
+                    View preView = viewList.get(j-1);
+                    //当前view的left是前一个view的right+水平间距
+                    int left = preView.getRight()+horizontalSpacing;
+                    childView.layout(left, preView.getTop(),left+childView.getMeasuredWidth(),preView.getBottom());
+                }
+            }
+        }
+    }
+    /**
+     * 获取指定line的留白
+     * @param line
+     * @return
+     */
+    private int getLineRemainSpacing(Line line){
+        return getMeasuredWidth()-getPaddingLeft()-getPaddingRight()-line.getLineWidth();
+    }
+
+    /**
+     * 封装每行的数据,包括所有的子View,行的宽高
+     * @author Administrator
+     *
+     */
+    class Line{
+        private ArrayList<View> viewList;//用来存放当前行所有的子View
+        private int width;//表示所有子View的宽+水平间距
+        private int height;//行的高度
+
+        public Line(){
+            viewList = new ArrayList<View>();
+        }
+
+        /**
+         * 记录子VIew
+         * @param child
+         */
+        public void addLineView(View child){
+            if(!viewList.contains(child)){
+                viewList.add(child);
+
+                //1.更新Line的width
+                if(viewList.size()==1){
+                    //说明添加的是第一个子View,那么line的宽就是子view的宽度
+                    width = child.getMeasuredWidth();
+                }else {
+                    //如果添加的不是第一个子View,那么应该加等于水平间距和子VIew的宽度
+                    width += child.getMeasuredWidth()+horizontalSpacing;
+                }
+                //2.更新line的height
+                height = Math.max(height,child.getMeasuredHeight());
+            }
+        }
+
+        /**
+         * 获取当前行的宽度
+         * @return
+         */
+        public int getLineWidth(){
+            return width;
+        }
+        /**
+         * 获取当前行的高度
+         * @return
+         */
+        public int getLineHeight(){
+            return height;
+        }
+        /**
+         * 获取当前行的所有的子View
+         * @return
+         */
+        public ArrayList<View> getViewList(){
+            return viewList;
+        }
+    }
+}
+

+ 80 - 0
base_library/src/main/java/com/mgtech/base_library/custom/HelperEditText.java

@@ -0,0 +1,80 @@
+package com.mgtech.base_library.custom;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputConnection;
+import android.view.inputmethod.InputConnectionWrapper;
+
+import androidx.appcompat.widget.AppCompatEditText;
+
+/**
+ * @ProjectName: Bua
+ * @Package: com.mgtech.base_library.custom
+ * @ClassName: HelperEditText
+ * @Description: 解决AOSP键盘无法监听无内容状态下删除键的问题
+ * @Author: Administrator
+ * @CreateDate: 2020/7/9 13:21
+ * @UpdateUser: 更新者:
+ * @UpdateDate: 2020/7/9 13:21
+ * @UpdateRemark: 更新说明:
+ * @Version: 1.0
+ */
+public class HelperEditText extends AppCompatEditText {
+
+    private OnKeyListener keyListener;
+
+    public HelperEditText(Context context) {
+        super(context);
+    }
+
+    public HelperEditText(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HelperEditText(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    //覆盖输入框和键盘的关联接口
+    @Override
+    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
+        return new MyInputConnection(super.onCreateInputConnection(outAttrs),
+                true);
+    }
+
+
+    private class MyInputConnection extends InputConnectionWrapper {
+
+        public MyInputConnection(InputConnection target, boolean mutable) {
+            super(target, mutable);
+        }
+
+        //覆盖事件传递
+        @Override
+        public boolean sendKeyEvent(KeyEvent event) {
+            if (keyListener != null) {
+                keyListener.onKey(HelperEditText.this, event.getKeyCode(), event);
+            }
+            return super.sendKeyEvent(event);
+        }
+
+        @Override
+        public boolean deleteSurroundingText(int beforeLength, int afterLength) {
+            //在删除时,输入框无内容,或者删除以后输入框无内容
+            if (beforeLength == 1 || afterLength == 0 || beforeLength == 0) {
+                // backspace
+                return sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL))
+                        && sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL));
+            }
+            return super.deleteSurroundingText(beforeLength, afterLength);
+        }
+
+    }
+
+    //设置监听回调
+    public void setDeleteEventListener(OnKeyListener listener) {
+        keyListener = listener;
+    }
+}

+ 368 - 0
base_library/src/main/java/com/mgtech/base_library/custom/VerifyEditText.java

@@ -0,0 +1,368 @@
+package com.mgtech.base_library.custom;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Typeface;
+import android.text.Editable;
+import android.text.InputFilter;
+import android.text.InputType;
+import android.text.TextWatcher;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.EditText;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.Nullable;
+import androidx.core.content.ContextCompat;
+
+import com.mgtech.base_library.R;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ProjectName: Bua
+ * @Package: com.mgtech.base_library.custom
+ * @ClassName: VerifyEditText
+ * @Description: 验证码输入框,可自定义输入框数量,间距,颜色等
+ * @Author: Administrator
+ * @CreateDate: 2020/7/9 13:21
+ * @UpdateUser: 更新者:
+ * @UpdateDate: 2020/7/9 13:21
+ * @UpdateRemark: 更新说明:
+ * @Version: 1.0
+ */
+public class VerifyEditText extends LinearLayout {
+
+    private final int DEFAULT_INPUT_COUNT = 4;
+    private final int DEFAULT_LINE_HEIGHT = 1;
+    private final int DEFAULT_INPUT_SPACE = 15;
+    private final int DEFAULT_LINE_SPACE = 8;
+    private final int DEFAULT_TEXT_SIZE = 60;
+
+    private Context context;
+    private List<HelperEditText> editTextList;
+    private List<View> underlineList;
+    private int currentPosition = 0;
+    private InputCompleteListener inputCompleteListener;
+    private @ColorInt
+    int lineFocusColor = ContextCompat.getColor(getContext(), android.R.color.holo_blue_light);
+    private @ColorInt
+    int lineDefaultColor = ContextCompat.getColor(getContext(), R.color.bg_color);
+    /**
+     * 是否让所有的线都高亮
+     */
+    private boolean isAllLineLight = false;
+    /**
+     * 输入框数量
+     */
+    private int inputCount = DEFAULT_INPUT_COUNT;
+    /**
+     * 下划线高度
+     */
+    private int lineHeight;
+    /**
+     * 输入框间距
+     */
+    private int inputSpace;
+    /**
+     * 和下划线的间距
+     */
+    private int lineSpace;
+    /**
+     * 输入文字大小
+     */
+    private float textSize = DEFAULT_TEXT_SIZE;
+    /**
+     * 光标资源
+     */
+    private @DrawableRes
+    int mCursorDrawable = R.drawable.edit_cursor_shape;
+
+    public VerifyEditText(Context context) {
+        this(context, null);
+    }
+
+    public VerifyEditText(Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public VerifyEditText(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        this.context = context;
+        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.VerifyEditText);
+        inputCount = typedArray.getInteger(R.styleable.VerifyEditText_inputCount, DEFAULT_INPUT_COUNT);
+        lineHeight = (int) typedArray.getDimension(R.styleable.VerifyEditText_underlineHeight, dp2px(DEFAULT_LINE_HEIGHT));
+        inputSpace = (int) typedArray.getDimension(R.styleable.VerifyEditText_inputSpace, dp2px(DEFAULT_INPUT_SPACE));
+        lineSpace = (int) typedArray.getDimension(R.styleable.VerifyEditText_underlineSpace, dp2px(DEFAULT_LINE_SPACE));
+        textSize = typedArray.getDimension(R.styleable.VerifyEditText_mTextSize, DEFAULT_TEXT_SIZE);
+        lineFocusColor = typedArray.getColor(R.styleable.VerifyEditText_focusColor, ContextCompat.getColor(getContext(), android.R.color.holo_blue_light));
+        lineDefaultColor = typedArray.getColor(R.styleable.VerifyEditText_defaultColor, ContextCompat.getColor(getContext(), R.color.bg_color));
+        mCursorDrawable = typedArray.getResourceId(R.styleable.VerifyEditText_cursorDrawable, R.drawable.edit_cursor_shape);
+        typedArray.recycle();
+        initView();
+    }
+
+    private void initView() {
+        if (inputCount <= 0) {
+            return;
+        }
+
+        editTextList = new ArrayList<>();
+        underlineList = new ArrayList<>();
+
+        setOrientation(HORIZONTAL);
+        setGravity(Gravity.CENTER);
+
+        for (int i = 0; i < inputCount; i++) {
+
+            LayoutParams flParams = new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
+            flParams.setMargins(i == 0 ? 0 : inputSpace, 0, 0, 0);
+            FrameLayout frameLayout = new FrameLayout(context);
+            frameLayout.setLayoutParams(flParams);
+
+            FrameLayout.LayoutParams etParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+            HelperEditText editText = new HelperEditText(context);
+            editText.setBackground(null);
+            editText.setPadding(0, 0, 0, lineSpace);
+            editText.setMaxLines(1);
+            editText.setTypeface(Typeface.DEFAULT_BOLD);
+            editText.setTextSize(TypedValue.COMPLEX_UNIT_PX,textSize);
+            InputFilter[] filters = {new InputFilter.LengthFilter(1)};
+            editText.setFilters(filters);
+            editText.setInputType(InputType.TYPE_CLASS_NUMBER);
+            editText.setGravity(Gravity.CENTER);
+            //修改光标的颜色(反射)
+            try {
+                Field f = TextView.class.getDeclaredField("mCursorDrawableRes");
+                f.setAccessible(true);
+                f.set(editText, mCursorDrawable);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            editText.setLayoutParams(etParams);
+            frameLayout.addView(editText);
+
+            FrameLayout.LayoutParams lineParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, lineHeight);
+            lineParams.gravity = Gravity.BOTTOM;
+            View underline = new View(context);
+            underline.setBackgroundColor(ContextCompat.getColor(context, R.color.bg_color));
+            underline.setLayoutParams(lineParams);
+            frameLayout.addView(underline);
+
+            addView(frameLayout);
+            editTextList.add(editText);
+            underlineList.add(underline);
+        }
+
+        TextWatcher textWatcher = new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+            }
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                if (!s.toString().isEmpty() && currentPosition < editTextList.size() - 1) {
+                    currentPosition++;
+                    editTextList.get(currentPosition).requestFocus();
+                }
+                if (isInputComplete() && inputCompleteListener != null) {
+                    inputCompleteListener.inputComplete(VerifyEditText.this, getContent());
+                }
+            }
+        };
+
+        OnFocusChangeListener onFocusChangeListener = (v, hasFocus) -> {
+            for (int i = 0; i < editTextList.size(); i++) {
+                if (editTextList.get(i).isFocused()) {
+                    currentPosition = i;
+                }
+                if (!isAllLineLight) {
+                    underlineList.get(i).setBackgroundColor(lineDefaultColor);
+                }
+            }
+            if (!isAllLineLight) {
+                underlineList.get(currentPosition).setBackgroundColor(lineFocusColor);
+            }
+        };
+
+        OnKeyListener keyListener = (v, keyCode, event) -> {
+            //监听键盘删除键
+            if (keyCode == KeyEvent.KEYCODE_DEL) {
+                //只对ACTION_DOWN进行处理
+                if (event.getAction() != KeyEvent.ACTION_DOWN) {
+                    return true;
+                }
+                if (editTextList.get(currentPosition).getText().toString().isEmpty()) {
+                    if (currentPosition <= 0) {
+                        return true;
+                    }
+                    //跳到前一个不为空的EditText
+                    for (int position = currentPosition; position >= 0; position--) {
+                        currentPosition = position;
+                        if (!editTextList.get(position).getText().toString().isEmpty()) {
+                            break;
+                        }
+                    }
+                }
+                editTextList.get(currentPosition).requestFocus();
+                editTextList.get(currentPosition).getText().clear();
+                return true;
+            }
+            return false;
+        };
+
+        for (HelperEditText et : editTextList) {
+            et.addTextChangedListener(textWatcher);
+            et.setOnFocusChangeListener(onFocusChangeListener);
+            et.setOnKeyListener(keyListener);
+        }
+
+        editTextList.get(0).requestFocus();
+    }
+
+    /**
+     * 获取输入的内容,可能为空
+     *
+     * @return 输入的内容
+     */
+    public String getContent() {
+        if (editTextList == null) {
+            return "";
+        }
+        StringBuilder builder = new StringBuilder();
+        for (HelperEditText et : editTextList) {
+            builder.append(et.getText().toString());
+        }
+        return builder.toString();
+    }
+
+    /**
+     * 是否输入完成
+     *
+     * @return 输入完成boolean
+     */
+    public boolean isInputComplete() {
+        if (editTextList == null) {
+            return false;
+        }
+        for (EditText et : editTextList) {
+            if (et.getText().toString().isEmpty()) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 是否设置所有下划线高亮
+     *
+     * @param flag 标志位
+     */
+    public void setAllLineLight(boolean flag) {
+        isAllLineLight = flag;
+        if (isAllLineLight) {
+            for (View v : underlineList) {
+                v.setBackgroundColor(lineFocusColor);
+            }
+        }
+    }
+
+    /**
+     * 输入完成监听,在afterTextChanged里调
+     */
+    public interface InputCompleteListener {
+        void inputComplete(VerifyEditText et, String content);
+    }
+
+    public void setInputCompleteListener(VerifyEditText.InputCompleteListener inputCompleteListener) {
+        this.inputCompleteListener = inputCompleteListener;
+    }
+
+    public int dp2px(int dp) {
+        return (int) (dp * context.getResources().getDisplayMetrics().density + 0.5f);
+    }
+
+    public int getLineFocusColor() {
+        return lineFocusColor;
+    }
+
+    public void setLineFocusColor(int lineFocusColor) {
+        this.lineFocusColor = lineFocusColor;
+    }
+
+    public int getLineDefaultColor() {
+        return lineDefaultColor;
+    }
+
+    public void setLineDefaultColor(int lineDefaultColor) {
+        this.lineDefaultColor = lineDefaultColor;
+    }
+
+    public int getInputCount() {
+        return inputCount;
+    }
+
+    public void setInputCount(int inputCount) {
+        this.inputCount = inputCount;
+    }
+
+    public int getLineHeight() {
+        return lineHeight;
+    }
+
+    public void setLineHeight(int lineHeight) {
+        this.lineHeight = lineHeight;
+    }
+
+    public int getInputSpace() {
+        return inputSpace;
+    }
+
+    public void setInputSpace(int inputSpace) {
+        this.inputSpace = inputSpace;
+    }
+
+    public int getLineSpace() {
+        return lineSpace;
+    }
+
+    public void setLineSpace(int lineSpace) {
+        this.lineSpace = lineSpace;
+    }
+
+    public float getTextSize() {
+        return textSize;
+    }
+
+    public void setTextSize(float textSize) {
+        this.textSize = textSize;
+    }
+
+    public int getmCursorDrawable() {
+        return mCursorDrawable;
+    }
+
+    public void setmCursorDrawable(int mCursorDrawable) {
+        this.mCursorDrawable = mCursorDrawable;
+    }
+
+    public boolean isAllLineLight() {
+        return isAllLineLight;
+    }
+}

+ 6 - 0
base_library/src/main/res/drawable/edit_cursor_shape.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <size android:width="2dp" />
+    <solid android:color="@android:color/holo_orange_light" />
+</shape>

+ 21 - 0
base_library/src/main/res/values/attrs.xml

@@ -99,4 +99,25 @@
         <attr name="verticalSpacing" format="dimension"/>
     </declare-styleable>
 
+
+
+    <declare-styleable name="VerifyEditText">
+        <!--输入框数量-->
+        <attr name="inputCount" format="integer" />
+        <!--输入框间距-->
+        <attr name="inputSpace" format="dimension" />
+        <!--下划线厚度-->
+        <attr name="underlineHeight" format="dimension" />
+        <!--输入框文本大小-->
+        <attr name="mTextSize" format="dimension" />
+        <!--下划线选中的颜色-->
+        <attr name="focusColor" format="color" />
+        <!--下划线未选中的颜色-->
+        <attr name="defaultColor" format="color" />
+        <!--下划线距文本的距离-->
+        <attr name="underlineSpace" format="dimension" />
+        <!--光标-->
+        <attr name="cursorDrawable" format="reference" />
+    </declare-styleable>
+
 </resources>

+ 1 - 0
base_library/src/main/res/values/dimens.xml

@@ -71,6 +71,7 @@
     <dimen name="sp_24">24sp</dimen>
     <dimen name="sp_25">25sp</dimen>
     <dimen name="sp_26">26sp</dimen>
+    <dimen name="sp_28">28sp</dimen>
     <dimen name="sp_30">30sp</dimen>
     <dimen name="sp_32">32sp</dimen>
     <dimen name="sp_34">34sp</dimen>

+ 1 - 1
base_library/src/main/res/values/styles.xml

@@ -6,7 +6,7 @@
         <item name="windowNoTitle">true</item>
         <item name="android:windowIsTranslucent">false</item>
         <item name="android:windowDisablePreview">true</item>
-        <item name="android:windowBackground">@color/bg_color</item>
+        <item name="android:windowBackground">@color/white</item>
     </style>