Commit e94650f8 authored by fengruiyu's avatar fengruiyu

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

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