kimi
2021-02-18 749a5510a9f014446a3cd6ba57b3cb0cc8148dc1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
package com.mylhyl.circledialog.params;
 
import android.graphics.Typeface;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.InputType;
import android.view.Gravity;
 
import com.mylhyl.circledialog.res.values.CircleColor;
import com.mylhyl.circledialog.res.values.CircleDimen;
 
/**
 * 输入框参数
 * Created by hupei on 2017/3/31.
 */
public class InputParams implements Parcelable {
 
    public static final Creator<InputParams> CREATOR = new Creator<InputParams>() {
        @Override
        public InputParams createFromParcel(Parcel source) {
            return new InputParams(source);
        }
 
        @Override
        public InputParams[] newArray(int size) {
            return new InputParams[size];
        }
    };
    /**
     * 输入框与body视图的距离 dp
     */
    public int[] margins = CircleDimen.INPUT_MARGINS;
    /**
     * 输入框的高度 dp
     */
    public int inputHeight = CircleDimen.INPUT_HEIGHT;
    /**
     * 输入框提示语
     */
    public String hintText;
    /**
     * 输入框提示语颜色
     */
    public int hintTextColor = CircleColor.INPUT_TEXT_HINT;
    /**
     * 输入框背景资源文件
     */
    public int inputBackgroundResourceId;
    /**
     * 输入框边框线条粗细 dp
     */
    public int strokeWidth = 1;
    /**
     * 输入框边框线条颜色
     */
    public int strokeColor = CircleColor.INPUT_STROKE;
    /**
     * 输入框的背景
     */
    public int inputBackgroundColor;
    /**
     * body视图的背景色
     */
    public int backgroundColor;
    /**
     * 输入框字体大小 sp
     */
    public int textSize = CircleDimen.INPUT_TEXT_SIZE;
    /**
     * 输入框字体颜色 rgb
     */
    public int textColor = CircleColor.INPUT_TEXT;
    /**
     * 输入类型
     */
    public int inputType = InputType.TYPE_NULL;
    /**
     * 文字对齐方式,默认左上角
     */
    public int gravity = Gravity.LEFT | Gravity.TOP;
    /**
     * 文本
     */
    public String text;
    /**
     * 内间距 [left, top, right, bottom] dp
     */
    public int[] padding = CircleDimen.INPUT_PADDING;
    /**
     * 字样式
     * {@linkplain Typeface#NORMAL NORMAL}
     * {@linkplain Typeface#BOLD BOLD}
     * {@linkplain Typeface#ITALIC ITALIC}
     * {@linkplain Typeface#BOLD_ITALIC BOLD_ITALIC}
     */
    public int styleText = Typeface.NORMAL;
    /**
     * 输入框限制字符数量,如counter=50:中(占2个)英(1个)文总字符数
     */
    public int maxLen;
    /**
     * 计数器外边距 [右,下] dp
     */
    public int[] counterMargins = CircleDimen.INPUT_COUNTER_MARGINS;
    /**
     * 计数器字体颜色值 rgb
     */
    public int counterColor = CircleColor.INPUT_COUNTER_TEXT;
    /**
     * 显示软键盘
     */
    public boolean showSoftKeyboard;
    /**
     * 是否禁止输入表情
     */
    public boolean isEmojiInput;
    /**
     * 输入限制计数器中文是否算1个字符
     */
    public boolean isCounterAllEn;
 
    public InputParams() {
    }
 
    protected InputParams(Parcel in) {
        this.margins = in.createIntArray();
        this.inputHeight = in.readInt();
        this.hintText = in.readString();
        this.hintTextColor = in.readInt();
        this.inputBackgroundResourceId = in.readInt();
        this.strokeWidth = in.readInt();
        this.strokeColor = in.readInt();
        this.inputBackgroundColor = in.readInt();
        this.backgroundColor = in.readInt();
        this.textSize = in.readInt();
        this.textColor = in.readInt();
        this.inputType = in.readInt();
        this.gravity = in.readInt();
        this.text = in.readString();
        this.padding = in.createIntArray();
        this.styleText = in.readInt();
        this.maxLen = in.readInt();
        this.counterMargins = in.createIntArray();
        this.counterColor = in.readInt();
        this.showSoftKeyboard = in.readByte() != 0;
        this.isEmojiInput = in.readByte() != 0;
        this.isCounterAllEn = in.readByte() != 0;
    }
 
    @Override
    public int describeContents() {
        return 0;
    }
 
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeIntArray(this.margins);
        dest.writeInt(this.inputHeight);
        dest.writeString(this.hintText);
        dest.writeInt(this.hintTextColor);
        dest.writeInt(this.inputBackgroundResourceId);
        dest.writeInt(this.strokeWidth);
        dest.writeInt(this.strokeColor);
        dest.writeInt(this.inputBackgroundColor);
        dest.writeInt(this.backgroundColor);
        dest.writeInt(this.textSize);
        dest.writeInt(this.textColor);
        dest.writeInt(this.inputType);
        dest.writeInt(this.gravity);
        dest.writeString(this.text);
        dest.writeIntArray(this.padding);
        dest.writeInt(this.styleText);
        dest.writeInt(this.maxLen);
        dest.writeIntArray(this.counterMargins);
        dest.writeInt(this.counterColor);
        dest.writeByte(this.showSoftKeyboard ? (byte) 1 : (byte) 0);
        dest.writeByte(this.isEmojiInput ? (byte) 1 : (byte) 0);
        dest.writeByte(this.isCounterAllEn ? (byte) 1 : (byte) 0);
    }
}