diff --git a/app/.gitignore b/app/.gitignore index 42afabf..796b96d 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1 @@ -/build \ No newline at end of file +/build diff --git a/app/build.gradle b/app/build.gradle index 97fc1a7..d08b275 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,44 +1,60 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' -} +apply from: '../versions.gradle' +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" + compileSdkVersion build_versions.target_sdk + buildToolsVersion build_versions.build_tools defaultConfig { applicationId "dev.carlos.acronyms" - minSdkVersion 21 - targetSdkVersion 30 + minSdkVersion build_versions.min_sdk + targetSdkVersion build_versions.target_sdk versionCode 1 versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + + buildConfigField "String", "BASE_ENDPOINT", '"http://www.nactem.ac.uk/software/acromine/"' } buildTypes { + debug { + applicationIdSuffix '.debug' + debuggable true + signingConfig signingConfigs.debug + } release { - minifyEnabled false + debuggable false + minifyEnabled true + signingConfig signingConfigs.debug proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + kotlinOptions { - jvmTarget = '1.8' + jvmTarget = JavaVersion.VERSION_1_8.toString() + } + + testOptions { + unitTests.returnDefaultValues = true + } + + lintOptions { + abortOnError false + } + + buildFeatures { + viewBinding true + dataBinding true } } dependencies { - - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.3.1' - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'com.google.android.material:material:1.3.0' - testImplementation 'junit:junit:4.+' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + implementation project(":core") } \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..f1b4245 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,4 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile diff --git a/base.gradle b/base.gradle new file mode 100644 index 0000000..6b9694a --- /dev/null +++ b/base.gradle @@ -0,0 +1,41 @@ +apply from: '../versions.gradle' +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' + +android { + compileSdkVersion build_versions.target_sdk + buildToolsVersion build_versions.build_tools + + defaultConfig { + minSdkVersion build_versions.min_sdk + targetSdkVersion build_versions.target_sdk + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } + + testOptions { + unitTests.returnDefaultValues = true + } + + lintOptions { + abortOnError false + } + + buildFeatures { + viewBinding true + dataBinding true + } +} + +dependencies { + kapt deps.core.room.compiler +} diff --git a/build.gradle b/build.gradle index 41df201..297bbc0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,25 +1,19 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = "1.5.10" - repositories { - google() - mavenCentral() - } - dependencies { - classpath "com.android.tools.build:gradle:4.2.1" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + apply from: 'versions.gradle' - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + addRepos(repositories) + + dependencies { + classpath deps.project.kotlin + classpath deps.project.gradle } + + ext.kotlin_version = build_versions.kotlin } allprojects { - repositories { - google() - mavenCentral() - jcenter() // Warning: this repository is going to shut down soon - } + addRepos(repositories) } task clean(type: Delete) { diff --git a/core/.gitignore b/core/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/core/.gitignore @@ -0,0 +1 @@ +/build diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 0000000..6372e2c --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,31 @@ +apply from: '../versions.gradle' +apply from: '../base.gradle' +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' + +dependencies { + api deps.google.kotlin.std_lib + api deps.google.androidx.appcompat + api deps.google.androidx.core_ktx + api deps.google.androidx.constraint_layout + api deps.google.androidx.lifecycle_ext + api deps.google.androidx.lifecycle_viewmodel + api deps.google.androidx.recycler_view + api deps.google.androidx.navigation_fragment + api deps.google.androidx.navigation_ui + api deps.google.material.core + api deps.core.okhttp.logging_interceptor + api deps.core.retrofit.runtime + api deps.core.retrofit.gson + api deps.core.retrofit.rx + api deps.core.room.runtime + api deps.core.koin.core + api deps.core.koin.scope + api deps.core.koin.viewmodel + api deps.core.rx.core + api deps.core.rx.android + api deps.core.thirdparty.timber + + kapt deps.core.room.compiler +} diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/core/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml new file mode 100644 index 0000000..30592ff --- /dev/null +++ b/core/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/core/src/main/res/drawable-v24/ic_launcher_foreground.xml b/core/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1448aba --- /dev/null +++ b/core/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/src/main/res/drawable/ic_launcher_background.xml b/core/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..445d0d5 --- /dev/null +++ b/core/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..03eed25 --- /dev/null +++ b/core/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/core/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..03eed25 --- /dev/null +++ b/core/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/src/main/res/mipmap-hdpi/ic_launcher.png b/core/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a571e60 Binary files /dev/null and b/core/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/core/src/main/res/mipmap-hdpi/ic_launcher_round.png b/core/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..61da551 Binary files /dev/null and b/core/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/core/src/main/res/mipmap-mdpi/ic_launcher.png b/core/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c41dd28 Binary files /dev/null and b/core/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/core/src/main/res/mipmap-mdpi/ic_launcher_round.png b/core/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..db5080a Binary files /dev/null and b/core/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/core/src/main/res/mipmap-xhdpi/ic_launcher.png b/core/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6dba46d Binary files /dev/null and b/core/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/core/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/core/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..da31a87 Binary files /dev/null and b/core/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/core/src/main/res/mipmap-xxhdpi/ic_launcher.png b/core/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..15ac681 Binary files /dev/null and b/core/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/core/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/core/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..b216f2d Binary files /dev/null and b/core/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/core/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/core/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..f25a419 Binary files /dev/null and b/core/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/core/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/core/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/core/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/core/src/main/res/values-night/themes.xml b/core/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..7558bbb --- /dev/null +++ b/core/src/main/res/values-night/themes.xml @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml new file mode 100644 index 0000000..09837df --- /dev/null +++ b/core/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml new file mode 100644 index 0000000..75f77d2 --- /dev/null +++ b/core/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + core + \ No newline at end of file diff --git a/core/src/main/res/values/themes.xml b/core/src/main/res/values/themes.xml new file mode 100644 index 0000000..a6cea39 --- /dev/null +++ b/core/src/main/res/values/themes.xml @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 26285aa..e89e7cc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ rootProject.name = "Acronyms" -include ':app' +include ':app', ':core' diff --git a/versions.gradle b/versions.gradle new file mode 100644 index 0000000..9aab55f --- /dev/null +++ b/versions.gradle @@ -0,0 +1,114 @@ +ext.deps = [:] + +def versions = [:] +versions.kotlin = "1.5.10" +versions.gradle = "4.2.1" +versions.room = "2.3.0" +versions.androidx_appcompat = "1.3.0" +versions.androidx_core = "1.3.2" +versions.androidx_constraint_layout = "2.0.4" +versions.androidx_lifecycle = "2.2.0" +versions.androidx_recycler_view = "1.2.0" +versions.androidx_navigation = "2.3.5" +versions.material_core = "1.3.0" +versions.okhttp_interceptor = "4.9.1" +versions.retrofit = "2.9.0" +versions.timber = "4.7.1" +versions.koin = "2.2.3" +versions.rx_core = "2.2.21" +versions.rx_android = "2.1.1" +versions.junit = "4.13.2" +versions.test = "1.3.0" +versions.test_ext = "1.1.2" +versions.espresso = "3.3.0" + +def build_versions = [:] +build_versions.min_sdk = 21 +build_versions.target_sdk = 30 +build_versions.build_tools = "30.0.3" +build_versions.kotlin = "$versions.kotlin" +ext.build_versions = build_versions + +def deps = [:] + +def project = [:] +project.kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin" +project.gradle = "com.android.tools.build:gradle:$versions.gradle" +deps.project = project + +def kotlin = [:] +kotlin.version = "$versions.kotlin" +kotlin.std_lib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin" + +def androidx = [:] +androidx.appcompat = "androidx.appcompat:appcompat:$versions.androidx_appcompat" +androidx.core_ktx = "androidx.core:core-ktx:$versions.androidx_core" +androidx.constraint_layout = "androidx.constraintlayout:constraintlayout:$versions.androidx_constraint_layout" +androidx.lifecycle_ext = "androidx.lifecycle:lifecycle-extensions:$versions.androidx_lifecycle" +androidx.lifecycle_viewmodel = "androidx.lifecycle:lifecycle-viewmodel-ktx:$versions.androidx_lifecycle" +androidx.recycler_view = "androidx.recyclerview:recyclerview:$versions.androidx_recycler_view" +androidx.navigation_fragment = "androidx.navigation:navigation-fragment-ktx:$versions.androidx_navigation" +androidx.navigation_ui = "androidx.navigation:navigation-ui-ktx:$versions.androidx_navigation" + +def material = [:] +material.core = "com.google.android.material:material:$versions.material_core" + +def google = [:] +google.kotlin = kotlin +google.androidx = androidx +google.material = material +deps.google = google + +def room = [:] +room.runtime = "androidx.room:room-runtime:$versions.room" +room.compiler = "androidx.room:room-compiler:$versions.room" + +def koin = [:] +koin.core = "io.insert-koin:koin-android:$versions.koin" +koin.scope = "io.insert-koin:koin-androidx-scope:$versions.koin" +koin.viewmodel = "io.insert-koin:koin-androidx-viewmodel:$versions.koin" + +def rx = [:] +rx.core = "io.reactivex.rxjava2:rxjava:$versions.rx_core" +rx.android = "io.reactivex.rxjava2:rxandroid:$versions.rx_android" +deps.rx = rx + +def okhttp = [:] +okhttp.logging_interceptor = "com.squareup.okhttp3:logging-interceptor:$versions.okhttp_interceptor" + +def retrofit = [:] +retrofit.runtime = "com.squareup.retrofit2:retrofit:$versions.retrofit" +retrofit.gson = "com.squareup.retrofit2:converter-gson:$versions.retrofit" +retrofit.mock = "com.squareup.retrofit2:retrofit-mock:$versions.retrofit" +retrofit.rx = "com.squareup.retrofit2:adapter-rxjava2:$versions.retrofit" + +def thirdparty = [:] +thirdparty.timber = "com.jakewharton.timber:timber:$versions.timber" + +def core = [:] +core.room = room +core.koin = koin +core.rx = rx +core.okhttp = okhttp +core.retrofit = retrofit +core.thirdparty = thirdparty +deps.core = core + +def testing = [:] +testing.junit = "junit:junit:$versions.junit" +testing.core = "androidx.test:core:$versions.test" +testing.rules = "androidx.test:rules:$versions.test" +testing.runner = "androidx.test:runner:$versions.test" +testing.ext = "androidx.test.ext:junit:$versions.test_ext" +testing.koin = "org.koin:koin-test:$versions.koin" +testing.espresso = "androidx.test.espresso:espresso-core:$versions.espresso" +deps.testing = testing + +ext.deps = deps + +static def addRepos(RepositoryHandler handler) { + handler.google() + handler.mavenCentral() +} + +ext.addRepos = this.&addRepos