Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_street
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_street
Commits
99259dea
Commit
99259dea
authored
Jul 14, 2021
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改权限弹窗界面
parent
09ffc425
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
165 additions
and
56 deletions
+165
-56
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-0
Constant.kt
app/src/main/java/com/mints/street/common/Constant.kt
+4
-0
LoginViewModel.kt
app/src/main/java/com/mints/street/login/LoginViewModel.kt
+5
-3
HomeFragment.kt
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
+4
-0
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+1
-1
PermissionsActivity.kt
...main/java/com/mints/street/main/my/PermissionsActivity.kt
+65
-5
UserManager.kt
app/src/main/java/com/mints/street/manager/UserManager.kt
+4
-2
SplashActivity.kt
app/src/main/java/com/mints/street/splash/SplashActivity.kt
+11
-1
shape_bt_agree.xml
app/src/main/res/drawable/shape_bt_agree.xml
+1
-1
shape_bt_disagree.xml
app/src/main/res/drawable/shape_bt_disagree.xml
+1
-1
activity_permissions.xml
app/src/main/res/layout/activity_permissions.xml
+67
-42
No files found.
app/src/main/AndroidManifest.xml
View file @
99259dea
...
...
@@ -21,6 +21,8 @@
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<!-- 获取手机状态信息 -->
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<!-- android10以后 后台运行位置 -->
<uses-permission
android:name=
"android.permission.ACCESS_BACKGROUND_LOCATION"
/>
<application
android:name=
"com.mints.street.AppApplication"
...
...
app/src/main/java/com/mints/street/common/Constant.kt
View file @
99259dea
...
...
@@ -12,4 +12,8 @@ object Constant {
*/
const
val
MINTS_PKG_NAME
=
"com.mints.street"
/**
* 第一次打开权限页面
*/
const
val
FIRST_OPEN_PERMISSIONS
=
"first_open_permissions"
}
app/src/main/java/com/mints/street/login/LoginViewModel.kt
View file @
99259dea
...
...
@@ -46,7 +46,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
}
fun
login
(
mobile
:
String
,
smsCode
:
String
)
{
showDialog
()
//
showDialog()
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"mobile"
]
=
mobile
vo
[
"smsCode"
]
=
smsCode
...
...
@@ -56,14 +56,16 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
object
:
HttpSubscribeImpl
<
BaseResponse
<
UserBean
>>(
this
@LoginViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
dismissDialog
()
//
dismissDialog()
this
@LoginViewModel
.
saveTerminalInfo
()
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
data
.
value
=
response
.
message
KLog
.
e
(
"login"
,
response
.
result
.
toString
())
ToastUtils
.
showShort
(
"登录信息="
+
response
.
result
.
consumer
?.
idcode
)
data
.
value
=
response
.
message
}
override
fun
onError
(
e
:
Throwable
)
{
...
...
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
View file @
99259dea
...
...
@@ -134,6 +134,10 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
binding
.
imageOut
.
setOnClickListener
{
mBaiduMap
?.
setMapStatus
(
MapStatusUpdateFactory
.
zoomOut
())
}
//历史影像
binding
.
imageMapHistory
.
setOnClickListener
{
startActivity
(
HistoricalimageActivity
::
class
.
java
)
}
mRecommendStopSearch
=
RecommendStopSearch
.
newInstance
()
mRecommendStopSearch
?.
setOnGetRecommendStopResultListener
{
result
->
if
(
result
!=
null
)
{
...
...
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
99259dea
...
...
@@ -74,7 +74,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickL
when
(
v
?.
id
)
{
R
.
id
.
ly_aboutus
->
{
startActivity
(
AboutusActivity
::
class
.
java
)
// startActivity(
Historicalimage
Activity::class.java)
// startActivity(
Permissions
Activity::class.java)
}
R
.
id
.
ly_moresettings
->
{
startActivity
(
MoresettingsActivity
::
class
.
java
)
...
...
app/src/main/java/com/mints/street/main/my/PermissionsActivity.kt
View file @
99259dea
package
com.mints.street.main.my
import
android.Manifest
import
android.os.Build
import
android.os.Bundle
import
android.view.View
import
com.fry.base.base.BaseActivity
import
com.github.iielse.switchbutton.SwitchView
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.
databinding.ActivityMoresettingsBinding
import
com.mints.street.
common.Constant
import
com.mints.street.databinding.ActivityPermissionsBinding
import
com.mints.street.main.MainActivity
import
com.tbruyelle.rxpermissions2.RxPermissions
import
com.tencent.mmkv.MMKV
import
kotlinx.android.synthetic.main.activity_permissions.*
import
me.goldze.mvvmhabit.utils.ToastUtils
/**
* 描述:权限授权
* 作者:孟崔广
* 时间:2021/7/14 15:51
*/
class
PermissionsActivity
:
BaseActivity
<
ActivityPermissionsBinding
,
PermissionsViewModel
>(),
View
.
OnClickListener
{
class
PermissionsActivity
:
BaseActivity
<
ActivityPermissionsBinding
,
PermissionsViewModel
>()
{
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)=
R
.
layout
.
activity_permissions
override
fun
initData
()
{
super
.
initData
()
initView
()
initListener
()
}
private
fun
initListener
()
{
btnPermissionsDont
.
setOnClickListener
(
this
)
btnPermissionsNext
.
setOnClickListener
(
this
)
}
private
fun
initView
()
{
sv_positioning
.
setOnStateChangedListener
(
object
:
SwitchView
.
OnStateChangedListener
{
svPosition
.
setOnStateChangedListener
(
object
:
SwitchView
.
OnStateChangedListener
{
override
fun
toggleToOn
(
view
:
SwitchView
?)
{
svPosition
?.
isOpened
=
true
}
override
fun
toggleToOff
(
view
:
SwitchView
?)
{
svPosition
?.
isOpened
=
false
}
})
svStrong
.
setOnStateChangedListener
(
object
:
SwitchView
.
OnStateChangedListener
{
override
fun
toggleToOn
(
view
:
SwitchView
?)
{
svStrong
?.
isOpened
=
true
}
override
fun
toggleToOff
(
view
:
SwitchView
?)
{
svStrong
?.
isOpened
=
false
}
})
svReadmsg
.
setOnStateChangedListener
(
object
:
SwitchView
.
OnStateChangedListener
{
override
fun
toggleToOn
(
view
:
SwitchView
?)
{
sv
_positionin
g
?.
isOpened
=
true
sv
Readms
g
?.
isOpened
=
true
}
override
fun
toggleToOff
(
view
:
SwitchView
?)
{
sv
_positionin
g
?.
isOpened
=
false
sv
Readms
g
?.
isOpened
=
false
}
})
}
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
){
R
.
id
.
btnPermissionsDont
->
ToastUtils
.
showLong
(
"请您同意授权,否则将无法使用APP功能"
)
R
.
id
.
btnPermissionsNext
->{
val
rxPermissions
=
RxPermissions
(
this
)
rxPermissions
.
request
(
if
(
svPosition
.
isOpened
&&
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
Manifest
.
permission
.
ACCESS_BACKGROUND_LOCATION
else
""
,
if
(
svPosition
.
isOpened
)
Manifest
.
permission
.
ACCESS_FINE_LOCATION
else
""
,
if
(
svStrong
.
isOpened
)
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
else
""
,
if
(
svReadmsg
.
isOpened
)
Manifest
.
permission
.
READ_PHONE_STATE
else
""
)
.
subscribe
{
startActivityThenKill
(
MainActivity
::
class
.
java
)
}
MMKV
.
mmkvWithID
(
Constant
.
FIRST_OPEN_PERMISSIONS
).
encode
(
Constant
.
FIRST_OPEN_PERMISSIONS
,
true
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/manager/UserManager.kt
View file @
99259dea
...
...
@@ -83,11 +83,13 @@ class UserManager {
val
mobile
:
String
?
=
user
.
mobile
val
openid
:
String
?
=
user
.
openid
MMKV
.
mmkvWithID
(
USER_ID
).
encode
(
USER_ID
,
user
.
pk_id
.
toString
())
MMKV
.
mmkvWithID
(
CODE_ID
).
encode
(
CODE_ID
,
user
.
idcode
.
toString
()
)
MMKV
.
mmkvWithID
(
CODE_ID
).
encode
(
CODE_ID
,
user
.
idcode
)
if
(!
TextUtils
.
isEmpty
(
mobile
))
{
MMKV
.
mmkvWithID
(
MOBILE
).
encode
(
MOBILE
,
mobile
)
}
MMKV
.
mmkvWithID
(
WX_NAME
).
encode
(
WX_NAME
,
user
.
nickname
.
toString
())
if
(!
TextUtils
.
isEmpty
(
user
.
nickname
))
{
MMKV
.
mmkvWithID
(
WX_NAME
).
encode
(
WX_NAME
,
user
.
nickname
)
}
MMKV
.
mmkvWithID
(
IS_FOREVER
).
encode
(
IS_FOREVER
,
user
.
isForever
)
MMKV
.
mmkvWithID
(
EXPIRETIME
).
encode
(
EXPIRETIME
,
user
.
expireTime
)
if
(!
TextUtils
.
isEmpty
(
openid
))
{
...
...
app/src/main/java/com/mints/street/splash/SplashActivity.kt
View file @
99259dea
...
...
@@ -12,10 +12,14 @@ import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback
import
com.fry.base.base.BaseActivity
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.common.Constant
import
com.mints.street.common.DeviceInfo
import
com.mints.street.databinding.ActivitySplashBinding
import
com.mints.street.main.MainActivity
import
com.mints.street.main.my.PermissionsActivity
import
com.mints.street.manager.CsjGroMoreManager
import
com.mints.street.manager.UserManager
import
com.tencent.mmkv.MMKV
/**
* 描述:gromore开屏页
...
...
@@ -163,6 +167,12 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
* 跳转到主页面
*/
private
fun
goToMainActivity
()
{
if
(
MMKV
.
mmkvWithID
(
Constant
.
FIRST_OPEN_PERMISSIONS
).
decodeBool
(
Constant
.
FIRST_OPEN_PERMISSIONS
,
false
)){
// 非新用户
startActivityThenKill
(
MainActivity
::
class
.
java
)
}
else
{
startActivityThenKill
(
PermissionsActivity
::
class
.
java
)
}
}
}
\ No newline at end of file
app/src/main/res/drawable/shape_bt_agree.xml
View file @
99259dea
...
...
@@ -2,6 +2,6 @@
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#2196F3"
/>
<corners
android:radius=
"
21
dp"
/>
<corners
android:radius=
"
30
dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/shape_bt_disagree.xml
View file @
99259dea
...
...
@@ -7,6 +7,6 @@
android:color=
"#74000000"
/>
<solid
android:color=
"#ffffffff"
/>
<corners
android:radius=
"
21
dp"
/>
<corners
android:radius=
"
30
dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_permissions.xml
View file @
99259dea
This diff is collapsed.
Click to expand it.
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