Skip to content

Commit 0154d7f

Browse files
committed
init
0 parents  commit 0154d7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1378
-0
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# General
2+
.DS_Store
3+
*~
4+
5+
# Android Studio
6+
.idea/
7+
.gradle
8+
local.properties
9+
/*/out
10+
build
11+
*.iml
12+
*.iws
13+
*.ipr
14+
*.swp
15+
16+
# built application files
17+
*.apk
18+
*.ap_
19+
20+
# files for the dex VM
21+
*.dex
22+
23+
# Java class files
24+
*.class
25+
26+
# generated files
27+
bin/
28+
gen/
29+
30+
# Eclipse project files
31+
.classpath
32+
.project
33+
34+
# Proguard folder generated by Eclipse
35+
proguard/s
36+
37+
/local.properties
38+
/.idea/workspace.xml
39+
/.idea/libraries
40+
/build
41+
/captures
42+
.externalNativeBuild
43+
/apk
44+
.idea/encodings.xml
45+
/gradle.properties

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 General Mobile
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Android Starter
2+
3+
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/general-mobile/kotlin-android-mvp-starter/master/LICENSE)
4+
[![Platform](https://img.shields.io/badge/platform-Android-green.svg)](http://developer.android.com/index.html)
5+
6+
Android Kotlin Starter is a starter project which implements MVP Pattern.
7+
8+
## Thanks
9+
This project extends from [Deniz Tunç Tuncer](https://github.com/dtunctuncer)'s [Android Starter](https://github.com/dtunctuncer/android-mvp-starter) project
10+
11+
## Libraries
12+
It includes libraries
13+
- [RxJava2](https://github.com/ReactiveX/RxJava) and [RxAndroid](https://github.com/ReactiveX/RxAndroid) and [RxKotlin](https://github.com/ReactiveX/RxKotlin)
14+
- [Retrofit](http://square.github.io/retrofit/) / [OkHttp](http://square.github.io/okhttp/)
15+
- [Gson](https://github.com/google/gson)
16+
- [Dagger 2](http://google.github.io/dagger/)
17+
- [Butterknife](https://github.com/JakeWharton/butterknife)
18+
- [Timber](https://github.com/JakeWharton/timber)
19+
- [Espresso](https://google.github.io/android-testing-support-library/) for UI tests
20+
- [Crashlytics](https://try.crashlytics.com/)
21+
- [Realm](https://realm.io/)
22+
- [Picasso](http://square.github.io/picasso/)
23+
24+
**You can choose which library you want to include in your project**
25+
26+
![Terminal](art/example.png)
27+
28+
#### Requirements
29+
30+
[python](https://www.python.org/)
31+
[pip](https://pypi.python.org/pypi/pip)
32+
[cookiecutter](https://github.com/audreyr/cookiecutter)
33+
34+
#### Install
35+
```
36+
1. Install python
37+
2. Install pip
38+
3. pip install cookiecutter
39+
```
40+
41+
Scaffold your project:
42+
```
43+
cookiecutter https://github.com/general-mobile/kotlin-android-mvp-starter.git
44+
```
45+
46+
47+
##### Project Tree After Scaffold
48+
```bash
49+
.
50+
├── app
51+
│ ├── app.iml
52+
│ ├── build.gradle
53+
│ ├── proguard-rules.pro
54+
│ └── src
55+
│ ├── androidTest
56+
│ │ └── java
57+
│ │ └── com
58+
│ │ └── generalmobile
59+
│ │ └── app
60+
│ │ └── test
61+
│ │ └── ApplicationTest.java
62+
│ ├── main
63+
│ │ ├── AndroidManifest.xml
64+
│ │ ├── kotlin
65+
│ │ │ └── com
66+
│ │ │ └── generalmobile
67+
│ │ │ └── app
68+
│ │ │ └── test
69+
│ │ │ ├── Application.kt
70+
│ │ │ ├── base
71+
│ │ │ │ ├── BaseActivity.kt
72+
│ │ │ │ └── IBaseView.kt
73+
│ │ │ ├── di
74+
│ │ │ │ ├── component
75+
│ │ │ │ │ └── ApplicationComponent.kt
76+
│ │ │ │ ├── module
77+
│ │ │ │ │ ├── ApplicationModule.kt
78+
│ │ │ │ │ ├── DatabaseModule.kt
79+
│ │ │ │ │ └── NetModule.kt
80+
│ │ │ │ └── scope
81+
│ │ │ │ └── ActivityScope.kt
82+
│ │ │ ├── main
83+
│ │ │ │ ├── IMainView.kt
84+
│ │ │ │ ├── MainActivity.kt
85+
│ │ │ │ ├── MainComponent.kt
86+
│ │ │ │ ├── MainModule.kt
87+
│ │ │ │ └── MainPresenter.kt
88+
│ │ │ ├── splash
89+
│ │ │ │ └── SplashActivity.kt
90+
│ │ │ └── utils
91+
│ │ │ ├── RxBus.kt
92+
│ │ │ └── timber
93+
│ │ │ └── CrashReportTree.kt
94+
│ │ └── res
95+
│ │ ├── drawable
96+
│ │ │ ├── android_starter.png
97+
│ │ │ └── splash_logo.xml
98+
│ │ ├── layout
99+
│ │ │ └── activity_main.xml
100+
│ │ ├── menu
101+
│ │ │ └── menu_main.xml
102+
│ │ ├── mipmap-hdpi
103+
│ │ │ ├── ic_launcher.png
104+
│ │ │ └── ic_launcher_round.png
105+
│ │ ├── mipmap-mdpi
106+
│ │ │ ├── ic_launcher.png
107+
│ │ │ └── ic_launcher_round.png
108+
│ │ ├── mipmap-xhdpi
109+
│ │ │ ├── ic_launcher.png
110+
│ │ │ └── ic_launcher_round.png
111+
│ │ ├── mipmap-xxhdpi
112+
│ │ │ ├── ic_launcher.png
113+
│ │ │ └── ic_launcher_round.png
114+
│ │ ├── mipmap-xxxhdpi
115+
│ │ │ ├── ic_launcher.png
116+
│ │ │ └── ic_launcher_round.png
117+
│ │ ├── values
118+
│ │ │ ├── colors.xml
119+
│ │ │ ├── dimens.xml
120+
│ │ │ ├── strings.xml
121+
│ │ │ └── styles.xml
122+
│ │ ├── values-v21
123+
│ │ │ └── styles.xml
124+
│ │ └── values-w820dp
125+
│ │ └── dimens.xml
126+
│ └── test
127+
│ └── java
128+
│ └── com
129+
│ └── generalmobile
130+
│ └── app
131+
│ └── test
132+
│ └── ExampleUnitTest.java
133+
├── build.gradle
134+
├── gradle
135+
│ └── wrapper
136+
│ ├── gradle-wrapper.jar
137+
│ └── gradle-wrapper.properties
138+
├── gradle.properties
139+
├── gradlew
140+
├── gradlew.bat
141+
├── local.properties
142+
├── settings.gradle
143+
└── test.iml
144+
145+
43 directories, 51 files
146+
```
147+
148+
149+
## License
150+
151+
The MIT License (MIT)
152+
153+
Copyright (c) 2017 General Mobile
154+
155+
Permission is hereby granted, free of charge, to any person obtaining a copy
156+
of this software and associated documentation files (the "Software"), to deal
157+
in the Software without restriction, including without limitation the rights
158+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
159+
copies of the Software, and to permit persons to whom the Software is
160+
furnished to do so, subject to the following conditions:
161+
162+
The above copyright notice and this permission notice shall be included in all
163+
copies or substantial portions of the Software.
164+
165+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
166+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
168+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
169+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
170+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
171+
SOFTWARE.

art/example.png

67.7 KB
Loading

cookiecutter.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"project_name": "kotlin-starter-project",
3+
"repo_name": "{{ cookiecutter.project_name|lower|replace(' ', '-') }}",
4+
"min_sdk" : 16,
5+
"target_sdk" : 25,
6+
"package_name": "com.generalmobile.app.{{ cookiecutter.project_name|lower|replace(' ', '')|replace('-', '') }}",
7+
"description": "A short description of the project.",
8+
"author": "General Mobile",
9+
"email": "[email protected]",
10+
"version" : "1.0.0",
11+
"splash_screen" : "n",
12+
"retrofit" : "n",
13+
"realm" : "n",
14+
"picasso" : "n"
15+
}

hooks/post_gen_project.py

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import os
5+
import shutil
6+
7+
project_dir = os.getcwd()
8+
9+
package_dir = '{{ cookiecutter.package_name }}'.replace('.', '/')
10+
11+
os.chdir(os.path.join("app","src","androidTest","java"))
12+
os.makedirs(package_dir)
13+
shutil.move('ApplicationTest.java', package_dir + '/ApplicationTest.java')
14+
15+
os.chdir(os.path.join(project_dir,"app","src","main","kotlin"))
16+
os.makedirs(package_dir)
17+
18+
19+
os.chdir(os.path.join(project_dir,"app","src","test","java"))
20+
os.makedirs(package_dir)
21+
shutil.move('ExampleUnitTest.java', package_dir + '/ExampleUnitTest.java')
22+
23+
os.chdir(os.path.join(project_dir,"app","src","main","kotlin",package_dir))
24+
os.chdir(os.path.join(project_dir,"app","src","main","kotlin"))
25+
26+
root_dst_dir = os.path.join(project_dir,"app","src","main","kotlin",package_dir)
27+
root_src_dir = os.path.join(project_dir,"app","src","main","kotlin")
28+
29+
if '{{ cookiecutter.splash_screen }}' != 'y':
30+
shutil.rmtree('splash')
31+
32+
if '{{ cookiecutter.retrofit }}' != 'y':
33+
os.remove('di/module/NetModule.kt')
34+
35+
if '{{ cookiecutter.realm }}' != 'y':
36+
os.remove('di/module/DatabaseModule.kt')
37+
38+
39+
base = os.path.join(root_src_dir,"base")
40+
di = os.path.join(root_src_dir,"di")
41+
splash = os.path.join(root_src_dir,"splash")
42+
utils = os.path.join(root_src_dir,"utils")
43+
main = os.path.join(root_src_dir,"main")
44+
45+
shutil.move('Application.kt',os.path.join(project_dir,"app","src","main","kotlin",package_dir,"Application.kt"))
46+
47+
def moverecursively(source_folder, destination_folder):
48+
basename = os.path.basename(source_folder)
49+
dest_dir = os.path.join(destination_folder, basename)
50+
if not os.path.exists(dest_dir):
51+
shutil.move(source_folder, destination_folder)
52+
else:
53+
dst_path = os.path.join(destination_folder, basename)
54+
for root, dirs, files in os.walk(source_folder):
55+
for item in files:
56+
src_path = os.path.join(root, item)
57+
if os.path.exists(dst_file):
58+
os.remove(dst_file)
59+
shutil.move(src_path, dst_path)
60+
for item in dirs:
61+
src_path = os.path.join(root, item)
62+
moverecursively(src_path, dst_path)
63+
64+
moverecursively(base,root_dst_dir)
65+
moverecursively(di,root_dst_dir)
66+
moverecursively(utils,root_dst_dir)
67+
moverecursively(main,root_dst_dir)
68+
69+
if '{{ cookiecutter.splash_screen }}' == 'y':
70+
moverecursively(splash,root_dst_dir)

requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cookiecutter==1.3.0
2+
python==2.7.13
3+
pip==1.5.4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

0 commit comments

Comments
 (0)