├── Art └── BlueFairy.png ├── IntermediateLayer ├── .gitignore ├── .idea │ ├── checkstyle-idea.xml │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── markdown-navigator.xml │ ├── markdown-navigator │ │ └── profiles_settings.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── README.md ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── tech │ │ │ └── jackywang │ │ │ └── intermediate │ │ │ └── layer │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── tech │ │ │ │ └── jackywang │ │ │ │ └── intermediate │ │ │ │ └── layer │ │ │ │ ├── BusinessDelegate.java │ │ │ │ ├── IBusinessDelegate.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── business │ │ │ │ ├── BasePresenter.java │ │ │ │ ├── BaseView.java │ │ │ │ ├── business1 │ │ │ │ ├── Business1Contract.java │ │ │ │ ├── Business1Model.java │ │ │ │ ├── Business1Presenter.java │ │ │ │ └── Business1View.java │ │ │ │ └── business2 │ │ │ │ ├── Business2Contract.java │ │ │ │ ├── Business2Model.java │ │ │ │ ├── Business2Presenter.java │ │ │ │ └── Business2View.java │ │ └── res │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ └── content_main.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── tech │ │ └── jackywang │ │ └── intermediate │ │ └── layer │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── LICENSE ├── README-CN.md ├── README.md ├── multi-variants-library ├── .gitignore ├── .idea │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── README-CN.md ├── README.md ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── jacky │ │ │ └── myapplication │ │ │ └── MainActivity.java │ │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── common │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── jacky │ │ │ └── common │ │ │ └── CommonFlavor.java │ │ └── res │ │ └── values │ │ └── strings.xml ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── sdk │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── jacky │ │ │ └── sdk │ │ │ └── SdkFlavor.java │ │ └── res │ │ └── values │ │ └── strings.xml ├── settings.gradle └── uikit │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── jacky │ │ └── library │ │ └── UIKitFlavor.java │ └── res │ └── values │ └── strings.xml └── mvp ├── .gitignore ├── .idea ├── checkstyle-idea.xml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── eclipseCodeFormatter.xml ├── encodings.xml ├── gradle.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README-CN.md ├── README.md ├── app ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── tinmegali │ │ └── tutsmvp_sample │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── tinmegali │ │ │ └── tutsmvp_sample │ │ │ ├── common │ │ │ └── StateMaintainer.java │ │ │ ├── data │ │ │ ├── DAO.java │ │ │ └── DBSchema.java │ │ │ ├── main │ │ │ └── activity │ │ │ │ ├── MVP_Main.java │ │ │ │ ├── model │ │ │ │ └── MainModel.java │ │ │ │ ├── presenter │ │ │ │ └── MainPresenter.java │ │ │ │ └── view │ │ │ │ ├── MainActivity.java │ │ │ │ └── recycler │ │ │ │ └── NotesViewHolder.java │ │ │ └── models │ │ │ └── Note.java │ └── res │ │ ├── drawable-hdpi │ │ ├── ic_action_add.png │ │ └── ic_action_cancel.png │ │ ├── drawable-ldpi │ │ ├── ic_action_add.png │ │ └── ic_action_cancel.png │ │ ├── drawable-mdpi │ │ ├── ic_action_add.png │ │ └── ic_action_cancel.png │ │ ├── drawable-tvdpi │ │ ├── ic_action_add.png │ │ └── ic_action_cancel.png │ │ ├── drawable-xhdpi │ │ ├── ic_action_add.png │ │ └── ic_action_cancel.png │ │ ├── drawable-xxhdpi │ │ ├── ic_action_add.png │ │ └── ic_action_cancel.png │ │ ├── drawable-xxxhdpi │ │ ├── ic_action_add.png │ │ └── ic_action_cancel.png │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── content_main.xml │ │ └── holder_notes.xml │ │ ├── menu │ │ └── menu_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── tinmegali │ └── tutsmvp_sample │ ├── DBTest.java │ ├── MainModelTest.java │ └── MainPresenterTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /Art/BlueFairy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/Art/BlueFairy.png -------------------------------------------------------------------------------- /IntermediateLayer/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/checkstyle-idea.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 36 | 37 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 53 | 54 | $USER_HOME$/.subversion 55 | 56 | 57 | 58 | 59 | 60 | 1.8 61 | 62 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /IntermediateLayer/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /IntermediateLayer/README.md: -------------------------------------------------------------------------------- 1 | ### Welcome to follow me on GitHub or CSDN 2 | 3 | GitHub: https://github.com/JackyAndroid 4 | 5 | CSDN: http://blog.csdn.net/rain_butterfly 6 | 7 | --- 8 | 9 | 如果一个产品需要有多个业务线,各业务线之间如何协作才是最高效的? 10 | 11 | 如果需要添加某个业务,把相应的View直接写在Layout里,然后处理业务逻辑。但是如果业务模块多达几十个,散落的逻辑有几千行,这时该如何设计才能保证各业务的稳定和可扩展性? 12 | 13 | 公共业务应该是各个业务积木堆积组成,各个积木之间是黑盒状态,只能通过“窗口”向外提供服务,以及发布需求。中间层委托、代理信息的传递。 14 | 15 | 中间层在Android平台该如何设计? 16 | 17 | - Android平台起点及终点都是和界面的生命周期息息相关,中间层作为业务/界面的承载模型,所以应该继承自View。 18 | - 各个业务积木之间是独立、隔离、和动态的,业务积木通过中间承载模型加载/卸载也应该是动态的。 19 | - 中间层作为界面承载模型,所以也是有生命周期的,且依赖于外部。 20 | - 中间层除了承载、通信职责,也应该随着外部环境变化,去影响业务积木的改变。 21 | 22 | **详情请见 [Android业务中间层该如何设计?](http://www.jackywang.tech/2017/10/11/Android%E4%B8%9A%E5%8A%A1%E4%B8%AD%E9%97%B4%E5%B1%82%E8%AF%A5%E5%A6%82%E4%BD%95%E8%AE%BE%E8%AE%A1%EF%BC%9F/)** -------------------------------------------------------------------------------- /IntermediateLayer/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /IntermediateLayer/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.3" 6 | defaultConfig { 7 | applicationId "tech.jackywang.intermediate.layer" 8 | minSdkVersion 15 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.3.1' 28 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 29 | compile 'com.android.support:design:25.3.1' 30 | testCompile 'junit:junit:4.12' 31 | } 32 | -------------------------------------------------------------------------------- /IntermediateLayer/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/wangshichang/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/androidTest/java/tech/jackywang/intermediate/layer/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("tech.jackywang.intermediate.layer", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/BusinessDelegate.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.RelativeLayout; 6 | 7 | import java.lang.ref.WeakReference; 8 | 9 | import tech.jackywang.intermediate.layer.business.business1.Business1Contract; 10 | import tech.jackywang.intermediate.layer.business.business1.Business1Model; 11 | import tech.jackywang.intermediate.layer.business.business1.Business1Presenter; 12 | import tech.jackywang.intermediate.layer.business.business1.Business1View; 13 | import tech.jackywang.intermediate.layer.business.business2.Business2Contract; 14 | import tech.jackywang.intermediate.layer.business.business2.Business2Model; 15 | import tech.jackywang.intermediate.layer.business.business2.Business2Presenter; 16 | import tech.jackywang.intermediate.layer.business.business2.Business2View; 17 | 18 | /** 19 | * 委托 20 | * 21 | * @author jacky 22 | * @version v1.0 23 | * @description 委托,隔离各业务间的耦合 24 | * @since 2017/9/14 25 | */ 26 | 27 | public class BusinessDelegate extends RelativeLayout implements IBusinessDelegate { 28 | 29 | private WeakReference mContextReference; 30 | 31 | private Business1Contract.Presenter mBusiness1Presenter; 32 | private Business2Contract.Presenter mBusiness2Presenter; 33 | 34 | public BusinessDelegate(Context context) { 35 | super(context); 36 | } 37 | 38 | public BusinessDelegate(Context context, AttributeSet attrs) { 39 | super(context, attrs); 40 | } 41 | 42 | public BusinessDelegate(Context context, AttributeSet attrs, int defStyleAttr) { 43 | super(context, attrs, defStyleAttr); 44 | } 45 | 46 | @Override 47 | public IBusinessDelegate setup() { 48 | mContextReference = new WeakReference<>(getContext()); 49 | removeAllViews(); 50 | return this; 51 | } 52 | 53 | // ---- 动态加载挂件 Start ---- 54 | @Override 55 | public IBusinessDelegate setupBusiness1() { 56 | Business1View view = new Business1View(mContextReference.get()); 57 | mBusiness1Presenter = new Business1Presenter(view, new Business1Model()); 58 | view.setPresenter(mBusiness1Presenter); 59 | LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 60 | params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); 61 | addView(view, params); 62 | return this; 63 | } 64 | 65 | @Override 66 | public IBusinessDelegate setupBusiness2() { 67 | Business2View view = new Business2View(mContextReference.get()); 68 | mBusiness2Presenter = new Business2Presenter(view, new Business2Model()); 69 | view.setPresenter(mBusiness2Presenter); 70 | LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 71 | params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); 72 | addView(view, params); 73 | return this; 74 | } 75 | // ---- 动态加载挂件 End ---- 76 | 77 | // ---- 接收事件 Start ---- 78 | @Override 79 | public void event1() { 80 | if (mBusiness1Presenter != null) { 81 | mBusiness1Presenter.notify(); 82 | } 83 | } 84 | 85 | @Override 86 | public void event2() { 87 | if (mBusiness2Presenter != null) { 88 | mBusiness2Presenter.notify(); 89 | } 90 | } 91 | // ---- 接收事件 End ---- 92 | 93 | // ---- 生命周期 Start ---- 94 | @Override 95 | public void onCreate() { 96 | if (mBusiness1Presenter != null) { 97 | mBusiness1Presenter.onCreate(); 98 | } 99 | if (mBusiness2Presenter != null) { 100 | mBusiness2Presenter.onCreate(); 101 | } 102 | } 103 | 104 | @Override 105 | public void onResume() { 106 | if (mBusiness1Presenter != null) { 107 | mBusiness1Presenter.onResume(); 108 | } 109 | if (mBusiness2Presenter != null) { 110 | mBusiness2Presenter.onResume(); 111 | } 112 | } 113 | 114 | @Override 115 | public void onPause() { 116 | if (mBusiness1Presenter != null) { 117 | mBusiness1Presenter.onPause(); 118 | } 119 | if (mBusiness2Presenter != null) { 120 | mBusiness2Presenter.onPause(); 121 | } 122 | } 123 | 124 | @Override 125 | public void onDestroy() { 126 | if (mBusiness1Presenter != null) { 127 | mBusiness1Presenter.onDestroy(); 128 | } 129 | if (mBusiness2Presenter != null) { 130 | mBusiness2Presenter.onDestroy(); 131 | } 132 | } 133 | // ---- 生命周期 End ---- 134 | } -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/IBusinessDelegate.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer; 2 | 3 | /** 4 | * 委托协议 5 | * 6 | * @author jacky 7 | * @version v1.0 8 | * @description 对外暴露的协议 9 | * @since 2017/9/14 10 | */ 11 | 12 | public interface IBusinessDelegate { 13 | 14 | IBusinessDelegate setup(); 15 | 16 | IBusinessDelegate setupBusiness1(); 17 | 18 | IBusinessDelegate setupBusiness2(); 19 | 20 | void event1(); 21 | 22 | void event2(); 23 | 24 | void onCreate(); 25 | 26 | void onResume(); 27 | 28 | void onPause(); 29 | 30 | void onDestroy(); 31 | } -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/MainActivity.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.FloatingActionButton; 5 | import android.support.design.widget.Snackbar; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.support.v7.widget.Toolbar; 8 | import android.view.View; 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | private BusinessDelegate mBusinessDelegate; 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 19 | setSupportActionBar(toolbar); 20 | 21 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); 22 | fab.setOnClickListener(new View.OnClickListener() { 23 | @Override 24 | public void onClick(View view) { 25 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) 26 | .setAction("Action", null).show(); 27 | } 28 | }); 29 | 30 | mBusinessDelegate = (BusinessDelegate) findViewById(R.id.business_delegate); 31 | mBusinessDelegate 32 | .setup() 33 | .setupBusiness1() 34 | .setupBusiness2(); 35 | } 36 | 37 | @Override 38 | protected void onResume() { 39 | super.onResume(); 40 | if (mBusinessDelegate != null) { 41 | mBusinessDelegate.onResume(); 42 | } 43 | } 44 | 45 | @Override 46 | protected void onPause() { 47 | super.onPause(); 48 | if (mBusinessDelegate != null) { 49 | mBusinessDelegate.onPause(); 50 | } 51 | } 52 | 53 | @Override 54 | protected void onDestroy() { 55 | super.onDestroy(); 56 | if (mBusinessDelegate != null) { 57 | mBusinessDelegate.onDestroy(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business; 2 | 3 | /** 4 | * @author jacky 5 | * @version v1.0 6 | * @description 7 | * @since 2017/10/19 8 | */ 9 | 10 | public interface BasePresenter { 11 | 12 | void onCreate(); 13 | 14 | void onResume(); 15 | 16 | void onPause(); 17 | 18 | void onDestroy(); 19 | } 20 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/BaseView.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business; 2 | 3 | /** 4 | * @author jacky 5 | * @version v1.0 6 | * @description 7 | * @since 2017/10/19 8 | */ 9 | 10 | public interface BaseView { 11 | 12 | void setPresenter(T presenter); 13 | } 14 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/business1/Business1Contract.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business.business1; 2 | 3 | import tech.jackywang.intermediate.layer.business.BasePresenter; 4 | import tech.jackywang.intermediate.layer.business.BaseView; 5 | 6 | /** 7 | * @author jacky 8 | * @version v1.0 9 | * @description 10 | * @since 2017/10/19 11 | */ 12 | 13 | public interface Business1Contract { 14 | 15 | interface View extends BaseView { 16 | 17 | } 18 | 19 | interface Presenter extends BasePresenter { 20 | 21 | } 22 | 23 | interface Model { 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/business1/Business1Model.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business.business1; 2 | 3 | /** 4 | * @author jacky 5 | * @version v1.0 6 | * @description 7 | * @since 2017/10/19 8 | */ 9 | 10 | public class Business1Model implements Business1Contract.Model { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/business1/Business1Presenter.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business.business1; 2 | 3 | /** 4 | * @author jacky 5 | * @version v1.0 6 | * @description 7 | * @since 2017/10/19 8 | */ 9 | 10 | public class Business1Presenter implements Business1Contract.Presenter { 11 | 12 | public Business1Presenter(Business1Contract.View view, Business1Contract.Model model) { 13 | 14 | } 15 | 16 | @Override 17 | public void onCreate() { 18 | 19 | } 20 | 21 | @Override 22 | public void onResume() { 23 | 24 | } 25 | 26 | @Override 27 | public void onPause() { 28 | 29 | } 30 | 31 | @Override 32 | public void onDestroy() { 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/business1/Business1View.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business.business1; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.AttrRes; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.Nullable; 7 | import android.util.AttributeSet; 8 | import android.widget.FrameLayout; 9 | 10 | /** 11 | * @author jacky 12 | * @version v1.0 13 | * @description 14 | * @since 2017/10/19 15 | */ 16 | 17 | public class Business1View extends FrameLayout implements Business1Contract.View { 18 | 19 | public Business1View(@NonNull Context context) { 20 | super(context); 21 | } 22 | 23 | public Business1View(@NonNull Context context, @Nullable AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | public Business1View(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) { 28 | super(context, attrs, defStyleAttr); 29 | } 30 | 31 | @Override 32 | public void setPresenter(Business1Contract.Presenter presenter) { 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/business2/Business2Contract.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business.business2; 2 | 3 | import tech.jackywang.intermediate.layer.business.BasePresenter; 4 | import tech.jackywang.intermediate.layer.business.BaseView; 5 | 6 | /** 7 | * @author jacky 8 | * @version v1.0 9 | * @description 10 | * @since 2017/10/19 11 | */ 12 | 13 | public interface Business2Contract { 14 | 15 | interface View extends BaseView { 16 | 17 | } 18 | 19 | interface Presenter extends BasePresenter { 20 | 21 | } 22 | 23 | interface Model { 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/business2/Business2Model.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business.business2; 2 | 3 | /** 4 | * @author jacky 5 | * @version v1.0 6 | * @description 7 | * @since 2017/10/19 8 | */ 9 | 10 | public class Business2Model implements Business2Contract.Model { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/business2/Business2Presenter.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business.business2; 2 | 3 | /** 4 | * @author jacky 5 | * @version v1.0 6 | * @description 7 | * @since 2017/10/19 8 | */ 9 | 10 | public class Business2Presenter implements Business2Contract.Presenter { 11 | 12 | public Business2Presenter(Business2Contract.View view, Business2Contract.Model model) { 13 | 14 | } 15 | 16 | @Override 17 | public void onCreate() { 18 | 19 | } 20 | 21 | @Override 22 | public void onResume() { 23 | 24 | } 25 | 26 | @Override 27 | public void onPause() { 28 | 29 | } 30 | 31 | @Override 32 | public void onDestroy() { 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/java/tech/jackywang/intermediate/layer/business/business2/Business2View.java: -------------------------------------------------------------------------------- 1 | package tech.jackywang.intermediate.layer.business.business2; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.AttrRes; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.Nullable; 7 | import android.util.AttributeSet; 8 | import android.widget.FrameLayout; 9 | 10 | /** 11 | * @author jacky 12 | * @version v1.0 13 | * @description 14 | * @since 2017/10/19 15 | */ 16 | 17 | public class Business2View extends FrameLayout implements Business2Contract.View { 18 | 19 | public Business2View(@NonNull Context context) { 20 | super(context); 21 | } 22 | 23 | public Business2View(@NonNull Context context, @Nullable AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | public Business2View(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) { 28 | super(context, attrs, defStyleAttr); 29 | } 30 | 31 | @Override 32 | public void setPresenter(Business2Contract.Presenter presenter) { 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackyAndroid/Android-Architecture-Fairy/b1d78dace78bf2e93a44d425b865f7589ca5cf68/IntermediateLayer/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | IntermediateLayer 3 | MainActivity 4 | 5 | -------------------------------------------------------------------------------- /IntermediateLayer/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 14 | 9 | 10 | -------------------------------------------------------------------------------- /mvp/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /mvp/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #318bff 4 | #30649f 5 | #d72629 6 | 7 | -------------------------------------------------------------------------------- /mvp/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /mvp/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | tuts+mvp_sample 3 | Settings 4 | 5 | -------------------------------------------------------------------------------- /mvp/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /mvp/app/src/test/java/com/tinmegali/tutsmvp_sample/DBTest.java: -------------------------------------------------------------------------------- 1 | package com.tinmegali.tutsmvp_sample; 2 | 3 | import android.content.Context; 4 | 5 | import com.tinmegali.tutsmvp_sample.data.DAO; 6 | import com.tinmegali.tutsmvp_sample.models.Note; 7 | 8 | import org.junit.Before; 9 | import org.junit.Test; 10 | import org.junit.runner.RunWith; 11 | import org.robolectric.RobolectricGradleTestRunner; 12 | import org.robolectric.RuntimeEnvironment; 13 | import org.robolectric.annotation.Config; 14 | 15 | import java.util.ArrayList; 16 | 17 | import static org.junit.Assert.*; 18 | 19 | /** 20 | * --------------------------------------------------- 21 | * Created by Tin Megali on 18/03/16. 22 | * Project: tuts+mvp_sample 23 | * --------------------------------------------------- 24 | * tinmegali.com 25 | * noteTexts = new ArrayList<>(); 61 | noteTexts.add( "note1" ); 62 | noteTexts.add( "note2" ); 63 | noteTexts.add("note3"); 64 | 65 | for( int i=0; i notes = dao.getAllNotes(); 71 | assertNotNull( notes ); 72 | assertEquals(notes.size(), noteTexts.size()); 73 | } 74 | 75 | @Test 76 | public void deleteNote() { 77 | Note note = getNote("deleteNote"); 78 | Note noteInserted = dao.insertNote(note); 79 | assertNotNull(noteInserted); 80 | 81 | Note noteFetched = dao.getNote(noteInserted.getId()); 82 | assertNotNull(noteFetched); 83 | assertEquals(noteFetched.getText(), note.getText()); 84 | 85 | long delResult = dao.deleteNote( noteInserted ); 86 | assertEquals(1, delResult); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /mvp/app/src/test/java/com/tinmegali/tutsmvp_sample/MainModelTest.java: -------------------------------------------------------------------------------- 1 | package com.tinmegali.tutsmvp_sample; 2 | 3 | import android.content.Context; 4 | 5 | import com.tinmegali.tutsmvp_sample.data.DAO; 6 | import com.tinmegali.tutsmvp_sample.main.activity.model.MainModel; 7 | import com.tinmegali.tutsmvp_sample.main.activity.presenter.MainPresenter; 8 | import com.tinmegali.tutsmvp_sample.models.Note; 9 | 10 | import org.junit.Before; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.mockito.Mockito; 14 | import org.robolectric.RobolectricGradleTestRunner; 15 | import org.robolectric.RuntimeEnvironment; 16 | import org.robolectric.annotation.Config; 17 | 18 | import java.util.ArrayList; 19 | 20 | import static org.mockito.Mockito.*; 21 | import static org.junit.Assert.*; 22 | 23 | /** 24 | * --------------------------------------------------- 25 | * Created by Tin Megali on 18/03/16. 26 | * Project: tuts+mvp_sample 27 | * --------------------------------------------------- 28 | * tinmegali.com 29 | * (); 47 | 48 | reset(mockPresenter); 49 | } 50 | 51 | 52 | private Note createNote(String text) { 53 | Note note = new Note(); 54 | note.setText(text); 55 | note.setDate("some date"); 56 | return note; 57 | } 58 | 59 | @Test 60 | public void loadData(){ 61 | 62 | int notesSize = 10; 63 | for (int i =0; i -1); 76 | } 77 | 78 | @Test 79 | public void deleteNote() { 80 | Note note = createNote("testNote"); 81 | Note insertedNote = mDAO.insertNote(note); 82 | mModel.mNotes = new ArrayList<>(); 83 | mModel.mNotes.add(insertedNote); 84 | 85 | assertTrue(mModel.deleteNote(insertedNote, 0)); 86 | 87 | Note fakeNote = createNote("fakeNote"); 88 | assertFalse(mModel.deleteNote(fakeNote, 0)); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /mvp/app/src/test/java/com/tinmegali/tutsmvp_sample/MainPresenterTest.java: -------------------------------------------------------------------------------- 1 | package com.tinmegali.tutsmvp_sample; 2 | 3 | import android.widget.EditText; 4 | import android.widget.Toast; 5 | 6 | import com.tinmegali.tutsmvp_sample.main.activity.MVP_Main; 7 | import com.tinmegali.tutsmvp_sample.main.activity.model.MainModel; 8 | import com.tinmegali.tutsmvp_sample.main.activity.presenter.MainPresenter; 9 | import com.tinmegali.tutsmvp_sample.models.Note; 10 | 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | import org.junit.runner.RunWith; 14 | import org.mockito.Mockito; 15 | import org.robolectric.RobolectricGradleTestRunner; 16 | import org.robolectric.annotation.Config; 17 | 18 | import static org.mockito.Mockito.*; 19 | 20 | /** 21 | * --------------------------------------------------- 22 | * Created by Tin Megali on 18/03/16. 23 | * Project: tuts+mvp_sample 24 | * --------------------------------------------------- 25 | * tinmegali.com 26 | * \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /mvp/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /mvp/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------