Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
HBHAndroid
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨秀秀
HBHAndroid
Commits
f3d5c09a
Commit
f3d5c09a
authored
Aug 11, 2023
by
杨秀秀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基础搭建
1:XxesitForm添加定义InputType 功能 功能开发 1:完善登陆功能
parent
1eed022f
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
391 additions
and
4 deletions
+391
-4
gradle.xml
.idea/gradle.xml
+1
-0
build.gradle
app/build.gradle
+1
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+4
-0
LoginActivity.kt
...rc/main/java/com/xx/merchanthbh/ui/login/LoginActivity.kt
+56
-1
LoginViewModel.java
...main/java/com/xx/merchanthbh/ui/login/LoginViewModel.java
+13
-1
MerchantEnterViewModel.java
.../merchanthbh/ui/merchantenter/MerchantEnterViewModel.java
+6
-0
CommWabActivity.kt
...rc/main/java/com/xx/merchanthbh/ui/web/CommWabActivity.kt
+29
-0
CommWebViewModel.java
...main/java/com/xx/merchanthbh/ui/web/CommWebViewModel.java
+20
-0
activity_comm_web.xml
app/src/main/res/layout/activity_comm_web.xml
+33
-0
activity_login.xml
app/src/main/res/layout/activity_login.xml
+2
-1
fragmemt_merchant_register.xml
app/src/main/res/layout/fragmemt_merchant_register.xml
+2
-0
build.gradle
consumer/build.gradle
+1
-0
build.gradle
hbhbcompany/build.gradle
+1
-0
LoginActivity.kt
...rc/main/java/com/xx/hbhbcompany/ui/login/LoginActivity.kt
+54
-0
LoginViewModel.java
...main/java/com/xx/hbhbcompany/ui/login/LoginViewModel.java
+8
-0
activity_login.xml
hbhbcompany/src/main/res/layout/activity_login.xml
+1
-1
login_icon_xuanze1.png
hbhbcompany/src/main/res/mipmap-xhdpi/login_icon_xuanze1.png
+0
-0
login_icon_xuanze2.png
hbhbcompany/src/main/res/mipmap-xhdpi/login_icon_xuanze2.png
+0
-0
colors.xml
hbhbcompany/src/main/res/values/colors.xml
+2
-0
BaseViewModel.java
...src/main/java/me/goldze/mvvmhabit/base/BaseViewModel.java
+1
-0
settings.gradle
settings.gradle
+1
-0
build.gradle
xxviewlibrary/build.gradle
+1
-0
XxFormEdit.kt
...y/src/main/java/com/xx/xxviewlibrary/witget/XxFormEdit.kt
+9
-0
values.xml
xxviewlibrary/src/main/res/values/values.xml
+145
-0
No files found.
.idea/gradle.xml
View file @
f3d5c09a
...
...
@@ -13,6 +13,7 @@
<option
value=
"$PROJECT_DIR$"
/>
<option
value=
"$PROJECT_DIR$/app"
/>
<option
value=
"$PROJECT_DIR$/consumer"
/>
<option
value=
"$PROJECT_DIR$/dsbridge"
/>
<option
value=
"$PROJECT_DIR$/hbhbcompany"
/>
<option
value=
"$PROJECT_DIR$/mvvmhabit"
/>
<option
value=
"$PROJECT_DIR$/xxviewlibrary"
/>
...
...
app/build.gradle
View file @
f3d5c09a
...
...
@@ -61,6 +61,7 @@ dependencies {
implementation
'androidx.navigation:navigation-ui-ktx:2.5.2'
implementation
'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation
'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation
project
(
path:
':dsbridge'
)
testImplementation
'junit:junit:4.13.2'
androidTestImplementation
'androidx.test.ext:junit:1.1.3'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.4.0'
...
...
app/src/main/AndroidManifest.xml
View file @
f3d5c09a
...
...
@@ -122,6 +122,10 @@
<activity
android:name=
".ui.appeallist.AppealListActivity"
android:exported=
"true"
/>
<!--H5展示-->
<activity
android:name=
".ui.web.CommWabActivity"
android:exported=
"true"
/>
<!-- 适配标准 -->
<meta-data
android:name=
"design_width_in_dp"
...
...
app/src/main/java/com/xx/merchanthbh/ui/login/LoginActivity.kt
View file @
f3d5c09a
package
com.xx.merchanthbh.ui.login
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.R
import
com.xx.merchanthbh.databinding.ActivityLoginBinding
import
com.xx.merchanthbh.data.http.requst.LoginRequest
import
com.xx.merchanthbh.databinding.ActivityLoginBinding
import
me.goldze.mvvmhabit.base.BaseActivity
class
LoginActivity
()
:
BaseActivity
<
ActivityLoginBinding
,
LoginViewModel
>()
{
...
...
@@ -23,6 +29,55 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
override
fun
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
}
...
...
app/src/main/java/com/xx/merchanthbh/ui/login/LoginViewModel.java
View file @
f3d5c09a
...
...
@@ -5,6 +5,8 @@ import static me.goldze.mvvmhabit.utils.Utils.Interceptor_TOKEN;
import
android.app.Application
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.text.style.ClickableSpan
;
import
android.view.View
;
import
androidx.annotation.NonNull
;
import
androidx.databinding.ObservableField
;
...
...
@@ -35,6 +37,8 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
//密码的绑定
public
ObservableField
<
String
>
password
=
new
ObservableField
<>(
""
);
public
boolean
isAgree
=
false
;
public
LoginViewModel
(
@NonNull
Application
application
,
LoginRequest
model
)
{
super
(
application
,
model
);
}
...
...
@@ -70,13 +74,19 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
public
BindingCommand
login
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
if
(!
isAgree
)
{
ToastUtils
.
showShort
(
"请阅读并同意协议"
);
return
;
}
if
(
TextUtils
.
isEmpty
(
userName
.
get
().
toString
()))
{
ToastUtils
.
showShort
(
"请输入账号!"
);
}
else
if
(
TextUtils
.
isEmpty
(
password
.
get
().
toString
()))
{
ToastUtils
.
showShort
(
"请输入密码!"
);
}
else
{
model
.
Login
(
/*userName.get().toString(), password.get().toString()*/
"13922222222"
,
"123456"
)
model
.
Login
(
userName
.
get
().
toString
(),
password
.
get
().
toString
()
)
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
.
doOnSubscribe
(
LoginViewModel
.
this
)
...
...
@@ -106,6 +116,8 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
public
void
getuserInfo
()
{
model
.
getUserInfo
()
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
...
...
app/src/main/java/com/xx/merchanthbh/ui/merchantenter/MerchantEnterViewModel.java
View file @
f3d5c09a
...
...
@@ -197,6 +197,12 @@ public class MerchantEnterViewModel extends BaseViewModel<MerchantEnterRequst> {
*/
public
void
register
(
View
view
)
{
if
(!
pwds
.
get
().
equals
(
registerBody
.
oPassword
.
get
()))
{
ToastUtils
.
showShort
(
"两次密码输入不一致!"
);
return
;
}
model
.
register
(
registerBody
)
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
.
doOnSubscribe
(
MerchantEnterViewModel
.
this
)
...
...
app/src/main/java/com/xx/merchanthbh/ui/web/CommWabActivity.kt
0 → 100644
View file @
f3d5c09a
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
app/src/main/java/com/xx/merchanthbh/ui/web/CommWebViewModel.java
0 → 100644
View file @
f3d5c09a
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
);
}
}
app/src/main/res/layout/activity_comm_web.xml
0 → 100644
View file @
f3d5c09a
<?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
app/src/main/res/layout/activity_login.xml
View file @
f3d5c09a
...
...
@@ -145,10 +145,11 @@
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:textSize=
"14sp"
android:text=
"我已阅读并同意《用户协议》、《隐私条款》
以及《中国移动认证服务条款》
"
android:text=
"我已阅读并同意《用户协议》、《隐私条款》"
app:layout_constraintLeft_toRightOf=
"@+id/iv_login_agreement"
android:layout_marginLeft=
"7dp"
app:layout_constraintRight_toRightOf=
"parent"
android:id=
"@+id/tv_login_agree"
app:layout_constraintTop_toTopOf=
"@+id/iv_login_agreement"
/>
...
...
app/src/main/res/layout/fragmemt_merchant_register.xml
View file @
f3d5c09a
...
...
@@ -76,6 +76,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
ed_content=
"@={viewModel.registerBody.oPassword}"
app:inputType=
"textPassword"
ed_title=
'@{"登录密码"}'
/>
<com.xx.xxviewlibrary.witget.XxFormEdit
...
...
@@ -83,6 +84,7 @@
android:layout_height=
"wrap_content"
ed_title=
'@{"确认密码"}'
ed_content=
"@={viewModel.pwds}"
app:inputType=
"textPassword"
app:isBottom=
"true"
/>
...
...
consumer/build.gradle
View file @
f3d5c09a
...
...
@@ -59,6 +59,7 @@ dependencies {
implementation
'androidx.navigation:navigation-ui-ktx:2.5.2'
implementation
'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation
'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation
project
(
path:
':dsbridge'
)
testImplementation
'junit:junit:4.13.2'
androidTestImplementation
'androidx.test.ext:junit:1.1.3'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.4.0'
...
...
hbhbcompany/build.gradle
View file @
f3d5c09a
...
...
@@ -57,6 +57,7 @@ dependencies {
implementation
'androidx.navigation:navigation-ui-ktx:2.5.2'
implementation
'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation
'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation
project
(
path:
':dsbridge'
)
testImplementation
'junit:junit:4.13.2'
androidTestImplementation
'androidx.test.ext:junit:1.1.3'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.4.0'
...
...
hbhbcompany/src/main/java/com/xx/hbhbcompany/ui/login/LoginActivity.kt
View file @
f3d5c09a
package
com.xx.hbhbcompany.ui.login
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.BR
import
com.xx.hbhbcompany.data.http.requst.LoginRequest
...
...
@@ -23,6 +28,55 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
override
fun
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
}
...
...
hbhbcompany/src/main/java/com/xx/hbhbcompany/ui/login/LoginViewModel.java
View file @
f3d5c09a
...
...
@@ -35,6 +35,7 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
//密码的绑定
public
ObservableField
<
String
>
password
=
new
ObservableField
<>(
""
);
public
boolean
isAgree
=
false
;
public
LoginViewModel
(
@NonNull
Application
application
,
LoginRequest
model
)
{
super
(
application
,
model
);
}
...
...
@@ -52,6 +53,13 @@ public class LoginViewModel extends BaseViewModel<LoginRequest> {
public
BindingCommand
login
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
if
(!
isAgree
)
{
ToastUtils
.
showShort
(
"请阅读并同意协议"
);
return
;
}
if
(
TextUtils
.
isEmpty
(
userName
.
get
().
toString
()))
{
ToastUtils
.
showShort
(
"请输入账号!"
);
...
...
hbhbcompany/src/main/res/layout/activity_login.xml
View file @
f3d5c09a
...
...
@@ -134,9 +134,9 @@
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:textSize=
"14sp"
android:text=
"我已阅读并同意《用户协议》、《隐私条款》以及《中国移动认证服务条款》"
app:layout_constraintLeft_toRightOf=
"@+id/iv_login_agreement"
android:layout_marginLeft=
"7dp"
android:id=
"@+id/tv_login_agree"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/iv_login_agreement"
/>
...
...
hbhbcompany/src/main/res/mipmap-xhdpi/login_icon_xuanze1.png
0 → 100644
View file @
f3d5c09a
1.02 KB
hbhbcompany/src/main/res/mipmap-xhdpi/login_icon_xuanze2.png
0 → 100644
View file @
f3d5c09a
1.3 KB
hbhbcompany/src/main/res/values/colors.xml
View file @
f3d5c09a
...
...
@@ -9,6 +9,8 @@
<color
name=
"black"
>
#222222
</color>
<color
name=
"white"
>
#FFFFFFFF
</color>
<color
name=
"line_grey"
>
#eeeeee
</color>
<color
name=
"text_grey_blue"
>
#6076A6
</color>
<color
name=
"bg_grey"
>
#F5F5F5
</color>
<color
name=
"light_blue_50"
>
#FFE1F5FE
</color>
...
...
mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseViewModel.java
View file @
f3d5c09a
...
...
@@ -157,6 +157,7 @@ public class BaseViewModel<M extends BaseModel> extends AndroidViewModel impleme
{
Map
<
String
,
Object
>
photomap
=
new
HashMap
<>();
photomap
.
put
(
"hasCamera"
,
hasCamera
);
photomap
.
put
(
"maxCount"
,
1
);
if
(
callback
!=
null
)
{
photomap
.
put
(
"callBack"
,
callback
);
}
...
...
settings.gradle
View file @
f3d5c09a
...
...
@@ -22,3 +22,4 @@ include ':app', ':mvvmhabit'
include
':xxviewlibrary'
include
':hbhbcompany'
include
':consumer'
include
':dsbridge'
xxviewlibrary/build.gradle
View file @
f3d5c09a
...
...
@@ -65,4 +65,5 @@ dependencies {
api
rootProject
.
ext
.
dependencies
[
"SmartRefreshBase"
]
api
rootProject
.
ext
.
dependencies
[
"SmartRefreshHeader"
]
api
rootProject
.
ext
.
dependencies
[
"SmartRefreshFooter"
]
}
\ No newline at end of file
xxviewlibrary/src/main/java/com/xx/xxviewlibrary/witget/XxFormEdit.kt
View file @
f3d5c09a
...
...
@@ -3,6 +3,7 @@ package com.xx.xxviewlibrary.witget
import
android.content.Context
import
android.content.res.TypedArray
import
android.text.Editable
import
android.text.InputType
import
android.text.TextUtils
import
android.text.TextWatcher
import
android.util.AttributeSet
...
...
@@ -17,6 +18,7 @@ import androidx.databinding.InverseBindingAdapter
import
androidx.databinding.InverseBindingListener
import
com.xx.xxviewlibrary.R
class
XxFormEdit
constructor
(
context
:
Context
?,
attrs
:
AttributeSet
?)
:
ConstraintLayout
(
context
!!
,
attrs
)
{
//标题
var
tv_title
:
TextView
?
=
null
...
...
@@ -139,16 +141,20 @@ class XxFormEdit constructor(context: Context?, attrs: AttributeSet?) : Constra
v_line
=
view
.
findViewById
(
R
.
id
.
v_wxe_line
)
tv_necessary
=
view
.
findViewById
(
R
.
id
.
tv_wxe_necessary
)
iv_select
=
view
.
findViewById
<
ImageView
>(
R
.
id
.
iv_wxe_select
)
if
(
attrs
!=
null
)
{
var
typedArray
:
TypedArray
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
xxFormEditStyle
)
if
(
typedArray
.
getBoolean
(
R
.
styleable
.
xxFormEditStyle_isBottom
,
false
))
{
v_line
?.
visibility
=
GONE
}
else
{
v_line
?.
visibility
=
VISIBLE
}
if
(
typedArray
.
getBoolean
(
R
.
styleable
.
xxFormEditStyle_necessary
,
true
))
{
tv_necessary
?.
visibility
=
VISIBLE
}
else
{
...
...
@@ -161,6 +167,9 @@ class XxFormEdit constructor(context: Context?, attrs: AttributeSet?) : Constra
tv_content
?.
visibility
=
GONE
iv_select
?.
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
{
override
fun
beforeTextChanged
(
p0
:
CharSequence
?,
p1
:
Int
,
p2
:
Int
,
p3
:
Int
)
{
...
...
xxviewlibrary/src/main/res/values/values.xml
View file @
f3d5c09a
...
...
@@ -14,6 +14,151 @@
<attr
name=
"content_type"
format=
"integer"
/>
<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>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment