Commit a6fac0d4 authored by mengcuiguang2's avatar mengcuiguang2

解决冲突

parents bd1e5224 99259dea
......@@ -12,6 +12,8 @@
<uses-permission android:name="android.permission.INTERNET" /> <!-- 调用相机,用于实现扫描二维码,预览个性化地图编辑器生成的个性化地图样式(开发者实际开发中地图SDK不需要该权限) -->
<uses-permission android:name="android.permission.CAMERA" /> <!-- 获取手机状态信息 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- android10以后 后台运行位置 -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<application
android:name=".AppApplication"
......@@ -50,9 +52,10 @@
<meta-data
android:name="Mob-AppSecret"
android:value="${SHARE_SECRET}" />
<!--百度地图开放平台 -->
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="SD6luBGzUFSVEZ3n9Xjk3xTsvDFmuRCi" /> <!-- 百度地图开放平台 -->
android:value="SD6luBGzUFSVEZ3n9Xjk3xTsvDFmuRCi" />
<!-- 百度地图开放平台 service -->
<service
android:name="com.baidu.location.f"
......
package com.mints.street.api
import com.google.gson.JsonObject
import com.mints.street.bean.AwardBean
import com.mints.street.bean.BaseResponse
import com.mints.street.bean.UserBean
import com.mints.street.bean.VipBean
import com.mints.street.netwrok.common.HttpManager
import io.reactivex.Observable
import me.goldze.mvvmhabit.http.BaseResponse
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.POST
......
package com.fry.base.bean
package com.mints.street.bean
import android.annotation.SuppressLint
import android.os.Parcelable
......
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
package me.goldze.mvvmhabit.http;
package com.mints.street.bean;
import androidx.annotation.Nullable;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
/**
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
public class BaseResponse<T> {
public class BaseResponse<T> implements Serializable {
private int status;
private String message;
......
......@@ -12,13 +12,12 @@ class UserBean : Serializable {
val consumer: ConsumerBean? = null
inner class ConsumerBean : Serializable {
val head: String = ""
val openid: String = ""
val nickname: String = ""
val mobile: String = ""
val real_name: String = ""
val idcode: String = ""
val pk_id // 用户id
: Long = 0
val isForever: Boolean = false
val expireTime : Long = 0
val pk_id : Long = 0
}
}
......@@ -12,4 +12,8 @@ object Constant {
*/
const val MINTS_PKG_NAME = "com.mints.street"
/**
* 第一次打开权限页面
*/
const val FIRST_OPEN_PERMISSIONS = "first_open_permissions"
}
......@@ -2,19 +2,14 @@ package com.mints.street.login
import android.app.Application
import androidx.lifecycle.MutableLiveData
import android.text.TextUtils
import androidx.lifecycle.viewModelScope
import com.mints.street.bean.AwardBean
import com.mints.street.bean.BaseResponse
import com.mints.street.bean.UserBean
import com.mints.street.common.DeviceInfo
import com.mints.street.manager.UserManager
import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.utils.DeviceUuidFactory
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.http.BaseResponse
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.ToastUtils
import java.util.HashMap
......@@ -55,6 +50,7 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
}
fun login(mobile: String, smsCode: String) {
// showDialog()
val vo = HashMap<String, Any>()
vo["mobile"] = mobile
vo["smsCode"] = smsCode
......@@ -64,12 +60,16 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
object : HttpSubscribeImpl<BaseResponse<UserBean>>(
this@LoginViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<UserBean>) {
data.value = response.message
KLog.e("login", response.result.toString())
// ToastUtils.showShort("登录信息="+response.result.ConsumerBean().idcode)
//展示业务逻辑
UserManager.INSTANCE.saveUserInfo(response.result)
// dismissDialog()
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) {
......@@ -84,35 +84,28 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
* 提交设备信息
*/
fun saveTerminalInfo() {
viewModelScope.launch(Dispatchers.IO) {
val appInfoMap = deviceInfo.getAppInfoMap()
launch(Dispatchers.Main) {
val vo = hashMapOf<String, Any>()
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
val vo = hashMapOf<String, Any>()
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
// if (!TextUtils.isEmpty(App.OAID)) {
// vo["oaid"] = App.OAID
// }
vo["os"] = "android"
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["appPkgList"] = appInfoMap
ApiModel.saveTerminalInfo(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
this@LoginViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<Any>) {
KLog.e("saveTerminalInfo", response.result.toString())
}
})
}
}
vo["os"] = "android"
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
ApiModel.saveTerminalInfo(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
this@LoginViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<Any>) {
KLog.e("saveTerminalInfo", response.result.toString())
}
})
}
}
\ No newline at end of file
......@@ -134,6 +134,10 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
binding.imageOut.setOnClickListener {
mBaiduMap?.setMapStatus(MapStatusUpdateFactory.zoomOut())
}
//历史影像
binding.imageMapHistory.setOnClickListener {
startActivity(HistoricalimageActivity::class.java)
}
mRecommendStopSearch = RecommendStopSearch.newInstance()
mRecommendStopSearch?.setOnGetRecommendStopResultListener { result ->
if (result != null) {
......
......@@ -93,7 +93,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickL
when (v?.id) {
R.id.aboutus -> {
startActivity(AboutusActivity::class.java)
// startActivity(HistoricalimageActivity::class.java)
// startActivity(PermissionsActivity::class.java)
}
R.id.moresettings -> {
startActivity(MoresettingsActivity::class.java)
......
package com.mints.street.main.my
import android.Manifest
import android.os.Build
import android.os.Bundle
import android.view.View
import com.fry.base.base.BaseActivity
import com.github.iielse.switchbutton.SwitchView
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.ActivityMoresettingsBinding
import com.mints.street.common.Constant
import com.mints.street.databinding.ActivityPermissionsBinding
import com.mints.street.main.MainActivity
import com.tbruyelle.rxpermissions2.RxPermissions
import com.tencent.mmkv.MMKV
import kotlinx.android.synthetic.main.activity_permissions.*
import me.goldze.mvvmhabit.utils.ToastUtils
/**
* 描述:权限授权
* 作者:孟崔广
* 时间:2021/7/14 15:51
*/
class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, PermissionsViewModel>(), View.OnClickListener {
class PermissionsActivity : BaseActivity<ActivityPermissionsBinding, PermissionsViewModel>() {
override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?)= R.layout.activity_permissions
override fun initData() {
super.initData()
initView()
initListener()
}
private fun initListener() {
btnPermissionsDont.setOnClickListener(this)
btnPermissionsNext.setOnClickListener(this)
}
private fun initView() {
sv_positioning.setOnStateChangedListener(object : SwitchView.OnStateChangedListener {
svPosition.setOnStateChangedListener(object : SwitchView.OnStateChangedListener {
override fun toggleToOn(view: SwitchView?) {
svPosition?.isOpened = true
}
override fun toggleToOff(view: SwitchView?) {
svPosition?.isOpened = false
}
})
svStrong.setOnStateChangedListener(object : SwitchView.OnStateChangedListener {
override fun toggleToOn(view: SwitchView?) {
svStrong?.isOpened = true
}
override fun toggleToOff(view: SwitchView?) {
svStrong?.isOpened = false
}
})
svReadmsg.setOnStateChangedListener(object : SwitchView.OnStateChangedListener {
override fun toggleToOn(view: SwitchView?) {
sv_positioning?.isOpened = true
svReadmsg?.isOpened = true
}
override fun toggleToOff(view: SwitchView?) {
sv_positioning?.isOpened = false
svReadmsg?.isOpened = false
}
})
}
override fun onClick(v: View?) {
when(v?.id){
R.id.btnPermissionsDont -> ToastUtils.showLong("请您同意授权,否则将无法使用APP功能")
R.id.btnPermissionsNext->{
val rxPermissions = RxPermissions(this)
rxPermissions.request(
if(svPosition.isOpened&&Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else "",
if(svPosition.isOpened) Manifest.permission.ACCESS_FINE_LOCATION else "",
if(svStrong.isOpened) Manifest.permission.WRITE_EXTERNAL_STORAGE else "",
if(svReadmsg.isOpened) Manifest.permission.READ_PHONE_STATE else ""
)
.subscribe {
startActivityThenKill(MainActivity::class.java)
}
MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS).encode(Constant.FIRST_OPEN_PERMISSIONS, true)
}
}
}
}
\ No newline at end of file
......@@ -33,11 +33,6 @@ class UserManager {
*/
private const val MOBILE = "mobile"
/**
* 姓名
*/
private const val REAL_NAME = "realName"
/**
* 微信名称
*/
......@@ -53,6 +48,16 @@ class UserManager {
*/
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) {
UserManager()
}
......@@ -78,16 +83,18 @@ class UserManager {
val mobile: String? = user.mobile
val openid: String? = user.openid
MMKV.mmkvWithID(USER_ID).encode(USER_ID, user.pk_id.toString())
MMKV.mmkvWithID(CODE_ID).encode(CODE_ID, user.idcode.toString())
MMKV.mmkvWithID(CODE_ID).encode(CODE_ID, user.idcode)
if (!TextUtils.isEmpty(mobile)) {
MMKV.mmkvWithID(MOBILE).encode(MOBILE, mobile)
}
MMKV.mmkvWithID(WX_NAME).encode(WX_NAME, user.nickname.toString())
MMKV.mmkvWithID(WX_HEADER).encode(WX_HEADER, user.head)
if (!TextUtils.isEmpty(user.nickname)) {
MMKV.mmkvWithID(WX_NAME).encode(WX_NAME, user.nickname)
}
MMKV.mmkvWithID(IS_FOREVER).encode(IS_FOREVER, user.isForever)
MMKV.mmkvWithID(EXPIRETIME).encode(EXPIRETIME, user.expireTime)
if (!TextUtils.isEmpty(openid)) {
MMKV.mmkvWithID(WX_OPENID).encode(WX_OPENID, openid)
}
MMKV.mmkvWithID(REAL_NAME).encode(REAL_NAME, user.real_name)
}
}
......@@ -133,23 +140,6 @@ class UserManager {
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 {
val kv = MMKV.mmkvWithID(WX_NAME)
......@@ -166,34 +156,26 @@ class UserManager {
return kv.decodeString(WX_OPENID, "")
}
fun setWxName(wxName: String?) {
val kv = MMKV.mmkvWithID(WX_NAME)
kv.encode(WX_NAME, wxName)
fun getIsforever(): Boolean {
val kv = MMKV.mmkvWithID(IS_FOREVER)
return kv.decodeBool(IS_FOREVER, false)
}
fun setWxHeader(wxHeader: String?) {
val kv = MMKV.mmkvWithID(WX_HEADER)
kv.encode(WX_HEADER, wxHeader)
fun getExpiretime(): Long {
val kv = MMKV.mmkvWithID(EXPIRETIME)
return kv.decodeLong(EXPIRETIME, 0)
}
/**
* mobile
*
* @param mobile
*/
fun setMobile(mobile: String?) {
val kv = MMKV.mmkvWithID(MOBILE)
kv.encode(MOBILE, mobile)
}
fun userLogout() {
MMKV.mmkvWithID(USER_ID).remove(USER_ID)
MMKV.mmkvWithID(CODE_ID).remove(CODE_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_NAME).remove(WX_NAME)
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
package com.mints.street.model
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.netwrok.common.HttpManager
import com.trello.rxlifecycle2.LifecycleProvider
import io.reactivex.Observable
import me.goldze.mvvmhabit.http.BaseResponse
import retrofit2.Response
/**
......
package com.mints.street.netwrok.base
import com.mints.street.bean.BaseResponse
import me.goldze.mvvmhabit._enum.ViewStatus
import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.http.BaseResponse
import me.goldze.mvvmhabit.http.ExceptionHandle
import me.goldze.mvvmhabit.http.ResponseThrowable
import me.goldze.mvvmhabit.utils.ToastUtils
......
package com.mints.street.netwrok.base;
import com.mints.street.bean.BaseResponse;
import io.reactivex.disposables.Disposable;
import me.goldze.mvvmhabit.http.BaseResponse;
import me.goldze.mvvmhabit.http.ResponseThrowable;
import retrofit2.Response;
......
package com.mints.street.netwrok.base
import com.mints.street.bean.BaseResponse
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.http.BaseResponse
import retrofit2.Response
/**
......
......@@ -31,7 +31,7 @@ import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
/**
* Created by jeme on 2019/1/31
* Created by mcg
*/
public class RetrofitClient {
......@@ -50,38 +50,10 @@ public class RetrofitClient {
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder()
.cookieJar(new CookieJarImpl(new PersistentCookieStore(mContext)))
// .cache(cache)
// .addInterceptor()
// .addInterceptor(new CacheInterceptor(mContext))
// .sslSocketFactory(sslParams.sSLSocketFactory, sslParams.trustManager)
.connectTimeout(mHttpConfig.getTimeOut(), TimeUnit.SECONDS)
.writeTimeout(mHttpConfig.getTimeOut(), TimeUnit.SECONDS)
.readTimeout(mHttpConfig.getTimeOut(), 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) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
......@@ -122,25 +94,4 @@ public class RetrofitClient {
}
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;
}
}
package com.mints.street.netwrok.common;
import com.google.gson.Gson;
import com.mints.street.bean.BaseResponse;
import com.mints.street.manager.UserManager;
import java.io.IOException;
......@@ -12,7 +13,6 @@ import java.lang.reflect.Type;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import me.goldze.mvvmhabit.http.BaseResponse;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
......
package com.mints.street.netwrok.common;
import com.mints.street.bean.BaseResponse;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.functions.Function;
import me.goldze.mvvmhabit.http.BaseResponse;
import retrofit2.Response;
/**
......
......@@ -3,10 +3,10 @@ package com.mints.street.netwrok.common;
import android.annotation.SuppressLint;
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.IHttpResponseListener;
import com.mints.street.netwrok.base.RetrofitClient;
import com.mints.street.utils.encry.AESUtils;
import com.trello.rxlifecycle2.LifecycleProvider;
import io.reactivex.Observable;
......@@ -17,7 +17,6 @@ import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import me.goldze.mvvmhabit.http.BaseResponse;
import me.goldze.mvvmhabit.http.ResponseThrowable;
import me.goldze.mvvmhabit.utils.RxUtils;
import retrofit2.Response;
......@@ -79,60 +78,4 @@ public class HttpManager {
.compose(RxUtils.exceptionTransformer())
.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();
}, () -> {
});
}
}
......@@ -3,10 +3,10 @@ package com.mints.street.netwrok.common
import android.text.TextUtils
import android.util.Log
import com.bytedance.hume.readapk.HumeSDK
import com.fry.base.bean.AppRequest
import com.google.gson.Gson
import com.mints.street.AppApplication
import com.mints.street.BuildConfig
import com.mints.street.bean.AppRequest
import com.mints.street.manager.UserManager
import com.mints.street.utils.CommonUtils
import com.mints.street.utils.encry.AESUtils
......
......@@ -12,10 +12,14 @@ import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback
import com.fry.base.base.BaseActivity
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.common.Constant
import com.mints.street.common.DeviceInfo
import com.mints.street.databinding.ActivitySplashBinding
import com.mints.street.main.MainActivity
import com.mints.street.main.my.PermissionsActivity
import com.mints.street.manager.CsjGroMoreManager
import com.mints.street.manager.UserManager
import com.tencent.mmkv.MMKV
/**
* 描述:gromore开屏页
......@@ -163,7 +167,11 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
* 跳转到主页面
*/
private fun goToMainActivity() {
// startActivityThenKill(MainActivity::class.java)
startActivityThenKill(GuideActivity::class.java)
if(MMKV.mmkvWithID(Constant.FIRST_OPEN_PERMISSIONS).decodeBool(Constant.FIRST_OPEN_PERMISSIONS, false)){
// 非新用户
startActivityThenKill(MainActivity::class.java)
}else{
startActivityThenKill(PermissionsActivity::class.java)
}
}
}
\ No newline at end of file
......@@ -2,6 +2,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#2196F3" />
<corners android:radius="21dp" />
<corners android:radius="30dp" />
</shape>
\ No newline at end of file
......@@ -7,6 +7,6 @@
android:color="#74000000"
/>
<solid android:color="#ffffffff" />
<corners android:radius="21dp" />
<corners android:radius="30dp" />
</shape>
\ No newline at end of file
......@@ -21,7 +21,8 @@ android.enableJetifier=true
isBuildModule=false
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_ALIAS=mints_street
......
......@@ -70,7 +70,6 @@ dependencies {
//Google LiveData和ViewModel组件
api rootProject.ext.dependencies["lifecycle-extensions"]
kapt rootProject.ext.dependencies["lifecycle-compiler"]
api "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
//api "com.jeme:gif:1.0.5@aar"
//使用aar库引用
......
package me.goldze.mvvmhabit.http;
import io.reactivex.observers.DisposableObserver;
import me.goldze.mvvmhabit.base.AppManager;
import me.goldze.mvvmhabit.utils.KLog;
import me.goldze.mvvmhabit.utils.ToastUtils;
import me.goldze.mvvmhabit.utils.Utils;
/**
* Created by goldze on 2017/5/10.
* 统一的Code封装处理。该类仅供参考,实际业务逻辑, 根据需求来定义,
*/
public abstract class ApiDisposableObserver<T> extends DisposableObserver<T> {
public abstract void onResult(T t);
@Override
public void onComplete() {
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
KLog.e(e.getMessage());
if (e instanceof ResponseThrowable) {
ResponseThrowable rError = (ResponseThrowable) e;
ToastUtils.showShort(rError.getMessage());
return;
}
//其他全部甩锅网络异常
ToastUtils.showShort("网络异常");
}
@Override
public void onStart() {
super.onStart();
ToastUtils.showShort("http is start");
// if NetworkAvailable no ! must to call onCompleted
if (!NetworkUtil.isNetworkAvailable(Utils.getContext())) {
ToastUtils.showShort("无网络,读取缓存数据");
onComplete();
}
}
@Override
public void onNext(Object o) {
BaseResponse baseResponse = (BaseResponse) o;
switch (baseResponse.getstatus()) {
case CodeRule.CODE_200:
//请求成功, 正确的操作方式
onResult((T) baseResponse.getResult());
break;
case CodeRule.CODE_220:
// 请求成功, 正确的操作方式, 并消息提示
onResult((T) baseResponse.getResult());
break;
case CodeRule.CODE_300:
//请求失败,不打印Message
KLog.e("请求失败");
ToastUtils.showShort("错误代码:", baseResponse.getstatus());
break;
case CodeRule.CODE_330:
//请求失败,打印Message
ToastUtils.showShort(baseResponse.getMessage());
break;
case CodeRule.CODE_500:
//服务器内部异常
ToastUtils.showShort("错误代码:", baseResponse.getstatus());
break;
case CodeRule.CODE_503:
//参数为空
KLog.e("参数为空");
break;
case CodeRule.CODE_502:
//没有数据
KLog.e("没有数据");
break;
case CodeRule.CODE_510:
//无效的Token,提示跳入登录页
ToastUtils.showShort("token已过期,请重新登录");
//关闭所有页面
AppManager.getAppManager().finishAllActivity();
//跳入登录界面
//*****该类仅供参考,实际业务Code, 根据需求来定义,******//
break;
case CodeRule.CODE_530:
ToastUtils.showShort("请先登录");
break;
case CodeRule.CODE_551:
ToastUtils.showShort("错误代码:", baseResponse.getstatus());
break;
default:
ToastUtils.showShort("错误代码:", baseResponse.getstatus());
break;
}
}
public static final class CodeRule {
//请求成功, 正确的操作方式
static final int CODE_200 = 200;
//请求成功, 消息提示
static final int CODE_220 = 220;
//请求失败,不打印Message
static final int CODE_300 = 300;
//请求失败,打印Message
static final int CODE_330 = 330;
//服务器内部异常
static final int CODE_500 = 500;
//参数为空
static final int CODE_503 = 503;
//没有数据
static final int CODE_502 = 502;
//无效的Token
static final int CODE_510 = 510;
//未登录
static final int CODE_530 = 530;
//请求的操作异常终止:未知的页面类型
static final int CODE_551 = 551;
}
}
\ No newline at end of file
//package me.goldze.mvvmhabit.http;
//
//
//import io.reactivex.observers.DisposableObserver;
//import me.goldze.mvvmhabit.base.AppManager;
//import me.goldze.mvvmhabit.utils.KLog;
//import me.goldze.mvvmhabit.utils.ToastUtils;
//import me.goldze.mvvmhabit.utils.Utils;
//
///**
// * Created by goldze on 2017/5/10.
// * 统一的Code封装处理。该类仅供参考,实际业务逻辑, 根据需求来定义,
// */
//
//public abstract class ApiDisposableObserver<T> extends DisposableObserver<T> {
// public abstract void onResult(T t);
//
// @Override
// public void onComplete() {
//
// }
//
// @Override
// public void onError(Throwable e) {
// e.printStackTrace();
// KLog.e(e.getMessage());
// if (e instanceof ResponseThrowable) {
// ResponseThrowable rError = (ResponseThrowable) e;
// ToastUtils.showShort(rError.getMessage());
// return;
// }
// //其他全部甩锅网络异常
// ToastUtils.showShort("网络异常");
// }
//
// @Override
// public void onStart() {
// super.onStart();
// ToastUtils.showShort("http is start");
// // if NetworkAvailable no ! must to call onCompleted
// if (!NetworkUtil.isNetworkAvailable(Utils.getContext())) {
// ToastUtils.showShort("无网络,读取缓存数据");
// onComplete();
// }
// }
//
// @Override
// public void onNext(Object o) {
// BaseResponse baseResponse = (BaseResponse) o;
// switch (baseResponse.getstatus()) {
// case CodeRule.CODE_200:
// //请求成功, 正确的操作方式
// onResult((T) baseResponse.getResult());
// break;
// case CodeRule.CODE_220:
// // 请求成功, 正确的操作方式, 并消息提示
// onResult((T) baseResponse.getResult());
// break;
// case CodeRule.CODE_300:
// //请求失败,不打印Message
// KLog.e("请求失败");
// ToastUtils.showShort("错误代码:", baseResponse.getstatus());
// break;
// case CodeRule.CODE_330:
// //请求失败,打印Message
// ToastUtils.showShort(baseResponse.getMessage());
// break;
// case CodeRule.CODE_500:
// //服务器内部异常
// ToastUtils.showShort("错误代码:", baseResponse.getstatus());
// break;
// case CodeRule.CODE_503:
// //参数为空
// KLog.e("参数为空");
// break;
// case CodeRule.CODE_502:
// //没有数据
// KLog.e("没有数据");
// break;
// case CodeRule.CODE_510:
// //无效的Token,提示跳入登录页
// ToastUtils.showShort("token已过期,请重新登录");
// //关闭所有页面
// AppManager.getAppManager().finishAllActivity();
// //跳入登录界面
// //*****该类仅供参考,实际业务Code, 根据需求来定义,******//
// break;
// case CodeRule.CODE_530:
// ToastUtils.showShort("请先登录");
// break;
// case CodeRule.CODE_551:
// ToastUtils.showShort("错误代码:", baseResponse.getstatus());
// break;
// default:
// ToastUtils.showShort("错误代码:", baseResponse.getstatus());
// break;
// }
// }
//
// public static final class CodeRule {
// //请求成功, 正确的操作方式
// static final int CODE_200 = 200;
// //请求成功, 消息提示
// static final int CODE_220 = 220;
// //请求失败,不打印Message
// static final int CODE_300 = 300;
// //请求失败,打印Message
// static final int CODE_330 = 330;
// //服务器内部异常
// static final int CODE_500 = 500;
// //参数为空
// static final int CODE_503 = 503;
// //没有数据
// static final int CODE_502 = 502;
// //无效的Token
// static final int CODE_510 = 510;
// //未登录
// static final int CODE_530 = 530;
// //请求的操作异常终止:未知的页面类型
// static final int CODE_551 = 551;
// }
//}
\ No newline at end of file
package me.goldze.mvvmhabit.http;
import java.util.List;
/**
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
public class BaseArrayResponse<T> extends BaseResponse<List<T>>{
@Override
public List<T> getResult() {
return result;
}
@Override
public void setResult(List<T> result) {
this.result = result;
}
}
//package me.goldze.mvvmhabit.http;
//
//import java.util.List;
//
///**
// * Created by goldze on 2017/5/10.
// * 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
// */
//public class BaseArrayResponse<T> extends BaseResponse<List<T>>{
//
//
// @Override
// public List<T> getResult() {
// return result;
// }
//
// @Override
// public void setResult(List<T> result) {
// this.result = result;
// }
//
//}
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