├── .attach_pid3679 ├── .gitignore ├── .idea ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── render.experimental.xml ├── runConfigurations.xml └── vcs.xml ├── app ├── .gitignore ├── build.gradle ├── paid │ └── release │ │ └── app-paid-release.aab ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── org │ │ └── pbreakers │ │ └── mobile │ │ └── androidtest │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── org │ │ │ └── pbreakers │ │ │ └── mobile │ │ │ └── androidtest │ │ │ └── udacity │ │ │ ├── MainActivity.kt │ │ │ ├── app │ │ │ ├── App.kt │ │ │ └── di │ │ │ │ └── Module.kt │ │ │ ├── model │ │ │ ├── AppDatabase.kt │ │ │ ├── api │ │ │ │ └── UserApi.kt │ │ │ ├── dao │ │ │ │ └── UserDao.kt │ │ │ ├── entity │ │ │ │ └── GithubUser.kt │ │ │ └── repository │ │ │ │ └── UserRepository.kt │ │ │ ├── utils │ │ │ └── LoadingState.kt │ │ │ └── viewmodel │ │ │ └── UserViewModel.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── check.xml │ │ ├── dice_1.xml │ │ ├── dice_2.xml │ │ ├── dice_3.xml │ │ ├── dice_4.xml │ │ ├── dice_5.xml │ │ ├── dice_6.xml │ │ ├── empty_dice.xml │ │ ├── ic_check_box.xml │ │ ├── ic_check_box_check.xml │ │ ├── ic_cloud_done_black_24dp.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_lightbulb_outline_black_24dp.xml │ │ ├── login.jpg │ │ └── login_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.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 │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── setting.xml │ └── test │ └── java │ └── org │ └── pbreakers │ └── mobile │ └── androidtest │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.attach_pid3679: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/.attach_pid3679 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | xmlns:android 17 | ^$ 18 | 19 | 20 | 21 |
22 |
23 | 24 | 25 | 26 | xmlns:.* 27 | ^$ 28 | 29 | 30 | BY_NAME 31 | 32 |
33 |
34 | 35 | 36 | 37 | .*:id 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | http://schemas.android.com/apk/res/android 49 | 50 | 51 | 52 |
53 |
54 | 55 | 56 | 57 | name 58 | ^$ 59 | 60 | 61 | 62 |
63 |
64 | 65 | 66 | 67 | style 68 | ^$ 69 | 70 | 71 | 72 |
73 |
74 | 75 | 76 | 77 | .* 78 | ^$ 79 | 80 | 81 | BY_NAME 82 | 83 |
84 |
85 | 86 | 87 | 88 | .* 89 | http://schemas.android.com/apk/res/android 90 | 91 | 92 | ANDROID_ATTRIBUTE_ORDER 93 | 94 |
95 |
96 | 97 | 98 | 99 | .* 100 | .* 101 | 102 | 103 | BY_NAME 104 | 105 |
106 |
107 |
108 |
109 | 110 | 112 |
113 |
-------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/render.experimental.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | //apply plugin: 'com.google.gms.google-services' 6 | 7 | androidExtensions { 8 | experimental = true 9 | } 10 | 11 | 12 | android { 13 | dataBinding { 14 | enabled = true 15 | } 16 | compileSdkVersion 28 17 | defaultConfig { 18 | multiDexEnabled true 19 | applicationId "org.pbreakers.mobile.androidtest" 20 | minSdkVersion 16 21 | targetSdkVersion 28 22 | versionCode 1 23 | versionName "1.0" 24 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 25 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 26 | } 27 | buildTypes { 28 | release { 29 | minifyEnabled false 30 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 31 | } 32 | } 33 | } 34 | 35 | dependencies { 36 | implementation fileTree(dir: 'libs', include: ['*.jar']) 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 38 | implementation 'androidx.appcompat:appcompat:1.0.0-beta01' 39 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 40 | // implementation 'com.google.firebase:firebase-auth:17.0.0' 41 | // implementation 'com.firebaseui:firebase-ui-auth:4.3.2' 42 | 43 | // ----------------------------------------------------------------------------- 44 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 45 | testImplementation 'junit:junit:4.12' 46 | androidTestImplementation 'androidx.test.espresso:espresso-web:3.3.0-alpha02' 47 | androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0-alpha02' 48 | androidTestImplementation 'androidx.test:runner:1.2.0' 49 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 50 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 51 | androidTestImplementation 'androidx.test:core:1.2.0' 52 | androidTestImplementation 'androidx.test:runner:1.2.0' 53 | androidTestImplementation 'androidx.test:rules:1.2.0' 54 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 55 | androidTestImplementation 'androidx.test.ext:truth:1.2.0' 56 | androidTestImplementation 'com.google.truth:truth:0.42' 57 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 58 | 59 | 60 | // ----------------------------------------------------------------------------- 61 | implementation 'android.arch.navigation:navigation-fragment:1.0.0' 62 | implementation 'android.arch.navigation:navigation-ui:1.0.0' 63 | implementation 'androidx.core:core-ktx:1.1.0' 64 | implementation 'androidx.fragment:fragment-ktx:1.1.0' 65 | implementation 'androidx.viewpager:viewpager:1.0.0' 66 | implementation 'androidx.recyclerview:recyclerview:1.0.0' 67 | implementation 'androidx.preference:preference:1.1.0' 68 | 69 | 70 | // ----------------------------------------------------------------------------- 71 | def dagger_version = "2.20" 72 | implementation "com.google.dagger:dagger-android:$dagger_version" 73 | implementation "com.google.dagger:dagger-android-support:$dagger_version" 74 | annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" 75 | implementation "com.squareup.picasso:picasso:2.71828" 76 | 77 | // ----------------------------------------------------------------------------- 78 | implementation "androidx.room:room-runtime:$version_room" 79 | implementation "androidx.room:room-coroutines:$version_room_coroutine" 80 | implementation "androidx.room:room-rxjava2:$version_room" 81 | kapt "androidx.room:room-compiler:$version_room" 82 | 83 | // Retrofit 84 | implementation 'com.squareup.retrofit2:retrofit:2.6.0' 85 | implementation 'com.squareup.retrofit2:converter-gson:2.6.0' 86 | implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:$version_retrofit_coroutines_adapter" 87 | 88 | // We will use it for loading the images 89 | implementation 'com.squareup.picasso:picasso:2.71828' 90 | 91 | // For ViewModel 92 | implementation "androidx.lifecycle:lifecycle-extensions:2.1.0" 93 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0" 94 | 95 | implementation 'com.karumi:dexter:5.0.0' 96 | 97 | // Koin 98 | implementation "org.koin:koin-android:2.0.1" 99 | implementation 'org.koin:koin-androidx-viewmodel:2.0.1' 100 | implementation 'org.koin:koin-androidx-scope:2.0.1' 101 | 102 | implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' 103 | implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0' 104 | 105 | implementation "androidx.paging:paging-runtime:2.1.0" 106 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0' 107 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.1.1' 108 | 109 | // ----------------------------------------------------------------------------- 110 | // implementation 'com.braintreepayments.api:drop-in:4.2.0' 111 | // implementation 'com.loopj.android:android-async-http:1.4.9' 112 | } 113 | 114 | android { 115 | productFlavors { 116 | flavorDimensions("dim") 117 | free { 118 | dimension "dim" 119 | applicationId "org.pbreakers.mobile.androidtest.free" 120 | } 121 | 122 | paid { 123 | dimension "dim" 124 | applicationId "org.pbreakers.mobile.androidtest.paid" 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /app/paid/release/app-paid-release.aab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/paid/release/app-paid-release.aab -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/org/pbreakers/mobile/androidtest/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest 2 | 3 | import androidx.test.espresso.Espresso.onView 4 | import androidx.test.espresso.IdlingResource 5 | import androidx.test.espresso.action.ViewActions.click 6 | import androidx.test.espresso.assertion.ViewAssertions.matches 7 | import androidx.test.espresso.matcher.ViewMatchers.withId 8 | import androidx.test.espresso.matcher.ViewMatchers.withText 9 | import androidx.test.ext.junit.runners.AndroidJUnit4 10 | import androidx.test.rule.ActivityTestRule 11 | import org.junit.Before 12 | import org.junit.Rule 13 | import org.junit.Test 14 | import org.junit.runner.RunWith 15 | import org.pbreakers.mobile.androidtest.udacity.MainActivity 16 | 17 | /** 18 | * Instrumented test, which will execute on an Android device. 19 | * 20 | * See [testing documentation](http://d.android.com/tools/testing). 21 | */ 22 | @RunWith(AndroidJUnit4::class) 23 | class ExampleInstrumentedTest { 24 | @get:Rule val activityRule = ActivityTestRule(MainActivity::class.java) 25 | lateinit var idlingResource: IdlingResource 26 | 27 | @Before 28 | fun init() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity 2 | 3 | import android.os.Bundle 4 | import android.widget.Toast 5 | import androidx.appcompat.app.AppCompatActivity 6 | import androidx.lifecycle.Observer 7 | import org.koin.androidx.viewmodel.ext.android.viewModel 8 | import org.pbreakers.mobile.androidtest.R 9 | import org.pbreakers.mobile.androidtest.udacity.utils.LoadingState 10 | import org.pbreakers.mobile.androidtest.udacity.viewmodel.UserViewModel 11 | 12 | 13 | class MainActivity : AppCompatActivity() { 14 | 15 | private val userViewModel by viewModel() 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | setContentView(R.layout.activity_main) 20 | 21 | userViewModel.data.observe(this, Observer { 22 | // Todo: Populate the recyclerView here 23 | it.forEach { githubUser -> 24 | Toast.makeText(baseContext, githubUser.login, Toast.LENGTH_SHORT).show() 25 | } 26 | }) 27 | 28 | userViewModel.loadingState.observe(this, Observer { 29 | when (it.status) { 30 | LoadingState.Status.FAILED -> Toast.makeText(baseContext, it.msg, Toast.LENGTH_SHORT).show() 31 | LoadingState.Status.RUNNING -> Toast.makeText(baseContext, "Loading", Toast.LENGTH_SHORT).show() 32 | LoadingState.Status.SUCCESS -> Toast.makeText(baseContext, "Success", Toast.LENGTH_SHORT).show() 33 | } 34 | }) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/app/App.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.app 2 | 3 | import android.app.Application 4 | import android.content.Context 5 | import androidx.multidex.MultiDex 6 | import org.koin.android.ext.koin.androidContext 7 | import org.koin.android.ext.koin.androidLogger 8 | import org.koin.core.context.startKoin 9 | import org.koin.core.logger.Level 10 | import org.pbreakers.mobile.androidtest.udacity.app.di.* 11 | 12 | class App : Application() { 13 | override fun onCreate() { 14 | super.onCreate() 15 | startKoin { 16 | androidContext(this@App) 17 | androidLogger(Level.DEBUG) 18 | modules(listOf(viewModelModule, repositoryModule, netModule, apiModule, databaseModule)) 19 | } 20 | } 21 | 22 | override fun attachBaseContext(base: Context?) { 23 | super.attachBaseContext(base) 24 | MultiDex.install(this) 25 | } 26 | } -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/app/di/Module.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.app.di 2 | 3 | import android.app.Application 4 | import androidx.room.Room 5 | import com.google.gson.FieldNamingPolicy 6 | import com.google.gson.Gson 7 | import com.google.gson.GsonBuilder 8 | import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory 9 | import okhttp3.Cache 10 | import okhttp3.OkHttpClient 11 | import org.koin.android.ext.koin.androidApplication 12 | import org.koin.dsl.module 13 | import org.pbreakers.mobile.androidtest.udacity.app.App 14 | import org.pbreakers.mobile.androidtest.udacity.model.AppDatabase 15 | import org.pbreakers.mobile.androidtest.udacity.model.api.UserApi 16 | import org.pbreakers.mobile.androidtest.udacity.model.dao.UserDao 17 | import org.pbreakers.mobile.androidtest.udacity.model.repository.UserRepository 18 | import org.pbreakers.mobile.androidtest.udacity.viewmodel.UserViewModel 19 | import retrofit2.Retrofit 20 | import retrofit2.converter.gson.GsonConverterFactory 21 | 22 | val viewModelModule = module { 23 | single { UserViewModel(get()) } 24 | } 25 | 26 | 27 | val apiModule = module { 28 | fun provideUserApi(retrofit: Retrofit): UserApi { 29 | return retrofit.create(UserApi::class.java) 30 | } 31 | 32 | single { provideUserApi(get()) } 33 | } 34 | 35 | val netModule = module { 36 | fun provideCache(application: Application): Cache { 37 | val cacheSize = 10 * 1024 * 1024 38 | return Cache(application.cacheDir, cacheSize.toLong()) 39 | } 40 | 41 | fun provideHttpClient(cache: Cache): OkHttpClient { 42 | val okHttpClientBuilder = OkHttpClient.Builder() 43 | .cache(cache) 44 | 45 | return okHttpClientBuilder.build() 46 | } 47 | 48 | fun provideGson(): Gson { 49 | return GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.IDENTITY).create() 50 | } 51 | 52 | 53 | fun provideRetrofit(factory: Gson, client: OkHttpClient): Retrofit { 54 | return Retrofit.Builder() 55 | .baseUrl("https://api.github.com/") 56 | .addConverterFactory(GsonConverterFactory.create(factory)) 57 | .addCallAdapterFactory(CoroutineCallAdapterFactory()) 58 | .client(client) 59 | .build() 60 | } 61 | 62 | single { provideCache(androidApplication()) } 63 | single { provideHttpClient(get()) } 64 | single { provideGson() } 65 | single { provideRetrofit(get(), get()) } 66 | 67 | } 68 | 69 | val databaseModule = module { 70 | 71 | fun provideDatabase(application: Application): AppDatabase { 72 | return Room.databaseBuilder(application, AppDatabase::class.java, "eds.database") 73 | .fallbackToDestructiveMigration() 74 | .allowMainThreadQueries() 75 | .build() 76 | } 77 | 78 | 79 | fun provideDao(database: AppDatabase): UserDao { 80 | return database.userDao 81 | } 82 | 83 | single { provideDatabase(androidApplication()) } 84 | single { provideDao(get()) } 85 | } 86 | 87 | val repositoryModule = module { 88 | fun provideUserRepository(api: UserApi, dao: UserDao): UserRepository { 89 | return UserRepository(api, dao) 90 | } 91 | 92 | single { provideUserRepository(get(), get()) } 93 | } -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/model/AppDatabase.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.model 2 | 3 | import androidx.room.Database 4 | import androidx.room.RoomDatabase 5 | import org.pbreakers.mobile.androidtest.udacity.model.dao.UserDao 6 | import org.pbreakers.mobile.androidtest.udacity.model.entity.GithubUser 7 | 8 | @Database(entities = [GithubUser::class], version = 1, exportSchema = false) 9 | abstract class AppDatabase : RoomDatabase() { 10 | abstract val userDao: UserDao 11 | } -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/model/api/UserApi.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.model.api 2 | 3 | import kotlinx.coroutines.Deferred 4 | import org.pbreakers.mobile.androidtest.udacity.model.entity.GithubUser 5 | import retrofit2.http.GET 6 | 7 | interface UserApi { 8 | 9 | @GET("users") 10 | fun getAllAsync(): Deferred> 11 | } -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/model/dao/UserDao.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.model.dao 2 | 3 | import androidx.lifecycle.LiveData 4 | import androidx.room.Dao 5 | import androidx.room.Insert 6 | import androidx.room.OnConflictStrategy 7 | import androidx.room.Query 8 | import org.pbreakers.mobile.androidtest.udacity.model.entity.GithubUser 9 | 10 | @Dao 11 | interface UserDao { 12 | 13 | @Query("SELECT * FROM users") 14 | fun findAll(): LiveData> 15 | 16 | @Insert(onConflict = OnConflictStrategy.REPLACE) 17 | fun add(users: List) 18 | } -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/model/entity/GithubUser.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.model.entity 2 | 3 | import androidx.room.Entity 4 | import androidx.room.PrimaryKey 5 | 6 | @Entity(tableName = "users") 7 | data class GithubUser( 8 | @PrimaryKey val id: Long, 9 | val login: String, 10 | val avatar_url: String 11 | ) -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/model/repository/UserRepository.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.model.repository 2 | 3 | import kotlinx.coroutines.Dispatchers 4 | import kotlinx.coroutines.withContext 5 | import org.pbreakers.mobile.androidtest.udacity.model.api.UserApi 6 | import org.pbreakers.mobile.androidtest.udacity.model.dao.UserDao 7 | 8 | class UserRepository(private val userApi: UserApi, private val userDao: UserDao) { 9 | 10 | val data = userDao.findAll() 11 | 12 | suspend fun refresh() { 13 | withContext(Dispatchers.IO) { 14 | val users = userApi.getAllAsync().await() 15 | userDao.add(users) 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/utils/LoadingState.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.utils 2 | 3 | 4 | 5 | @Suppress("DataClassPrivateConstructor") 6 | data class LoadingState private constructor(val status: Status, val msg: String? = null) { 7 | companion object { 8 | val LOADED = LoadingState(Status.SUCCESS) 9 | val LOADING = LoadingState(Status.RUNNING) 10 | fun error(msg: String?) = LoadingState(Status.FAILED, msg) 11 | } 12 | 13 | enum class Status { 14 | RUNNING, 15 | SUCCESS, 16 | FAILED 17 | } 18 | } -------------------------------------------------------------------------------- /app/src/main/java/org/pbreakers/mobile/androidtest/udacity/viewmodel/UserViewModel.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest.udacity.viewmodel 2 | 3 | import androidx.lifecycle.LiveData 4 | import androidx.lifecycle.MutableLiveData 5 | import androidx.lifecycle.ViewModel 6 | import androidx.lifecycle.viewModelScope 7 | import kotlinx.coroutines.launch 8 | import org.pbreakers.mobile.androidtest.udacity.model.repository.UserRepository 9 | import org.pbreakers.mobile.androidtest.udacity.utils.LoadingState 10 | 11 | class UserViewModel(private val userRepository: UserRepository) : ViewModel() { 12 | 13 | private val _loadingState = MutableLiveData() 14 | val loadingState: LiveData 15 | get() = _loadingState 16 | 17 | val data = userRepository.data 18 | 19 | init { 20 | fetchData() 21 | } 22 | 23 | private fun fetchData() { 24 | viewModelScope.launch { 25 | try { 26 | _loadingState.value = LoadingState.LOADING 27 | userRepository.refresh() 28 | _loadingState.value = LoadingState.LOADED 29 | } catch (e: Exception) { 30 | _loadingState.value = LoadingState.error(e.message) 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/check.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dice_1.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 60 | 63 | 66 | 67 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dice_2.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 60 | 63 | 66 | 67 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dice_3.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 60 | 63 | 66 | 67 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dice_4.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 60 | 63 | 66 | 69 | 70 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dice_5.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 60 | 63 | 66 | 69 | 72 | 75 | 76 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dice_6.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 60 | 63 | 66 | 69 | 72 | 75 | 78 | 81 | 82 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/empty_dice.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_check_box.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_check_box_check.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_cloud_done_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_lightbulb_outline_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/drawable/login.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/login_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | #aeaaaaaa 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Android Demo 3 | 4 | Special: %s 5 | Price: %s 6 | Lesson One 7 | Lesson Two 8 | Lesson Tree 9 | Lesson Four 10 | Lesson Five 11 | Lesson Sive 12 | Lesson Seven 13 | Lesson Eight 14 | Lesson Nine 15 | Lesson Ten 16 | Hello blank fragment 17 | 18 | 19 | color 20 | Couleur 21 | #fff 22 | Couleur 23 | Selectionner la couleur de votre choix 24 | amount 25 | key 26 | Big Text Sum : You can define a property in the primary constructor by prefixing a parameter 27 | Big Text : You can define a property in the primary constructor by prefixing a parameter with val or var. You can define a property outside the constructor by adding it to the class body 28 | 29 | Red 30 | Blue 31 | Green 32 | 33 | 34 | 35 | #FF0000 36 | #283593 37 | #2E7D32 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 16 | 17 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/xml/setting.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 10 | 11 | 18 | 19 | 26 | 27 | 35 | 36 | 37 | 44 | 45 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/test/java/org/pbreakers/mobile/androidtest/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package org.pbreakers.mobile.androidtest 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | kotlin_version = '1.3.21' 6 | version_core = "1.0.1" 7 | version_constraint_layout = "1.1.3" 8 | version_lifecycle_extensions = "2.0.0" 9 | version_material = "1.0.0" 10 | version_navigation = "1.0.0" 11 | version_glide = "4.9.0" 12 | version_kotlin_coroutines = "1.3.0-M2" 13 | version_moshi = "1.8.0" 14 | version_retrofit = "2.5.0" 15 | version_retrofit_coroutines_adapter = "0.9.2" 16 | version_work = "1.0.0-alpha11" 17 | version_timber = "4.7.1" 18 | version_room = "2.1.0" 19 | version_room_coroutine = "2.1.0-alpha04" 20 | version_app_center = "2.2.0" 21 | } 22 | repositories { 23 | google() 24 | jcenter() 25 | 26 | } 27 | dependencies { 28 | classpath 'com.android.tools.build:gradle:3.5.0' 29 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 30 | // classpath 'com.google.gms:google-services:4.1.0' 31 | // NOTE: Do not place your application dependencies here; they belong 32 | // in the individual module build.gradle files 33 | } 34 | } 35 | 36 | allprojects { 37 | repositories { 38 | google() 39 | jcenter() 40 | maven { url 'https://maven.fabric.io/public' } 41 | } 42 | } 43 | 44 | task clean(type: Delete) { 45 | delete rootProject.buildDir 46 | } 47 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # Kotlin code style for this project: "official" or "obsolete": 15 | kotlin.code.style=official 16 | android.useAndroidX=true 17 | android.enableJetifier=true 18 | android.databinding.enableV2=true 19 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-ampire/android-clean-architecture/81bd75361560d45e153bd3c0c4ee94999159f6cd/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Aug 22 15:56:48 EET 2019 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-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /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 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 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 Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------