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
a4949318
Commit
a4949318
authored
Jul 17, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交个人中心界面逻辑
parent
6ef43e37
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
63 additions
and
76 deletions
+63
-76
MainApi.kt
app/src/main/java/com/mints/street/api/MainApi.kt
+1
-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
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
+3
-3
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+38
-20
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
+1
-1
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_moresettings.xml
app/src/main/res/layout/activity_moresettings.xml
+0
-1
activity_permissions.xml
app/src/main/res/layout/activity_permissions.xml
+5
-2
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
No files found.
app/src/main/java/com/mints/street/api/MainApi.kt
View file @
a4949318
...
...
@@ -55,7 +55,7 @@ interface MainApi {
* 获取用户登录信息
*/
@POST
(
"api/baseMsg"
)
fun
baseMsg
():
Observable
<
Response
<
BaseResponse
<
MyInfo
>>>
fun
baseMsg
():
Observable
<
Response
<
BaseResponse
<
UserBean
>>>
/**
* 绑定手机号接口
...
...
app/src/main/java/com/mints/street/bean/BindMobileBean.kt
deleted
100644 → 0
View file @
6ef43e37
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 @
6ef43e37
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/main/my/BindMobileActivity.kt
View file @
a4949318
...
...
@@ -8,7 +8,6 @@ import androidx.lifecycle.Observer
import
com.fry.base.base.BaseActivity
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.bean.BindMobileBean
import
com.mints.street.bean.UserBean
import
com.mints.street.databinding.ActivityBindmobileBinding
import
com.mints.street.main.MainActivity
...
...
app/src/main/java/com/mints/street/main/my/BindMobileViewModel.kt
View file @
a4949318
...
...
@@ -3,7 +3,6 @@ package com.mints.street.main.my
import
android.app.Application
import
androidx.lifecycle.MutableLiveData
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.BindMobileBean
import
com.mints.street.bean.UserBean
import
com.mints.street.manager.UserManager
import
com.mints.street.model.ApiModel
...
...
app/src/main/java/com/mints/street/main/my/MoresettingsActivity.kt
View file @
a4949318
...
...
@@ -68,7 +68,7 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
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_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
)
userAgree
?.
setBounds
(
0
,
0
,
56
,
56
)
item_userAgree
.
findViewById
<
TextView
>(
R
.
id
.
tv_title
).
setCompoundDrawables
(
userAgree
,
null
,
null
,
null
)
...
...
@@ -111,10 +111,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
KLog
.
e
(
"setOnClick"
,
"btn_switch has been clicked."
)
}
R
.
id
.
item_userAgree
->
{
//用户协议
ToastUtils
.
showShort
(
"点击了《注册协议》"
)
}
R
.
id
.
item_privacyAgree
->
{
//隐私协议
ToastUtils
.
showShort
(
"点击了《隐私协议》"
)
}
}
...
...
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
a4949318
...
...
@@ -19,7 +19,7 @@ import com.fry.base.base.BaseFragment
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.mints.street.BR
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.databinding.FragmentMyBinding
import
com.mints.street.login.LoginActivity
...
...
@@ -31,6 +31,7 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.tbruyelle.rxpermissions2.RxPermissions
import
kotlinx.android.synthetic.main.fragment_my.*
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.ToastUtils
import
java.util.*
...
...
@@ -43,7 +44,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
View
.
OnClickListener
,
OnLoginListener
{
private
val
userManager
by
lazy
{
UserManager
.
INSTANCE
}
private
var
userConfig
:
MyInfo
?
=
null
private
var
userConfig
:
UserBean
?
=
null
private
val
loginApi
by
lazy
{
LoginApi
()
}
private
var
wxInfo
:
WXInfo
?
=
null
...
...
@@ -53,6 +54,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
private
var
iv_weixin
:
ImageView
?
=
null
private
var
ly_phone
:
LinearLayoutCompat
?
=
null
private
var
cb_checked
:
CheckBox
?
=
null
private
var
tv_regist
:
TextView
?
=
null
private
var
tv_private
:
TextView
?
=
null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
...
...
@@ -64,7 +67,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
super
.
initData
()
srl_my
.
setOnRefreshListener
(
this
)
//隐藏立即领取
bt_try
.
visibility
=
View
.
GONE
bt_try
.
visibility
=
View
.
GONE
initView
()
initListener
()
}
...
...
@@ -72,32 +75,43 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
override
fun
onResume
()
{
super
.
onResume
()
if
(
userManager
.
userIsLogin
())
{
//查询用户登录信息
viewModel
.
getmyInfo
()
}
else
{
//重新显示界面信息
setUserLoginStatus
()
}
//查询用户登录信息
viewModel
.
getmyInfo
()
setUserLoginStatus
()
//
// if (userManager.userIsLogin()) {
// //查询用户登录信息
// viewModel.getmyInfo()
// } else {
// //重新显示界面信息
// setUserLoginStatus()
// }
}
private
fun
initListener
()
{
//设置登录点击事件
binding
.
llMyLogin
.
setOnClickListener
{
if
(!
userManager
.
userIsLogin
())
{
//创建弹窗
mBottomSheetDialog
=
BottomSheetDialog
(
context
!!
)
val
view1
:
View
=
layoutInflater
.
inflate
(
R
.
layout
.
layout_popupwindow
,
null
)
mBottomSheetDialog
!!
.
setContentView
(
view1
)
mBottomSheetDialog
!!
.
window
!!
.
findViewById
<
View
>(
R
.
id
.
design_bottom_sheet
).
setBackgroundColor
(
Color
.
TRANSPARENT
)
mBottomSheetDialog
!!
.
show
()
iv_weixin
=
view1
.
findViewById
(
R
.
id
.
iv_weixin
)
ly_phone
=
view1
.
findViewById
(
R
.
id
.
ly_phone
)
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
)
ly_phone
?.
setOnClickListener
(
this
)
}
}
}
//设置立即领取点击事件
...
...
@@ -143,8 +157,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
R
.
id
.
iv_weixin
->
{
if
(
cb_checked
!!
.
isChecked
)
{
// ToastUtils.showShort("未完成微信登录对接")
val
wechat
=
ShareSDK
.
getPlatform
(
Wechat
.
NAME
)
if
(!
wechat
.
isClientValid
){
val
wechat
=
ShareSDK
.
getPlatform
(
Wechat
.
NAME
)
if
(!
wechat
.
isClientValid
)
{
ToastUtils
.
showShort
(
"请先安装微信"
)
return
}
...
...
@@ -172,13 +186,20 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
ToastUtils
.
showShort
(
"请先同意用户协议与隐私政策"
)
}
}
R
.
id
.
tv_regist
->
{
KLog
.
e
(
"sssss"
,
"点击了《注册协议》"
)
ToastUtils
.
showShort
(
"点击了《注册协议》"
)
}
R
.
id
.
tv_private
->
{
KLog
.
e
(
"sssss"
,
"点击了《隐私协议》"
)
ToastUtils
.
showShort
(
"点击了《隐私协议》"
)
}
}
}
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
viewModel
.
myInfodata
.
observe
(
this
,
Observer
<
MyInfo
>
{
viewModel
.
myInfodata
.
observe
(
this
,
Observer
<
UserBean
>
{
srl_my
.
finishRefresh
(
true
)
if
(
it
==
null
)
{
userConfig
=
null
...
...
@@ -195,7 +216,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
private
fun
setUserLoginStatus
()
{
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
)
}
else
{
// 未登录
...
...
@@ -205,12 +226,9 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
}
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
if
(
userManager
.
userIsLogin
())
{
//查询用户登录信息
viewModel
.
getmyInfo
()
}
else
{
setUserLoginStatus
()
srl_my
.
finishRefresh
(
true
)
}
}
override
fun
onDestroy
()
{
...
...
app/src/main/java/com/mints/street/main/my/MyViewModel.kt
View file @
a4949318
...
...
@@ -3,7 +3,6 @@ package com.mints.street.main.my
import
android.app.Application
import
androidx.lifecycle.MutableLiveData
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.MyInfo
import
com.mints.street.bean.UserBean
import
com.mints.street.common.DeviceInfo
import
com.mints.street.manager.UserManager
...
...
@@ -19,7 +18,7 @@ import java.util.HashMap
*/
class
MyViewModel
(
application
:
Application
)
:
BaseViewModel
(
application
)
{
val
myInfodata
:
MutableLiveData
<
MyInfo
>
=
MutableLiveData
()
val
myInfodata
:
MutableLiveData
<
UserBean
>
=
MutableLiveData
()
val
deviceInfo
:
DeviceInfo
get
()
{
...
...
@@ -31,11 +30,13 @@ class MyViewModel(application: Application) : BaseViewModel(application) {
*/
fun
getmyInfo
()
{
ApiModel
.
getuserInfo
(
lifecycleProvider
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
MyInfo
>>(
object
:
HttpSubscribeImpl
<
BaseResponse
<
UserBean
>>(
this
@MyViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
MyInfo
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
myInfodata
.
value
=
response
.
result
//保存用户信息到Usermanager
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
KLog
.
e
(
"getmyInfo"
,
response
.
result
.
toString
())
}
...
...
app/src/main/java/com/mints/street/model/ApiModel.kt
View file @
a4949318
...
...
@@ -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
()
.
execute
(
lifecycleProvider
,
MainApi
.
newInstance
().
baseMsg
())
}
...
...
app/src/main/res/drawable/shape_gold_blue.xml
View file @
a4949318
...
...
@@ -4,7 +4,7 @@
<!-- 边框的颜色和粗细 -->
<stroke
android:width=
"1dp"
android:color=
"#
4CAF50
"
android:color=
"#
C7EDCC
"
/>
<solid
android:color=
"#ffffffff"
/>
<corners
android:radius=
"10dp"
/>
...
...
app/src/main/res/layout/activity_aboutus.xml
View file @
a4949318
...
...
@@ -30,7 +30,7 @@
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:layout_marginBottom=
"65dp"
android:src=
"@mipmap/ic_
avatar_ph
"
/>
android:src=
"@mipmap/ic_
launcher_main
"
/>
<LinearLayout
android:layout_centerHorizontal=
"true"
android:id=
"@+id/ly_text"
...
...
app/src/main/res/layout/activity_moresettings.xml
View file @
a4949318
...
...
@@ -12,7 +12,6 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<include
layout=
"@layout/include_header"
/>
<com.mints.street.widget.ElasticScrollView
...
...
app/src/main/res/layout/activity_permissions.xml
View file @
a4949318
...
...
@@ -75,6 +75,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"20dp"
app:isOpened=
"true"
app:primaryColor=
"#2196F3"
android:layout_alignParentEnd=
"true"
android:layout_centerHorizontal=
"true"
android:layout_centerVertical=
"true"
...
...
@@ -120,6 +121,7 @@
<com.github.iielse.switchbutton.SwitchView
android:id=
"@+id/svStrong"
app:primaryColor=
"#2196F3"
android:layout_width=
"wrap_content"
android:layout_height=
"20dp"
android:layout_alignParentEnd=
"true"
...
...
@@ -168,6 +170,7 @@
<com.github.iielse.switchbutton.SwitchView
android:id=
"@+id/svReadmsg"
app:primaryColor=
"#2196F3"
android:layout_width=
"wrap_content"
android:layout_height=
"20dp"
app:isOpened=
"true"
...
...
@@ -231,14 +234,14 @@
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"《
隐私
协议》"
android:text=
"《
注册
协议》"
android:textColor=
"@color/black"
android:textSize=
"12sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"《
用户
协议》"
android:text=
"《
隐私
协议》"
android:textColor=
"@color/black"
android:textSize=
"12sp"
/>
</LinearLayout>
...
...
app/src/main/res/layout/layout_popupwindow.xml
View file @
a4949318
...
...
@@ -8,11 +8,11 @@
<androidx.appcompat.widget.LinearLayoutCompat
android:id=
"@+id/ly_phone"
android:layout_alignParentRight=
"true"
android:paddingTop=
"20dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:layout_alignParentRight=
"true"
android:orientation=
"horizontal"
android:paddingTop=
"20dp"
>
<TextView
android:layout_width=
"wrap_content"
...
...
@@ -27,10 +27,10 @@
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_below=
"@+id/ly_phone"
android:id=
"@+id/ly_constrain"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ly_phone"
android:layout_centerHorizontal=
"true"
android:padding=
"10dp"
>
...
...
@@ -78,9 +78,10 @@
android:textColor=
"@color/black"
/>
<TextView
android:id=
"@+id/tv_regist"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"《
隐私政策
》"
android:text=
"《
注册协议
》"
android:textColor=
"@color/black"
/>
<TextView
...
...
@@ -90,9 +91,10 @@
android:textColor=
"@color/black"
/>
<TextView
android:id=
"@+id/tv_private"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"《
用户
协议》"
android:text=
"《
隐私
协议》"
android:textColor=
"@color/black"
/>
</LinearLayout>
...
...
app/src/main/res/mipmap-xhdpi/ic_launcher_main.png
View replaced file @
6ef43e37
View file @
a4949318
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 @
6ef43e37
View file @
a4949318
23.7 KB
|
W:
|
H:
21.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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