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
a6fac0d4
Commit
a6fac0d4
authored
Jul 15, 2021
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
bd1e5224
99259dea
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
378 additions
and
426 deletions
+378
-426
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+4
-1
MainApi.kt
app/src/main/java/com/mints/street/api/MainApi.kt
+1
-3
AppRequest.kt
app/src/main/java/com/mints/street/bean/AppRequest.kt
+1
-1
AwardBean.kt
app/src/main/java/com/mints/street/bean/AwardBean.kt
+0
-20
BaseResponse.java
app/src/main/java/com/mints/street/bean/BaseResponse.java
+4
-3
UserBean.kt
app/src/main/java/com/mints/street/bean/UserBean.kt
+3
-4
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
+31
-38
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
+24
-42
ApiModel.kt
app/src/main/java/com/mints/street/model/ApiModel.kt
+1
-2
HttpSubscribeImpl.kt
...n/java/com/mints/street/netwrok/base/HttpSubscribeImpl.kt
+1
-1
IHttpResponseListener.java
.../com/mints/street/netwrok/base/IHttpResponseListener.java
+2
-1
IHttpSubscribe.kt
...main/java/com/mints/street/netwrok/base/IHttpSubscribe.kt
+1
-1
RetrofitClient.java
...in/java/com/mints/street/netwrok/base/RetrofitClient.java
+1
-50
GsonConverterFactory.java
...com/mints/street/netwrok/common/GsonConverterFactory.java
+1
-1
HttpErrorProcess.java
...ava/com/mints/street/netwrok/common/HttpErrorProcess.java
+2
-1
HttpManager.java
...ain/java/com/mints/street/netwrok/common/HttpManager.java
+1
-58
OkHttpInterceptor.kt
...java/com/mints/street/netwrok/common/OkHttpInterceptor.kt
+1
-1
SplashActivity.kt
app/src/main/java/com/mints/street/splash/SplashActivity.kt
+10
-2
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
gradle.properties
gradle.properties
+2
-1
build.gradle
mvvmhabit/build.gradle
+0
-1
ApiDisposableObserver.java
.../java/me/goldze/mvvmhabit/http/ApiDisposableObserver.java
+122
-122
BaseArrayResponse.java
...main/java/me/goldze/mvvmhabit/http/BaseArrayResponse.java
+22
-22
No files found.
app/src/main/AndroidManifest.xml
View file @
a6fac0d4
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 调用相机,用于实现扫描二维码,预览个性化地图编辑器生成的个性化地图样式(开发者实际开发中地图SDK不需要该权限) -->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 调用相机,用于实现扫描二维码,预览个性化地图编辑器生成的个性化地图样式(开发者实际开发中地图SDK不需要该权限) -->
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<!-- 获取手机状态信息 -->
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<!-- 获取手机状态信息 -->
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<!-- android10以后 后台运行位置 -->
<uses-permission
android:name=
"android.permission.ACCESS_BACKGROUND_LOCATION"
/>
<application
<application
android:name=
".AppApplication"
android:name=
".AppApplication"
...
@@ -50,9 +52,10 @@
...
@@ -50,9 +52,10 @@
<meta-data
<meta-data
android:name=
"Mob-AppSecret"
android:name=
"Mob-AppSecret"
android:value=
"${SHARE_SECRET}"
/>
android:value=
"${SHARE_SECRET}"
/>
<!--百度地图开放平台 -->
<meta-data
<meta-data
android:name=
"com.baidu.lbsapi.API_KEY"
android:name=
"com.baidu.lbsapi.API_KEY"
android:value=
"SD6luBGzUFSVEZ3n9Xjk3xTsvDFmuRCi"
/>
<!-- 百度地图开放平台 -->
android:value=
"SD6luBGzUFSVEZ3n9Xjk3xTsvDFmuRCi"
/>
<!-- 百度地图开放平台 service -->
<!-- 百度地图开放平台 service -->
<service
<service
android:name=
"com.baidu.location.f"
android:name=
"com.baidu.location.f"
...
...
app/src/main/java/com/mints/street/api/MainApi.kt
View file @
a6fac0d4
package
com.mints.street.api
package
com.mints.street.api
import
com.google.gson.JsonObject
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.AwardBean
import
com.mints.street.bean.UserBean
import
com.mints.street.bean.UserBean
import
com.mints.street.bean.VipBean
import
com.mints.street.bean.VipBean
import
com.mints.street.netwrok.common.HttpManager
import
com.mints.street.netwrok.common.HttpManager
import
io.reactivex.Observable
import
io.reactivex.Observable
import
me.goldze.mvvmhabit.http.BaseResponse
import
retrofit2.Response
import
retrofit2.Response
import
retrofit2.http.Body
import
retrofit2.http.Body
import
retrofit2.http.POST
import
retrofit2.http.POST
...
...
library_base/src/main/java/com/fry/base
/bean/AppRequest.kt
→
app/src/main/java/com/mints/street
/bean/AppRequest.kt
View file @
a6fac0d4
package
com.
fry.base
.bean
package
com.
mints.street
.bean
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.os.Parcelable
import
android.os.Parcelable
...
...
app/src/main/java/com/mints/street/bean/AwardBean.kt
deleted
100644 → 0
View file @
bd1e5224
package
com.mints.street.bean
import
android.annotation.SuppressLint
import
android.os.Parcelable
import
kotlinx.android.parcel.Parcelize
/**
*
* @author jyx
* @date 2021/4/7
* @des
*/
@SuppressLint
(
"ParcelCreator"
)
@Parcelize
data class
AwardBean
(
var
highCoin
:
Int
=
0
,
var
showHigh
:
Boolean
=
false
,
var
coin
:
Int
=
0
,
var
riskinfoRate
:
Boolean
=
false
)
:
Parcelable
\ No newline at end of file
mvvmhabit/src/main/java/me/goldze/mvvmhabit/http
/BaseResponse.java
→
app/src/main/java/com/mints/street/bean
/BaseResponse.java
View file @
a6fac0d4
package
me
.
goldze
.
mvvmhabit
.
http
;
package
com
.
mints
.
street
.
bean
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.gson.annotations.JsonAdapter
;
import
com.google.gson.annotations.SerializedName
;
import
com.google.gson.annotations.SerializedName
;
import
java.io.Serializable
;
/**
/**
* Created by goldze on 2017/5/10.
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
*/
public
class
BaseResponse
<
T
>
{
public
class
BaseResponse
<
T
>
implements
Serializable
{
private
int
status
;
private
int
status
;
private
String
message
;
private
String
message
;
...
...
app/src/main/java/com/mints/street/bean/UserBean.kt
View file @
a6fac0d4
...
@@ -12,13 +12,12 @@ class UserBean : Serializable {
...
@@ -12,13 +12,12 @@ class UserBean : Serializable {
val
consumer
:
ConsumerBean
?
=
null
val
consumer
:
ConsumerBean
?
=
null
inner
class
ConsumerBean
:
Serializable
{
inner
class
ConsumerBean
:
Serializable
{
val
head
:
String
=
""
val
openid
:
String
=
""
val
openid
:
String
=
""
val
nickname
:
String
=
""
val
nickname
:
String
=
""
val
mobile
:
String
=
""
val
mobile
:
String
=
""
val
real_name
:
String
=
""
val
idcode
:
String
=
""
val
idcode
:
String
=
""
val
pk_id
// 用户id
val
isForever
:
Boolean
=
false
:
Long
=
0
val
expireTime
:
Long
=
0
val
pk_id
:
Long
=
0
}
}
}
}
app/src/main/java/com/mints/street/common/Constant.kt
View file @
a6fac0d4
...
@@ -12,4 +12,8 @@ object Constant {
...
@@ -12,4 +12,8 @@ object Constant {
*/
*/
const
val
MINTS_PKG_NAME
=
"com.mints.street"
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 @
a6fac0d4
...
@@ -2,19 +2,14 @@ package com.mints.street.login
...
@@ -2,19 +2,14 @@ package com.mints.street.login
import
android.app.Application
import
android.app.Application
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.MutableLiveData
import
android.text.TextUtils
import
com.mints.street.bean.BaseResponse
import
androidx.lifecycle.viewModelScope
import
com.mints.street.bean.AwardBean
import
com.mints.street.bean.UserBean
import
com.mints.street.bean.UserBean
import
com.mints.street.common.DeviceInfo
import
com.mints.street.common.DeviceInfo
import
com.mints.street.manager.UserManager
import
com.mints.street.manager.UserManager
import
com.mints.street.model.ApiModel
import
com.mints.street.model.ApiModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
com.mints.street.utils.DeviceUuidFactory
import
com.mints.street.utils.DeviceUuidFactory
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.http.BaseResponse
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.ToastUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
import
java.util.HashMap
import
java.util.HashMap
...
@@ -55,6 +50,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
...
@@ -55,6 +50,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
}
}
fun
login
(
mobile
:
String
,
smsCode
:
String
)
{
fun
login
(
mobile
:
String
,
smsCode
:
String
)
{
// showDialog()
val
vo
=
HashMap
<
String
,
Any
>()
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"mobile"
]
=
mobile
vo
[
"mobile"
]
=
mobile
vo
[
"smsCode"
]
=
smsCode
vo
[
"smsCode"
]
=
smsCode
...
@@ -64,12 +60,16 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
...
@@ -64,12 +60,16 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
object
:
HttpSubscribeImpl
<
BaseResponse
<
UserBean
>>(
object
:
HttpSubscribeImpl
<
BaseResponse
<
UserBean
>>(
this
@LoginViewModel
,
true
)
{
this
@LoginViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
UserBean
>)
{
data
.
value
=
response
.
message
// dismissDialog()
KLog
.
e
(
"login"
,
response
.
result
.
toString
())
// ToastUtils.showShort("登录信息="+response.result.ConsumerBean().idcode)
//展示业务逻辑
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
this
@LoginViewModel
.
saveTerminalInfo
()
this
@LoginViewModel
.
saveTerminalInfo
()
UserManager
.
INSTANCE
.
saveUserInfo
(
response
.
result
)
KLog
.
e
(
"login"
,
response
.
result
.
toString
())
ToastUtils
.
showShort
(
"登录信息="
+
response
.
result
.
consumer
?.
idcode
)
data
.
value
=
response
.
message
}
}
override
fun
onError
(
e
:
Throwable
)
{
override
fun
onError
(
e
:
Throwable
)
{
...
@@ -84,35 +84,28 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
...
@@ -84,35 +84,28 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
* 提交设备信息
* 提交设备信息
*/
*/
fun
saveTerminalInfo
()
{
fun
saveTerminalInfo
()
{
viewModelScope
.
launch
(
Dispatchers
.
IO
)
{
val
vo
=
hashMapOf
<
String
,
Any
>()
val
appInfoMap
=
deviceInfo
.
getAppInfoMap
()
val
macAddress
:
String
=
deviceInfo
.
getMacAddress
()
val
mac
=
macAddress
.
replace
(
":"
,
""
)
launch
(
Dispatchers
.
Main
)
{
vo
[
"mac"
]
=
mac
val
vo
=
hashMapOf
<
String
,
Any
>()
vo
[
"mac1"
]
=
macAddress
val
macAddress
:
String
=
deviceInfo
.
getMacAddress
()
vo
[
"androidid"
]
=
deviceInfo
.
getAndroidId
(
null
)
val
mac
=
macAddress
.
replace
(
":"
,
""
)
vo
[
"imei"
]
=
deviceInfo
.
iMEI
vo
[
"mac"
]
=
mac
vo
[
"mac1"
]
=
macAddress
vo
[
"androidid"
]
=
deviceInfo
.
getAndroidId
(
null
)
vo
[
"imei"
]
=
deviceInfo
.
iMEI
// if (!TextUtils.isEmpty(App.OAID)) {
// if (!TextUtils.isEmpty(App.OAID)) {
// vo["oaid"] = App.OAID
// vo["oaid"] = App.OAID
// }
// }
vo
[
"os"
]
=
"android"
vo
[
"os"
]
=
"android"
vo
[
"model"
]
=
deviceInfo
.
newModel
vo
[
"model"
]
=
deviceInfo
.
newModel
vo
[
"uuid"
]
=
DeviceUuidFactory
().
deviceUuid
vo
[
"uuid"
]
=
DeviceUuidFactory
().
deviceUuid
vo
[
"osversion"
]
=
deviceInfo
.
oSVersion
vo
[
"osversion"
]
=
deviceInfo
.
oSVersion
vo
[
"appversion"
]
=
deviceInfo
.
versionName
vo
[
"appversion"
]
=
deviceInfo
.
versionName
vo
[
"appPkgList"
]
=
appInfoMap
ApiModel
.
saveTerminalInfo
(
lifecycleProvider
,
vo
).
safeSubscribe
(
ApiModel
.
saveTerminalInfo
(
lifecycleProvider
,
vo
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
Any
>>(
object
:
HttpSubscribeImpl
<
BaseResponse
<
Any
>>(
this
@LoginViewModel
,
true
)
{
this
@LoginViewModel
,
true
)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
Any
>)
{
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
Any
>)
{
KLog
.
e
(
"saveTerminalInfo"
,
response
.
result
.
toString
())
KLog
.
e
(
"saveTerminalInfo"
,
response
.
result
.
toString
())
}
}
})
})
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
View file @
a6fac0d4
...
@@ -134,6 +134,10 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
...
@@ -134,6 +134,10 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
binding
.
imageOut
.
setOnClickListener
{
binding
.
imageOut
.
setOnClickListener
{
mBaiduMap
?.
setMapStatus
(
MapStatusUpdateFactory
.
zoomOut
())
mBaiduMap
?.
setMapStatus
(
MapStatusUpdateFactory
.
zoomOut
())
}
}
//历史影像
binding
.
imageMapHistory
.
setOnClickListener
{
startActivity
(
HistoricalimageActivity
::
class
.
java
)
}
mRecommendStopSearch
=
RecommendStopSearch
.
newInstance
()
mRecommendStopSearch
=
RecommendStopSearch
.
newInstance
()
mRecommendStopSearch
?.
setOnGetRecommendStopResultListener
{
result
->
mRecommendStopSearch
?.
setOnGetRecommendStopResultListener
{
result
->
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
...
...
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
a6fac0d4
...
@@ -93,7 +93,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickL
...
@@ -93,7 +93,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickL
when
(
v
?.
id
)
{
when
(
v
?.
id
)
{
R
.
id
.
aboutus
->
{
R
.
id
.
aboutus
->
{
startActivity
(
AboutusActivity
::
class
.
java
)
startActivity
(
AboutusActivity
::
class
.
java
)
// startActivity(
Historicalimage
Activity::class.java)
// startActivity(
Permissions
Activity::class.java)
}
}
R
.
id
.
moresettings
->
{
R
.
id
.
moresettings
->
{
startActivity
(
MoresettingsActivity
::
class
.
java
)
startActivity
(
MoresettingsActivity
::
class
.
java
)
...
...
app/src/main/java/com/mints/street/main/my/PermissionsActivity.kt
View file @
a6fac0d4
package
com.mints.street.main.my
package
com.mints.street.main.my
import
android.Manifest
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
com.fry.base.base.BaseActivity
import
com.fry.base.base.BaseActivity
import
com.github.iielse.switchbutton.SwitchView
import
com.github.iielse.switchbutton.SwitchView
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.ActivityMoresettingsBinding
import
com.mints.street.
common.Constant
import
com.mints.street.databinding.ActivityPermissionsBinding
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
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
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
()
initListener
()
}
private
fun
initListener
()
{
btnPermissionsDont
.
setOnClickListener
(
this
)
btnPermissionsNext
.
setOnClickListener
(
this
)
}
}
private
fun
initView
()
{
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
?)
{
override
fun
toggleToOn
(
view
:
SwitchView
?)
{
sv
_positionin
g
?.
isOpened
=
true
sv
Readms
g
?.
isOpened
=
true
}
}
override
fun
toggleToOff
(
view
:
SwitchView
?)
{
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 @
a6fac0d4
...
@@ -33,11 +33,6 @@ class UserManager {
...
@@ -33,11 +33,6 @@ class UserManager {
*/
*/
private
const
val
MOBILE
=
"mobile"
private
const
val
MOBILE
=
"mobile"
/**
* 姓名
*/
private
const
val
REAL_NAME
=
"realName"
/**
/**
* 微信名称
* 微信名称
*/
*/
...
@@ -53,6 +48,16 @@ class UserManager {
...
@@ -53,6 +48,16 @@ class UserManager {
*/
*/
private
const
val
WX_OPENID
=
"wx_openid"
private
const
val
WX_OPENID
=
"wx_openid"
/**
* 是否购买会员
*/
private
const
val
IS_FOREVER
=
"is_forever"
/**
* 会员是否永久
*/
private
const
val
EXPIRETIME
=
"expiretime"
val
INSTANCE
:
UserManager
by
lazy
(
mode
=
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
val
INSTANCE
:
UserManager
by
lazy
(
mode
=
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
UserManager
()
UserManager
()
}
}
...
@@ -78,16 +83,18 @@ class UserManager {
...
@@ -78,16 +83,18 @@ class UserManager {
val
mobile
:
String
?
=
user
.
mobile
val
mobile
:
String
?
=
user
.
mobile
val
openid
:
String
?
=
user
.
openid
val
openid
:
String
?
=
user
.
openid
MMKV
.
mmkvWithID
(
USER_ID
).
encode
(
USER_ID
,
user
.
pk_id
.
toString
())
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
))
{
if
(!
TextUtils
.
isEmpty
(
mobile
))
{
MMKV
.
mmkvWithID
(
MOBILE
).
encode
(
MOBILE
,
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_HEADER
).
encode
(
WX_HEADER
,
user
.
head
)
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
))
{
if
(!
TextUtils
.
isEmpty
(
openid
))
{
MMKV
.
mmkvWithID
(
WX_OPENID
).
encode
(
WX_OPENID
,
openid
)
MMKV
.
mmkvWithID
(
WX_OPENID
).
encode
(
WX_OPENID
,
openid
)
}
}
MMKV
.
mmkvWithID
(
REAL_NAME
).
encode
(
REAL_NAME
,
user
.
real_name
)
}
}
}
}
...
@@ -133,23 +140,6 @@ class UserManager {
...
@@ -133,23 +140,6 @@ class UserManager {
return
kv
.
decodeString
(
CODE_ID
,
""
)
return
kv
.
decodeString
(
CODE_ID
,
""
)
}
}
/**
* 获取真实姓名
*/
fun
getRealName
():
String
{
val
kv
=
MMKV
.
mmkvWithID
(
REAL_NAME
)
return
kv
.
decodeString
(
REAL_NAME
,
""
)
}
/**
* 设置真实姓名
*
* @param name
*/
fun
setRealName
(
name
:
String
?)
{
val
kv
=
MMKV
.
mmkvWithID
(
REAL_NAME
)
kv
.
encode
(
REAL_NAME
,
name
)
}
fun
getWxName
():
String
{
fun
getWxName
():
String
{
val
kv
=
MMKV
.
mmkvWithID
(
WX_NAME
)
val
kv
=
MMKV
.
mmkvWithID
(
WX_NAME
)
...
@@ -166,34 +156,26 @@ class UserManager {
...
@@ -166,34 +156,26 @@ class UserManager {
return
kv
.
decodeString
(
WX_OPENID
,
""
)
return
kv
.
decodeString
(
WX_OPENID
,
""
)
}
}
fun
setWxName
(
wxName
:
String
?)
{
fun
getIsforever
():
Boolean
{
val
kv
=
MMKV
.
mmkvWithID
(
WX_NAME
)
val
kv
=
MMKV
.
mmkvWithID
(
IS_FOREVER
)
kv
.
encode
(
WX_NAME
,
wxNam
e
)
return
kv
.
decodeBool
(
IS_FOREVER
,
fals
e
)
}
}
fun
setWxHeader
(
wxHeader
:
String
?)
{
fun
getExpiretime
():
Long
{
val
kv
=
MMKV
.
mmkvWithID
(
WX_HEADER
)
val
kv
=
MMKV
.
mmkvWithID
(
EXPIRETIME
)
kv
.
encode
(
WX_HEADER
,
wxHeader
)
return
kv
.
decodeLong
(
EXPIRETIME
,
0
)
}
}
/**
* mobile
*
* @param mobile
*/
fun
setMobile
(
mobile
:
String
?)
{
val
kv
=
MMKV
.
mmkvWithID
(
MOBILE
)
kv
.
encode
(
MOBILE
,
mobile
)
}
fun
userLogout
()
{
fun
userLogout
()
{
MMKV
.
mmkvWithID
(
USER_ID
).
remove
(
USER_ID
)
MMKV
.
mmkvWithID
(
USER_ID
).
remove
(
USER_ID
)
MMKV
.
mmkvWithID
(
CODE_ID
).
remove
(
CODE_ID
)
MMKV
.
mmkvWithID
(
CODE_ID
).
remove
(
CODE_ID
)
MMKV
.
mmkvWithID
(
TOKEN_ID
).
remove
(
TOKEN_ID
)
MMKV
.
mmkvWithID
(
TOKEN_ID
).
remove
(
TOKEN_ID
)
MMKV
.
mmkvWithID
(
REAL_NAME
).
remove
(
REAL_NAME
)
MMKV
.
mmkvWithID
(
WX_OPENID
).
remove
(
WX_OPENID
)
MMKV
.
mmkvWithID
(
WX_OPENID
).
remove
(
WX_OPENID
)
MMKV
.
mmkvWithID
(
WX_NAME
).
remove
(
WX_NAME
)
MMKV
.
mmkvWithID
(
WX_NAME
).
remove
(
WX_NAME
)
MMKV
.
mmkvWithID
(
WX_HEADER
).
remove
(
WX_HEADER
)
MMKV
.
mmkvWithID
(
WX_HEADER
).
remove
(
WX_HEADER
)
MMKV
.
mmkvWithID
(
IS_FOREVER
).
remove
(
IS_FOREVER
)
MMKV
.
mmkvWithID
(
EXPIRETIME
).
remove
(
EXPIRETIME
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/model/ApiModel.kt
View file @
a6fac0d4
package
com.mints.street.model
package
com.mints.street.model
import
com.mints.street.api.MainApi
import
com.mints.street.api.MainApi
import
com.mints.street.bean.
AwardBean
import
com.mints.street.bean.
BaseResponse
import
com.mints.street.bean.UserBean
import
com.mints.street.bean.UserBean
import
com.mints.street.netwrok.common.HttpManager
import
com.mints.street.netwrok.common.HttpManager
import
com.trello.rxlifecycle2.LifecycleProvider
import
com.trello.rxlifecycle2.LifecycleProvider
import
io.reactivex.Observable
import
io.reactivex.Observable
import
me.goldze.mvvmhabit.http.BaseResponse
import
retrofit2.Response
import
retrofit2.Response
/**
/**
...
...
app/src/main/java/com/mints/street/netwrok/base/HttpSubscribeImpl.kt
View file @
a6fac0d4
package
com.mints.street.netwrok.base
package
com.mints.street.netwrok.base
import
com.mints.street.bean.BaseResponse
import
me.goldze.mvvmhabit._enum.ViewStatus
import
me.goldze.mvvmhabit._enum.ViewStatus
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.http.BaseResponse
import
me.goldze.mvvmhabit.http.ExceptionHandle
import
me.goldze.mvvmhabit.http.ExceptionHandle
import
me.goldze.mvvmhabit.http.ResponseThrowable
import
me.goldze.mvvmhabit.http.ResponseThrowable
import
me.goldze.mvvmhabit.utils.ToastUtils
import
me.goldze.mvvmhabit.utils.ToastUtils
...
...
app/src/main/java/com/mints/street/netwrok/base/IHttpResponseListener.java
View file @
a6fac0d4
package
com
.
mints
.
street
.
netwrok
.
base
;
package
com
.
mints
.
street
.
netwrok
.
base
;
import
com.mints.street.bean.BaseResponse
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.disposables.Disposable
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
import
me.goldze.mvvmhabit.http.ResponseThrowable
;
import
me.goldze.mvvmhabit.http.ResponseThrowable
;
import
retrofit2.Response
;
import
retrofit2.Response
;
...
...
app/src/main/java/com/mints/street/netwrok/base/IHttpSubscribe.kt
View file @
a6fac0d4
package
com.mints.street.netwrok.base
package
com.mints.street.netwrok.base
import
com.mints.street.bean.BaseResponse
import
io.reactivex.Observer
import
io.reactivex.Observer
import
io.reactivex.disposables.Disposable
import
io.reactivex.disposables.Disposable
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.http.BaseResponse
import
retrofit2.Response
import
retrofit2.Response
/**
/**
...
...
app/src/main/java/com/mints/street/netwrok/base/RetrofitClient.java
View file @
a6fac0d4
...
@@ -31,7 +31,7 @@ import retrofit2.Retrofit;
...
@@ -31,7 +31,7 @@ import retrofit2.Retrofit;
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
;
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
;
/**
/**
* Created by
jeme on 2019/1/31
* Created by
mcg
*/
*/
public
class
RetrofitClient
{
public
class
RetrofitClient
{
...
@@ -50,38 +50,10 @@ public class RetrofitClient {
...
@@ -50,38 +50,10 @@ public class RetrofitClient {
OkHttpClient
.
Builder
clientBuilder
=
new
OkHttpClient
.
Builder
()
OkHttpClient
.
Builder
clientBuilder
=
new
OkHttpClient
.
Builder
()
.
cookieJar
(
new
CookieJarImpl
(
new
PersistentCookieStore
(
mContext
)))
.
cookieJar
(
new
CookieJarImpl
(
new
PersistentCookieStore
(
mContext
)))
// .cache(cache)
// .addInterceptor()
// .addInterceptor(new CacheInterceptor(mContext))
// .sslSocketFactory(sslParams.sSLSocketFactory, sslParams.trustManager)
.
connectTimeout
(
mHttpConfig
.
getTimeOut
(),
TimeUnit
.
SECONDS
)
.
connectTimeout
(
mHttpConfig
.
getTimeOut
(),
TimeUnit
.
SECONDS
)
.
writeTimeout
(
mHttpConfig
.
getTimeOut
(),
TimeUnit
.
SECONDS
)
.
writeTimeout
(
mHttpConfig
.
getTimeOut
(),
TimeUnit
.
SECONDS
)
.
readTimeout
(
mHttpConfig
.
getTimeOut
(),
TimeUnit
.
SECONDS
)
.
readTimeout
(
mHttpConfig
.
getTimeOut
(),
TimeUnit
.
SECONDS
)
.
connectionPool
(
new
ConnectionPool
(
8
,
15
,
TimeUnit
.
SECONDS
));
.
connectionPool
(
new
ConnectionPool
(
8
,
15
,
TimeUnit
.
SECONDS
));
// 这里你可以根据自己的机型设置同时连接的个数和时间,我这里8个,和每个保持时间为10s
// if (configuation.getInterceptors() != null) {
// for (Interceptor interceptor : configuation.getInterceptors()) {
// clientBuilder.addInterceptor(interceptor);
// }
// }
// if(BuildConfig.IS_DEV) {
// clientBuilder.addInterceptor(new LoggingInterceptor
// .Builder()
// //是否开启日志打印
// .loggable(BuildConfig.DEBUG)
// //打印的等级
// .setLevel(Level.BASIC)
// // 打印类型
// .log(Platform.INFO)
// // request的Tag
// .request("Request")
// // Response的Tag
// .response("Request")
//// .addHeader("log-header", "I am the log request header.") // 添加打印头, 注意 key 和 value 都不能是中文
// .build()
// );
// }
if
(
BuildConfig
.
DEBUG
)
{
if
(
BuildConfig
.
DEBUG
)
{
HttpLoggingInterceptor
logging
=
new
HttpLoggingInterceptor
(
message
->
{
HttpLoggingInterceptor
logging
=
new
HttpLoggingInterceptor
(
message
->
{
...
@@ -122,25 +94,4 @@ public class RetrofitClient {
...
@@ -122,25 +94,4 @@ public class RetrofitClient {
}
}
return
mRetrofit
.
create
(
service
);
return
mRetrofit
.
create
(
service
);
}
}
/**
* /**
* execute your customer API
* For example:
* MyApiService service =
* RetrofitClient.getInstance(MainActivity.this).create(MyApiService.class);
* <p>
* RetrofitClient.getInstance(MainActivity.this)
* .execute(service.lgon("name", "password"), subscriber)
* * @param subscriber
*/
public
static
<
T
>
T
execute
(
Observable
<
T
>
observable
,
Observer
<
T
>
subscriber
)
{
observable
.
subscribeOn
(
Schedulers
.
io
())
.
unsubscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
subscriber
);
return
null
;
}
}
}
app/src/main/java/com/mints/street/netwrok/common/GsonConverterFactory.java
View file @
a6fac0d4
package
com
.
mints
.
street
.
netwrok
.
common
;
package
com
.
mints
.
street
.
netwrok
.
common
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.mints.street.bean.BaseResponse
;
import
com.mints.street.manager.UserManager
;
import
com.mints.street.manager.UserManager
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -12,7 +13,6 @@ import java.lang.reflect.Type;
...
@@ -12,7 +13,6 @@ import java.lang.reflect.Type;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
import
okhttp3.MediaType
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
import
okhttp3.RequestBody
;
import
okhttp3.ResponseBody
;
import
okhttp3.ResponseBody
;
...
...
app/src/main/java/com/mints/street/netwrok/common/HttpErrorProcess.java
View file @
a6fac0d4
package
com
.
mints
.
street
.
netwrok
.
common
;
package
com
.
mints
.
street
.
netwrok
.
common
;
import
com.mints.street.bean.BaseResponse
;
import
io.reactivex.Observable
;
import
io.reactivex.Observable
;
import
io.reactivex.ObservableSource
;
import
io.reactivex.ObservableSource
;
import
io.reactivex.ObservableTransformer
;
import
io.reactivex.ObservableTransformer
;
import
io.reactivex.functions.Function
;
import
io.reactivex.functions.Function
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
import
retrofit2.Response
;
import
retrofit2.Response
;
/**
/**
...
...
app/src/main/java/com/mints/street/netwrok/common/HttpManager.java
View file @
a6fac0d4
...
@@ -3,10 +3,10 @@ package com.mints.street.netwrok.common;
...
@@ -3,10 +3,10 @@ package com.mints.street.netwrok.common;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
com.fry.base.global.Constants
;
import
com.fry.base.global.Constants
;
import
com.mints.street.bean.BaseResponse
;
import
com.mints.street.netwrok.base.HttpConfiguation
;
import
com.mints.street.netwrok.base.HttpConfiguation
;
import
com.mints.street.netwrok.base.IHttpResponseListener
;
import
com.mints.street.netwrok.base.IHttpResponseListener
;
import
com.mints.street.netwrok.base.RetrofitClient
;
import
com.mints.street.netwrok.base.RetrofitClient
;
import
com.mints.street.utils.encry.AESUtils
;
import
com.trello.rxlifecycle2.LifecycleProvider
;
import
com.trello.rxlifecycle2.LifecycleProvider
;
import
io.reactivex.Observable
;
import
io.reactivex.Observable
;
...
@@ -17,7 +17,6 @@ import io.reactivex.functions.Action;
...
@@ -17,7 +17,6 @@ import io.reactivex.functions.Action;
import
io.reactivex.functions.Consumer
;
import
io.reactivex.functions.Consumer
;
import
io.reactivex.functions.Function
;
import
io.reactivex.functions.Function
;
import
io.reactivex.schedulers.Schedulers
;
import
io.reactivex.schedulers.Schedulers
;
import
me.goldze.mvvmhabit.http.BaseResponse
;
import
me.goldze.mvvmhabit.http.ResponseThrowable
;
import
me.goldze.mvvmhabit.http.ResponseThrowable
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
me.goldze.mvvmhabit.utils.RxUtils
;
import
retrofit2.Response
;
import
retrofit2.Response
;
...
@@ -79,60 +78,4 @@ public class HttpManager {
...
@@ -79,60 +78,4 @@ public class HttpManager {
.
compose
(
RxUtils
.
exceptionTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
compose
(
HttpErrorProcess
.
businessExceptionTransformer
());
.
compose
(
HttpErrorProcess
.
businessExceptionTransformer
());
}
}
@SuppressLint
(
"CheckResult"
)
public
<
B
extends
BaseResponse
,
T
extends
Response
<
B
>>
void
execute
(
LifecycleProvider
life
,
final
Observable
<
T
>
observable
,
IHttpResponseListener
<
B
>
listener
)
{
Observable
<
T
>
newObservable
=
Observable
.
just
(
observable
)
.
observeOn
(
Schedulers
.
io
())
.
flatMap
((
Function
<
Observable
<
T
>,
ObservableSource
<
T
>>)
tObservable
->
{
// ServerTimeHelper.requestServerTime();
return
observable
;
})
.
observeOn
(
AndroidSchedulers
.
mainThread
());
if
(
life
!=
null
)
{
newObservable
=
newObservable
.
compose
(
RxUtils
.
bindToLifecycle
(
life
));
}
newObservable
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
compose
(
HttpErrorProcess
.
businessExceptionTransformer
())
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
if
(
listener
!=
null
)
{
listener
.
onStart
(
disposable
);
}
}
})
.
doFinally
(
new
Action
()
{
@Override
public
void
run
()
throws
Exception
{
if
(
listener
!=
null
)
{
listener
.
onCompleted
();
}
}
})
.
subscribe
(
t
->
{
if
(
listener
!=
null
)
{
// listener.onCompleted();
if
(!
listener
.
onParseResponse
(
t
))
{
if
(
t
.
body
()
!=
null
&&
t
.
body
().
isOk
())
{
listener
.
onBusinessSuccess
(
t
.
body
());
}
else
{
listener
.
onBusinessFail
(
t
.
body
());
}
}
}
},
throwable
->
{
if
(
listener
!=
null
&&
throwable
instanceof
ResponseThrowable
)
{
listener
.
onFailed
((
ResponseThrowable
)
throwable
);
}
throwable
.
printStackTrace
();
},
()
->
{
});
}
}
}
app/src/main/java/com/mints/street/netwrok/common/OkHttpInterceptor.kt
View file @
a6fac0d4
...
@@ -3,10 +3,10 @@ package com.mints.street.netwrok.common
...
@@ -3,10 +3,10 @@ package com.mints.street.netwrok.common
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
import
com.bytedance.hume.readapk.HumeSDK
import
com.bytedance.hume.readapk.HumeSDK
import
com.fry.base.bean.AppRequest
import
com.google.gson.Gson
import
com.google.gson.Gson
import
com.mints.street.AppApplication
import
com.mints.street.AppApplication
import
com.mints.street.BuildConfig
import
com.mints.street.BuildConfig
import
com.mints.street.bean.AppRequest
import
com.mints.street.manager.UserManager
import
com.mints.street.manager.UserManager
import
com.mints.street.utils.CommonUtils
import
com.mints.street.utils.CommonUtils
import
com.mints.street.utils.encry.AESUtils
import
com.mints.street.utils.encry.AESUtils
...
...
app/src/main/java/com/mints/street/splash/SplashActivity.kt
View file @
a6fac0d4
...
@@ -12,10 +12,14 @@ import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback
...
@@ -12,10 +12,14 @@ import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback
import
com.fry.base.base.BaseActivity
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.common.Constant
import
com.mints.street.common.DeviceInfo
import
com.mints.street.common.DeviceInfo
import
com.mints.street.databinding.ActivitySplashBinding
import
com.mints.street.databinding.ActivitySplashBinding
import
com.mints.street.main.MainActivity
import
com.mints.street.main.MainActivity
import
com.mints.street.main.my.PermissionsActivity
import
com.mints.street.manager.CsjGroMoreManager
import
com.mints.street.manager.CsjGroMoreManager
import
com.mints.street.manager.UserManager
import
com.tencent.mmkv.MMKV
/**
/**
* 描述:gromore开屏页
* 描述:gromore开屏页
...
@@ -163,7 +167,11 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
...
@@ -163,7 +167,11 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
* 跳转到主页面
* 跳转到主页面
*/
*/
private
fun
goToMainActivity
()
{
private
fun
goToMainActivity
()
{
// startActivityThenKill(MainActivity::class.java)
if
(
MMKV
.
mmkvWithID
(
Constant
.
FIRST_OPEN_PERMISSIONS
).
decodeBool
(
Constant
.
FIRST_OPEN_PERMISSIONS
,
false
)){
startActivityThenKill
(
GuideActivity
::
class
.
java
)
// 非新用户
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 @
a6fac0d4
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
android:shape=
"rectangle"
>
<solid
android:color=
"#2196F3"
/>
<solid
android:color=
"#2196F3"
/>
<corners
android:radius=
"
21
dp"
/>
<corners
android:radius=
"
30
dp"
/>
</shape>
</shape>
\ No newline at end of file
app/src/main/res/drawable/shape_bt_disagree.xml
View file @
a6fac0d4
...
@@ -7,6 +7,6 @@
...
@@ -7,6 +7,6 @@
android:color=
"#74000000"
android:color=
"#74000000"
/>
/>
<solid
android:color=
"#ffffffff"
/>
<solid
android:color=
"#ffffffff"
/>
<corners
android:radius=
"
21
dp"
/>
<corners
android:radius=
"
30
dp"
/>
</shape>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_permissions.xml
View file @
a6fac0d4
This diff is collapsed.
Click to expand it.
gradle.properties
View file @
a6fac0d4
...
@@ -21,7 +21,8 @@ android.enableJetifier=true
...
@@ -21,7 +21,8 @@ android.enableJetifier=true
isBuildModule
=
false
isBuildModule
=
false
DEBUG_URL
=
"http://test.mints-id.com/map-api/"
DEBUG_URL
=
"http://test.mints-id.com/map-api/"
RELEASE_URL
=
"https://api.mints-id.com/gc-api/"
#RELEASE_URL="https://api.mints-id.com/map-api/"
RELEASE_URL
=
"http://test.mints-id.com/map-api/"
RELEASE_KEY_PASSWORD
=
mints.street
RELEASE_KEY_PASSWORD
=
mints.street
RELEASE_KEY_ALIAS
=
mints_street
RELEASE_KEY_ALIAS
=
mints_street
...
...
mvvmhabit/build.gradle
View file @
a6fac0d4
...
@@ -70,7 +70,6 @@ dependencies {
...
@@ -70,7 +70,6 @@ dependencies {
//Google LiveData和ViewModel组件
//Google LiveData和ViewModel组件
api
rootProject
.
ext
.
dependencies
[
"lifecycle-extensions"
]
api
rootProject
.
ext
.
dependencies
[
"lifecycle-extensions"
]
kapt
rootProject
.
ext
.
dependencies
[
"lifecycle-compiler"
]
kapt
rootProject
.
ext
.
dependencies
[
"lifecycle-compiler"
]
api
"androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
//api "com.jeme:gif:1.0.5@aar"
//api "com.jeme:gif:1.0.5@aar"
//使用aar库引用
//使用aar库引用
...
...
mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/ApiDisposableObserver.java
View file @
a6fac0d4
package
me
.
goldze
.
mvvmhabit
.
http
;
//package me.goldze.mvvmhabit.http;
//
//
import
io.reactivex.observers.DisposableObserver
;
//import io.reactivex.observers.DisposableObserver;
import
me.goldze.mvvmhabit.base.AppManager
;
//import me.goldze.mvvmhabit.base.AppManager;
import
me.goldze.mvvmhabit.utils.KLog
;
//import me.goldze.mvvmhabit.utils.KLog;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
//import me.goldze.mvvmhabit.utils.ToastUtils;
import
me.goldze.mvvmhabit.utils.Utils
;
//import me.goldze.mvvmhabit.utils.Utils;
//
/**
///**
* Created by goldze on 2017/5/10.
// * Created by goldze on 2017/5/10.
* 统一的Code封装处理。该类仅供参考,实际业务逻辑, 根据需求来定义,
// * 统一的Code封装处理。该类仅供参考,实际业务逻辑, 根据需求来定义,
*/
// */
//
public
abstract
class
ApiDisposableObserver
<
T
>
extends
DisposableObserver
<
T
>
{
//public abstract class ApiDisposableObserver<T> extends DisposableObserver<T> {
public
abstract
void
onResult
(
T
t
);
// public abstract void onResult(T t);
//
@Override
// @Override
public
void
onComplete
()
{
// public void onComplete() {
//
}
// }
//
@Override
// @Override
public
void
onError
(
Throwable
e
)
{
// public void onError(Throwable e) {
e
.
printStackTrace
();
// e.printStackTrace();
KLog
.
e
(
e
.
getMessage
());
// KLog.e(e.getMessage());
if
(
e
instanceof
ResponseThrowable
)
{
// if (e instanceof ResponseThrowable) {
ResponseThrowable
rError
=
(
ResponseThrowable
)
e
;
// ResponseThrowable rError = (ResponseThrowable) e;
ToastUtils
.
showShort
(
rError
.
getMessage
());
// ToastUtils.showShort(rError.getMessage());
return
;
// return;
}
// }
//其他全部甩锅网络异常
// //其他全部甩锅网络异常
ToastUtils
.
showShort
(
"网络异常"
);
// ToastUtils.showShort("网络异常");
}
// }
//
@Override
// @Override
public
void
onStart
()
{
// public void onStart() {
super
.
onStart
();
// super.onStart();
ToastUtils
.
showShort
(
"http is start"
);
// ToastUtils.showShort("http is start");
// if NetworkAvailable no ! must to call onCompleted
// // if NetworkAvailable no ! must to call onCompleted
if
(!
NetworkUtil
.
isNetworkAvailable
(
Utils
.
getContext
()))
{
// if (!NetworkUtil.isNetworkAvailable(Utils.getContext())) {
ToastUtils
.
showShort
(
"无网络,读取缓存数据"
);
// ToastUtils.showShort("无网络,读取缓存数据");
onComplete
();
// onComplete();
}
// }
}
// }
//
@Override
// @Override
public
void
onNext
(
Object
o
)
{
// public void onNext(Object o) {
BaseResponse
baseResponse
=
(
BaseResponse
)
o
;
// BaseResponse baseResponse = (BaseResponse) o;
switch
(
baseResponse
.
getstatus
())
{
// switch (baseResponse.getstatus()) {
case
CodeRule
.
CODE_200
:
// case CodeRule.CODE_200:
//请求成功, 正确的操作方式
// //请求成功, 正确的操作方式
onResult
((
T
)
baseResponse
.
getResult
());
// onResult((T) baseResponse.getResult());
break
;
// break;
case
CodeRule
.
CODE_220
:
// case CodeRule.CODE_220:
// 请求成功, 正确的操作方式, 并消息提示
// // 请求成功, 正确的操作方式, 并消息提示
onResult
((
T
)
baseResponse
.
getResult
());
// onResult((T) baseResponse.getResult());
break
;
// break;
case
CodeRule
.
CODE_300
:
// case CodeRule.CODE_300:
//请求失败,不打印Message
// //请求失败,不打印Message
KLog
.
e
(
"请求失败"
);
// KLog.e("请求失败");
ToastUtils
.
showShort
(
"错误代码:"
,
baseResponse
.
getstatus
());
// ToastUtils.showShort("错误代码:", baseResponse.getstatus());
break
;
// break;
case
CodeRule
.
CODE_330
:
// case CodeRule.CODE_330:
//请求失败,打印Message
// //请求失败,打印Message
ToastUtils
.
showShort
(
baseResponse
.
getMessage
());
// ToastUtils.showShort(baseResponse.getMessage());
break
;
// break;
case
CodeRule
.
CODE_500
:
// case CodeRule.CODE_500:
//服务器内部异常
// //服务器内部异常
ToastUtils
.
showShort
(
"错误代码:"
,
baseResponse
.
getstatus
());
// ToastUtils.showShort("错误代码:", baseResponse.getstatus());
break
;
// break;
case
CodeRule
.
CODE_503
:
// case CodeRule.CODE_503:
//参数为空
// //参数为空
KLog
.
e
(
"参数为空"
);
// KLog.e("参数为空");
break
;
// break;
case
CodeRule
.
CODE_502
:
// case CodeRule.CODE_502:
//没有数据
// //没有数据
KLog
.
e
(
"没有数据"
);
// KLog.e("没有数据");
break
;
// break;
case
CodeRule
.
CODE_510
:
// case CodeRule.CODE_510:
//无效的Token,提示跳入登录页
// //无效的Token,提示跳入登录页
ToastUtils
.
showShort
(
"token已过期,请重新登录"
);
// ToastUtils.showShort("token已过期,请重新登录");
//关闭所有页面
// //关闭所有页面
AppManager
.
getAppManager
().
finishAllActivity
();
// AppManager.getAppManager().finishAllActivity();
//跳入登录界面
// //跳入登录界面
//*****该类仅供参考,实际业务Code, 根据需求来定义,******//
// //*****该类仅供参考,实际业务Code, 根据需求来定义,******//
break
;
// break;
case
CodeRule
.
CODE_530
:
// case CodeRule.CODE_530:
ToastUtils
.
showShort
(
"请先登录"
);
// ToastUtils.showShort("请先登录");
break
;
// break;
case
CodeRule
.
CODE_551
:
// case CodeRule.CODE_551:
ToastUtils
.
showShort
(
"错误代码:"
,
baseResponse
.
getstatus
());
// ToastUtils.showShort("错误代码:", baseResponse.getstatus());
break
;
// break;
default
:
// default:
ToastUtils
.
showShort
(
"错误代码:"
,
baseResponse
.
getstatus
());
// ToastUtils.showShort("错误代码:", baseResponse.getstatus());
break
;
// break;
}
// }
}
// }
//
public
static
final
class
CodeRule
{
// public static final class CodeRule {
//请求成功, 正确的操作方式
// //请求成功, 正确的操作方式
static
final
int
CODE_200
=
200
;
// static final int CODE_200 = 200;
//请求成功, 消息提示
// //请求成功, 消息提示
static
final
int
CODE_220
=
220
;
// static final int CODE_220 = 220;
//请求失败,不打印Message
// //请求失败,不打印Message
static
final
int
CODE_300
=
300
;
// static final int CODE_300 = 300;
//请求失败,打印Message
// //请求失败,打印Message
static
final
int
CODE_330
=
330
;
// static final int CODE_330 = 330;
//服务器内部异常
// //服务器内部异常
static
final
int
CODE_500
=
500
;
// static final int CODE_500 = 500;
//参数为空
// //参数为空
static
final
int
CODE_503
=
503
;
// static final int CODE_503 = 503;
//没有数据
// //没有数据
static
final
int
CODE_502
=
502
;
// static final int CODE_502 = 502;
//无效的Token
// //无效的Token
static
final
int
CODE_510
=
510
;
// static final int CODE_510 = 510;
//未登录
// //未登录
static
final
int
CODE_530
=
530
;
// static final int CODE_530 = 530;
//请求的操作异常终止:未知的页面类型
// //请求的操作异常终止:未知的页面类型
static
final
int
CODE_551
=
551
;
// static final int CODE_551 = 551;
}
// }
}
//}
\ No newline at end of file
\ No newline at end of file
mvvmhabit/src/main/java/me/goldze/mvvmhabit/http/BaseArrayResponse.java
View file @
a6fac0d4
package
me
.
goldze
.
mvvmhabit
.
http
;
//
package me.goldze.mvvmhabit.http;
//
import
java.util.List
;
//
import java.util.List;
//
/**
/
//
**
* Created by goldze on 2017/5/10.
//
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
//
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
//
*/
public
class
BaseArrayResponse
<
T
>
extends
BaseResponse
<
List
<
T
>>{
//
public class BaseArrayResponse<T> extends BaseResponse<List<T>>{
//
//
@Override
//
@Override
public
List
<
T
>
getResult
()
{
//
public List<T> getResult() {
return
result
;
//
return result;
}
//
}
//
@Override
//
@Override
public
void
setResult
(
List
<
T
>
result
)
{
//
public void setResult(List<T> result) {
this
.
result
=
result
;
//
this.result = result;
}
//
}
//
}
//
}
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