Commit fbed7c64 authored by fengruiyu's avatar fengruiyu

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

parent 2ebe1a42
...@@ -205,6 +205,11 @@ ...@@ -205,6 +205,11 @@
#如果引用了v4或者v7包 #如果引用了v4或者v7包
-dontwarn android.support.** -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解析包的,直接添加下面这几行就能成功混淆,不然会报错。
#gson #gson
......
...@@ -69,14 +69,14 @@ ...@@ -69,14 +69,14 @@
<activity android:name="com.mints.street.splash.SplashActivity" <activity android:name="com.mints.street.splash.SplashActivity"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:theme="@style/NormalSplash"> android:theme="@style/NormalSplash">
</activity>
<activity android:name="com.mints.street.login.LoginActivity">
<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 android:name="com.mints.street.login.LoginActivity">
</activity> </activity>
<activity android:name="com.mints.street.main.MainActivity" <activity android:name="com.mints.street.main.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
......
...@@ -2,11 +2,13 @@ package com.mints.street.login ...@@ -2,11 +2,13 @@ package com.mints.street.login
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.lifecycle.Observer
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.databinding.ActivityLoginBinding import com.mints.street.databinding.ActivityLoginBinding
import kotlinx.android.synthetic.main.include_header.* import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.ToastUtils
/** /**
* Created by 冯瑞雨 on 2021/7/2. * Created by 冯瑞雨 on 2021/7/2.
...@@ -31,6 +33,13 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View ...@@ -31,6 +33,13 @@ class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View
iv_left_icon.setOnClickListener(this) iv_left_icon.setOnClickListener(this)
} }
override fun initViewObservable() {
super.initViewObservable()
viewModel.data.observe(this, Observer<String>{
ToastUtils.showLong("初始化成功")
})
}
override fun onClick(v: View?) { override fun onClick(v: View?) {
when (v?.id) { when (v?.id) {
R.id.iv_left_icon -> { R.id.iv_left_icon -> {
......
package com.mints.street.login package com.mints.street.login
import android.app.Application import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.fry.base.basenetwork.HttpSubscribeImpl import com.fry.base.basenetwork.HttpSubscribeImpl
import com.mints.street.bean.AwardBean import com.mints.street.bean.AwardBean
import com.mints.street.model.ApiModel import com.mints.street.model.ApiModel
...@@ -11,22 +12,27 @@ import me.goldze.mvvmhabit.utils.KLog ...@@ -11,22 +12,27 @@ import me.goldze.mvvmhabit.utils.KLog
/** /**
* Created by 冯瑞雨 on 2021/7/2. * Created by 冯瑞雨 on 2021/7/2.
*/ */
class LoginViewModel(application:Application):BaseViewModel(application) { class LoginViewModel(application: Application) : BaseViewModel(application) {
fun login(){ val data :MutableLiveData<String> = MutableLiveData()
// val vo = hashMapOf<String, Any>()
// vo["shumeiId"] = ""
// vo["mobile"] = ""
// vo["smsCode"] = ""
// vo["device"] = ""
fun login() {
ApiModel.coinMsg(lifecycleProvider).safeSubscribe( ApiModel.coinMsg(lifecycleProvider).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<AwardBean>>( object : HttpSubscribeImpl<BaseResponse<AwardBean>>(
this@LoginViewModel,true){ this@LoginViewModel, true
override fun onBusinessSuccess(response: BaseResponse<AwardBean>) { ) {
KLog.e("sfdsdf",response.result.toString()) 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?, ...@@ -47,21 +47,6 @@ abstract class HttpSubscribeImpl<T : BaseResponse<*>>(viewModel: BaseViewModel?,
} }
onFailed(throwable) 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) { override fun onError(e: Throwable) {
......
...@@ -7,13 +7,10 @@ package com.fry.base.config; ...@@ -7,13 +7,10 @@ package com.fry.base.config;
*/ */
public class ModuleLifecycleReflexs { public class ModuleLifecycleReflexs {
private static final String BASE_INIT = "com.jeme.base.base.BaseModuleInit"; private static final String BASE_INIT = "com.fry.base.base.BaseModuleInit";
/***
* 主模块
*/
private static final String MAIN_INIT = "com.qjzn.ddg.main.MainModuleInit";
public static String[] initModuleNames = { 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 { ...@@ -24,7 +24,7 @@ public final class Utils {
/** /**
* 初始化工具类 * 初始化工具类
* *splashLoad
* @param context 上下文 * @param context 上下文
*/ */
public static void init(@NonNull final Context 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