Commit e94650f8 authored by fengruiyu's avatar fengruiyu

未付费时,把国内的景点或720之类的都变成可以访问的 已完成

定位权限的框架更换 已完成
搜索的境外地址必须是会员,否则跳转充值页面 已完成
parent eefdbecc
......@@ -63,28 +63,60 @@
<activity
android:name=".splash.SplashActivity"
android:theme="@style/NormalSplash">
android:theme="@style/NormalSplash"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".login.LoginActivity" />
<activity android:name=".login.LoginActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity
android:name=".main.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:theme="@style/AppTheme.NoneTranslucent" />
<activity android:name=".main.my.MoresettingsActivity" />
<activity android:name=".main.my.AboutusActivity" />
<activity android:name=".main.my.PermissionsActivity" />
<activity android:name=".main.my.OpenvipActivity" />
<activity android:name=".main.home.HistoricalimageActivity" />
<activity android:name=".main.my.BindMobileActivity" />
<activity android:name=".splash.GuideActivity" />
<activity android:name=".main.my.MoresettingsActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity android:name=".main.my.AboutusActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity android:name=".main.my.PermissionsActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity android:name=".main.my.OpenvipActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity android:name=".main.home.HistoricalimageActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity android:name=".main.my.BindMobileActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity android:name=".splash.GuideActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity android:name=".main.home.SearchMapActivity" /> <!-- ShareSDK start -->
<activity android:name=".main.home.SearchMapActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/> <!-- ShareSDK start -->
<activity
android:name="com.mob.tools.MobUIShell"
android:configChanges="keyboardHidden|orientation|screenSize"
......@@ -132,7 +164,8 @@
<activity
android:name="com.qq.e.ads.ADActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" />
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
/>
<activity
android:name="com.qq.e.ads.PortraitADActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
......@@ -163,10 +196,18 @@
android:exported="false"
android:screenOrientation="behind"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity android:name=".main.vr.PanoramicActivity" />
<activity android:name=".webview.MintsWebViewActivity"></activity>
<service android:name=".services.UpdateServices"/>
<activity android:name=".main.vr.PanoramicActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<activity android:name=".webview.MintsWebViewActivity"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
<service android:name=".services.UpdateServices"
android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation|keyboardHidden"
android:screenOrientation="portrait"
/>
</application>
</manifest>
\ No newline at end of file
......@@ -73,7 +73,7 @@ function doAppFun(funstr, params) {
}
function centerChanged() {
try {
doAppFun("centerChanged", msg);
doAppFun("centerChanged");
} catch (e) {
console.log("tips",msg)
//alert("app未弹框==>" + msg + e)
......
......@@ -341,6 +341,10 @@ function initZsMap(pointStr) {
},
// scaleControlOptions:true,
});
map.addListener("center_changed", () => {
centerChanged();
});
/**
* HYBRID 此地图类型在卫星图像上显示主要街道的透明图层。
ROADMAP 此地图类型显示普通街道地图。
......@@ -351,9 +355,6 @@ function initZsMap(pointStr) {
window.google.maps.Load && window.google.maps.Load(ZSYDa);
map.addListener("center_changed", () => {
centerChanged();
});
} else {
......
......@@ -49,7 +49,6 @@ class ItemEnterDestinationAdapter(
holder.binding.tvName.text = it[position].area
holder.binding.tvNumberPeople.text = "人数"
it[position].url?.let { url ->
KLog.e("zsf__","==========${it.indices}")
for (index in 0..2) {
when (index) {
0 -> {
......
......@@ -111,13 +111,21 @@ interface MainApi {
, Any>):Observable<Response<BaseResponse<Version>>>
/**
* 谷歌地图授权
* 授权
*
* @return
*/
@POST("api/mpgah")
fun authorized():Observable<Response<BaseResponse<AuthorizedBean>>>
/**
* 授权
* 国内免费用户查看
* @return
*/
@POST("na/mpgah")
fun authorizedA():Observable<Response<BaseResponse<AuthorizedBean>>>
/**
* 精选体验展示图
*/
......
......@@ -9,17 +9,16 @@ import com.fry.base.base.BaseActivity
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.ActivityLoginBinding
import com.mints.street.main.MainActivity
import com.mints.street.manager.UserManager
import com.mints.street.utils.BackInputUtil
import com.mints.street.widget.dialog.DialogUtils
import com.tbruyelle.rxpermissions2.RxPermissions
import com.permissionx.guolindev.PermissionX
import com.permissionx.guolindev.callback.RequestCallback
import kotlinx.android.synthetic.main.activity_bindmobile.*
import kotlinx.android.synthetic.main.activity_login.*
import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.AppUtils
import me.goldze.mvvmhabit.utils.ToastUtils
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
/**
* Created by 冯瑞雨 on 2021/7/2.
......@@ -30,6 +29,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
override fun getStatusBarHeightView(): View? {
return binding.tvName
}
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_login
override fun initVariableId() = BR.viewModel
......@@ -74,19 +74,18 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
return@setOnClickListener
}
RxPermissions(this@LoginActivity)
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
PermissionX.init(this@LoginActivity)
.permissions(Manifest.permission.READ_PHONE_STATE)
.request(RequestCallback { allGranted, _, _ ->
if (allGranted) {
mobile = mobile.replace(" ".toRegex(), "")
// 登录
viewModel.mobilelogin(mobile, code)
} else {
DialogUtils.showPermissionDialog(this@LoginActivity,"设备")
}
DialogUtils.showPermissionDialog(this@LoginActivity, "设备")
}
})
}
iv_left_icon.setOnClickListener(this)
iv_left_icon.setOnClickListener(this)
......@@ -97,7 +96,12 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
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))
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
......
......@@ -22,7 +22,8 @@ import com.mints.street.main.my.MyFragment
import com.mints.street.main.vr.VRFragment
import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager
import com.tbruyelle.rxpermissions2.RxPermissions
import com.permissionx.guolindev.PermissionX
import com.permissionx.guolindev.callback.RequestCallback
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.ToastUtils
......@@ -36,6 +37,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
override fun getStatusBarHeightView(): View? {
return null
}
override fun initData() {
super.initData()
OaidManager.init()
......@@ -46,10 +48,10 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
binding.mainBottom.init {
when (it) {
R.id.menu_home -> {
if(UserManager.INSTANCE.userIsLogin()&&UserManager.INSTANCE.getVipFlag()){
if (UserManager.INSTANCE.userIsLogin() && UserManager.INSTANCE.getVipFlag()) {
binding.mainViewpager.setCurrentItem(3, false)
}else{
} else {
binding.mainViewpager.setCurrentItem(0, false)
}
}
......@@ -71,17 +73,15 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
R.id.menu_my
)
RxPermissions(this).request(
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else "",
Manifest.permission.ACCESS_FINE_LOCATION ,
Manifest.permission.WRITE_EXTERNAL_STORAGE ,
PermissionX.init(this).permissions(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else "",
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_PHONE_STATE
)
.subscribe {
.request(RequestCallback { allGranted, grantedList, deniedList ->
})
}
}
var oldTime: Long = 0
......@@ -137,7 +137,8 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 {
2 -> {
//个人中心
MyFragment()
}3 -> {
}
3 -> {
GoogleMapFragment()
}
......@@ -151,10 +152,10 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 {
override fun getItemCount() = 4
}
if(UserManager.INSTANCE.userIsLogin()&&UserManager.INSTANCE.getVipFlag()){
if (UserManager.INSTANCE.userIsLogin() && UserManager.INSTANCE.getVipFlag()) {
this.setCurrentItem(3, false)
}else{
} else {
this.setCurrentItem(0, false)
}
return this
......
......@@ -26,6 +26,7 @@ import com.mints.street.main.home.SearchMapActivity
import com.mints.street.utils.GPSConverterUtils
import com.mints.street.webview.MintsWebViewActivity
import com.mints.street.widget.ScrollLayout
import com.mints.street.widget.ScrollLayout.STATUS_CLOSE
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.CommonDialogUtils
import me.goldze.mvvmhabit.utils.KLog
......@@ -58,13 +59,6 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
override fun initVariableId() = BR.viewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return super.onCreateView(inflater, container, savedInstanceState)
}
override fun onResume() {
viewModel.authorized()
......@@ -89,7 +83,6 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
})
//提供给js使用
binding.webview.registerHandler("tips") { data, _ ->
ToastUtils.showLong(data)
}
//跳转国外google街景
......@@ -129,6 +122,13 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
)
)
}
//地图改变时
binding.webview.registerHandler("centerChanged") { data, _ ->
KLog.a("js - > android centerChanged", data)
if (!binding.scrollLayout.isClose){
binding.scrollLayout.toggle(STATUS_CLOSE)
}
}
//加载完成
binding.webview.registerHandler("allIsOk") { _, _ ->
KLog.e("Sfsadfa","allIsOk")
......
......@@ -54,13 +54,27 @@ class HomeViewModel(application: Application):BaseViewModel(application) {
})
}
fun authorized(name:String?=null,lat:String?,lng:String?,isLook:Boolean) {
if (!isLook){
if (isLook){
ApiModel.authorizedA().safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<AuthorizedBean>>(
this@HomeViewModel,false
) {
override fun onBusinessSuccess(response: BaseResponse<AuthorizedBean>) {
if(!Gson().toJson(response.result).equals(Gson().toJson(authorizedBean.value))){
authorizedBean.value = response.result
}
MintsWebViewActivity.startWebView(name,
MintsWebViewActivity.toBaduVR(lat,lng,response.result?.bk))
}
})
}else{
if((!UserManager.INSTANCE.userIsLogin() && !UserManager.INSTANCE.getVipFlag())){
startActivity(OpenvipActivity::class.java)
return
}
}
ApiModel.authorized().safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<AuthorizedBean>>(
this@HomeViewModel,false
......@@ -76,6 +90,9 @@ class HomeViewModel(application: Application):BaseViewModel(application) {
})
}
}
fun getMapBean(){
val assets = AppManager.getAppManager().currentActivity.assets
val stringBuilder = StringBuilder()
......
......@@ -4,6 +4,8 @@ import android.content.Intent
import com.baidu.mapapi.model.LatLng
import com.mints.street.bean.HistoryBean
import com.mints.street.bean.Location
import com.mints.street.main.my.OpenvipActivity
import com.mints.street.manager.UserManager
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.base.ItemViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction
......@@ -21,6 +23,12 @@ class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
* 点击名称回调回调
*/
val onClick = BindingCommand<Any>(BindingAction {
if(viewModel.index.value==1&&
!UserManager.INSTANCE.userIsLogin() &&
!UserManager.INSTANCE.getVipFlag()){
viewModel.startActivity(OpenvipActivity::class.java)
return@BindingAction
}
viewModel.searchName.value = HistoryBean(name = this.name,
latitude = pt?.lat,longitude = pt?.lng)
val intent = Intent()
......
......@@ -13,13 +13,15 @@ import com.mints.street.databinding.ActivityBindmobileBinding
import com.mints.street.main.MainActivity
import com.mints.street.utils.BackInputUtil
import com.mints.street.widget.dialog.DialogUtils
import com.tbruyelle.rxpermissions2.RxPermissions
import com.permissionx.guolindev.PermissionX
import com.permissionx.guolindev.callback.RequestCallback
import kotlinx.android.synthetic.main.activity_bindmobile.*
import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.ToastUtils
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileViewModel>(), View.OnClickListener {
class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileViewModel>(),
View.OnClickListener {
private var mobile: String? = null
......@@ -85,16 +87,16 @@ class BindMobileActivity : BaseActivity<ActivityBindmobileBinding, BindMobileVie
return
}
RxPermissions(this@BindMobileActivity)
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
PermissionX.init(this@BindMobileActivity)
.permissions(Manifest.permission.READ_PHONE_STATE)
.request(RequestCallback { allGranted, _, _ ->
if (allGranted) {
mobile = mobile.replace(" ".toRegex(), "")
viewModel.bindingMobile(mobile, code)
} else {
DialogUtils.showPermissionDialog(this@BindMobileActivity,"设备")
}
DialogUtils.showPermissionDialog(this@BindMobileActivity, "设备")
}
})
}
}
}
......
package com.mints.street.main.my
import android.Manifest
import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.bumptech.glide.Glide
import com.coorchice.library.utils.LogUtils
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.UserBean
import com.mints.street.bean.WXInfo
import com.mints.street.common.Constant
import com.mints.street.databinding.FragmentMyBinding
import com.mints.street.login.LoginActivity
import com.mints.street.login.LoginApi
import com.mints.street.login.OnLoginListener
import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager
import com.mints.street.utils.json.JsonUtil
import com.mints.street.webview.MintsWebViewActivity
import com.mints.street.widget.dialog.WxLoginDialog
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.base.AppManager
import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.ToastUtils
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
import java.util.*
......@@ -56,14 +36,19 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
private val loginDialog by lazy { WxLoginDialog(requireActivity()).init() }
override fun initContentView(inflater: LayoutInflater?,
override fun initContentView(
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?) = R.layout.fragment_my
savedInstanceState: Bundle?
) = R.layout.fragment_my
override fun initVariableId() = BR.viewModel
override fun initData() {
super.initData()
StatusBarUtil.setHeightAndPadding(AppManager.getAppManager().currentActivity, binding.llMyRoot)
StatusBarUtil.setHeightAndPadding(
AppManager.getAppManager().currentActivity,
binding.llMyRoot
)
srl_my.setOnRefreshListener(this)
initView()
initListener()
......@@ -165,14 +150,16 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
aboutus.findViewById<TextView>(R.id.tv_title).text = "关于我们"
val userAgree = ContextCompat.getDrawable(context!!, R.mipmap.iv_about_us)
userAgree?.setBounds(0, 0, 56, 56)
aboutus.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(userAgree, null, null, null)
aboutus.findViewById<TextView>(R.id.tv_title)
.setCompoundDrawables(userAgree, null, null, null)
aboutus.findViewById<TextView>(R.id.tv_right).visibility = View.GONE
aboutus.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE
moresettings.findViewById<TextView>(R.id.tv_title).text = "更多设置"
val privacyAgree = ContextCompat.getDrawable(context!!, R.mipmap.iv_more_settings)
privacyAgree?.setBounds(0, 0, 56, 56)
moresettings.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(privacyAgree, null, null, null)
moresettings.findViewById<TextView>(R.id.tv_title)
.setCompoundDrawables(privacyAgree, null, null, null)
moresettings.findViewById<TextView>(R.id.tv_right).visibility = View.GONE
moresettings.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE
......
......@@ -15,7 +15,8 @@ import com.mints.street.main.MainActivity
import com.mints.street.utils.NetUtils
import com.mints.street.utils.nodoubleclick.AntiShake
import com.mints.street.webview.MintsWebViewActivity
import com.tbruyelle.rxpermissions2.RxPermissions
import com.permissionx.guolindev.PermissionX
import com.permissionx.guolindev.callback.RequestCallback
import com.tencent.mmkv.MMKV
import kotlinx.android.synthetic.main.activity_permissions.*
import me.goldze.mvvmhabit.utils.ToastUtils
......@@ -25,10 +26,11 @@ import me.goldze.mvvmhabit.utils.ToastUtils
* 作者:孟崔广
* 时间:2021/7/14 15:51
*/
class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, PermissionsViewModel>(), View.OnClickListener {
class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, PermissionsViewModel>(),
View.OnClickListener {
override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?)= R.layout.activity_permissions
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_permissions
override fun initData() {
super.initData()
initView()
......@@ -76,40 +78,43 @@ class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, Permission
}
override fun onClick(v: View?) {
when(v?.id){
when (v?.id) {
R.id.btnPermissionsDont -> ToastUtils.showLong("请您同意授权,否则将无法使用APP功能")
R.id.btnPermissionsNext->{
R.id.btnPermissionsNext -> {
if (AntiShake.check(v?.id)) return
com.blankj.utilcode.util.ToastUtils.showLong("努力加载中...")
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 {
PermissionX.init(this).permissions(
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 ""
).request(RequestCallback { allGranted, grantedList, deniedList ->
startActivityThenKill(MainActivity::class.java)
}
})
MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS).encode(Constant.FIRST_OPEN_PERMISSIONS, true)
MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS)
.encode(Constant.FIRST_OPEN_PERMISSIONS, true)
}
R.id.tv_regist->{
R.id.tv_regist -> {
if (!NetUtils.isNetworkConnected(AppApplication.getContext())) {
com.blankj.utilcode.util.ToastUtils.showShort("网络异常,请检测网络")
return
}
MintsWebViewActivity.startWebView(name = "用户协议",url = Constant.REGISTER_URL)
MintsWebViewActivity.startWebView(name = "用户协议", url = Constant.REGISTER_URL)
}
R.id.tv_private->{
R.id.tv_private -> {
if (!NetUtils.isNetworkConnected(AppApplication.getContext())) {
com.blankj.utilcode.util.ToastUtils.showShort("网络异常,请检测网络")
return
}
MintsWebViewActivity.startWebView(name = "隐私协议",url = "http://test.mints-id.com/map-api/map/privacy.html")
MintsWebViewActivity.startWebView(
name = "隐私协议",
url = "http://test.mints-id.com/map-api/map/privacy.html"
)
}
}
}
......
......@@ -134,9 +134,16 @@ object ApiModel {
return HttpManager.getInstance().execute(lifecycleProvider,MainApi.newInstance().checkUpgrade(map))
}
/**
* 谷歌地图授权
* 授权
*/
fun authorized():Observable<Response<BaseResponse<AuthorizedBean>>>{
return HttpManager.getInstance().execute(null,MainApi.newInstance().authorized())
}
/**
* 授权
* 国内免费用户查看
*/
fun authorizedA():Observable<Response<BaseResponse<AuthorizedBean>>>{
return HttpManager.getInstance().execute(null,MainApi.newInstance().authorizedA())
}
}
\ No newline at end of file
package com.mints.street.widget.dialog
import android.Manifest
import android.annotation.SuppressLint
import android.annotation.TargetApi
......@@ -10,28 +11,26 @@ import android.provider.Settings
import android.text.TextUtils
import android.view.View
import androidx.fragment.app.FragmentActivity
import com.fry.base.utils.SpannableUtils
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.core.CenterPopupView
import com.lxj.xpopup.interfaces.SimpleCallback
import com.mints.street.R
import com.mints.street.bean.Version
import com.mints.street.services.UpdateServices
import com.tbruyelle.rxpermissions2.RxPermissions
import com.permissionx.guolindev.PermissionX
import com.permissionx.guolindev.callback.RequestCallback
import kotlinx.android.synthetic.main.main_update_dialog.view.*
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.ToastUtils
/**
*
* @author 冯瑞雨
* @date 2021/7/23
*/
class UpdateDialog(val activity: FragmentActivity, val version: Version) : CenterPopupView(activity) {
class UpdateDialog(val activity: FragmentActivity, val version: Version) :
CenterPopupView(activity) {
companion object {
@JvmStatic
......@@ -61,9 +60,9 @@ class UpdateDialog(val activity: FragmentActivity, val version: Version) : Cente
}
private fun initView() {
if ( version.upgrades!=null &&version.upgrades?.size?:0>0){
if (version.upgrades != null && version.upgrades?.size ?: 0 > 0) {
version.upgrades[0]?.let {
tv_update_content.text =it.updatemsg
tv_update_content.text = it.updatemsg
// tv_tip.text = SpannableUtils.getGradientTxt(upgradeInfoBean.title,
// intArrayOf(0xFFFFDA81.toInt(), 0xFFFFF1D5.toInt(), 0xFFFFEDAA.toInt()), null)
tv_title.text = "V${it.version}诚邀更新"
......@@ -82,7 +81,7 @@ class UpdateDialog(val activity: FragmentActivity, val version: Version) : Cente
private fun initClick() {
stv_download_next.setOnClickListener { this.dismiss() }
RxUtils.onMultiClick(stv_download_now){
RxUtils.onMultiClick(stv_download_now) {
permissionStorage()
}
}
......@@ -91,11 +90,11 @@ class UpdateDialog(val activity: FragmentActivity, val version: Version) : Cente
@SuppressLint("CheckResult")
private fun permissionStorage() {
//请求存储权限
val rxPermissions = RxPermissions(activity)
rxPermissions.request(Manifest.permission.WRITE_EXTERNAL_STORAGE
, Manifest.permission.READ_EXTERNAL_STORAGE)
.subscribe{ grant: Boolean ->
if (grant) {
PermissionX.init(activity).permissions(
Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE
)
.request(RequestCallback { allGranted, _, _ ->
if (allGranted) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { //  8.0 检测是否允许安装apk
val b: Boolean = activity.packageManager.canRequestPackageInstalls()
if (b) {
......@@ -114,8 +113,9 @@ class UpdateDialog(val activity: FragmentActivity, val version: Version) : Cente
}
ToastUtils.showLong("请前往系统设置里允许读写权限")
}
})
}
}
/**
* 8.0安装新版本APK权限
*/
......@@ -123,10 +123,9 @@ class UpdateDialog(val activity: FragmentActivity, val version: Version) : Cente
@SuppressLint("CheckResult")
private fun permissionInstall() {
//请求安装权限
val rxPermissions = RxPermissions(activity)
rxPermissions.request(Manifest.permission.REQUEST_INSTALL_PACKAGES)
.subscribe { grant: Boolean ->
if (grant) {
PermissionX.init(activity).permissions(Manifest.permission.REQUEST_INSTALL_PACKAGES)
.request(RequestCallback { allGranted, _, _ ->
if (allGranted) {
startDownload()
} else {
//跳转到安装未知应用界面
......@@ -134,11 +133,11 @@ class UpdateDialog(val activity: FragmentActivity, val version: Version) : Cente
val intent = Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, packageURI)
activity.startActivity(intent)
}
}
})
}
private fun startDownload() {
if ( version.upgrades==null ||version.upgrades?.size?:0<=0) {
if (version.upgrades == null || version.upgrades?.size ?: 0 <= 0) {
return
}
val upgrades = version.upgrades?.get(0)
......
......@@ -21,7 +21,8 @@ import com.mints.street.login.LoginApi
import com.mints.street.login.OnLoginListener
import com.mints.street.utils.json.JsonUtil
import com.mints.street.webview.MintsWebViewActivity
import com.tbruyelle.rxpermissions2.RxPermissions
import com.permissionx.guolindev.PermissionX
import com.permissionx.guolindev.callback.RequestCallback
import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.ToastUtils
import java.util.*
......@@ -73,17 +74,17 @@ class WxLoginDialog(context: FragmentActivity) : OnLoginListener {
ToastUtils.showShort("请先安装微信")
return@setOnClickListener
}
RxPermissions(context)
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
PermissionX.init(context)
.permissions(Manifest.permission.READ_PHONE_STATE)
.request(RequestCallback { allGranted, _, _ ->
if (allGranted) {
loginApi.setOnLoginListener(this)
loginApi.setPlatform(Wechat.NAME)
loginApi.login(context)
} else {
DialogUtils.showPermissionDialog(context,"设备")
}
}
})
mBottomSheetDialog!!.dismiss()
} else {
ToastUtils.showShort("请先同意用户协议与隐私政策")
......
......@@ -99,7 +99,7 @@
android:id="@+id/image_under"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:padding="5dp"
android:src="@mipmap/icon_content_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
......@@ -59,8 +59,7 @@ ext {
//rxbinding
"rxbinding" : "com.jakewharton.rxbinding2:rxbinding:2.1.1",
//rx 6.0权限请求
"rxpermissions" : 'com.github.tbruyelle:rxpermissions:0.10.2',
// "rxpermissions" : "com.tbruyelle.rxpermissions2:rxpermissions:0.10.2@aar",
"permissionx" : 'com.guolindev.permissionx:permissionx:1.5.0',
//network
"okhttp" : "com.squareup.okhttp3:okhttp:4.2.2",
"retrofit" : "com.squareup.retrofit2:retrofit:2.6.2",
......
......@@ -43,7 +43,7 @@ dependencies {
exclude group: 'com.android.support'
}
//rx权限请求
api(rootProject.ext.dependencies.rxpermissions) {
api(rootProject.ext.dependencies.permissionx) {
exclude group: 'com.android.support'
}
//network
......
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