Commit 99259dea authored by mengcuiguang2's avatar mengcuiguang2

修改权限弹窗界面

parent 09ffc425
......@@ -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"
......
......@@ -12,4 +12,8 @@ object Constant {
*/
const val MINTS_PKG_NAME = "com.mints.street"
/**
* 第一次打开权限页面
*/
const val FIRST_OPEN_PERMISSIONS = "first_open_permissions"
}
......@@ -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) {
......
......@@ -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) {
......
......@@ -74,7 +74,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickL
when (v?.id) {
R.id.ly_aboutus -> {
startActivity(AboutusActivity::class.java)
// startActivity(HistoricalimageActivity::class.java)
// startActivity(PermissionsActivity::class.java)
}
R.id.ly_moresettings -> {
startActivity(MoresettingsActivity::class.java)
......
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_positioning?.isOpened = true
svReadmsg?.isOpened = true
}
override fun toggleToOff(view: SwitchView?) {
sv_positioning?.isOpened = false
svReadmsg?.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
......@@ -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)) {
......
......@@ -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() {
startActivityThenKill(MainActivity::class.java)
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
......@@ -2,6 +2,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#2196F3" />
<corners android:radius="21dp" />
<corners android:radius="30dp" />
</shape>
\ No newline at end of file
......@@ -7,6 +7,6 @@
android:color="#74000000"
/>
<solid android:color="#ffffffff" />
<corners android:radius="21dp" />
<corners android:radius="30dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
......@@ -9,7 +10,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="716dp"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<TextView
......@@ -17,7 +19,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="25dp"
android:text="世界街景3D地图"
android:text="3D高清街景"
android:textStyle="bold"
android:textColor="@color/black"
android:textSize="25dp" />
......@@ -26,20 +29,20 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10pt"
android:text="为了提供下服务"
android:layout_marginBottom="4pt"
android:text="为了提供下服务"
android:textColor="#CD000000" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_height="100dp"
android:layout_margin="10dp"
android:background="@drawable/shape_gold_blue">
<ImageView
android:id="@+id/iv1"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:src="@mipmap/ic_my"/>
......@@ -49,25 +52,30 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/iv1"
android:layout_marginStart="20dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="@id/iv1"
android:text="提供精准定位及导航服务"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textColor="@color/black"
android:textSize="12sp" />
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/iv1"
android:layout_marginStart="20dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="@+id/iv1"
android:text="基于您当前位置...."
android:textSize="12sp"
android:text="基于您当前位置、为您提供完整的周边信息"
android:layout_marginBottom="10dp"
android:textColor="#A9000000" />
<com.github.iielse.switchbutton.SwitchView
android:id="@+id/sv_positioning"
android:id="@+id/svPosition"
android:layout_width="wrap_content"
android:layout_height="20dp"
app:isOpened="true"
android:layout_alignParentEnd="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
......@@ -76,14 +84,14 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_height="100dp"
android:layout_margin="10dp"
android:background="@drawable/shape_gold_blue">
<ImageView
android:id="@+id/iv2"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:src="@mipmap/ic_my"/>
......@@ -93,25 +101,31 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/iv2"
android:layout_marginStart="20dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="@id/iv2"
android:text="提供精准定位及导航服务"
android:text="存储地图等相关数据"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textColor="@color/black"
android:textSize="12sp" />
android:textSize="14sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/iv2"
android:layout_marginStart="20dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="@+id/iv2"
android:text="基于您当前位置...."
android:textSize="12sp"
android:text="用于读写地图、常用地址等相关数据"
android:layout_marginBottom="10dp"
android:textColor="#A9000000" />
<com.github.iielse.switchbutton.SwitchView
android:id="@+id/svStrong"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
app:isOpened="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp" />
......@@ -119,14 +133,14 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_height="100dp"
android:layout_margin="10dp"
android:background="@drawable/shape_gold_blue">
<ImageView
android:id="@+id/iv3"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:src="@mipmap/ic_my"/>
......@@ -136,38 +150,52 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/iv3"
android:layout_marginStart="20dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="@id/iv3"
android:text="提供精准定位及导航服务"
android:text="问题诊断及修复"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textColor="@color/black"
android:textSize="12sp" />
android:textSize="14sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/iv3"
android:layout_marginStart="20dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="@+id/iv3"
android:text="基于您当前位置...."
android:textSize="12sp"
android:text="用于读取信息、快速确诊问题"
android:layout_marginBottom="10dp"
android:textColor="#A9000000" />
<com.github.iielse.switchbutton.SwitchView
android:id="@+id/svReadmsg"
android:layout_width="wrap_content"
android:layout_height="20dp"
app:isOpened="true"
android:layout_alignParentEnd="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="您的个人信息将受到严格的保密,3D高清街景不会将您的个人信息泄露给他人。您也可以在系统设置中关闭授权,但可能影响部分功能使用。"
android:layout_margin="10dp"
android:textColor="#CD000000" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20pt"
android:layout_marginTop="10pt"
android:orientation="horizontal">
<Button
android:id="@+id/btnPermissionsDont"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
......@@ -178,6 +206,7 @@
android:textColor="#43000000" />
<Button
android:id="@+id/btnPermissionsNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
......@@ -188,37 +217,33 @@
android:textColor="@color/white" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:gravity="bottom|center_horizontal"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:text="链接网络后可查看并同意完整的"
android:textColor="@color/black"
android:textSize="8sp" />
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《隐私协议》"
android:textColor="@color/black"
android:textSize="8sp" />
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《用户协议》"
android:textColor="@color/black"
android:textSize="8sp" />
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment