testSubscriber = new TestSubscriber<>();
64 | mDataManager.getPokemon(name).subscribe(testSubscriber);
65 | testSubscriber.assertCompleted();
66 | testSubscriber.assertValue(pokemon);
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/MVPStarter/root/app/src/test/java/in/mvpstarter/sample/util/DefaultConfig.java.ftl:
--------------------------------------------------------------------------------
1 | package ${packageName}.util;
2 |
3 | public class DefaultConfig {
4 | //The api level that Roboelectric will use to run the unit tests
5 | public static final int EMULATE_SDK = 21;
6 | }
--------------------------------------------------------------------------------
/MVPStarter/root/app/src/test/java/in/mvpstarter/sample/util/RxSchedulersOverrideRule.java.ftl:
--------------------------------------------------------------------------------
1 | package ${packageName}.util;
2 |
3 | import org.junit.rules.TestRule;
4 | import org.junit.runner.Description;
5 | import org.junit.runners.model.Statement;
6 |
7 | import rx.Scheduler;
8 | import rx.android.plugins.RxAndroidPlugins;
9 | import rx.android.plugins.RxAndroidSchedulersHook;
10 | import rx.plugins.RxJavaPlugins;
11 | import rx.plugins.RxJavaSchedulersHook;
12 | import rx.schedulers.Schedulers;
13 |
14 | /**
15 | * NOTE: You MUST use this rule in every test class that targets app code that uses RxJava.
16 | * Even when that code doesn't use any scheduler. The RxJava {@link Schedulers} class is setup
17 | * once and caches the schedulers in memory. So if one of the test classes doesn't use this rule
18 | * by the time this rule runs it may be too late to override the schedulers. This is really not
19 | * ideal but currently there isn't a better approach.
20 | * More info here: https://github.com/ReactiveX/RxJava/issues/2297
21 | *
22 | * This rule registers SchedulerHooks for RxJava and RxAndroid to ensure that subscriptions
23 | * always subscribeOn and observeOn Schedulers.immediate().
24 | * Warning, this rule will reset RxAndroidPlugins and RxJavaPlugins before and after each test so
25 | * if the application code uses RxJava plugins this may affect the behaviour of the testing method.
26 | */
27 | public class RxSchedulersOverrideRule implements TestRule {
28 |
29 | private final RxJavaSchedulersHook mRxJavaSchedulersHook = new RxJavaSchedulersHook() {
30 | @Override
31 | public Scheduler getIOScheduler() {
32 | return Schedulers.immediate();
33 | }
34 |
35 | @Override
36 | public Scheduler getNewThreadScheduler() {
37 | return Schedulers.immediate();
38 | }
39 | };
40 |
41 | private final RxAndroidSchedulersHook mRxAndroidSchedulersHook = new RxAndroidSchedulersHook() {
42 | @Override
43 | public Scheduler getMainThreadScheduler() {
44 | return Schedulers.immediate();
45 | }
46 | };
47 |
48 | @Override
49 | public Statement apply(final Statement base, Description description) {
50 | return new Statement() {
51 | @Override
52 | public void evaluate() throws Throwable {
53 | RxAndroidPlugins.getInstance().reset();
54 | RxAndroidPlugins.getInstance().registerSchedulersHook(mRxAndroidSchedulersHook);
55 | RxJavaPlugins.getInstance().reset();
56 | RxJavaPlugins.getInstance().registerSchedulersHook(mRxJavaSchedulersHook);
57 |
58 | base.evaluate();
59 |
60 | RxAndroidPlugins.getInstance().reset();
61 | RxJavaPlugins.getInstance().reset();
62 | }
63 | };
64 | }
65 | }
--------------------------------------------------------------------------------
/MVPStarter/root/art/screens.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/androidstarters/androidstarters-template/fc1f211820047303cc49c3d9f832460fc0676dba/MVPStarter/root/art/screens.png
--------------------------------------------------------------------------------
/MVPStarter/root/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | mavenCentral()
5 | maven { url 'https://maven.fabric.io/public' }
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.0-rc2'
9 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
10 | classpath 'me.tatarka:gradle-retrolambda:3.3.0'
11 | classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
12 | //noinspection GradleDynamicVersion
13 | classpath 'io.fabric.tools:gradle:1.+'
14 | classpath 'com.google.gms:google-services:3.0.0'
15 | }
16 |
17 | configurations.classpath.exclude group: 'com.android.tools.external.lombok'
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | jcenter()
23 | mavenCentral()
24 | maven { url "https://jitpack.io" }
25 | maven { url 'https://maven.fabric.io/public' }
26 | }
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/MVPStarter/root/config/quality/checkstyle/checkstyle-config.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
77 |
79 |
81 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
92 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
117 |
118 |
119 |
120 |
121 |
123 |
124 |
125 |
126 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
137 |
138 |
139 |
140 |
141 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
151 |
152 |
153 |
154 |
155 |
157 |
158 |
159 |
160 |
161 |
163 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/MVPStarter/root/config/quality/findbugs/android-exclude-filter.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/MVPStarter/root/config/quality/pmd/pmd-ruleset.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | Custom ruleset for ribot Android application
8 |
9 | .*/R.java
10 | .*/gen/.*
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/MVPStarter/root/config/quality/quality.gradle:
--------------------------------------------------------------------------------
1 | /**
2 | * Set up Checkstyle, Findbugs and PMD to perform extensive code analysis.
3 | *
4 | * Gradle tasks added:
5 | * - checkstyle
6 | * - findbugs
7 | * - pmd
8 | *
9 | * The three tasks above are added as dependencies of the check task so running check will
10 | * run all of them.
11 | */
12 |
13 | apply plugin: 'checkstyle'
14 | apply plugin: 'findbugs'
15 | apply plugin: 'pmd'
16 |
17 | findbugs {
18 | toolVersion = '3.0.0'
19 | }
20 |
21 | dependencies {
22 | checkstyle 'com.puppycrawl.tools:checkstyle:7.1'
23 | }
24 |
25 | def qualityConfigDir = "$project.rootDir/config/quality";
26 | def reportsDir = "$project.buildDir/reports"
27 |
28 | check.dependsOn 'checkstyle', 'findbugs', 'pmd'
29 |
30 | task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code style checks') {
31 | configFile file("$qualityConfigDir/checkstyle/checkstyle-config.xml")
32 | source 'src'
33 | include '**/*.java'
34 |
35 | reports {
36 | xml.enabled = true
37 | xml {
38 | destination "$reportsDir/checkstyle/checkstyle.xml"
39 | }
40 | }
41 |
42 | classpath = files( )
43 | }
44 |
45 | task findbugs(type: FindBugs,
46 | group: 'Verification',
47 | description: 'Inspect java bytecode for bugs',
48 | dependsOn: ['compileDebugSources','compileReleaseSources']) {
49 |
50 | ignoreFailures = false
51 | effort = "max"
52 | reportLevel = "high"
53 | excludeFilter = new File("$qualityConfigDir/findbugs/android-exclude-filter.xml")
54 | classes = files("$project.rootDir/app/build/intermediates/classes")
55 |
56 | source 'src'
57 | include '**/*.java'
58 | exclude '**/gen/**'
59 |
60 | reports {
61 | xml.enabled = true
62 | html.enabled = false
63 | xml {
64 | destination "$reportsDir/findbugs/findbugs.xml"
65 | }
66 | html {
67 | destination "$reportsDir/findbugs/findbugs.html"
68 | }
69 | }
70 |
71 | classpath = files()
72 | }
73 |
74 |
75 | task pmd(type: Pmd, group: 'Verification', description: 'Inspect sourcecode for bugs') {
76 | ruleSetFiles = files("$qualityConfigDir/pmd/pmd-ruleset.xml")
77 | ignoreFailures = false
78 | ruleSets = []
79 |
80 | source 'src'
81 | include '**/*.java'
82 | exclude '**/gen/**'
83 |
84 | reports {
85 | xml.enabled = true
86 | html.enabled = true
87 | xml {
88 | destination "$reportsDir/pmd/pmd.xml"
89 | }
90 | html {
91 | destination "$reportsDir/pmd/pmd.html"
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/MVPStarter/root/gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | .DS_Store
5 | /build
6 | .idea/
7 | *iml
8 | *.iml
9 | */build
10 | fastlane
--------------------------------------------------------------------------------
/MVPStarter/root/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | org.gradle.daemon=true
21 | org.gradle.jvmargs=-Xmx14312M -XX:MaxPermSize=2512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
22 | org.gradle.parallel=true
23 | org.gradle.configureondemand=true
24 |
25 | PokeapiApiUrl = http://pokeapi.co/api/v2/
--------------------------------------------------------------------------------
/MVPStarter/root/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/androidstarters/androidstarters-template/fc1f211820047303cc49c3d9f832460fc0676dba/MVPStarter/root/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/MVPStarter/root/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Aug 02 14:28:17 IST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-all.zip
7 |
--------------------------------------------------------------------------------
/MVPStarter/root/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
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 |
--------------------------------------------------------------------------------
/MVPStarter/root/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 |
--------------------------------------------------------------------------------
/MVPStarter/root/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/MVPStarter/sync_template.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 | const rimraf = require('rimraf');
5 | const mv = require('mv');
6 | const mkdirp = require('mkdirp');
7 | const clone = require('nodegit').Clone;
8 | const replace = require('replace');
9 | const ncp = require('ncp').ncp;
10 | const fs = require('fs');
11 | const Finder = require('fs-finder');
12 |
13 | // Clone a given repository into the `./tmp` folder.
14 |
15 | rimraf.sync(path.join(__dirname, '/root'));
16 | rimraf.sync(path.join(__dirname, '/tmp'));
17 | mkdirp('./root');
18 |
19 | clone('https://github.com/ravidsrk/android-mvp-starter', './tmp')
20 | .then(function (repo) {
21 | checkOutAndCopy(repo, 'master');
22 | })
23 | .catch(function (err) {
24 | console.log(err);
25 | });
26 |
27 | function checkOutAndCopy(repo, name) {
28 | repo.getBranch('refs/remotes/origin/' + name)
29 | .then(function (reference) {
30 | console.log('Checking out branch ' + name);
31 | return repo.checkoutRef(reference);
32 | })
33 | .then(function () {
34 | replace({
35 | regex: 'in.mvpstarter.sample',
36 | replacement: '${packageName}',
37 | paths: ['./tmp/app'],
38 | recursive: true,
39 | silent: true
40 | });
41 |
42 | mv('./tmp/.gitignore', './tmp/gitignore', function (err) {
43 | if (err) {
44 | console.log(err);
45 | }
46 | console.log('Renamed root folder .gitignore');
47 | });
48 |
49 | mv('./tmp/app/.gitignore', './tmp/app/gitignore', function (err) {
50 | if (err) {
51 | console.log(err);
52 | }
53 | console.log('Renamed app folder .gitignore');
54 | });
55 |
56 | console.log('Copying files to ./root');
57 | ncp.limit = 1600;
58 | ncp('./tmp', './root', function (err) {
59 | if (err) {
60 | return console.error(err);
61 | }
62 | console.log('Renaming files to add .ftl extension!');
63 | renameFileToFtl();
64 | console.log('Copying complete!');
65 | rimraf.sync(path.join(__dirname, '/tmp'));
66 | });
67 | });
68 | }
69 |
70 | function renameFileToFtl() {
71 | Finder.from("./root").findFiles('*.java', function(files) {
72 | for (var i = 0; i < files.length; i++) {
73 | mv(files[i], files[i]+'.ftl', function (err) {
74 | if (err) {
75 | return console.log(err);
76 | }
77 | console.log('Renamed '+ files[i] + ' file to ' + files[i]+'.ftl');
78 | });
79 | };
80 | });
81 |
82 | Finder.from("./root").findFiles('*.xml', function(files) {
83 | for (var i = 0; i < files.length; i++) {
84 | mv(files[i], files[i]+'.ftl', function (err) {
85 | if (err) {
86 | return console.log(err);
87 | }
88 | console.log('Renamed '+ files[i] + ' file to ' + files[i]+'.ftl');
89 | });
90 | };
91 | });
92 | }
93 |
--------------------------------------------------------------------------------
/MVPStarter/template.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
21 |
22 |
28 |
29 |
30 | template_mvp_activity.png
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/MVPStarter/template_mvp_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/androidstarters/androidstarters-template/fc1f211820047303cc49c3d9f832460fc0676dba/MVPStarter/template_mvp_activity.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android Studio MVP Starter Template
2 |
3 | This is an Android Studio template for MVP.
4 |
5 |
6 | ## Installation
7 |
8 | #### For Mac:
9 |
10 | - If you have a standard Android Studio installation:
11 |
12 | Just run the install script at the root of this repository:
13 |
14 | ```
15 | ./install.sh
16 | ```
17 |
18 | - Manual installation:
19 |
20 | Just copy all 3 directories `MVPFragment`, `MVPActivity` and `MVPStarter` to `$ANDROID_STUDIO_FOLDER$/Contents/plugins/android/lib/templates/activities/`
21 |
22 | #### For Windows:
23 |
24 | Just copy all 3 directories `MVPFragment`, `MVPActivity` and `MVPStarter` to `$ANDROID_STUDIO_FOLDER$\plugins\android\lib\templates\activities\`
25 |
26 | ## License
27 |
28 | Copyright 2016 Ravindra Kumar
29 |
30 | Licensed under the Apache License, Version 2.0 (the "License");
31 | you may not use this file except in compliance with the License.
32 | You may obtain a copy of the License at
33 |
34 | http://www.apache.org/licenses/LICENSE-2.0
35 |
36 | Unless required by applicable law or agreed to in writing, software
37 | distributed under the License is distributed on an "AS IS" BASIS,
38 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39 | See the License for the specific language governing permissions and
40 | limitations under the License.
41 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Installs IntelliJ templates
3 |
4 | echo "Installing template files..."
5 |
6 | find /Applications -path "*.app" -prune \( -name "*Android Studio*" -or -name "*IntelliJ IDEA*" \) -print0 | while read -d $'\0' folder
7 | do
8 | echo "\nInstalling to $folder"
9 | cp -frv $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/MVP* "$folder/Contents/plugins/android/lib/templates/activities/"
10 | done
11 |
12 |
13 | echo "Done."
14 | echo ""
15 | echo "Restart IntelliJ and/or AndroidStudio"
--------------------------------------------------------------------------------
/screenshots/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/androidstarters/androidstarters-template/fc1f211820047303cc49c3d9f832460fc0676dba/screenshots/menu.png
--------------------------------------------------------------------------------
/screenshots/mvp_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/androidstarters/androidstarters-template/fc1f211820047303cc49c3d9f832460fc0676dba/screenshots/mvp_activity.png
--------------------------------------------------------------------------------
/screenshots/mvp_fragment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/androidstarters/androidstarters-template/fc1f211820047303cc49c3d9f832460fc0676dba/screenshots/mvp_fragment.png
--------------------------------------------------------------------------------