Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_freeworld
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
0
Merge Requests
0
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
android
android_freeworld
Commits
6ef43e37
Commit
6ef43e37
authored
Jul 17, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交手机号微信登录代码
parent
44a350d4
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
566 additions
and
108 deletions
+566
-108
GridPaymentAdapter.kt
.../main/java/com/mints/street/adapter/GridPaymentAdapter.kt
+2
-2
MainApi.kt
app/src/main/java/com/mints/street/api/MainApi.kt
+7
-1
WXInfo.java
app/src/main/java/com/mints/street/bean/WXInfo.java
+295
-0
LoginActivity.kt
app/src/main/java/com/mints/street/login/LoginActivity.kt
+9
-3
LoginViewModel.kt
app/src/main/java/com/mints/street/login/LoginViewModel.kt
+4
-4
BindMobileActivity.kt
.../main/java/com/mints/street/main/my/BindMobileActivity.kt
+3
-2
BindMobileViewModel.kt
...main/java/com/mints/street/main/my/BindMobileViewModel.kt
+8
-4
MoresettingsActivity.kt
...ain/java/com/mints/street/main/my/MoresettingsActivity.kt
+64
-50
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+76
-15
MyViewModel.kt
app/src/main/java/com/mints/street/main/my/MyViewModel.kt
+67
-3
ApiModel.kt
app/src/main/java/com/mints/street/model/ApiModel.kt
+8
-1
activity_aboutus.xml
app/src/main/res/layout/activity_aboutus.xml
+1
-1
activity_permissions.xml
app/src/main/res/layout/activity_permissions.xml
+12
-15
fragment_my.xml
app/src/main/res/layout/fragment_my.xml
+5
-3
include_header.xml
app/src/main/res/layout/include_header.xml
+1
-0
layout_popupwindow.xml
app/src/main/res/layout/layout_popupwindow.xml
+4
-4
ic_arrow_back_white.png
app/src/main/res/mipmap-xhdpi/ic_arrow_back_white.png
+0
-0
icon_impower_location.png
app/src/main/res/mipmap-xhdpi/icon_impower_location.png
+0
-0
icon_impower_save.png
app/src/main/res/mipmap-xhdpi/icon_impower_save.png
+0
-0
icon_impower_setting.png
app/src/main/res/mipmap-xhdpi/icon_impower_setting.png
+0
-0
icon_login_wx.png
app/src/main/res/mipmap-xhdpi/icon_login_wx.png
+0
-0
icon_me_tiao.png
app/src/main/res/mipmap-xhdpi/icon_me_tiao.png
+0
-0
No files found.
app/src/main/java/com/mints/street/adapter/GridPaymentAdapter.kt
View file @
6ef43e37
...
@@ -12,9 +12,9 @@ import com.mints.street.bean.VipBean
...
@@ -12,9 +12,9 @@ import com.mints.street.bean.VipBean
import
com.mints.street.databinding.ItemGridPaymentAdpaterBinding
import
com.mints.street.databinding.ItemGridPaymentAdpaterBinding
import
me.goldze.mvvmhabit.utils.AppUtils
import
me.goldze.mvvmhabit.utils.AppUtils
class
GridPaymentAdapter
(
val
context
:
Context
,
val
list
:
List
<
VipBean
.
ConsumerBean
>)
:
AbstractVLayoutBaseAdapter
<
ItemGridPaymentAdpaterBinding
,
List
<
VipBean
.
Consumer
Bean
>>(
context
,
list
,
3
)
{
class
GridPaymentAdapter
(
val
context
:
Context
,
val
list
:
List
<
VipBean
.
ListBean
>)
:
AbstractVLayoutBaseAdapter
<
ItemGridPaymentAdpaterBinding
,
List
<
VipBean
.
List
Bean
>>(
context
,
list
,
3
)
{
private
var
datalist
:
List
<
VipBean
.
Consumer
Bean
>?
=
list
private
var
datalist
:
List
<
VipBean
.
List
Bean
>?
=
list
private
var
mposition
:
Int
=
-
1
private
var
mposition
:
Int
=
-
1
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemGridPaymentAdpaterBinding
>,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemGridPaymentAdpaterBinding
>,
position
:
Int
)
{
...
...
app/src/main/java/com/mints/street/api/MainApi.kt
View file @
6ef43e37
...
@@ -61,11 +61,17 @@ interface MainApi {
...
@@ -61,11 +61,17 @@ interface MainApi {
* 绑定手机号接口
* 绑定手机号接口
*/
*/
@POST
(
"api/bindingMobile"
)
@POST
(
"api/bindingMobile"
)
fun
bindingMobile
(
@Body
vo
:
@JvmSuppressWildcards
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
BindMobile
Bean
>>>
fun
bindingMobile
(
@Body
vo
:
@JvmSuppressWildcards
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
User
Bean
>>>
/**
/**
* 获取绑定手机号验证码接口
* 获取绑定手机号验证码接口
*/
*/
@POST
(
"api/sendMobileBindingCode"
)
@POST
(
"api/sendMobileBindingCode"
)
fun
sendMobileBindingCode
(
@Body
vo
:
@JvmSuppressWildcards
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
Any
>>>
fun
sendMobileBindingCode
(
@Body
vo
:
@JvmSuppressWildcards
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
Any
>>>
/**
* 微信登录
*/
@POST
(
"api/wechatlogin"
)
fun
wechatlogin
(
@Body
vo
:
@JvmSuppressWildcards
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
UserBean
>>>
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/bean/WXInfo.java
0 → 100644
View file @
6ef43e37
package
com
.
mints
.
street
.
bean
;
import
java.io.Serializable
;
/**
* 第三方登录 微信
*/
public
class
WXInfo
implements
Serializable
{
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.wid
*
* @mbggenerated
*/
private
String
wid
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.uid
*
* @mbggenerated
*/
private
String
uid
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.unionid
*
* @mbggenerated
*/
private
String
unionid
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.openid
*
* @mbggenerated
*/
private
String
openid
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.nickname
*
* @mbggenerated
*/
private
String
nickname
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.headimgurl
*
* @mbggenerated
*/
private
String
headimgurl
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.sex
*
* @mbggenerated
*/
private
int
sex
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.country
*
* @mbggenerated
*/
private
String
country
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.province
*
* @mbggenerated
*/
private
String
province
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column e_wxinfo.city
*
* @mbggenerated
*/
private
String
city
;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.wid
*
* @return the value of e_wxinfo.wid
* @mbggenerated
*/
public
String
getWid
()
{
return
wid
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.wid
*
* @param wid the value for e_wxinfo.wid
* @mbggenerated
*/
public
void
setWid
(
String
wid
)
{
this
.
wid
=
wid
==
null
?
null
:
wid
.
trim
();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.uid
*
* @return the value of e_wxinfo.uid
* @mbggenerated
*/
public
String
getUid
()
{
return
uid
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.uid
*
* @param uid the value for e_wxinfo.uid
* @mbggenerated
*/
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
==
null
?
null
:
uid
.
trim
();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.unionid
*
* @return the value of e_wxinfo.unionid
* @mbggenerated
*/
public
String
getUnionid
()
{
return
unionid
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.unionid
*
* @param unionid the value for e_wxinfo.unionid
* @mbggenerated
*/
public
void
setUnionid
(
String
unionid
)
{
this
.
unionid
=
unionid
==
null
?
null
:
unionid
.
trim
();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.openid
*
* @return the value of e_wxinfo.openid
* @mbggenerated
*/
public
String
getOpenid
()
{
return
openid
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.openid
*
* @param openid the value for e_wxinfo.openid
* @mbggenerated
*/
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
==
null
?
null
:
openid
.
trim
();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.nickname
*
* @return the value of e_wxinfo.nickname
* @mbggenerated
*/
public
String
getNickname
()
{
return
nickname
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.nickname
*
* @param nickname the value for e_wxinfo.nickname
* @mbggenerated
*/
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
==
null
?
null
:
nickname
.
trim
();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.headimgurl
*
* @return the value of e_wxinfo.headimgurl
* @mbggenerated
*/
public
String
getHeadimgurl
()
{
return
headimgurl
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.headimgurl
*
* @param headimgurl the value for e_wxinfo.headimgurl
* @mbggenerated
*/
public
void
setHeadimgurl
(
String
headimgurl
)
{
this
.
headimgurl
=
headimgurl
==
null
?
null
:
headimgurl
.
trim
();
}
public
int
getSex
()
{
return
sex
;
}
public
void
setSex
(
int
sex
)
{
this
.
sex
=
sex
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.country
*
* @return the value of e_wxinfo.country
* @mbggenerated
*/
public
String
getCountry
()
{
return
country
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.country
*
* @param country the value for e_wxinfo.country
* @mbggenerated
*/
public
void
setCountry
(
String
country
)
{
this
.
country
=
country
==
null
?
null
:
country
.
trim
();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.province
*
* @return the value of e_wxinfo.province
* @mbggenerated
*/
public
String
getProvince
()
{
return
province
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.province
*
* @param province the value for e_wxinfo.province
* @mbggenerated
*/
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
==
null
?
null
:
province
.
trim
();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column e_wxinfo.city
*
* @return the value of e_wxinfo.city
* @mbggenerated
*/
public
String
getCity
()
{
return
city
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column e_wxinfo.city
*
* @param city the value for e_wxinfo.city
* @mbggenerated
*/
public
void
setCity
(
String
city
)
{
this
.
city
=
city
==
null
?
null
:
city
.
trim
();
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/login/LoginActivity.kt
View file @
6ef43e37
package
com.mints.street.login
package
com.mints.street.login
import
android.Manifest
import
android.Manifest
import
android.graphics.Color
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
androidx.lifecycle.Observer
import
androidx.lifecycle.Observer
...
@@ -14,6 +15,7 @@ import com.tbruyelle.rxpermissions2.RxPermissions
...
@@ -14,6 +15,7 @@ import com.tbruyelle.rxpermissions2.RxPermissions
import
kotlinx.android.synthetic.main.activity_bindmobile.*
import
kotlinx.android.synthetic.main.activity_bindmobile.*
import
kotlinx.android.synthetic.main.activity_login.*
import
kotlinx.android.synthetic.main.activity_login.*
import
kotlinx.android.synthetic.main.include_header.*
import
kotlinx.android.synthetic.main.include_header.*
import
me.goldze.mvvmhabit.utils.AppUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
/**
/**
...
@@ -71,7 +73,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
...
@@ -71,7 +73,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
// 登录
// 登录
viewModel
.
login
(
mobile
,
code
)
viewModel
.
mobile
login
(
mobile
,
code
)
}
else
{
}
else
{
// showMissingPermissionDialog("设备")
// showMissingPermissionDialog("设备")
}
}
...
@@ -84,7 +86,11 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
...
@@ -84,7 +86,11 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
private
fun
initView
()
{
private
fun
initView
()
{
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
iv_return_white
)
tv_title
.
text
=
"手机号登录"
tv_title
.
setTextColor
(
Color
.
WHITE
)
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back_white
)
iv_left_icon
.
setPadding
(
AppUtils
.
dp2Px
(
this
,
15F
),
AppUtils
.
dp2Px
(
this
,
15F
),
AppUtils
.
dp2Px
(
this
,
15F
),
AppUtils
.
dp2Px
(
this
,
15F
))
header_line
.
visibility
=
View
.
GONE
iv_left_icon
.
visibility
=
View
.
VISIBLE
iv_left_icon
.
visibility
=
View
.
VISIBLE
//手机号设置格式
//手机号设置格式
...
@@ -101,7 +107,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
...
@@ -101,7 +107,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
super
.
initViewObservable
()
super
.
initViewObservable
()
viewModel
.
data
.
observe
(
this
,
Observer
<
String
>
{
viewModel
.
data
.
observe
(
this
,
Observer
<
String
>
{
ToastUtils
.
showLong
(
"登录成功"
)
ToastUtils
.
showLong
(
"登录成功"
)
startActivityThenKill
(
MainActivity
::
class
.
java
)
finish
(
)
})
})
}
}
...
...
app/src/main/java/com/mints/street/login/LoginViewModel.kt
View file @
6ef43e37
...
@@ -52,20 +52,20 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
...
@@ -52,20 +52,20 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
/**
/**
* 调用登录接口
* 调用登录接口
*/
*/
fun
login
(
mobile
:
String
,
smsCode
:
String
)
{
fun
mobile
login
(
mobile
:
String
,
smsCode
:
String
)
{
// showDialog()
// showDialog()
val
vo
=
HashMap
<
String
,
Any
>()
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"mobile"
]
=
mobile
vo
[
"mobile"
]
=
mobile
vo
[
"smsCode"
]
=
smsCode
vo
[
"smsCode"
]
=
smsCode
vo
[
"device"
]
=
DeviceUuidFactory
().
deviceUuid
.
toString
()
//
vo["device"] = DeviceUuidFactory().deviceUuid.toString()
ApiModel
.
login
(
lifecycleProvider
,
vo
).
safeSubscribe
(
ApiModel
.
login
(
lifecycleProvider
,
vo
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
UserBean
>>(
object
:
HttpSubscribeImpl
<
BaseResponse
<
UserBean
>>(
this
@LoginViewModel
,
true
)
{
this
@LoginViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
//提交设备信息
//提交设备信息
【注:这里海哥的意思是说在测试的环境下,进行当前的注册是利用手机号进行注册,由于开通了微信登录,就不需要再手机号登录的时候进行设备信息的提交】
this
@LoginViewModel
.
saveTerminalInfo
()
//
this@LoginViewModel.saveTerminalInfo()
//保存用户信息到Usermanager
//保存用户信息到Usermanager
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
...
...
app/src/main/java/com/mints/street/main/my/BindMobileActivity.kt
View file @
6ef43e37
...
@@ -9,6 +9,7 @@ import com.fry.base.base.BaseActivity
...
@@ -9,6 +9,7 @@ import com.fry.base.base.BaseActivity
import
com.mints.street.BR
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.R
import
com.mints.street.bean.BindMobileBean
import
com.mints.street.bean.BindMobileBean
import
com.mints.street.bean.UserBean
import
com.mints.street.databinding.ActivityBindmobileBinding
import
com.mints.street.databinding.ActivityBindmobileBinding
import
com.mints.street.main.MainActivity
import
com.mints.street.main.MainActivity
import
com.mints.street.utils.BackInputUtil
import
com.mints.street.utils.BackInputUtil
...
@@ -94,8 +95,8 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie
...
@@ -94,8 +95,8 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie
override
fun
initViewObservable
()
{
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
super
.
initViewObservable
()
viewModel
.
bindmobiledata
.
observe
(
this
,
Observer
<
BindMobile
Bean
>
{
viewModel
.
bindmobiledata
.
observe
(
this
,
Observer
<
User
Bean
>
{
ToastUtils
.
showLong
(
"
请求绑定手机号接口
成功"
)
ToastUtils
.
showLong
(
"
手机号绑定
成功"
)
startActivityThenKill
(
MainActivity
::
class
.
java
)
startActivityThenKill
(
MainActivity
::
class
.
java
)
})
})
viewModel
.
data
.
observe
(
this
,
Observer
{
viewModel
.
data
.
observe
(
this
,
Observer
{
...
...
app/src/main/java/com/mints/street/main/my/BindMobileViewModel.kt
View file @
6ef43e37
...
@@ -4,6 +4,8 @@ import android.app.Application
...
@@ -4,6 +4,8 @@ import android.app.Application
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.MutableLiveData
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.BindMobileBean
import
com.mints.street.bean.BindMobileBean
import
com.mints.street.bean.UserBean
import
com.mints.street.manager.UserManager
import
com.mints.street.model.ApiModel
import
com.mints.street.model.ApiModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.base.BaseViewModel
...
@@ -13,7 +15,7 @@ import java.util.HashMap
...
@@ -13,7 +15,7 @@ import java.util.HashMap
class
BindMobileViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
class
BindMobileViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
val
bindmobiledata
:
MutableLiveData
<
BindMobile
Bean
>
=
MutableLiveData
()
val
bindmobiledata
:
MutableLiveData
<
User
Bean
>
=
MutableLiveData
()
val
data
:
MutableLiveData
<
String
>
=
MutableLiveData
()
val
data
:
MutableLiveData
<
String
>
=
MutableLiveData
()
...
@@ -47,14 +49,16 @@ class BindMobileViewModel (application: Application): BaseViewModel(application)
...
@@ -47,14 +49,16 @@ class BindMobileViewModel (application: Application): BaseViewModel(application)
vo
[
"mobile"
]=
mobile
vo
[
"mobile"
]=
mobile
vo
[
"smsCode"
]=
smsCode
vo
[
"smsCode"
]=
smsCode
ApiModel
.
bindingMobile
(
lifecycleProvider
,
vo
).
safeSubscribe
(
ApiModel
.
bindingMobile
(
lifecycleProvider
,
vo
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
BindMobile
Bean
>>(
object
:
HttpSubscribeImpl
<
BaseResponse
<
User
Bean
>>(
this
@BindMobileViewModel
,
true
){
this
@BindMobileViewModel
,
true
){
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
BindMobile
Bean
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
User
Bean
>)
{
bindmobiledata
.
value
=
response
.
result
bindmobiledata
.
value
=
response
.
result
//保存用户信息到Usermanager
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
KLog
.
e
(
"bindingMobile"
,
response
.
result
.
toString
())
KLog
.
e
(
"bindingMobile"
,
response
.
result
.
toString
())
}
}
override
fun
onBusinessFail
(
response
:
BaseResponse
<
BindMobile
Bean
>?)
{
override
fun
onBusinessFail
(
response
:
BaseResponse
<
User
Bean
>?)
{
super
.
onBusinessFail
(
response
)
super
.
onBusinessFail
(
response
)
}
}
...
...
app/src/main/java/com/mints/street/main/my/MoresettingsActivity.kt
View file @
6ef43e37
package
com.mints.street.main.my
package
com.mints.street.main.my
import
android.content.res.ColorStateList
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
...
@@ -16,6 +17,7 @@ import kotlinx.android.synthetic.main.activity_moresettings.*
...
@@ -16,6 +17,7 @@ import kotlinx.android.synthetic.main.activity_moresettings.*
import
kotlinx.android.synthetic.main.include_header.*
import
kotlinx.android.synthetic.main.include_header.*
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.ToastUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
org.w3c.dom.Text
class
MoresettingsActivity
:
BaseActivity
<
ActivityMoresettingsBinding
,
MoresettingsViewModel
>(),
View
.
OnClickListener
{
class
MoresettingsActivity
:
BaseActivity
<
ActivityMoresettingsBinding
,
MoresettingsViewModel
>(),
View
.
OnClickListener
{
...
@@ -27,11 +29,11 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
...
@@ -27,11 +29,11 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
super
.
initData
()
super
.
initData
()
initView
()
initView
()
initListener
()
initListener
()
}
}
private
fun
initListener
()
{
private
fun
initListener
()
{
item_phone
.
setOnClickListener
(
this
)
iv_left_icon
.
setOnClickListener
(
this
)
iv_left_icon
.
setOnClickListener
(
this
)
item_userAgree
.
setOnClickListener
(
this
)
item_userAgree
.
setOnClickListener
(
this
)
item_privacyAgree
.
setOnClickListener
(
this
)
item_privacyAgree
.
setOnClickListener
(
this
)
...
@@ -39,67 +41,79 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
...
@@ -39,67 +41,79 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
}
}
private
fun
initView
()
{
override
fun
onResume
()
{
super
.
onResume
()
tv_title
.
text
=
"更多设置"
//判断当前手机号是否绑定
tv_title
.
setTextColor
(
Color
.
BLACK
)
if
(!
userManager
.
getMobile
().
isEmpty
())
{
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
visibility
=
View
.
VISIBLE
iv_left_icon
.
visibility
=
View
.
VISIBLE
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
userManager
.
getMobile
()
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
setTextColor
(
Color
.
BLACK
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"绑定手机号"
}
else
{
val
phone
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_tel
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
visibility
=
View
.
VISIBLE
phone
?.
setBounds
(
0
,
0
,
56
,
56
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
setTextColor
(
Color
.
BLACK
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
phone
,
null
,
null
,
null
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
"去绑定"
// item_phone.findViewById<TextView>(R.id.tv_right).visibility=View.VISIBLE
item_phone
.
setOnClickListener
(
this
)
// item_phone.findViewById<TextView>(R.id.tv_right).text = "未绑定"
}
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
visibility
=
View
.
GONE
}
item_phone
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
VISIBLE
private
fun
initView
()
{
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"用户协议"
tv_title
.
text
=
"更多设置"
val
userAgree
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_user
)
tv_title
.
setTextColor
(
Color
.
BLACK
)
userAgree
?.
setBounds
(
0
,
0
,
56
,
56
)
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
userAgree
,
null
,
null
,
null
)
iv_left_icon
.
visibility
=
View
.
VISIBLE
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
visibility
=
View
.
GONE
item_userAgree
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
VISIBLE
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"绑定手机号"
val
phone
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_tel
)
item_privacyAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"隐私协议"
phone
?.
setBounds
(
0
,
0
,
56
,
56
)
val
privacyAgree
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_privacy
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
phone
,
null
,
null
,
null
)
privacyAgree
?.
setBounds
(
0
,
0
,
56
,
56
)
item_phone
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
GONE
item_privacyAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
privacyAgree
,
null
,
null
,
null
)
item_privacyAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
visibility
=
View
.
GONE
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"用户协议"
item_privacyAgree
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
VISIBLE
val
userAgree
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_user
)
userAgree
?.
setBounds
(
0
,
0
,
56
,
56
)
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
userAgree
,
null
,
null
,
null
)
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
visibility
=
View
.
GONE
item_userAgree
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
VISIBLE
item_privacyAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"隐私协议"
val
privacyAgree
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_privacy
)
privacyAgree
?.
setBounds
(
0
,
0
,
56
,
56
)
item_privacyAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
privacyAgree
,
null
,
null
,
null
)
item_privacyAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
visibility
=
View
.
GONE
item_privacyAgree
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
VISIBLE
if
(
userManager
.
userIsLogin
())
{
btn_switch
.
visibility
=
View
.
VISIBLE
}
else
{
btn_switch
.
visibility
=
View
.
GONE
}
}
}
override
fun
onClick
(
v
:
View
?)
{
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
when
(
v
?.
id
)
{
R
.
id
.
iv_left_icon
->
{
R
.
id
.
iv_left_icon
->
{
finish
()
finish
()
}
}
R
.
id
.
item_phone
->
{
R
.
id
.
item_phone
->
{
// if (!userManager.userIsLogin()) {
if
(
userManager
.
userIsLogin
())
{
// readyGo(WxLoginActivity::class.java)
// return
// }
// if (userManager.getMobile().isEmpty()) {
startActivity
(
BindMobileActivity
::
class
.
java
)
startActivity
(
BindMobileActivity
::
class
.
java
)
// }else{
return
// ToastUtils.showLong("当前手机号已绑定")
}
else
{
// }
ToastUtils
.
showLong
(
"请先使用微信登录"
)
}
R
.
id
.
btn_switch
->
{
//推出登录
if
(!
userManager
.
getMobile
().
isEmpty
()){
UserManager
.
INSTANCE
.
userLogout
()
startActivityThenKill
(
MainActivity
::
class
.
java
)
}
}
KLog
.
e
(
"setOnClick"
,
"btn_switch has been clicked."
)
}
}
R
.
id
.
item_userAgree
->
{
R
.
id
.
btn_switch
->
{
//退出登录
UserManager
.
INSTANCE
.
userLogout
()
finish
()
KLog
.
e
(
"setOnClick"
,
"btn_switch has been clicked."
)
}
R
.
id
.
item_userAgree
->
{
//用户协议
}
}
R
.
id
.
item_privacyAgree
->
{
R
.
id
.
item_privacyAgree
->
{
//隐私协议
}
}
...
...
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
6ef43e37
package
com.mints.street.main.my
package
com.mints.street.main.my
import
android.Manifest
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Bundle
import
android.os.Bundle
import
android.text.TextUtils
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.CheckBox
import
android.widget.CheckBox
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.TextView
import
android.widget.TextView
import
android.widget.Toast
import
androidx.appcompat.widget.LinearLayoutCompat
import
androidx.appcompat.widget.LinearLayoutCompat
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.lifecycle.Observer
import
androidx.lifecycle.Observer
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.wechat.friends.Wechat
import
com.bumptech.glide.Glide
import
com.fry.base.base.BaseFragment
import
com.fry.base.base.BaseFragment
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.mints.street.BR
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.R
import
com.mints.street.bean.MyInfo
import
com.mints.street.bean.MyInfo
import
com.mints.street.bean.
UserBean
import
com.mints.street.bean.
WXInfo
import
com.mints.street.databinding.FragmentMyBinding
import
com.mints.street.databinding.FragmentMyBinding
import
com.mints.street.login.LoginActivity
import
com.mints.street.login.LoginActivity
import
com.mints.street.main.home.HistoricalimageActivity
import
com.mints.street.login.LoginApi
import
com.mints.street.login.OnLoginListener
import
com.mints.street.manager.UserManager
import
com.mints.street.manager.UserManager
import
com.mints.street.utils.json.JsonUtil
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
kotlinx.android.synthetic.main.activity_moresettings.*
import
com.tbruyelle.rxpermissions2.RxPermissions
import
kotlinx.android.synthetic.main.fragment_my.*
import
kotlinx.android.synthetic.main.fragment_my.*
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.ToastUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
java.util.*
/**
/**
...
@@ -37,10 +40,13 @@ import me.goldze.mvvmhabit.utils.ToastUtils
...
@@ -37,10 +40,13 @@ import me.goldze.mvvmhabit.utils.ToastUtils
* 个人中心页面
* 个人中心页面
*/
*/
class
MyFragment
:
BaseFragment
<
FragmentMyBinding
,
MyViewModel
>(),
OnRefreshListener
,
class
MyFragment
:
BaseFragment
<
FragmentMyBinding
,
MyViewModel
>(),
OnRefreshListener
,
View
.
OnClickListener
{
View
.
OnClickListener
,
OnLoginListener
{
private
val
userManager
by
lazy
{
UserManager
.
INSTANCE
}
private
val
userManager
by
lazy
{
UserManager
.
INSTANCE
}
private
var
userConfig
:
MyInfo
?
=
null
private
var
userConfig
:
MyInfo
?
=
null
private
val
loginApi
by
lazy
{
LoginApi
()
}
private
var
wxInfo
:
WXInfo
?
=
null
//弹窗
//弹窗
private
var
mBottomSheetDialog
:
BottomSheetDialog
?
=
null
private
var
mBottomSheetDialog
:
BottomSheetDialog
?
=
null
...
@@ -57,6 +63,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -57,6 +63,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
override
fun
initData
()
{
override
fun
initData
()
{
super
.
initData
()
super
.
initData
()
srl_my
.
setOnRefreshListener
(
this
)
srl_my
.
setOnRefreshListener
(
this
)
//隐藏立即领取
bt_try
.
visibility
=
View
.
GONE
initView
()
initView
()
initListener
()
initListener
()
}
}
...
@@ -134,7 +142,24 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -134,7 +142,24 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
}
}
R
.
id
.
iv_weixin
->
{
R
.
id
.
iv_weixin
->
{
if
(
cb_checked
!!
.
isChecked
)
{
if
(
cb_checked
!!
.
isChecked
)
{
ToastUtils
.
showShort
(
"未完成微信登录对接"
)
// ToastUtils.showShort("未完成微信登录对接")
val
wechat
=
ShareSDK
.
getPlatform
(
Wechat
.
NAME
)
if
(!
wechat
.
isClientValid
){
ToastUtils
.
showShort
(
"请先安装微信"
)
return
}
RxPermissions
(
this
)
.
request
(
Manifest
.
permission
.
READ_PHONE_STATE
)
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
loginApi
.
setOnLoginListener
(
this
@MyFragment
)
loginApi
.
setPlatform
(
Wechat
.
NAME
)
loginApi
.
login
(
context
)
}
else
{
// showMissingPermissionDialog("设备")
}
}
mBottomSheetDialog
!!
.
dismiss
()
}
else
{
}
else
{
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
}
}
...
@@ -153,7 +178,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -153,7 +178,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
override
fun
initViewObservable
()
{
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
super
.
initViewObservable
()
viewModel
.
M
yInfodata
.
observe
(
this
,
Observer
<
MyInfo
>
{
viewModel
.
m
yInfodata
.
observe
(
this
,
Observer
<
MyInfo
>
{
srl_my
.
finishRefresh
(
true
)
srl_my
.
finishRefresh
(
true
)
if
(
it
==
null
)
{
if
(
it
==
null
)
{
userConfig
=
null
userConfig
=
null
...
@@ -164,20 +189,56 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -164,20 +189,56 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
setUserLoginStatus
()
setUserLoginStatus
()
})
})
}
}
private
fun
setUserLoginStatus
()
{
private
fun
setUserLoginStatus
()
{
if
(
userManager
.
getMobile
().
isNotEmpty
())
{
if
(
userManager
.
userIsLogin
())
{
item_title_id
.
text
=
userManager
.
getMobile
()
// 已登录
item_title_id
.
text
=
userManager
.
getWxName
()
Glide
.
with
(
requireContext
()).
load
(
userManager
.
getWxHeader
()).
into
(
item_title_avatar
)
}
else
{
}
else
{
// 未登录
item_title_id
.
text
=
"未登录"
item_title_id
.
text
=
"未登录"
item_title_avatar
.
setImageResource
(
R
.
mipmap
.
ic_my
)
}
}
}
}
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
KLog
.
e
(
"onRefresh"
,
"The current page has been refreshed."
)
if
(
userManager
.
userIsLogin
())
{
//重新显示界面信息
//查询用户登录信息
setUserLoginStatus
()
viewModel
.
getmyInfo
()
}
else
{
srl_my
.
finishRefresh
(
true
)
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
loginApi
.
setOnLoginListener
(
null
)
}
override
fun
onLogin
(
platform
:
String
?,
res
:
HashMap
<
String
,
Any
>?):
Boolean
{
try
{
wxInfo
=
WXInfo
()
wxInfo
?.
let
{
it
.
unionid
=
res
?.
get
(
"unionid"
).
toString
()
+
""
it
.
openid
=
res
?.
get
(
"openid"
).
toString
()
+
""
it
.
province
=
res
?.
get
(
"province"
).
toString
()
+
""
it
.
city
=
res
?.
get
(
"city"
).
toString
()
+
""
it
.
country
=
res
?.
get
(
"country"
).
toString
()
+
""
it
.
headimgurl
=
res
?.
get
(
"headimgurl"
).
toString
()
+
""
it
.
nickname
=
res
?.
get
(
"nickname"
).
toString
()
+
""
it
.
sex
=
(
res
?.
get
(
"sex"
).
toString
()
+
""
).
toInt
()
}
if
(!
isHidden
)
{
//当前fragment正在显示调用微信登陆接口
viewModel
.
wechatlogin
(
JsonUtil
.
toJson
(
wxInfo
))
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
false
}
}
...
...
app/src/main/java/com/mints/street/main/my/MyViewModel.kt
View file @
6ef43e37
...
@@ -5,8 +5,11 @@ import androidx.lifecycle.MutableLiveData
...
@@ -5,8 +5,11 @@ import androidx.lifecycle.MutableLiveData
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.MyInfo
import
com.mints.street.bean.MyInfo
import
com.mints.street.bean.UserBean
import
com.mints.street.bean.UserBean
import
com.mints.street.common.DeviceInfo
import
com.mints.street.manager.UserManager
import
com.mints.street.model.ApiModel
import
com.mints.street.model.ApiModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
com.mints.street.utils.DeviceUuidFactory
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.KLog
import
java.util.HashMap
import
java.util.HashMap
...
@@ -16,25 +19,86 @@ import java.util.HashMap
...
@@ -16,25 +19,86 @@ import java.util.HashMap
*/
*/
class
MyViewModel
(
application
:
Application
)
:
BaseViewModel
(
application
)
{
class
MyViewModel
(
application
:
Application
)
:
BaseViewModel
(
application
)
{
val
M
yInfodata
:
MutableLiveData
<
MyInfo
>
=
MutableLiveData
()
val
m
yInfodata
:
MutableLiveData
<
MyInfo
>
=
MutableLiveData
()
val
deviceInfo
:
DeviceInfo
get
()
{
return
DeviceInfo
.
instance
}
/**
* 获取个人信息
*/
fun
getmyInfo
()
{
fun
getmyInfo
()
{
ApiModel
.
getuserInfo
(
lifecycleProvider
).
safeSubscribe
(
ApiModel
.
getuserInfo
(
lifecycleProvider
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
MyInfo
>>(
object
:
HttpSubscribeImpl
<
BaseResponse
<
MyInfo
>>(
this
@MyViewModel
,
true
)
{
this
@MyViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
MyInfo
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
MyInfo
>)
{
M
yInfodata
.
value
=
response
.
result
m
yInfodata
.
value
=
response
.
result
KLog
.
e
(
"getmyInfo"
,
response
.
result
.
toString
())
KLog
.
e
(
"getmyInfo"
,
response
.
result
.
toString
())
}
}
override
fun
onError
(
e
:
Throwable
)
{
override
fun
onError
(
e
:
Throwable
)
{
KLog
.
e
(
"getmyInfo"
,
"用户登录信息请求失败"
)
super
.
onError
(
e
)
super
.
onError
(
e
)
KLog
.
e
(
"getmyInfo"
,
"用户登录信息请求失败"
)
}
}
}
}
)
)
}
}
fun
wechatlogin
(
wxInfo
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"wxInfo"
]
=
wxInfo
// vo["shumeiId"] = ShumeiManager.getInstance().shumeiDeviceId
vo
[
"device"
]
=
DeviceUuidFactory
().
deviceUuid
.
toString
()
ApiModel
.
wechatlogin
(
lifecycleProvider
,
vo
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
UserBean
>>(
this
@MyViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
//保存用户信息到Usermanager
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
this
@MyViewModel
.
saveTerminalInfo
()
//提交设备信息
this
@MyViewModel
.
getmyInfo
()
KLog
.
e
(
"wechatlogin"
,
"微信登录接口成功"
)
}
override
fun
onError
(
e
:
Throwable
)
{
super
.
onError
(
e
)
KLog
.
e
(
"wechatlogin"
,
"微信登录接口失败"
)
}
})
}
/**
* 提交设备信息
*/
fun
saveTerminalInfo
()
{
val
vo
=
hashMapOf
<
String
,
Any
>()
val
macAddress
:
String
=
deviceInfo
.
getMacAddress
()
val
mac
=
macAddress
.
replace
(
":"
,
""
)
vo
[
"mac"
]
=
mac
vo
[
"mac1"
]
=
macAddress
vo
[
"androidid"
]
=
deviceInfo
.
getAndroidId
(
null
)
vo
[
"imei"
]
=
deviceInfo
.
iMEI
// if (!TextUtils.isEmpty(App.OAID)) {
// vo["oaid"] = App.OAID
// }
vo
[
"os"
]
=
"android"
vo
[
"model"
]
=
deviceInfo
.
newModel
vo
[
"uuid"
]
=
DeviceUuidFactory
().
deviceUuid
vo
[
"osversion"
]
=
deviceInfo
.
oSVersion
vo
[
"appversion"
]
=
deviceInfo
.
versionName
ApiModel
.
saveTerminalInfo
(
lifecycleProvider
,
vo
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
Any
>>(
this
@MyViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
Any
>)
{
KLog
.
e
(
"saveTerminalInfo"
,
response
.
result
.
toString
())
}
})
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/model/ApiModel.kt
View file @
6ef43e37
...
@@ -65,7 +65,7 @@ object ApiModel {
...
@@ -65,7 +65,7 @@ object ApiModel {
/**
/**
* 绑定手机号登录
* 绑定手机号登录
*/
*/
fun
bindingMobile
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
BindMobile
Bean
>>>{
fun
bindingMobile
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
User
Bean
>>>{
return
HttpManager
.
getInstance
().
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
bindingMobile
(
map
))
return
HttpManager
.
getInstance
().
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
bindingMobile
(
map
))
}
}
...
@@ -75,4 +75,11 @@ object ApiModel {
...
@@ -75,4 +75,11 @@ object ApiModel {
fun
bindingMobilecode
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
Any
>>>{
fun
bindingMobilecode
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
Any
>>>{
return
HttpManager
.
getInstance
().
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
sendMobileBindingCode
(
map
))
return
HttpManager
.
getInstance
().
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
sendMobileBindingCode
(
map
))
}
}
/**
* 微信登录
*/
fun
wechatlogin
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
UserBean
>>>{
return
HttpManager
.
getInstance
().
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
wechatlogin
(
map
))
}
}
}
\ No newline at end of file
app/src/main/res/layout/activity_aboutus.xml
View file @
6ef43e37
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
android:paddingTop=
"30dp"
android:paddingTop=
"30dp"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
世界街景3D地图
"
android:text=
"
3D高清街景
"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:layout_centerInParent=
"true"
/>
android:layout_centerInParent=
"true"
/>
...
...
app/src/main/res/layout/activity_permissions.xml
View file @
6ef43e37
...
@@ -41,11 +41,11 @@
...
@@ -41,11 +41,11 @@
<ImageView
<ImageView
android:id=
"@+id/iv1"
android:id=
"@+id/iv1"
android:layout_width=
"
7
0dp"
android:layout_width=
"
5
0dp"
android:layout_height=
"
7
0dp"
android:layout_height=
"
5
0dp"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"10dp"
android:layout_marginLeft=
"10dp"
android:src=
"@mipmap/ic
_my
"
/>
android:src=
"@mipmap/ic
on_impower_location
"
/>
<TextView
<TextView
android:id=
"@+id/tv1"
android:id=
"@+id/tv1"
...
@@ -55,7 +55,6 @@
...
@@ -55,7 +55,6 @@
android:layout_marginStart=
"10dp"
android:layout_marginStart=
"10dp"
android:layout_toRightOf=
"@id/iv1"
android:layout_toRightOf=
"@id/iv1"
android:text=
"提供精准定位及导航服务"
android:text=
"提供精准定位及导航服务"
android:layout_marginTop=
"10dp"
android:textStyle=
"bold"
android:textStyle=
"bold"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
/>
...
@@ -66,7 +65,7 @@
...
@@ -66,7 +65,7 @@
android:layout_alignBottom=
"@+id/iv1"
android:layout_alignBottom=
"@+id/iv1"
android:layout_marginStart=
"10dp"
android:layout_marginStart=
"10dp"
android:layout_toRightOf=
"@+id/iv1"
android:layout_toRightOf=
"@+id/iv1"
android:textSize=
"1
2
sp"
android:textSize=
"1
0
sp"
android:text=
"基于您当前位置、为您提供完整的周边信息"
android:text=
"基于您当前位置、为您提供完整的周边信息"
android:layout_marginBottom=
"10dp"
android:layout_marginBottom=
"10dp"
android:textColor=
"#A9000000"
/>
android:textColor=
"#A9000000"
/>
...
@@ -90,11 +89,11 @@
...
@@ -90,11 +89,11 @@
<ImageView
<ImageView
android:id=
"@+id/iv2"
android:id=
"@+id/iv2"
android:layout_width=
"
7
0dp"
android:layout_width=
"
5
0dp"
android:layout_height=
"
7
0dp"
android:layout_height=
"
5
0dp"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"10dp"
android:layout_marginLeft=
"10dp"
android:src=
"@mipmap/ic
_my
"
/>
android:src=
"@mipmap/ic
on_impower_save
"
/>
<TextView
<TextView
android:id=
"@+id/tv2"
android:id=
"@+id/tv2"
...
@@ -104,7 +103,6 @@
...
@@ -104,7 +103,6 @@
android:layout_marginStart=
"10dp"
android:layout_marginStart=
"10dp"
android:layout_toRightOf=
"@id/iv2"
android:layout_toRightOf=
"@id/iv2"
android:text=
"存储地图等相关数据"
android:text=
"存储地图等相关数据"
android:layout_marginTop=
"10dp"
android:textStyle=
"bold"
android:textStyle=
"bold"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
/>
...
@@ -115,7 +113,7 @@
...
@@ -115,7 +113,7 @@
android:layout_alignBottom=
"@+id/iv2"
android:layout_alignBottom=
"@+id/iv2"
android:layout_marginStart=
"10dp"
android:layout_marginStart=
"10dp"
android:layout_toRightOf=
"@+id/iv2"
android:layout_toRightOf=
"@+id/iv2"
android:textSize=
"1
2
sp"
android:textSize=
"1
0
sp"
android:text=
"用于读写地图、常用地址等相关数据"
android:text=
"用于读写地图、常用地址等相关数据"
android:layout_marginBottom=
"10dp"
android:layout_marginBottom=
"10dp"
android:textColor=
"#A9000000"
/>
android:textColor=
"#A9000000"
/>
...
@@ -139,11 +137,11 @@
...
@@ -139,11 +137,11 @@
<ImageView
<ImageView
android:id=
"@+id/iv3"
android:id=
"@+id/iv3"
android:layout_width=
"
7
0dp"
android:layout_width=
"
5
0dp"
android:layout_height=
"
7
0dp"
android:layout_height=
"
5
0dp"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"10dp"
android:layout_marginLeft=
"10dp"
android:src=
"@mipmap/ic
_my
"
/>
android:src=
"@mipmap/ic
on_impower_setting
"
/>
<TextView
<TextView
android:id=
"@+id/tv3"
android:id=
"@+id/tv3"
...
@@ -153,7 +151,6 @@
...
@@ -153,7 +151,6 @@
android:layout_marginStart=
"10dp"
android:layout_marginStart=
"10dp"
android:layout_toRightOf=
"@id/iv3"
android:layout_toRightOf=
"@id/iv3"
android:text=
"问题诊断及修复"
android:text=
"问题诊断及修复"
android:layout_marginTop=
"10dp"
android:textStyle=
"bold"
android:textStyle=
"bold"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
/>
...
@@ -164,7 +161,7 @@
...
@@ -164,7 +161,7 @@
android:layout_alignBottom=
"@+id/iv3"
android:layout_alignBottom=
"@+id/iv3"
android:layout_marginStart=
"10dp"
android:layout_marginStart=
"10dp"
android:layout_toRightOf=
"@+id/iv3"
android:layout_toRightOf=
"@+id/iv3"
android:textSize=
"1
2
sp"
android:textSize=
"1
0
sp"
android:text=
"用于读取信息、快速确诊问题"
android:text=
"用于读取信息、快速确诊问题"
android:layout_marginBottom=
"10dp"
android:layout_marginBottom=
"10dp"
android:textColor=
"#A9000000"
/>
android:textColor=
"#A9000000"
/>
...
...
app/src/main/res/layout/fragment_my.xml
View file @
6ef43e37
...
@@ -81,7 +81,9 @@
...
@@ -81,7 +81,9 @@
<TextView
<TextView
android:id=
"@+id/tv_tips"
android:id=
"@+id/tv_tips"
android:layout_width=
"wrap_content"
android:gravity=
"center"
android:layout_toStartOf=
"@+id/bt_try"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_toRightOf=
"@id/iv_flag"
android:layout_toRightOf=
"@id/iv_flag"
...
@@ -313,7 +315,7 @@
...
@@ -313,7 +315,7 @@
android:id=
"@+id/imageView16"
android:id=
"@+id/imageView16"
android:layout_width=
"20dp"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
android:
background=
"@drawable/shape_btn_friends_unenabled
"
android:
src=
"@mipmap/icon_me_tiao
"
app:layout_constraintBottom_toTopOf=
"@+id/guideline7"
app:layout_constraintBottom_toTopOf=
"@+id/guideline7"
app:layout_constraintEnd_toStartOf=
"@+id/textView5"
app:layout_constraintEnd_toStartOf=
"@+id/textView5"
app:layout_constraintStart_toStartOf=
"@+id/guideline5"
app:layout_constraintStart_toStartOf=
"@+id/guideline5"
...
@@ -324,7 +326,7 @@
...
@@ -324,7 +326,7 @@
android:id=
"@+id/imageView18"
android:id=
"@+id/imageView18"
android:layout_width=
"20dp"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
android:
background=
"@drawable/shape_btn_friends_unenabled
"
android:
src=
"@mipmap/icon_me_tiao
"
app:layout_constraintBottom_toTopOf=
"@+id/guideline7"
app:layout_constraintBottom_toTopOf=
"@+id/guideline7"
app:layout_constraintEnd_toStartOf=
"@+id/guideline6"
app:layout_constraintEnd_toStartOf=
"@+id/guideline6"
app:layout_constraintHorizontal_bias=
"0.481"
app:layout_constraintHorizontal_bias=
"0.481"
...
...
app/src/main/res/layout/include_header.xml
View file @
6ef43e37
...
@@ -78,6 +78,7 @@
...
@@ -78,6 +78,7 @@
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<View
<View
android:id=
"@+id/header_line"
style=
"@style/view_line_E6E6E6"
style=
"@style/view_line_E6E6E6"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"@+id/iv_right_icon"
/>
app:layout_constraintEnd_toEndOf=
"@+id/iv_right_icon"
/>
...
...
app/src/main/res/layout/layout_popupwindow.xml
View file @
6ef43e37
...
@@ -32,17 +32,17 @@
...
@@ -32,17 +32,17 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:padding=
"
2
0dp"
>
android:padding=
"
1
0dp"
>
<ImageView
<ImageView
android:id=
"@+id/iv_weixin"
android:id=
"@+id/iv_weixin"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
70dp
"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
70dp
"
android:layout_marginRight=
"20pt"
android:layout_marginRight=
"20pt"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@mipmap/ic
_my
"
app:srcCompat=
"@mipmap/ic
on_login_wx
"
tools:ignore=
"MissingConstraints"
/>
tools:ignore=
"MissingConstraints"
/>
<TextView
<TextView
...
...
app/src/main/res/mipmap-xhdpi/ic_arrow_back_white.png
0 → 100644
View file @
6ef43e37
193 Bytes
app/src/main/res/mipmap-xhdpi/icon_impower_location.png
0 → 100644
View file @
6ef43e37
7.49 KB
app/src/main/res/mipmap-xhdpi/icon_impower_save.png
0 → 100644
View file @
6ef43e37
7.55 KB
app/src/main/res/mipmap-xhdpi/icon_impower_setting.png
0 → 100644
View file @
6ef43e37
7.4 KB
app/src/main/res/mipmap-xhdpi/icon_login_wx.png
0 → 100644
View file @
6ef43e37
11 KB
app/src/main/res/mipmap-xhdpi/icon_me_tiao.png
0 → 100644
View file @
6ef43e37
2.27 KB
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