Commit fbed7c64 authored by fengruiyu's avatar fengruiyu

登录页面请求接口回调到本地处理

parent 2ebe1a42
......@@ -205,6 +205,11 @@
#如果引用了v4或者v7包
-dontwarn android.support.**
-keep class com.mints.street.**.bean.**{*;}
-keep class com.mints.street.**._enum.**{*;}
-keep class com.mints.street.**._enum.**{*;}
-keep class * implements com.fry.base.base.IModuleInit
#如果用用到Gson解析包的,直接添加下面这几行就能成功混淆,不然会报错。
#gson
......
......@@ -69,14 +69,14 @@
<activity android:name="com.mints.street.splash.SplashActivity"
android:excludeFromRecents="true"
android:theme="@style/NormalSplash">
</activity>
<activity android:name="com.mints.street.login.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.mints.street.login.LoginActivity">
</activity>
<activity android:name="com.mints.street.main.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
......
......@@ -2,11 +2,13 @@ package com.mints.street.login
import android.os.Bundle
import android.view.View
import androidx.lifecycle.Observer
import com.fry.base.base.BaseActivity
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.ActivityLoginBinding
import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.ToastUtils
/**
* Created by 冯瑞雨 on 2021/7/2.
......@@ -31,6 +33,13 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
iv_left_icon.setOnClickListener(this)
}
override fun initViewObservable() {
super.initViewObservable()
viewModel.data.observe(this, Observer<String>{
ToastUtils.showLong("初始化成功")
})
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_left_icon -> {
......
package com.mints.street.login
import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.fry.base.basenetwork.HttpSubscribeImpl
import com.mints.street.bean.AwardBean
import com.mints.street.model.ApiModel
......@@ -11,22 +12,27 @@ import me.goldze.mvvmhabit.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class LoginViewModel(application:Application):BaseViewModel(application) {
class LoginViewModel(application: Application) : BaseViewModel(application) {
fun login(){
// val vo = hashMapOf<String, Any>()
// vo["shumeiId"] = ""
// vo["mobile"] = ""
// vo["smsCode"] = ""
// vo["device"] = ""
val data :MutableLiveData<String> = MutableLiveData()
fun login() {
ApiModel.coinMsg(lifecycleProvider).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<AwardBean>>(
this@LoginViewModel,true){
override fun onBusinessSuccess(response: BaseResponse<AwardBean>) {
KLog.e("sfdsdf",response.result.toString())
}
object : HttpSubscribeImpl<BaseResponse<AwardBean>>(
this@LoginViewModel, true
) {
override fun onBusinessSuccess(response: BaseResponse<AwardBean>) {
KLog.e("sfdsdf", response.result.toString())
}
})
override fun onError(e: Throwable) {
KLog.e("LoginViewModel", "登录错误")
}
override fun onComplete() {
super.onComplete()
}
})
}
}
\ No newline at end of file
......@@ -47,21 +47,6 @@ abstract class HttpSubscribeImpl<T : BaseResponse<*>>(viewModel: BaseViewModel?,
}
onFailed(throwable)
}
/* if(t.code() == 200){
if(t.isSuccessful){
if (t.body()?.isOk == true) {
onBusinessSuccess(t.body()!!)
} else {
onBusinessFail(t.body())
}
}
}else{
if (needToast) {
ToastUtils.showShort(t.message())
}
viewModel?.viewSwitch(ViewStatus.NONETWORK)
}*/
}
override fun onError(e: Throwable) {
......
......@@ -7,13 +7,10 @@ package com.fry.base.config;
*/
public class ModuleLifecycleReflexs {
private static final String BASE_INIT = "com.jeme.base.base.BaseModuleInit";
/***
* 主模块
*/
private static final String MAIN_INIT = "com.qjzn.ddg.main.MainModuleInit";
private static final String BASE_INIT = "com.fry.base.base.BaseModuleInit";
public static String[] initModuleNames = {
BASE_INIT,MAIN_INIT
BASE_INIT
};
}
package com.fry.base.eventbean;
/**
* @author 冯瑞雨
* @date 2019/10/23 16:29
*/
public class DownloadEvent {
/**
* apk 的大小
*/
private long apkSize;
/**
* 下载的进度 百分比
*/
private int apkCurrentProgress;
/**
* 下载当前进度
*/
private long apkSchedule;
public long getApkSize() {
return apkSize;
}
public void setApkSize(long apkSize) {
this.apkSize = apkSize;
}
public int getApkCurrentProgress() {
return apkCurrentProgress;
}
public void setApkCurrentProgress(int apkCurrentProgress) {
this.apkCurrentProgress = apkCurrentProgress;
}
public long getApkSchedule() {
return apkSchedule;
}
public void setApkSchedule(long apkSchedule) {
this.apkSchedule = apkSchedule;
}
public DownloadEvent(long apkSize, int apkCurrentProgress, long apkSchedule) {
this.apkSize = apkSize;
this.apkCurrentProgress = apkCurrentProgress;
this.apkSchedule = apkSchedule;
}
}
......@@ -24,7 +24,7 @@ public final class Utils {
/**
* 初始化工具类
*
*splashLoad
* @param context 上下文
*/
public static void init(@NonNull final Context context) {
......
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