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
e9635526
Commit
e9635526
authored
Jul 17, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'branche_zsf' of
http://39.97.65.143:81/android/android_street
into fry_dev
parents
9fa3b5fe
e4f090c2
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
156 additions
and
117 deletions
+156
-117
MainApi.kt
app/src/main/java/com/mints/street/api/MainApi.kt
+2
-2
BaseResponse.java
app/src/main/java/com/mints/street/bean/BaseResponse.java
+7
-1
BindMobileBean.kt
app/src/main/java/com/mints/street/bean/BindMobileBean.kt
+0
-16
MyInfo.kt
app/src/main/java/com/mints/street/bean/MyInfo.kt
+0
-18
LoginActivity.kt
app/src/main/java/com/mints/street/login/LoginActivity.kt
+28
-0
LoginViewModel.kt
app/src/main/java/com/mints/street/login/LoginViewModel.kt
+4
-4
MainActivity.kt
app/src/main/java/com/mints/street/main/MainActivity.kt
+1
-1
BindMobileActivity.kt
.../main/java/com/mints/street/main/my/BindMobileActivity.kt
+0
-1
BindMobileViewModel.kt
...main/java/com/mints/street/main/my/BindMobileViewModel.kt
+0
-1
MoresettingsActivity.kt
...ain/java/com/mints/street/main/my/MoresettingsActivity.kt
+20
-11
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+64
-38
MyViewModel.kt
app/src/main/java/com/mints/street/main/my/MyViewModel.kt
+5
-4
ApiModel.kt
app/src/main/java/com/mints/street/model/ApiModel.kt
+2
-2
shape_gold_blue.xml
app/src/main/res/drawable/shape_gold_blue.xml
+1
-1
activity_aboutus.xml
app/src/main/res/layout/activity_aboutus.xml
+1
-1
activity_login.xml
app/src/main/res/layout/activity_login.xml
+2
-2
activity_moresettings.xml
app/src/main/res/layout/activity_moresettings.xml
+0
-1
activity_permissions.xml
app/src/main/res/layout/activity_permissions.xml
+7
-4
layout_popupwindow.xml
app/src/main/res/layout/layout_popupwindow.xml
+8
-6
ic_launcher_main.png
app/src/main/res/mipmap-xhdpi/ic_launcher_main.png
+0
-0
ic_launcher_main.png
app/src/main/res/mipmap-xxhdpi/ic_launcher_main.png
+0
-0
menu_navigation.xml
library_base/src/main/res/menu/menu_navigation.xml
+3
-2
ic_earth_map.png
library_base/src/main/res/mipmap-xxhdpi/ic_earth_map.png
+0
-0
ic_eye_tokephone.gif
library_base/src/main/res/mipmap-xxhdpi/ic_eye_tokephone.gif
+0
-0
ResponseThrowable.java
...main/java/me/goldze/mvvmhabit/http/ResponseThrowable.java
+1
-1
No files found.
app/src/main/java/com/mints/street/api/MainApi.kt
View file @
e9635526
...
@@ -23,7 +23,7 @@ interface MainApi {
...
@@ -23,7 +23,7 @@ interface MainApi {
* @return
* @return
*/
*/
@POST
(
"api/sendMobileCode"
)
@POST
(
"api/sendMobileCode"
)
fun
sendMobileCode
(
@Body
vo
:
@JvmSuppressWildcards
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
Any
>>>
fun
sendMobileCode
(
@Body
vo
:
Map
<
String
,
String
>):
Observable
<
Response
<
BaseResponse
<
Any
>>>
/**
/**
* 登录
* 登录
...
@@ -55,7 +55,7 @@ interface MainApi {
...
@@ -55,7 +55,7 @@ interface MainApi {
* 获取用户登录信息
* 获取用户登录信息
*/
*/
@POST
(
"api/baseMsg"
)
@POST
(
"api/baseMsg"
)
fun
baseMsg
():
Observable
<
Response
<
BaseResponse
<
MyInfo
>>>
fun
baseMsg
():
Observable
<
Response
<
BaseResponse
<
UserBean
>>>
/**
/**
* 绑定手机号接口
* 绑定手机号接口
...
...
app/src/main/java/com/mints/street/bean/BaseResponse.java
View file @
e9635526
...
@@ -12,7 +12,8 @@ import java.io.Serializable;
...
@@ -12,7 +12,8 @@ import java.io.Serializable;
*/
*/
public
class
BaseResponse
<
T
>
implements
Serializable
{
public
class
BaseResponse
<
T
>
implements
Serializable
{
private
int
status
;
private
int
status
;
private
String
message
;
private
String
message
=
""
;
// @JsonAdapter(value = JsonAdapterGsonDeserializer.class)
// @JsonAdapter(value = JsonAdapterGsonDeserializer.class)
@SerializedName
(
"data"
)
@SerializedName
(
"data"
)
...
@@ -27,6 +28,11 @@ public class BaseResponse<T> implements Serializable {
...
@@ -27,6 +28,11 @@ public class BaseResponse<T> implements Serializable {
this
.
result
=
result
;
this
.
result
=
result
;
}
}
public
BaseResponse
(
int
status
)
{
this
.
status
=
status
;
}
public
int
getstatus
()
{
public
int
getstatus
()
{
return
status
;
return
status
;
}
}
...
...
app/src/main/java/com/mints/street/bean/BindMobileBean.kt
deleted
100644 → 0
View file @
9fa3b5fe
package
com.mints.street.bean
data class
BindMobileBean
(
val
consumer
:
Consumer
,
val
token
:
Any
)
data class
Consumer
(
val
createTime
:
Int
,
val
expireTime
:
Int
,
val
idcode
:
String
,
val
isForever
:
Boolean
,
val
mobile
:
String
,
val
nickname
:
String
,
val
pk_id
:
Long
)
\ No newline at end of file
app/src/main/java/com/mints/street/bean/MyInfo.kt
deleted
100644 → 0
View file @
9fa3b5fe
package
com.mints.street.bean
import
java.io.Serializable
class
MyInfo
{
val
token
:
String
=
""
val
consumer
:
ConsumerBean
?
=
null
inner
class
ConsumerBean
:
Serializable
{
val
openid
:
String
=
""
val
nickname
:
String
=
""
val
mobile
:
String
=
""
val
idcode
:
String
=
""
val
isForever
:
Boolean
=
false
val
expireTime
:
Long
=
0
val
pk_id
:
Long
=
0
}
}
app/src/main/java/com/mints/street/login/LoginActivity.kt
View file @
e9635526
...
@@ -47,6 +47,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
...
@@ -47,6 +47,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
return
@setOnClickListener
return
@setOnClickListener
}
}
sendCodeThread
()
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
viewModel
.
sendMobileCode
(
mobile
)
viewModel
.
sendMobileCode
(
mobile
)
...
@@ -117,4 +118,31 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
...
@@ -117,4 +118,31 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
R
.
id
.
iv_left_icon
->
finish
()
R
.
id
.
iv_left_icon
->
finish
()
}
}
}
}
/**
* 发送手机验证码,按钮动态改变状态
*/
var
num
=
0
var
run
:
Runnable
?
=
null
fun
sendCodeThread
()
{
num
=
60
tv_send_sms
?.
let
{
it
.
isEnabled
=
false
it
.
text
=
"($num)重新获取"
run
=
object
:
Runnable
{
override
fun
run
()
{
num
--
if
(
num
==
0
)
{
it
.
text
=
"重新获取"
it
.
isEnabled
=
true
}
else
{
it
.
text
=
"($num)重新获取"
it
.
postDelayed
(
this
,
1000
)
}
}
}
it
.
postDelayed
(
run
,
1000
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/login/LoginViewModel.kt
View file @
e9635526
...
@@ -32,15 +32,15 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
...
@@ -32,15 +32,15 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
* @param mobile
* @param mobile
*/
*/
fun
sendMobileCode
(
mobile
:
String
)
{
fun
sendMobileCode
(
mobile
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
val
vo
=
HashMap
<
String
,
String
>()
vo
[
"mobile"
]
=
mobile
vo
[
"mobile"
]
=
mobile
vo
[
"type"
]
=
1
//
vo["type"] = 1
ApiModel
.
sendMobileCode
(
lifecycleProvider
,
vo
).
s
afeS
ubscribe
(
ApiModel
.
sendMobileCode
(
lifecycleProvider
,
vo
).
subscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
Any
>>(
object
:
HttpSubscribeImpl
<
BaseResponse
<
Any
>>(
this
@LoginViewModel
,
true
)
{
this
@LoginViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
Any
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
Any
>)
{
KLog
.
e
(
"sendMobileCode"
,
response
.
result
.
toString
())
//
KLog.e("sendMobileCode", response.result.toString())
}
}
override
fun
onError
(
e
:
Throwable
)
{
override
fun
onError
(
e
:
Throwable
)
{
data
.
value
=
"失败"
data
.
value
=
"失败"
...
...
app/src/main/java/com/mints/street/main/MainActivity.kt
View file @
e9635526
...
@@ -51,7 +51,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
...
@@ -51,7 +51,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
}
}
//加载本地GIF动图
//加载本地GIF动图
ImageLoader
.
ImageBuilder
.
with
(
this
)
ImageLoader
.
ImageBuilder
.
with
(
this
)
.
setDrawable
(
R
.
mipmap
.
ic_e
ye_tokephone
)
.
setDrawable
(
R
.
mipmap
.
ic_e
arth_map
)
.
setTargetView
(
binding
.
ivTakephoto
).
start
()
.
setTargetView
(
binding
.
ivTakephoto
).
start
()
binding
.
mainBottom
.
interceptLongClick
(
binding
.
mainBottom
.
interceptLongClick
(
...
...
app/src/main/java/com/mints/street/main/my/BindMobileActivity.kt
View file @
e9635526
...
@@ -8,7 +8,6 @@ import androidx.lifecycle.Observer
...
@@ -8,7 +8,6 @@ import androidx.lifecycle.Observer
import
com.fry.base.base.BaseActivity
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.UserBean
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
...
...
app/src/main/java/com/mints/street/main/my/BindMobileViewModel.kt
View file @
e9635526
...
@@ -3,7 +3,6 @@ package com.mints.street.main.my
...
@@ -3,7 +3,6 @@ package com.mints.street.main.my
import
android.app.Application
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.UserBean
import
com.mints.street.bean.UserBean
import
com.mints.street.manager.UserManager
import
com.mints.street.manager.UserManager
import
com.mints.street.model.ApiModel
import
com.mints.street.model.ApiModel
...
...
app/src/main/java/com/mints/street/main/my/MoresettingsActivity.kt
View file @
e9635526
...
@@ -16,6 +16,7 @@ import com.mints.street.manager.UserManager
...
@@ -16,6 +16,7 @@ import com.mints.street.manager.UserManager
import
kotlinx.android.synthetic.main.activity_moresettings.*
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.RxUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
org.w3c.dom.Text
import
org.w3c.dom.Text
...
@@ -53,6 +54,14 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
...
@@ -53,6 +54,14 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
setTextColor
(
Color
.
BLACK
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
setTextColor
(
Color
.
BLACK
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
"去绑定"
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
"去绑定"
item_phone
.
setOnClickListener
(
this
)
item_phone
.
setOnClickListener
(
this
)
RxUtils
.
onMultiClick
(
item_phone
){
if
(
userManager
.
userIsLogin
())
{
startActivity
(
BindMobileActivity
::
class
.
java
)
return
@onMultiClick
}
else
{
ToastUtils
.
showLong
(
"请先使用微信登录"
)
}
}
}
}
}
}
private
fun
initView
()
{
private
fun
initView
()
{
...
@@ -68,7 +77,7 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
...
@@ -68,7 +77,7 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
phone
,
null
,
null
,
null
)
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
phone
,
null
,
null
,
null
)
item_phone
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
GONE
item_phone
.
findViewById
<
ImageView
>(
R
.
id
.
iv_right
).
visibility
=
View
.
GONE
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"
用户
协议"
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
text
=
"
注册
协议"
val
userAgree
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_user
)
val
userAgree
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
icon_settings_user
)
userAgree
?.
setBounds
(
0
,
0
,
56
,
56
)
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_title
).
setCompoundDrawables
(
userAgree
,
null
,
null
,
null
)
...
@@ -96,14 +105,14 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
...
@@ -96,14 +105,14 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
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()) {
startActivity
(
BindMobileActivity
::
class
.
java
)
//
startActivity(BindMobileActivity::class.java)
return
//
return
}
else
{
//
} else {
ToastUtils
.
showLong
(
"请先使用微信登录"
)
//
ToastUtils.showLong("请先使用微信登录")
}
//
}
}
//
}
R
.
id
.
btn_switch
->
{
//退出登录
R
.
id
.
btn_switch
->
{
//退出登录
UserManager
.
INSTANCE
.
userLogout
()
UserManager
.
INSTANCE
.
userLogout
()
...
@@ -111,10 +120,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
...
@@ -111,10 +120,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
KLog
.
e
(
"setOnClick"
,
"btn_switch has been clicked."
)
KLog
.
e
(
"setOnClick"
,
"btn_switch has been clicked."
)
}
}
R
.
id
.
item_userAgree
->
{
//用户协议
R
.
id
.
item_userAgree
->
{
//用户协议
ToastUtils
.
showShort
(
"点击了《注册协议》"
)
}
}
R
.
id
.
item_privacyAgree
->
{
//隐私协议
R
.
id
.
item_privacyAgree
->
{
//隐私协议
ToastUtils
.
showShort
(
"点击了《隐私协议》"
)
}
}
}
}
...
...
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
e9635526
...
@@ -19,7 +19,7 @@ import com.fry.base.base.BaseFragment
...
@@ -19,7 +19,7 @@ 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.
UserBean
import
com.mints.street.bean.WXInfo
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
...
@@ -31,6 +31,8 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout
...
@@ -31,6 +31,8 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.tbruyelle.rxpermissions2.RxPermissions
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.RxUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
java.util.*
import
java.util.*
...
@@ -43,7 +45,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -43,7 +45,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
View
.
OnClickListener
,
OnLoginListener
{
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
:
UserBean
?
=
null
private
val
loginApi
by
lazy
{
LoginApi
()
}
private
val
loginApi
by
lazy
{
LoginApi
()
}
private
var
wxInfo
:
WXInfo
?
=
null
private
var
wxInfo
:
WXInfo
?
=
null
...
@@ -53,6 +55,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -53,6 +55,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
private
var
iv_weixin
:
ImageView
?
=
null
private
var
iv_weixin
:
ImageView
?
=
null
private
var
ly_phone
:
LinearLayoutCompat
?
=
null
private
var
ly_phone
:
LinearLayoutCompat
?
=
null
private
var
cb_checked
:
CheckBox
?
=
null
private
var
cb_checked
:
CheckBox
?
=
null
private
var
tv_regist
:
TextView
?
=
null
private
var
tv_private
:
TextView
?
=
null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
...
@@ -64,7 +68,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -64,7 +68,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
super
.
initData
()
super
.
initData
()
srl_my
.
setOnRefreshListener
(
this
)
srl_my
.
setOnRefreshListener
(
this
)
//隐藏立即领取
//隐藏立即领取
bt_try
.
visibility
=
View
.
GONE
bt_try
.
visibility
=
View
.
GONE
initView
()
initView
()
initListener
()
initListener
()
}
}
...
@@ -72,32 +76,52 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -72,32 +76,52 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
if
(
userManager
.
userIsLogin
())
{
//查询用户登录信息
//查询用户登录信息
viewModel
.
getmyInfo
()
viewModel
.
getmyInfo
()
setUserLoginStatus
()
}
else
{
//
//重新显示界面信息
// if (userManager.userIsLogin()) {
setUserLoginStatus
()
// //查询用户登录信息
}
// viewModel.getmyInfo()
// } else {
// //重新显示界面信息
// setUserLoginStatus()
// }
}
}
private
fun
initListener
()
{
private
fun
initListener
()
{
//设置登录点击事件
//设置登录点击事件
binding
.
llMyLogin
.
setOnClickListener
{
RxUtils
.
onMultiClick
(
binding
.
llMyLogin
){
// binding.llMyLogin.setOnClickListener {
if
(!
userManager
.
userIsLogin
())
{
if
(!
userManager
.
userIsLogin
())
{
//创建弹窗
//创建弹窗
mBottomSheetDialog
=
BottomSheetDialog
(
context
!!
)
mBottomSheetDialog
=
BottomSheetDialog
(
context
!!
)
val
view1
:
View
=
layoutInflater
.
inflate
(
R
.
layout
.
layout_popupwindow
,
null
)
val
view1
:
View
=
layoutInflater
.
inflate
(
R
.
layout
.
layout_popupwindow
,
null
)
mBottomSheetDialog
!!
.
setContentView
(
view1
)
mBottomSheetDialog
!!
.
setContentView
(
view1
)
mBottomSheetDialog
!!
.
window
!!
.
findViewById
<
View
>(
R
.
id
.
design_bottom_sheet
).
setBackgroundColor
(
Color
.
TRANSPARENT
)
mBottomSheetDialog
!!
.
window
!!
.
findViewById
<
View
>(
R
.
id
.
design_bottom_sheet
).
setBackgroundColor
(
Color
.
TRANSPARENT
)
mBottomSheetDialog
!!
.
show
()
mBottomSheetDialog
!!
.
show
()
iv_weixin
=
view1
.
findViewById
(
R
.
id
.
iv_weixin
)
iv_weixin
=
view1
.
findViewById
(
R
.
id
.
iv_weixin
)
ly_phone
=
view1
.
findViewById
(
R
.
id
.
ly_phone
)
ly_phone
=
view1
.
findViewById
(
R
.
id
.
ly_phone
)
cb_checked
=
view1
.
findViewById
(
R
.
id
.
cb_checked
)
cb_checked
=
view1
.
findViewById
(
R
.
id
.
cb_checked
)
tv_private
=
view1
.
findViewById
(
R
.
id
.
tv_private
)
tv_regist
=
view1
.
findViewById
(
R
.
id
.
tv_regist
)
tv_regist
?.
setOnClickListener
(
this
)
tv_private
?.
setOnClickListener
(
this
)
iv_weixin
?.
setOnClickListener
(
this
)
iv_weixin
?.
setOnClickListener
(
this
)
ly_phone
?.
setOnClickListener
(
this
)
// ly_phone?.setOnClickListener(this)
}
RxUtils
.
onMultiClick
(
ly_phone
){
if
(
cb_checked
!!
.
isChecked
)
{
startActivity
(
LoginActivity
::
class
.
java
)
mBottomSheetDialog
!!
.
dismiss
()
}
else
{
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
}
}
}
}
}
//设置立即领取点击事件
//设置立即领取点击事件
...
@@ -110,8 +134,13 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -110,8 +134,13 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
}
}
}
}
aboutus
.
setOnClickListener
(
this
)
moresettings
.
setOnClickListener
(
this
)
RxUtils
.
onMultiClick
(
aboutus
){
startActivity
(
AboutusActivity
::
class
.
java
)
}
RxUtils
.
onMultiClick
(
moresettings
){
startActivity
(
MoresettingsActivity
::
class
.
java
)
}
}
}
private
fun
initView
()
{
private
fun
initView
()
{
...
@@ -133,18 +162,11 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -133,18 +162,11 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
override
fun
onClick
(
v
:
View
?)
{
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
when
(
v
?.
id
)
{
R
.
id
.
aboutus
->
{
startActivity
(
AboutusActivity
::
class
.
java
)
// startActivity(PermissionsActivity::class.java)
}
R
.
id
.
moresettings
->
{
startActivity
(
MoresettingsActivity
::
class
.
java
)
}
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
)
val
wechat
=
ShareSDK
.
getPlatform
(
Wechat
.
NAME
)
if
(!
wechat
.
isClientValid
){
if
(!
wechat
.
isClientValid
)
{
ToastUtils
.
showShort
(
"请先安装微信"
)
ToastUtils
.
showShort
(
"请先安装微信"
)
return
return
}
}
...
@@ -164,21 +186,28 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -164,21 +186,28 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
}
}
}
}
R
.
id
.
ly_phone
->
{
// R.id.ly_phone -> {
if
(
cb_checked
!!
.
isChecked
)
{
// if (cb_checked!!.isChecked) {
startActivity
(
LoginActivity
::
class
.
java
)
// startActivity(LoginActivity::class.java)
mBottomSheetDialog
!!
.
dismiss
()
// mBottomSheetDialog!!.dismiss()
}
else
{
// } else {
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
// ToastUtils.showShort("请先同意用户协议与隐私政策")
}
// }
// }
R
.
id
.
tv_regist
->
{
KLog
.
e
(
"sssss"
,
"点击了《注册协议》"
)
ToastUtils
.
showShort
(
"点击了《注册协议》"
)
}
R
.
id
.
tv_private
->
{
KLog
.
e
(
"sssss"
,
"点击了《隐私协议》"
)
ToastUtils
.
showShort
(
"点击了《隐私协议》"
)
}
}
}
}
}
}
override
fun
initViewObservable
()
{
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
super
.
initViewObservable
()
viewModel
.
myInfodata
.
observe
(
this
,
Observer
<
MyInfo
>
{
viewModel
.
myInfodata
.
observe
(
this
,
Observer
<
UserBean
>
{
srl_my
.
finishRefresh
(
true
)
srl_my
.
finishRefresh
(
true
)
if
(
it
==
null
)
{
if
(
it
==
null
)
{
userConfig
=
null
userConfig
=
null
...
@@ -195,7 +224,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -195,7 +224,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
private
fun
setUserLoginStatus
()
{
private
fun
setUserLoginStatus
()
{
if
(
userManager
.
userIsLogin
())
{
if
(
userManager
.
userIsLogin
())
{
// 已登录
// 已登录
item_title_id
.
text
=
userManager
.
getWxName
()
item_title_id
.
text
=
userManager
.
getWxName
()
Glide
.
with
(
requireContext
()).
load
(
userManager
.
getWxHeader
()).
into
(
item_title_avatar
)
Glide
.
with
(
requireContext
()).
load
(
userManager
.
getWxHeader
()).
into
(
item_title_avatar
)
}
else
{
}
else
{
// 未登录
// 未登录
...
@@ -205,12 +234,9 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
...
@@ -205,12 +234,9 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
}
}
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
if
(
userManager
.
userIsLogin
())
{
//查询用户登录信息
viewModel
.
getmyInfo
()
viewModel
.
getmyInfo
()
}
else
{
setUserLoginStatus
()
srl_my
.
finishRefresh
(
true
)
srl_my
.
finishRefresh
(
true
)
}
}
}
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
...
...
app/src/main/java/com/mints/street/main/my/MyViewModel.kt
View file @
e9635526
...
@@ -3,7 +3,6 @@ package com.mints.street.main.my
...
@@ -3,7 +3,6 @@ package com.mints.street.main.my
import
android.app.Application
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.MyInfo
import
com.mints.street.bean.UserBean
import
com.mints.street.bean.UserBean
import
com.mints.street.common.DeviceInfo
import
com.mints.street.common.DeviceInfo
import
com.mints.street.manager.UserManager
import
com.mints.street.manager.UserManager
...
@@ -19,7 +18,7 @@ import java.util.HashMap
...
@@ -19,7 +18,7 @@ import java.util.HashMap
*/
*/
class
MyViewModel
(
application
:
Application
)
:
BaseViewModel
(
application
)
{
class
MyViewModel
(
application
:
Application
)
:
BaseViewModel
(
application
)
{
val
myInfodata
:
MutableLiveData
<
MyInfo
>
=
MutableLiveData
()
val
myInfodata
:
MutableLiveData
<
UserBean
>
=
MutableLiveData
()
val
deviceInfo
:
DeviceInfo
val
deviceInfo
:
DeviceInfo
get
()
{
get
()
{
...
@@ -31,11 +30,13 @@ class MyViewModel(application: Application) : BaseViewModel(application) {
...
@@ -31,11 +30,13 @@ class MyViewModel(application: Application) : BaseViewModel(application) {
*/
*/
fun
getmyInfo
()
{
fun
getmyInfo
()
{
ApiModel
.
getuserInfo
(
lifecycleProvider
).
safeSubscribe
(
ApiModel
.
getuserInfo
(
lifecycleProvider
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
MyInfo
>>(
object
:
HttpSubscribeImpl
<
BaseResponse
<
UserBean
>>(
this
@MyViewModel
,
true
)
{
this
@MyViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
MyInfo
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
myInfodata
.
value
=
response
.
result
myInfodata
.
value
=
response
.
result
//保存用户信息到Usermanager
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
KLog
.
e
(
"getmyInfo"
,
response
.
result
.
toString
())
KLog
.
e
(
"getmyInfo"
,
response
.
result
.
toString
())
}
}
...
...
app/src/main/java/com/mints/street/model/ApiModel.kt
View file @
e9635526
...
@@ -16,7 +16,7 @@ object ApiModel {
...
@@ -16,7 +16,7 @@ object ApiModel {
/**
/**
* 发送验证码
* 发送验证码
*/
*/
fun
sendMobileCode
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
Map
<
String
,
Any
>):
Observable
<
Response
<
BaseResponse
<
Any
>>>
{
fun
sendMobileCode
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?,
map
:
Map
<
String
,
String
>):
Observable
<
Response
<
BaseResponse
<
Any
>>>
{
return
HttpManager
.
getInstance
()
return
HttpManager
.
getInstance
()
.
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
sendMobileCode
(
map
))
.
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
sendMobileCode
(
map
))
}
}
...
@@ -57,7 +57,7 @@ object ApiModel {
...
@@ -57,7 +57,7 @@ object ApiModel {
/**
/**
* 获取用户登录信息
* 获取用户登录信息
*/
*/
fun
getuserInfo
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?):
Observable
<
Response
<
BaseResponse
<
MyInfo
>>>
{
fun
getuserInfo
(
lifecycleProvider
:
LifecycleProvider
<
Any
>?):
Observable
<
Response
<
BaseResponse
<
UserBean
>>>
{
return
HttpManager
.
getInstance
()
return
HttpManager
.
getInstance
()
.
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
baseMsg
())
.
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
baseMsg
())
}
}
...
...
app/src/main/res/drawable/shape_gold_blue.xml
View file @
e9635526
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<!-- 边框的颜色和粗细 -->
<!-- 边框的颜色和粗细 -->
<stroke
<stroke
android:width=
"1dp"
android:width=
"1dp"
android:color=
"#
4CAF50
"
android:color=
"#
03A9F4
"
/>
/>
<solid
android:color=
"#ffffffff"
/>
<solid
android:color=
"#ffffffff"
/>
<corners
android:radius=
"10dp"
/>
<corners
android:radius=
"10dp"
/>
...
...
app/src/main/res/layout/activity_aboutus.xml
View file @
e9635526
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
android:layout_alignParentBottom=
"true"
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:layout_marginBottom=
"65dp"
android:layout_marginBottom=
"65dp"
android:src=
"@mipmap/ic_
avatar_ph
"
/>
android:src=
"@mipmap/ic_
launcher_main
"
/>
<LinearLayout
<LinearLayout
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:id=
"@+id/ly_text"
android:id=
"@+id/ly_text"
...
...
app/src/main/res/layout/activity_login.xml
View file @
e9635526
...
@@ -104,8 +104,8 @@
...
@@ -104,8 +104,8 @@
<TextView
<TextView
android:id=
"@+id/tv_send_sms"
android:id=
"@+id/tv_send_sms"
android:layout_width=
"1
0
0dp"
android:layout_width=
"1
2
0dp"
android:layout_height=
"
30dp
"
android:layout_height=
"
match_parent
"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:gravity=
"center"
android:gravity=
"center"
...
...
app/src/main/res/layout/activity_moresettings.xml
View file @
e9635526
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<include
layout=
"@layout/include_header"
/>
<include
layout=
"@layout/include_header"
/>
<com.mints.street.widget.ElasticScrollView
<com.mints.street.widget.ElasticScrollView
...
...
app/src/main/res/layout/activity_permissions.xml
View file @
e9635526
...
@@ -75,6 +75,7 @@
...
@@ -75,6 +75,7 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
app:isOpened=
"true"
app:isOpened=
"true"
app:primaryColor=
"#2196F3"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
...
@@ -120,6 +121,7 @@
...
@@ -120,6 +121,7 @@
<com.github.iielse.switchbutton.SwitchView
<com.github.iielse.switchbutton.SwitchView
android:id=
"@+id/svStrong"
android:id=
"@+id/svStrong"
app:primaryColor=
"#2196F3"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
...
@@ -168,6 +170,7 @@
...
@@ -168,6 +170,7 @@
<com.github.iielse.switchbutton.SwitchView
<com.github.iielse.switchbutton.SwitchView
android:id=
"@+id/svReadmsg"
android:id=
"@+id/svReadmsg"
app:primaryColor=
"#2196F3"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"20dp"
android:layout_height=
"20dp"
app:isOpened=
"true"
app:isOpened=
"true"
...
@@ -216,8 +219,8 @@
...
@@ -216,8 +219,8 @@
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
match_par
ent"
android:layout_height=
"
wrap_cont
ent"
android:
layout_marginBottom=
"2
0dp"
android:
paddingTop=
"1
0dp"
android:gravity=
"bottom|center_horizontal"
android:gravity=
"bottom|center_horizontal"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
...
@@ -231,14 +234,14 @@
...
@@ -231,14 +234,14 @@
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"《
隐私
协议》"
android:text=
"《
注册
协议》"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:textSize=
"12sp"
/>
android:textSize=
"12sp"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"《
用户
协议》"
android:text=
"《
隐私
协议》"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:textSize=
"12sp"
/>
android:textSize=
"12sp"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/layout_popupwindow.xml
View file @
e9635526
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
<androidx.appcompat.widget.LinearLayoutCompat
<androidx.appcompat.widget.LinearLayoutCompat
android:id=
"@+id/ly_phone"
android:id=
"@+id/ly_phone"
android:layout_alignParentRight=
"true"
android:paddingTop=
"20dp"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:layout_alignParentRight=
"true"
android:orientation=
"horizontal"
android:paddingTop=
"20dp"
>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -27,10 +27,10 @@
...
@@ -27,10 +27,10 @@
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_below=
"@+id/ly_phone"
android:id=
"@+id/ly_constrain"
android:id=
"@+id/ly_constrain"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ly_phone"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:padding=
"10dp"
>
android:padding=
"10dp"
>
...
@@ -78,9 +78,10 @@
...
@@ -78,9 +78,10 @@
android:textColor=
"@color/black"
/>
android:textColor=
"@color/black"
/>
<TextView
<TextView
android:id=
"@+id/tv_regist"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"《
隐私政策
》"
android:text=
"《
注册协议
》"
android:textColor=
"@color/black"
/>
android:textColor=
"@color/black"
/>
<TextView
<TextView
...
@@ -90,9 +91,10 @@
...
@@ -90,9 +91,10 @@
android:textColor=
"@color/black"
/>
android:textColor=
"@color/black"
/>
<TextView
<TextView
android:id=
"@+id/tv_private"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"《
用户
协议》"
android:text=
"《
隐私
协议》"
android:textColor=
"@color/black"
/>
android:textColor=
"@color/black"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/mipmap-xhdpi/ic_launcher_main.png
View replaced file @
9fa3b5fe
View file @
e9635526
14 KB
|
W:
|
H:
21.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
app/src/main/res/mipmap-xxhdpi/ic_launcher_main.png
View replaced file @
9fa3b5fe
View file @
e9635526
23.7 KB
|
W:
|
H:
21.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
library_base/src/main/res/menu/menu_navigation.xml
View file @
e9635526
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<menu
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
<item
android:id=
"@+id/menu_home"
android:id=
"@+id/menu_home"
android:checked=
"true"
android:checked=
"true"
...
@@ -9,7 +10,7 @@
...
@@ -9,7 +10,7 @@
<item
<item
android:id=
"@+id/menu_square"
android:id=
"@+id/menu_square"
android:icon=
"@drawable/menu_square"
android:icon=
"@drawable/menu_square"
android:title=
"@string/bottom_name_squar
e"
/>
tools:ignore=
"MenuTitl
e"
/>
<item
<item
...
...
library_base/src/main/res/mipmap-xxhdpi/ic_earth_map.png
0 → 100644
View file @
e9635526
8.41 KB
library_base/src/main/res/mipmap-xxhdpi/ic_eye_tokephone.gif
deleted
100644 → 0
View file @
9fa3b5fe
48.7 KB
mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/ResponseThrowable.java
View file @
e9635526
...
@@ -6,7 +6,7 @@ package me.goldze.mvvmhabit.http;
...
@@ -6,7 +6,7 @@ package me.goldze.mvvmhabit.http;
public
class
ResponseThrowable
extends
Exception
{
public
class
ResponseThrowable
extends
Exception
{
public
int
code
;
public
int
code
;
public
String
message
;
public
String
message
=
""
;
public
ResponseThrowable
(
Throwable
throwable
,
int
code
)
{
public
ResponseThrowable
(
Throwable
throwable
,
int
code
)
{
super
(
throwable
);
super
(
throwable
);
...
...
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