Commit f3d5c09a authored by 杨秀秀's avatar 杨秀秀

基础搭建

1:XxesitForm添加定义InputType 功能
功能开发
1:完善登陆功能
parent 1eed022f
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" /> <option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/consumer" /> <option value="$PROJECT_DIR$/consumer" />
<option value="$PROJECT_DIR$/dsbridge" />
<option value="$PROJECT_DIR$/hbhbcompany" /> <option value="$PROJECT_DIR$/hbhbcompany" />
<option value="$PROJECT_DIR$/mvvmhabit" /> <option value="$PROJECT_DIR$/mvvmhabit" />
<option value="$PROJECT_DIR$/xxviewlibrary" /> <option value="$PROJECT_DIR$/xxviewlibrary" />
......
...@@ -61,6 +61,7 @@ dependencies { ...@@ -61,6 +61,7 @@ dependencies {
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2' implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation project(path: ':dsbridge')
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
......
...@@ -122,6 +122,10 @@ ...@@ -122,6 +122,10 @@
<activity android:name=".ui.appeallist.AppealListActivity" <activity android:name=".ui.appeallist.AppealListActivity"
android:exported="true"/> android:exported="true"/>
<!--H5展示-->
<activity android:name=".ui.web.CommWabActivity"
android:exported="true"/>
<!-- 适配标准 --> <!-- 适配标准 -->
<meta-data <meta-data
android:name="design_width_in_dp" android:name="design_width_in_dp"
......
package com.xx.merchanthbh.ui.login package com.xx.merchanthbh.ui.login
import android.os.Bundle import android.os.Bundle
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.TextPaint
import android.text.style.ClickableSpan
import android.text.style.ForegroundColorSpan
import android.view.View
import com.xx.merchanthbh.BR import com.xx.merchanthbh.BR
import com.xx.merchanthbh.R import com.xx.merchanthbh.R
import com.xx.merchanthbh.databinding.ActivityLoginBinding
import com.xx.merchanthbh.data.http.requst.LoginRequest import com.xx.merchanthbh.data.http.requst.LoginRequest
import com.xx.merchanthbh.databinding.ActivityLoginBinding
import me.goldze.mvvmhabit.base.BaseActivity import me.goldze.mvvmhabit.base.BaseActivity
class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() { class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
...@@ -23,6 +29,55 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() { ...@@ -23,6 +29,55 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
override fun initData() { override fun initData() {
super.initData() super.initData()
if (viewModel.isAgree)
{
binding.ivLoginAgreement.setImageDrawable(getDrawable(R.mipmap.login_icon_xuanze2))
}else{
binding.ivLoginAgreement.setImageDrawable(getDrawable(R.mipmap.login_icon_xuanze1))
}
binding.ivLoginAgreement.setOnClickListener()
{
if (viewModel.isAgree)
{
viewModel.isAgree=false
binding.ivLoginAgreement.setImageDrawable(getDrawable(R.mipmap.login_icon_xuanze1))
}else{
viewModel.isAgree=true
binding.ivLoginAgreement.setImageDrawable(getDrawable(R.mipmap.login_icon_xuanze2))
}
}
var sp:SpannableStringBuilder= SpannableStringBuilder("我已阅读并同意《用户协议》、《隐私条款》")
// sp.setSpan(ForegroundColorSpan(getColor(R.color.text_grey_blue)),7,20,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
sp.setSpan(object : ClickableSpan() {
override fun onClick(view: View) {
}
override fun updateDrawState(ds: TextPaint) {
ds.setColor(getColor(R.color.text_grey_blue))
ds.isUnderlineText=false
}
},7,13,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
sp.setSpan(object : ClickableSpan() {
override fun onClick(view: View) {
}
override fun updateDrawState(ds: TextPaint) {
ds.setColor(getColor(R.color.text_grey_blue))
ds.isUnderlineText=false
}
},14,20,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
binding.tvLoginAgree.text=sp
} }
......
...@@ -5,6 +5,8 @@ import static me.goldze.mvvmhabit.utils.Utils.Interceptor_TOKEN; ...@@ -5,6 +5,8 @@ import static me.goldze.mvvmhabit.utils.Utils.Interceptor_TOKEN;
import android.app.Application; import android.app.Application;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.ClickableSpan;
import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.databinding.ObservableField; import androidx.databinding.ObservableField;
...@@ -35,6 +37,8 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> { ...@@ -35,6 +37,8 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
//密码的绑定 //密码的绑定
public ObservableField<String> password = new ObservableField<>(""); public ObservableField<String> password = new ObservableField<>("");
public boolean isAgree=false;
public LoginViewModel(@NonNull Application application, LoginRequest model) { public LoginViewModel(@NonNull Application application, LoginRequest model) {
super(application, model); super(application, model);
} }
...@@ -70,13 +74,19 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> { ...@@ -70,13 +74,19 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
public BindingCommand login = new BindingCommand(new BindingAction() { public BindingCommand login = new BindingCommand(new BindingAction() {
@Override @Override
public void call() { public void call() {
if (!isAgree)
{
ToastUtils.showShort("请阅读并同意协议");
return;
}
if (TextUtils.isEmpty(userName.get().toString())) { if (TextUtils.isEmpty(userName.get().toString())) {
ToastUtils.showShort("请输入账号!"); ToastUtils.showShort("请输入账号!");
} else if (TextUtils.isEmpty(password.get().toString())) { } else if (TextUtils.isEmpty(password.get().toString())) {
ToastUtils.showShort("请输入密码!"); ToastUtils.showShort("请输入密码!");
} else { } else {
model.Login(/*userName.get().toString(), password.get().toString()*/"13922222222","123456") model.Login(userName.get().toString(), password.get().toString())
.compose(RxUtils.schedulersTransformer()) //线程调度 .compose(RxUtils.schedulersTransformer()) //线程调度
// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle // .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
.doOnSubscribe(LoginViewModel.this) .doOnSubscribe(LoginViewModel.this)
...@@ -106,6 +116,8 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> { ...@@ -106,6 +116,8 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
public void getuserInfo() { public void getuserInfo() {
model.getUserInfo() model.getUserInfo()
.compose(RxUtils.schedulersTransformer()) //线程调度 .compose(RxUtils.schedulersTransformer()) //线程调度
// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle // .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
......
...@@ -197,6 +197,12 @@ public class MerchantEnterViewModel extends BaseViewModel<MerchantEnterRequst> { ...@@ -197,6 +197,12 @@ public class MerchantEnterViewModel extends BaseViewModel<MerchantEnterRequst> {
*/ */
public void register(View view) public void register(View view)
{ {
if (!pwds.get().equals(registerBody.oPassword.get()))
{
ToastUtils.showShort("两次密码输入不一致!");
return;
}
model.register(registerBody) model.register(registerBody)
.compose(RxUtils.schedulersTransformer()) //线程调度 .compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(MerchantEnterViewModel.this) .doOnSubscribe(MerchantEnterViewModel.this)
......
package com.xx.merchanthbh.ui.web
import android.os.Bundle
import com.xx.merchanthbh.BR
import com.xx.merchanthbh.R
import com.xx.merchanthbh.databinding.ActivityCommWebBinding
import me.goldze.mvvmhabit.base.BaseActivity
class CommWabActivity : BaseActivity<ActivityCommWebBinding, CommWebViewModel>() {
override fun initParam() {
super.initParam()
}
override fun initContentView(savedInstanceState: Bundle?): Int {
return R.layout.activity_comm_web
}
override fun initVariableId(): Int {
return BR.viewModel
}
override fun initData() {
super.initData()
viewModel.url=intent.getStringExtra("url")
viewModel.title.set(intent.getStringExtra("title"))
}
}
\ No newline at end of file
package com.xx.merchanthbh.ui.web;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;
import com.xx.merchanthbh.data.http.BaseRespons;
import me.goldze.mvvmhabit.base.BaseViewModel;
public class CommWebViewModel extends BaseViewModel<BaseRespons> {
public String url="";
public ObservableField<String> title = new ObservableField<>("");
public CommWebViewModel(@NonNull Application application) {
super(application);
}
}
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:binding="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="com.xx.merchanthbh.ui.web.CommWebViewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_grey"
android:fitsSystemWindows="true"
android:orientation="vertical">
<com.xx.xxviewlibrary.witget.XxBar
android:layout_width="match_parent"
android:layout_height="55dp"
app:bar_title='@{@string/appeal_manager}' />
<wendu.dsbridge.DWebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/web_comm"/>
</LinearLayout>
</layout>
\ No newline at end of file
...@@ -145,10 +145,11 @@ ...@@ -145,10 +145,11 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="14sp" android:textSize="14sp"
android:text="我已阅读并同意《用户协议》、《隐私条款》以及《中国移动认证服务条款》" android:text="我已阅读并同意《用户协议》、《隐私条款》"
app:layout_constraintLeft_toRightOf="@+id/iv_login_agreement" app:layout_constraintLeft_toRightOf="@+id/iv_login_agreement"
android:layout_marginLeft="7dp" android:layout_marginLeft="7dp"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
android:id="@+id/tv_login_agree"
app:layout_constraintTop_toTopOf="@+id/iv_login_agreement"/> app:layout_constraintTop_toTopOf="@+id/iv_login_agreement"/>
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
ed_content="@={viewModel.registerBody.oPassword}" ed_content="@={viewModel.registerBody.oPassword}"
app:inputType="textPassword"
ed_title='@{"登录密码"}' ed_title='@{"登录密码"}'
/> />
<com.xx.xxviewlibrary.witget.XxFormEdit <com.xx.xxviewlibrary.witget.XxFormEdit
...@@ -83,6 +84,7 @@ ...@@ -83,6 +84,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
ed_title='@{"确认密码"}' ed_title='@{"确认密码"}'
ed_content="@={viewModel.pwds}" ed_content="@={viewModel.pwds}"
app:inputType="textPassword"
app:isBottom="true" app:isBottom="true"
/> />
......
...@@ -59,6 +59,7 @@ dependencies { ...@@ -59,6 +59,7 @@ dependencies {
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2' implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation project(path: ':dsbridge')
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
......
...@@ -57,6 +57,7 @@ dependencies { ...@@ -57,6 +57,7 @@ dependencies {
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2' implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation project(path: ':dsbridge')
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
......
package com.xx.hbhbcompany.ui.login package com.xx.hbhbcompany.ui.login
import android.os.Bundle import android.os.Bundle
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.TextPaint
import android.text.style.ClickableSpan
import android.view.View
import com.xx.hbhbcompany.R import com.xx.hbhbcompany.R
import com.xx.hbhbcompany.BR import com.xx.hbhbcompany.BR
import com.xx.hbhbcompany.data.http.requst.LoginRequest import com.xx.hbhbcompany.data.http.requst.LoginRequest
...@@ -23,6 +28,55 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() { ...@@ -23,6 +28,55 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
override fun initData() { override fun initData() {
super.initData() super.initData()
if (viewModel.isAgree)
{
binding.ivLoginAgreement.setImageDrawable(getDrawable(R.mipmap.login_icon_xuanze2))
}else{
binding.ivLoginAgreement.setImageDrawable(getDrawable(R.mipmap.login_icon_xuanze1))
}
binding.ivLoginAgreement.setOnClickListener()
{
if (viewModel.isAgree)
{
viewModel.isAgree=false
binding.ivLoginAgreement.setImageDrawable(getDrawable(R.mipmap.login_icon_xuanze1))
}else{
viewModel.isAgree=true
binding.ivLoginAgreement.setImageDrawable(getDrawable(R.mipmap.login_icon_xuanze2))
}
}
var sp: SpannableStringBuilder = SpannableStringBuilder("我已阅读并同意《用户协议》、《隐私条款》")
// sp.setSpan(ForegroundColorSpan(getColor(R.color.text_grey_blue)),7,20,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
sp.setSpan(object : ClickableSpan() {
override fun onClick(view: View) {
}
override fun updateDrawState(ds: TextPaint) {
ds.setColor(getColor(R.color.text_grey_blue))
ds.isUnderlineText=false
}
},7,13, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
sp.setSpan(object : ClickableSpan() {
override fun onClick(view: View) {
}
override fun updateDrawState(ds: TextPaint) {
ds.setColor(getColor(R.color.text_grey_blue))
ds.isUnderlineText=false
}
},14,20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
binding.tvLoginAgree.text=sp
} }
......
...@@ -35,6 +35,7 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> { ...@@ -35,6 +35,7 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
//密码的绑定 //密码的绑定
public ObservableField<String> password = new ObservableField<>(""); public ObservableField<String> password = new ObservableField<>("");
public boolean isAgree=false;
public LoginViewModel(@NonNull Application application, LoginRequest model) { public LoginViewModel(@NonNull Application application, LoginRequest model) {
super(application, model); super(application, model);
} }
...@@ -52,6 +53,13 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> { ...@@ -52,6 +53,13 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
public BindingCommand login = new BindingCommand(new BindingAction() { public BindingCommand login = new BindingCommand(new BindingAction() {
@Override @Override
public void call() { public void call() {
if (!isAgree)
{
ToastUtils.showShort("请阅读并同意协议");
return;
}
if (TextUtils.isEmpty(userName.get().toString())) { if (TextUtils.isEmpty(userName.get().toString())) {
ToastUtils.showShort("请输入账号!"); ToastUtils.showShort("请输入账号!");
......
...@@ -134,9 +134,9 @@ ...@@ -134,9 +134,9 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="14sp" android:textSize="14sp"
android:text="我已阅读并同意《用户协议》、《隐私条款》以及《中国移动认证服务条款》"
app:layout_constraintLeft_toRightOf="@+id/iv_login_agreement" app:layout_constraintLeft_toRightOf="@+id/iv_login_agreement"
android:layout_marginLeft="7dp" android:layout_marginLeft="7dp"
android:id="@+id/tv_login_agree"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/iv_login_agreement"/> app:layout_constraintTop_toTopOf="@+id/iv_login_agreement"/>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
<color name="black">#222222</color> <color name="black">#222222</color>
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<color name="line_grey">#eeeeee</color> <color name="line_grey">#eeeeee</color>
<color name="text_grey_blue">#6076A6</color>
<color name="bg_grey">#F5F5F5</color> <color name="bg_grey">#F5F5F5</color>
<color name="light_blue_50">#FFE1F5FE</color> <color name="light_blue_50">#FFE1F5FE</color>
......
...@@ -157,6 +157,7 @@ public class BaseViewModel<M extends BaseModel> extends AndroidViewModel impleme ...@@ -157,6 +157,7 @@ public class BaseViewModel<M extends BaseModel> extends AndroidViewModel impleme
{ {
Map<String, Object> photomap = new HashMap<>(); Map<String, Object> photomap = new HashMap<>();
photomap.put("hasCamera", hasCamera); photomap.put("hasCamera", hasCamera);
photomap.put("maxCount", 1);
if (callback != null) { if (callback != null) {
photomap.put("callBack", callback); photomap.put("callBack", callback);
} }
......
...@@ -22,3 +22,4 @@ include ':app', ':mvvmhabit' ...@@ -22,3 +22,4 @@ include ':app', ':mvvmhabit'
include ':xxviewlibrary' include ':xxviewlibrary'
include ':hbhbcompany' include ':hbhbcompany'
include ':consumer' include ':consumer'
include ':dsbridge'
...@@ -65,4 +65,5 @@ dependencies { ...@@ -65,4 +65,5 @@ dependencies {
api rootProject.ext.dependencies["SmartRefreshBase"] api rootProject.ext.dependencies["SmartRefreshBase"]
api rootProject.ext.dependencies["SmartRefreshHeader"] api rootProject.ext.dependencies["SmartRefreshHeader"]
api rootProject.ext.dependencies["SmartRefreshFooter"] api rootProject.ext.dependencies["SmartRefreshFooter"]
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.xx.xxviewlibrary.witget ...@@ -3,6 +3,7 @@ package com.xx.xxviewlibrary.witget
import android.content.Context import android.content.Context
import android.content.res.TypedArray import android.content.res.TypedArray
import android.text.Editable import android.text.Editable
import android.text.InputType
import android.text.TextUtils import android.text.TextUtils
import android.text.TextWatcher import android.text.TextWatcher
import android.util.AttributeSet import android.util.AttributeSet
...@@ -17,6 +18,7 @@ import androidx.databinding.InverseBindingAdapter ...@@ -17,6 +18,7 @@ import androidx.databinding.InverseBindingAdapter
import androidx.databinding.InverseBindingListener import androidx.databinding.InverseBindingListener
import com.xx.xxviewlibrary.R import com.xx.xxviewlibrary.R
class XxFormEdit constructor(context: Context?, attrs: AttributeSet?) : ConstraintLayout(context!!, attrs ) { class XxFormEdit constructor(context: Context?, attrs: AttributeSet?) : ConstraintLayout(context!!, attrs ) {
//标题 //标题
var tv_title: TextView? = null var tv_title: TextView? = null
...@@ -139,16 +141,20 @@ class XxFormEdit constructor(context: Context?, attrs: AttributeSet?) : Constra ...@@ -139,16 +141,20 @@ class XxFormEdit constructor(context: Context?, attrs: AttributeSet?) : Constra
v_line = view.findViewById(R.id.v_wxe_line) v_line = view.findViewById(R.id.v_wxe_line)
tv_necessary = view.findViewById(R.id.tv_wxe_necessary) tv_necessary = view.findViewById(R.id.tv_wxe_necessary)
iv_select = view.findViewById<ImageView>(R.id.iv_wxe_select) iv_select = view.findViewById<ImageView>(R.id.iv_wxe_select)
if(attrs!=null) if(attrs!=null)
{ {
var typedArray: TypedArray = var typedArray: TypedArray =
context.obtainStyledAttributes(attrs, R.styleable.xxFormEditStyle) context.obtainStyledAttributes(attrs, R.styleable.xxFormEditStyle)
if (typedArray.getBoolean(R.styleable.xxFormEditStyle_isBottom, false)) { if (typedArray.getBoolean(R.styleable.xxFormEditStyle_isBottom, false)) {
v_line?.visibility = GONE v_line?.visibility = GONE
} else { } else {
v_line?.visibility = VISIBLE v_line?.visibility = VISIBLE
} }
if (typedArray.getBoolean(R.styleable.xxFormEditStyle_necessary, true)) { if (typedArray.getBoolean(R.styleable.xxFormEditStyle_necessary, true)) {
tv_necessary?.visibility = VISIBLE tv_necessary?.visibility = VISIBLE
} else { } else {
...@@ -161,6 +167,9 @@ class XxFormEdit constructor(context: Context?, attrs: AttributeSet?) : Constra ...@@ -161,6 +167,9 @@ class XxFormEdit constructor(context: Context?, attrs: AttributeSet?) : Constra
tv_content?.visibility = GONE tv_content?.visibility = GONE
iv_select?.visibility = GONE iv_select?.visibility = GONE
et_contents?.visibility = GONE et_contents?.visibility = GONE
et_content?.inputType=typedArray.getInt(R.styleable.xxFormEditStyle_inputType,
InputType.TYPE_CLASS_TEXT or InputType.TYPE_NUMBER_FLAG_DECIMAL)
et_content?.addTextChangedListener(object : TextWatcher { et_content?.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
......
...@@ -14,6 +14,151 @@ ...@@ -14,6 +14,151 @@
<attr name="content_type" format="integer"/> <attr name="content_type" format="integer"/>
<attr name="hint_text" format="string"></attr> <attr name="hint_text" format="string"></attr>
<attr name="inputType">
<!-- There is no content type. The text is not editable. -->
<flag name="none" value="0x00000000" />
<!-- Just plain old text. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_NORMAL}. -->
<flag name="text" value="0x00000001" />
<!-- Can be combined with <var>text</var> and its variations to
request capitalization of all characters. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_CAP_CHARACTERS}. -->
<flag name="textCapCharacters" value="0x00001001" />
<!-- Can be combined with <var>text</var> and its variations to
request capitalization of the first character of every word. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_CAP_WORDS}. -->
<flag name="textCapWords" value="0x00002001" />
<!-- Can be combined with <var>text</var> and its variations to
request capitalization of the first character of every sentence. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_CAP_SENTENCES}. -->
<flag name="textCapSentences" value="0x00004001" />
<!-- Can be combined with <var>text</var> and its variations to
request auto-correction of text being input. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_AUTO_CORRECT}. -->
<flag name="textAutoCorrect" value="0x00008001" />
<!-- Can be combined with <var>text</var> and its variations to
specify that this field will be doing its own auto-completion and
talking with the input method appropriately. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_AUTO_COMPLETE}. -->
<flag name="textAutoComplete" value="0x00010001" />
<!-- Can be combined with <var>text</var> and its variations to
allow multiple lines of text in the field. If this flag is not set,
the text field will be constrained to a single line. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_MULTI_LINE}.
Note: If this flag is not set and the text field doesn't have max length limit, the
framework automatically set maximum length of the characters to 5000 for the
performance reasons.
-->
<flag name="textMultiLine" value="0x00020001" />
<!-- Can be combined with <var>text</var> and its variations to
indicate that though the regular text view should not be multiple
lines, the IME should provide multiple lines if it can. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_IME_MULTI_LINE}. -->
<flag name="textImeMultiLine" value="0x00040001" />
<!-- Can be combined with <var>text</var> and its variations to
indicate that the IME should not show any
dictionary-based word suggestions. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_NO_SUGGESTIONS}. -->
<flag name="textNoSuggestions" value="0x00080001" />
<!-- Can be combined with <var>text</var> and its variations to
indicate that if there is extra information, the IME should provide
{@link android.view.inputmethod.TextAttribute}. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS}. -->
<flag name="textEnableTextConversionSuggestions" value="0x00100001" />
<!-- Text that will be used as a URI. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_URI}. -->
<flag name="textUri" value="0x00000011" />
<!-- Text that will be used as an e-mail address. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_EMAIL_ADDRESS}. -->
<flag name="textEmailAddress" value="0x00000021" />
<!-- Text that is being supplied as the subject of an e-mail. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_EMAIL_SUBJECT}. -->
<flag name="textEmailSubject" value="0x00000031" />
<!-- Text that is the content of a short message. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_SHORT_MESSAGE}. -->
<flag name="textShortMessage" value="0x00000041" />
<!-- Text that is the content of a long message. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_LONG_MESSAGE}. -->
<flag name="textLongMessage" value="0x00000051" />
<!-- Text that is the name of a person. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_PERSON_NAME}. -->
<flag name="textPersonName" value="0x00000061" />
<!-- Text that is being supplied as a postal mailing address. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_POSTAL_ADDRESS}. -->
<flag name="textPostalAddress" value="0x00000071" />
<!-- Text that is a password. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_PASSWORD}. -->
<flag name="textPassword" value="0x00000081" />
<!-- Text that is a password that should be visible. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_VISIBLE_PASSWORD}. -->
<flag name="textVisiblePassword" value="0x00000091" />
<!-- Text that is being supplied as text in a web form. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_WEB_EDIT_TEXT}. -->
<flag name="textWebEditText" value="0x000000a1" />
<!-- Text that is filtering some other data. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_FILTER}. -->
<flag name="textFilter" value="0x000000b1" />
<!-- Text that is for phonetic pronunciation, such as a phonetic name
field in a contact entry. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_PHONETIC}. -->
<flag name="textPhonetic" value="0x000000c1" />
<!-- Text that will be used as an e-mail address on a web form. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS}. -->
<flag name="textWebEmailAddress" value="0x000000d1" />
<!-- Text that will be used as a password on a web form. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_WEB_PASSWORD}. -->
<flag name="textWebPassword" value="0x000000e1" />
<!-- A numeric only field. Corresponds to
{@link android.text.InputType#TYPE_CLASS_NUMBER} |
{@link android.text.InputType#TYPE_NUMBER_VARIATION_NORMAL}. -->
<flag name="number" value="0x00000002" />
<!-- Can be combined with <var>number</var> and its other options to
allow a signed number. Corresponds to
{@link android.text.InputType#TYPE_CLASS_NUMBER} |
{@link android.text.InputType#TYPE_NUMBER_FLAG_SIGNED}. -->
<flag name="numberSigned" value="0x00001002" />
<!-- Can be combined with <var>number</var> and its other options to
allow a decimal (fractional) number. Corresponds to
{@link android.text.InputType#TYPE_CLASS_NUMBER} |
{@link android.text.InputType#TYPE_NUMBER_FLAG_DECIMAL}. -->
<flag name="numberDecimal" value="0x00002002" />
<!-- A numeric password field. Corresponds to
{@link android.text.InputType#TYPE_CLASS_NUMBER} |
{@link android.text.InputType#TYPE_NUMBER_VARIATION_PASSWORD}. -->
<flag name="numberPassword" value="0x00000012" />
<!-- For entering a phone number. Corresponds to
{@link android.text.InputType#TYPE_CLASS_PHONE}. -->
<flag name="phone" value="0x00000003" />
<!-- For entering a date and time. Corresponds to
{@link android.text.InputType#TYPE_CLASS_DATETIME} |
{@link android.text.InputType#TYPE_DATETIME_VARIATION_NORMAL}. -->
<flag name="datetime" value="0x00000004" />
<!-- For entering a date. Corresponds to
{@link android.text.InputType#TYPE_CLASS_DATETIME} |
{@link android.text.InputType#TYPE_DATETIME_VARIATION_DATE}. -->
<flag name="date" value="0x00000014" />
<!-- For entering a time. Corresponds to
{@link android.text.InputType#TYPE_CLASS_DATETIME} |
{@link android.text.InputType#TYPE_DATETIME_VARIATION_TIME}. -->
<flag name="time" value="0x00000024" />
</attr>
</declare-styleable> </declare-styleable>
</resources> </resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment