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); } }