Commit 8fdd3fee by 宁斌

修改模塊名稱

parent 261b3c34

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

/build/
app.iml
proguard-rules.pro
proguard-rules.pro
\ No newline at end of file
ext.mainApp = true //设置为true,表示此module为主app module,一直以application方式编译
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
android {
signingConfigs {
GSAndroidNew {
keyAlias 'keycypos'
keyPassword 'qingkeke'
storeFile file('cyposandroid.keyset')
storePassword 'qingkeke'
}
}
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
applicationId 'com.gingersoft.gsa.cloud'
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
multiDexEnabled true
}
resourcePrefix "user_login"
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
minifyEnabled false
proguardFiles 'proguard.cfg'
signingConfig signingConfigs.GSAndroidNew
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
minifyEnabled false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
signingConfig signingConfigs.GSAndroidNew
}
}
lintOptions {
abortOnError false
}
dataBinding {
enabled = true
}
//修改生成的apk名字
applicationVariants.all { variant ->
variant.outputs.all {
def fileName
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd')
if (variant.buildType.name == 'release') {
fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_正式版_.apk"
} else if (variant.buildType.name == 'Test') {
fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_测试版_.apk"
} else if (variant.buildType.name == 'debug') {
fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_debug_.apk"
}
outputFileName = fileName
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// addComponent 'public-base'
addComponent 'main-module'
addComponent 'download-module'
addComponent 'table-module'
addComponent 'print-module'
addComponent 'other_order_mode'
addComponent 'manager-module'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
implementation rootProject.ext.dependencies["autosize"]
implementation rootProject.ext.dependencies["fastjson"]
}
package com.gingersoft.cloud.gsa.component.order.list;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.gingersoft.cloud.gsa.component.order.list", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.gingersoft.gsa.cloud.login">
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/user_login_name"
android:networkSecurityConfig="@xml/network_android"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:label">
<activity
android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".mvp.ui.activity.mvp.ui.activity.LoginActivity"
android:launchMode="singleTop" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.SwitchServerActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.RecoverPasswordActivity" />
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<meta-data
android:name="design_width_in_dp"
android:value="360"/>
<meta-data
android:name="design_height_in_dp"
android:value="640"/>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.gingersoft.gsa.cloud.login">
<application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/user_login_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.mvp.ui.activity.LoginActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.SwitchServerActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".mvp.ui.activity.mvp.ui.activity.LoginOutActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.RecoverPasswordActivity" />
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<meta-data
android:name="design_width_in_dp"
android:value="360"/>
<meta-data
android:name="design_height_in_dp"
android:value="640"/>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
</manifest>
\ No newline at end of file
package com.gingersoft.gsa.cloud.login;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
public class ComponentLogin implements IComponent {
@Override
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "User.Component.Login";
}
/**
* 组件被调用时的入口
* 要确保每个逻辑分支都会调用到CC.sendCCResult,
* 包括try-catch,if-else,switch-case-default,startActivity
*
* @param cc 组件调用对象,可从此对象中获取相关信息
* @return true:将异步调用CC.sendCCResult(...),用于异步实现相关功能,例如:文件加载、网络请求等
* false:会同步调用CC.sendCCResult(...),即在onCall方法return之前调用,否则将被视为不合法的实现
*/
@Override
public boolean onCall(CC cc) {
String actionName = cc.getActionName();
switch (actionName) {
case "showActivityA":
case "User.Component.Login":
openActivity(cc);
break;
case "getLifecycleFragment":
//demo for provide fragment object to other component
getLifecycleFragment(cc);
break;
case "lifecycleFragment.addText":
lifecycleFragmentDoubleText(cc);
break;
case "getInfo":
getInfo(cc);
break;
case "switchServer":
//切換環境
CCUtil.navigateTo(cc, SwitchServerActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
break;
default:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
//在LocalCCInterceptor中将会返回错误码为-10的CCResult
break;
}
return false;
}
private void lifecycleFragmentDoubleText(CC cc) {
// LifecycleFragment lifecycleFragment = cc.getParamItem("fragment");
// if (lifecycleFragment != null) {
// String text = cc.getParamItem("text", "");
// lifecycleFragment.addText(text);
// CC.sendCCResult(cc.getCallId(), CCResult.success());
// } else {
// CC.sendCCResult(cc.getCallId(), CCResult.error("no fragment params"));
// }
}
private void getLifecycleFragment(CC cc) {
// CC.sendCCResult(cc.getCallId(), CCResult.successWithNoKey(new LifecycleFragment()));
}
private void getInfo(CC cc) {
String userName = "billy";
CC.sendCCResult(cc.getCallId(), CCResult.success("userName", userName));
}
private void openActivity(CC cc) {
CCUtil.navigateTo(cc, LoginActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
}
}
package com.gingersoft.gsa.cloud.login.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.login.di.module.LoginModule;
import com.gingersoft.gsa.cloud.login.mvp.contract.LoginContract;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/21/2019 16:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
@Component(modules = LoginModule.class, dependencies = AppComponent.class)
public interface LoginComponent {
void inject(LoginActivity activity);
@Component.Builder
interface Builder {
@BindsInstance
LoginComponent.Builder view(LoginContract.View view);
LoginComponent.Builder appComponent(AppComponent appComponent);
LoginComponent build();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.login.di.module.SwitchServerModule;
import com.gingersoft.gsa.cloud.login.mvp.contract.SwitchServerContract;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 02/29/2020 20:49
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
@Component(modules = SwitchServerModule.class, dependencies = AppComponent.class)
public interface SwitchServerComponent {
void inject(SwitchServerActivity activity);
@Component.Builder
interface Builder {
@BindsInstance
SwitchServerComponent.Builder view(SwitchServerContract.View view);
SwitchServerComponent.Builder appComponent(AppComponent appComponent);
SwitchServerComponent build();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.di.component;
import com.gingersoft.gsa.cloud.login.di.module.WelcomeModule;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.WelcomeActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Component;
@ActivityScope
@Component(modules = WelcomeModule.class, dependencies = AppComponent.class)
public interface WelcomeComponent {
void inject(WelcomeActivity activity);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.di.module;
import com.gingersoft.gsa.cloud.login.mvp.contract.LoginContract;
import com.gingersoft.gsa.cloud.login.mvp.model.LoginModel;
import dagger.Binds;
import dagger.Module;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/21/2019 16:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class LoginModule {
@Binds
abstract LoginContract.Model bindLoginModel(LoginModel model);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.di.module;
import dagger.Binds;
import dagger.Module;
import com.gingersoft.gsa.cloud.login.mvp.contract.SwitchServerContract;
import com.gingersoft.gsa.cloud.login.mvp.model.SwitchServerModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 02/29/2020 20:49
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class SwitchServerModule {
@Binds
abstract SwitchServerContract.Model bindSwitchServerModel(SwitchServerModel model);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.di.module;
import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract;
import com.gingersoft.gsa.cloud.login.mvp.model.WelcomeModel;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Module;
import dagger.Provides;
@Module
public class WelcomeModule {
private WelcomeContract.View view;
/**
* 构建WelcomeModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public WelcomeModule(WelcomeContract.View view) {
this.view = view;
}
@ActivityScope
@Provides
WelcomeContract.View provideWelcomeView() {
return this.view;
}
@ActivityScope
@Provides
WelcomeContract.Model provideWelcomeModel(WelcomeModel model) {
return model;
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.mvp.bean;
import android.graphics.drawable.Drawable;
public class GuideBean {
private String title;
private String details;
private Drawable img;
public GuideBean(String title, String details, Drawable img) {
this.title = title;
this.details = details;
this.img = img;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDetails() {
return details;
}
public void setDetails(String details) {
this.details = details;
}
public Drawable getImg() {
return img;
}
public void setImg(Drawable img) {
this.img = img;
}
}
package com.gingersoft.gsa.cloud.login.mvp.bean;
/**
* Created by Wyh on 2019/12/20.
*/
public class TestLoginBean {
/**
* success : true
* sysTime : 1.7506064484631255E7
* data : {"user":{"id":-2.59329254789086E7,"groupId":4.9519301404318124E7,"parentId":7.234733767439088E7,"merchantsId":-7.917127479317397E7,"userName":"Lorem ut in qui","mobile":"et non tempor ut","email":"est velit occaecat Excepteur ad","status":-2.4309450245410383E7,"createTime":"ea proident Excepteur","createBy":"Excepteur proident dolor anim","updateTime":"mag","updateBy":"nisi sed ut esse ex"},"token":"in"}
*/
private boolean success;
private double sysTime;
private DataBean data;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public double getSysTime() {
return sysTime;
}
public void setSysTime(double sysTime) {
this.sysTime = sysTime;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean {
/**
* user : {"id":-2.59329254789086E7,"groupId":4.9519301404318124E7,"parentId":7.234733767439088E7,"merchantsId":-7.917127479317397E7,"userName":"Lorem ut in qui","mobile":"et non tempor ut","email":"est velit occaecat Excepteur ad","status":-2.4309450245410383E7,"createTime":"ea proident Excepteur","createBy":"Excepteur proident dolor anim","updateTime":"mag","updateBy":"nisi sed ut esse ex"}
* token : in
*/
private UserBean user;
private String token;
public UserBean getUser() {
return user;
}
public void setUser(UserBean user) {
this.user = user;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public static class UserBean {
/**
* id : -2.59329254789086E7
* groupId : 4.9519301404318124E7
* parentId : 7.234733767439088E7
* merchantsId : -7.917127479317397E7
* userName : Lorem ut in qui
* mobile : et non tempor ut
* email : est velit occaecat Excepteur ad
* status : -2.4309450245410383E7
* createTime : ea proident Excepteur
* createBy : Excepteur proident dolor anim
* updateTime : mag
* updateBy : nisi sed ut esse ex
*/
private int id;
private int groupId;
private int parentId;
private int merchantsId;
private String userName;
private String mobile;
private String email;
private int status;
private String createTime;
private String createBy;
private String updateTime;
private String updateBy;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
public int getMerchantsId() {
return merchantsId;
}
public void setMerchantsId(int merchantsId) {
this.merchantsId = merchantsId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
}
}
}
package com.gingersoft.gsa.cloud.login.mvp.contract;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/21/2019 16:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface BaseLoginContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loginSuccess(LoginBean info);
void startToSwitchServer();
void showChooseRestaurantDialog(List<LoginBean.DataBean.UserBean.BrandsBean> brandsBean,List<LoginBean.DataBean.UserBean.BrandsBean> brands);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<LoginBean> login(RequestBody requestBody);
}
}
package com.gingersoft.gsa.cloud.login.mvp.contract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/21/2019 16:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface LoginContract extends BaseLoginContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends BaseLoginContract.View {
// void loginSuccess(LoginBean info);
//
// void startToSwitchServer();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends BaseLoginContract.Model {
// Observable<LoginBean> login(RequestBody requestBody);
//
// Observable<Object> loginOut( RequestBody requestBody);
}
}
package com.gingersoft.gsa.cloud.login.mvp.contract;
import android.content.Intent;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.constans.UserConstans;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.gingersoft.gsa.cloud.login.mvp.presenter.BaseLoginPresenter;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
import com.jess.arms.base.BaseActivity;
import java.util.ArrayList;
import java.util.List;
public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends BaseActivity<P> implements BaseLoginContract.View {
@Override
public void loginSuccess(LoginBean info) {
saveLoginInfo(info);
}
@Override
public void startToSwitchServer() {
startActivity(new Intent(mContext, SwitchServerActivity.class));
}
private void saveLoginInfo(LoginBean loginBean) {
GsaCloudApplication.setBrandRestaurantInfos(mContext, "");
if (loginBean.getData() != null) {
GsaCloudApplication.setLoginToken(mContext, loginBean.getData().getToken());
if (loginBean.getData().getUser() != null) {
GsaCloudApplication.setMemberId(mContext, loginBean.getData().getUser().getUserId());
GsaCloudApplication.setMemberName(mContext, loginBean.getData().getUser().getUserName());
List<LoginBean.DataBean.UserBean.BrandsBean> brands = loginBean.getData().getUser().getBrands();
if (brands != null) {
String brandRestaurantInfos = JsonUtils.toJson(brands);
GsaCloudApplication.setBrandRestaurantInfos(mContext, brandRestaurantInfos);
}
int restaurantSize = 0;
List<LoginBean.DataBean.UserBean.BrandsBean> brandsBeans = new ArrayList<>();
if (loginBean.getData().getUser().getBrands() != null) {
restaurantSize = getRestaurantSize(loginBean.getData().getUser().getBrands());
brandsBeans.addAll(loginBean.getData().getUser().getBrands());
}
boolean autoLogin = (boolean) SPUtils.get(mContext, UserConstans.AUTO_LOGIN, false);
if (autoLogin) {
int restaurantId = GsaCloudApplication.getRestaurantId(this);
if (restaurantId != 0) {
//有選擇餐廳,直接跳轉首頁
jumpMainActivity();
return;
}
}
if (restaurantSize == 1) {
//只有一個品牌是直接進下載頁面
LoginBean.DataBean.UserBean.BrandsBean brandsBean = getOnlyBrand(loginBean.getData().getUser().getBrands());
LoginBean.DataBean.UserBean.BrandsBean.RestaurantsBean restaurantsBean = getOnlyRestaurant(loginBean.getData().getUser().getBrands());
if (brandsBean != null) {
saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), restaurantsBean.getRestaurantId(), restaurantsBean.getRestaurantName());
}
jumpDownloadActivity();
} else {
showChooseRestaurantDialog(brandsBeans, brands);
}
}
}
}
protected void ChooseRestaurantItemClick(List<LoginBean.DataBean.UserBean.BrandsBean> brands, ChooseRestaurantDialog dialog, SectionTextItem item) {
LoginBean.DataBean.UserBean.BrandsBean brandsBean = getBrandByRestaurantId(brands, item.getId());
if (brandsBean != null) {
saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), item.getId(), item.getText());
}
dialog.dismiss();
jumpDownloadActivity();
}
protected void saveBrandAndRestaurantInfo(int brandId, String brandName, int restaurantId, String restaurantName) {
GsaCloudApplication.setBrandId(mContext, brandId);
GsaCloudApplication.setBrandName(mContext, brandName);
GsaCloudApplication.setRestaurantId(mContext, restaurantId);
GsaCloudApplication.setRestaurantName(mContext, restaurantName);
}
private int getRestaurantSize(List<LoginBean.DataBean.UserBean.BrandsBean> brands) {
int size = 0;
for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null)
size += brands.get(i).getRestaurants().size();
}
return size;
}
private LoginBean.DataBean.UserBean.BrandsBean getOnlyBrand(List<LoginBean.DataBean.UserBean.BrandsBean> brands) {
for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
return brands.get(i);
}
}
}
return null;
}
private LoginBean.DataBean.UserBean.BrandsBean.RestaurantsBean getOnlyRestaurant(List<LoginBean.DataBean.UserBean.BrandsBean> brands) {
for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
return brands.get(i).getRestaurants().get(j);
}
}
}
return null;
}
private LoginBean.DataBean.UserBean.BrandsBean getBrandByRestaurantId(List<LoginBean.DataBean.UserBean.BrandsBean> brands, int restaurantId) {
for (int i = 0; i < brands.size(); i++) {
if (brands.get(i).getRestaurants() != null) {
for (int j = 0; j < brands.get(i).getRestaurants().size(); j++) {
if (brands.get(i).getRestaurants().get(j).getRestaurantId() == restaurantId) {
return brands.get(i);
}
}
}
}
return null;
}
private void jumpDownloadActivity() {
CC.obtainBuilder("Component.Download")
.setActionName("showDownloadActivity")
.addParam("fromPage",1)
.build()
.call();
killMyself();
}
private void jumpMainActivity() {
CC.obtainBuilder("Component.Main")
.setActionName("showMainActivity")
.build()
.call();
killMyself();
}
}
package com.gingersoft.gsa.cloud.login.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 02/29/2020 20:49
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface SwitchServerContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.gsa.cloud.login.mvp.contract;
public interface WelcomeContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends BaseLoginContract.View {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends BaseLoginContract.Model {
}
}
package com.gingersoft.gsa.cloud.login.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.login.mvp.contract.LoginContract;
import com.gingersoft.gsa.cloud.login.mvp.server.LoginService;
import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/21/2019 16:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
public class LoginModel extends BaseModel implements LoginContract.Model{
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public LoginModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<LoginBean> login(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(LoginService.class)
.login(requestBody);
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.login.mvp.contract.SwitchServerContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 02/29/2020 20:49
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
public class SwitchServerModel extends BaseModel implements SwitchServerContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public SwitchServerModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract;
import com.gingersoft.gsa.cloud.login.mvp.server.LoginService;
import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@ActivityScope
public class WelcomeModel extends BaseModel implements WelcomeContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public WelcomeModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<LoginBean> login(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(LoginService.class)
.login(requestBody);
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.mvp.presenter;
import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.login.mvp.contract.BaseLoginContract;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.RequestBody;
@ActivityScope
public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends BaseLoginContract.View> extends BasePresenter<BaseLoginContract.Model, BaseLoginContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
private Activity IAcitivity;
@Inject
public BaseLoginPresenter(BaseLoginContract.Model model, BaseLoginContract.View rootView) {
super(model, rootView);
IAcitivity = (Activity) rootView;
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void login(String account, String pwd) {
if (account.equals("88888888") && pwd.equals("cc81081168")) {
mRootView.startToSwitchServer();
return;
}
RequestBody requestBody;
requestBody = new FormBody.Builder()
.add("userName", account.trim() + "")
.add("passWord", pwd.trim() + "")
.build();
mModel.login(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("登錄中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<LoginBean>(mErrorHandler) {
@Override
public void onNext(@NonNull LoginBean info) {
if (info.isSuccess()) {
GsaCloudApplication.isLogin = true;
GsaCloudApplication.userName = info.getData().getUser().getUserName();
mRootView.showMessage("登陸成功");
mRootView.loginSuccess(info);
//開啟打印服務
CC.obtainBuilder("Component.Print")
.setActionName("openPrintService")
.build()
.call();
} else {
GsaCloudApplication.isLogin = false;
mRootView.showMessage(info.getErrMsg());
if (IAcitivity instanceof LoginActivity) {
} else {
mRootView.launchActivity(new Intent(IAcitivity, LoginActivity.class));
}
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
if (IAcitivity instanceof LoginActivity) {
} else {
mRootView.launchActivity(new Intent(IAcitivity, LoginActivity.class));
}
}
});
}
}
package com.gingersoft.gsa.cloud.login.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.base.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.login.R;
import com.gingersoft.gsa.cloud.login.mvp.contract.LoginContract;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.PermissionUtil;
import com.tbruyelle.rxpermissions2.RxPermissions;
import java.util.List;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/21/2019 16:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
public class LoginPresenter extends BaseLoginPresenter<LoginContract.Model, LoginContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
private LoginActivity IAcitivty;
@Inject
public LoginPresenter(LoginContract.Model model, LoginContract.View rootView) {
super(model, rootView);
IAcitivty = (LoginActivity) rootView;
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
/**
* 进入应用强制用户开启 存储的权限(保存error log来文件必须拥有读写权限)
*/
public void requestExternalStoragePermission() {
PermissionUtil.externalStorage(new PermissionUtil.RequestPermission() {
@Override
public void onRequestPermissionSuccess() {
}
@Override
public void onRequestPermissionFailure(List<String> permissions) {
mRootView.showMessage(LanguageUtils.get_language_system(mApplication, "external.storage.permission.hint", ArmsUtils.getString(mApplication, R.string.queue_write_external_storage_permission_hint)));
mRootView.killMyself();
}
@Override
public void onRequestPermissionFailureWithAskNeverAgain(List<String> permissions) {
}
}, new RxPermissions(IAcitivty), mErrorHandler);
}
// public void login(String account, String pwd) {
// if (account.equals("88888888") && pwd.equals("cc81081168")) {
// mRootView.startToSwitchServer();
// return;
// }
// RequestBody requestBody;
// requestBody = new FormBody.Builder()
// .add("userName", account.trim() + "")
// .add("passWord", pwd.trim() + "")
// .build();
// mModel.login(requestBody)
// .subscribeOn(Schedulers.io())
// .doOnSubscribe(disposable -> mRootView.showLoading("登錄中..."))
// .subscribeOn(AndroidSchedulers.mainThread())
// .observeOn(AndroidSchedulers.mainThread())
// .doAfterTerminate(() -> mRootView.hideLoading())
// .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
// .subscribe(new ErrorHandleSubscriber<LoginBean>(mErrorHandler) {
//
// @Override
// public void onNext(@NonNull LoginBean info) {
// if (info.isSuccess()) {
// GsaCloudApplication.isLogin = true;
// GsaCloudApplication.userName = info.getData().getUser().getUserName();
// mRootView.showMessage("登陸成功");
// mRootView.loginSuccess(info);
// } else {
// GsaCloudApplication.isLogin = false;
// mRootView.showMessage(info.getErrMsg());
// }
// }
// });
// }
}
package com.gingersoft.gsa.cloud.login.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.login.mvp.contract.SwitchServerContract;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 02/29/2020 20:49
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
* 切換服務器頁面
*/
@ActivityScope
public class SwitchServerPresenter extends BasePresenter<SwitchServerContract.Model, SwitchServerContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public SwitchServerPresenter(SwitchServerContract.Model model, SwitchServerContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.gsa.cloud.login.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
@ActivityScope
public class WelcomePresenter extends BaseLoginPresenter<WelcomeContract.Model, WelcomeContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public WelcomePresenter(WelcomeContract.Model model, WelcomeContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.gsa.cloud.login.mvp.server;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.POST;
/**
* Created by Wyh on 2019/12/20.
*/
public interface LoginService {
@POST("gsa/login" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<LoginBean> login(@Body RequestBody requestBody);
@POST("gsa/logout" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<Object> loginOut(@Body RequestBody requestBody);
}
package com.gingersoft.gsa.cloud.login.mvp.ui.activity.di.component;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.di.module.RecoverPasswordModule;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.RecoverPasswordActivity;
@ActivityScope
@Component(modules = RecoverPasswordModule.class,dependencies = AppComponent.class)
public interface RecoverPasswordComponent {
void inject(RecoverPasswordActivity activity);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.mvp.ui.activity.di.module;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract.RecoverPasswordContract;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.model.RecoverPasswordModel;
@Module
public class RecoverPasswordModule {
private RecoverPasswordContract.View view;
/**
* 构建RecoverPasswordModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
* @param view
*/
public RecoverPasswordModule(RecoverPasswordContract.View view) {
this.view = view;
}
@ActivityScope
@Provides
RecoverPasswordContract.View provideRecoverPasswordView(){
return this.view;
}
@ActivityScope
@Provides
RecoverPasswordContract.Model provideRecoverPasswordModel(RecoverPasswordModel model){
return model;
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
public interface RecoverPasswordContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel{
}
}
package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract.RecoverPasswordContract;
@ActivityScope
public class RecoverPasswordModel extends BaseModel implements RecoverPasswordContract.Model{
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public RecoverPasswordModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.presenter;
import android.app.Application;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract.RecoverPasswordContract;
@ActivityScope
public class RecoverPasswordPresenter extends BasePresenter<RecoverPasswordContract.Model, RecoverPasswordContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public RecoverPasswordPresenter (RecoverPasswordContract.Model model, RecoverPasswordContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
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