From e3cdc2af2b50e23310be5f8154fd2052958cb4ee Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Sun, 2 Feb 2020 10:54:43 -0300 Subject: [PATCH] reestructure gradle config so modules can implement a base configuration --- app/src/main/AndroidManifest.xml | 19 ++++++++++-- .../com/hako/friendlists/MainApplication.kt | 7 +++++ .../com/hako/friendlists/home/HomeActivity.kt | 7 +++++ app/src/main/res/values/colors.xml | 7 +++-- core.gradle | 29 +++++++++++++++++++ settings.gradle | 2 +- userlist/.gitignore | 1 + userlist/build.gradle | 6 ++++ userlist/consumer-rules.pro | 0 userlist/proguard-rules.pro | 21 ++++++++++++++ .../ExampleInstrumentedTest.kt | 24 +++++++++++++++ userlist/src/main/AndroidManifest.xml | 2 ++ userlist/src/main/res/values/strings.xml | 3 ++ .../friendlist_userlist/ExampleUnitTest.kt | 17 +++++++++++ 14 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/com/hako/friendlists/MainApplication.kt create mode 100644 app/src/main/java/com/hako/friendlists/home/HomeActivity.kt create mode 100644 core.gradle create mode 100644 userlist/.gitignore create mode 100644 userlist/build.gradle create mode 100644 userlist/consumer-rules.pro create mode 100644 userlist/proguard-rules.pro create mode 100644 userlist/src/androidTest/java/com/hako/friendlist_userlist/ExampleInstrumentedTest.kt create mode 100644 userlist/src/main/AndroidManifest.xml create mode 100644 userlist/src/main/res/values/strings.xml create mode 100644 userlist/src/test/java/com/hako/friendlist_userlist/ExampleUnitTest.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cfc8478..5322f2e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,10 +2,25 @@ package="com.hako.friendlists"> + android:supportsRtl="false" + android:theme="@style/AppTheme"> + + + + + + + + + + + diff --git a/app/src/main/java/com/hako/friendlists/MainApplication.kt b/app/src/main/java/com/hako/friendlists/MainApplication.kt new file mode 100644 index 0000000..4e58a5a --- /dev/null +++ b/app/src/main/java/com/hako/friendlists/MainApplication.kt @@ -0,0 +1,7 @@ +package com.hako.friendlists + +import android.app.Application + +class MainApplication : Application() { + +} \ No newline at end of file diff --git a/app/src/main/java/com/hako/friendlists/home/HomeActivity.kt b/app/src/main/java/com/hako/friendlists/home/HomeActivity.kt new file mode 100644 index 0000000..9147d3e --- /dev/null +++ b/app/src/main/java/com/hako/friendlists/home/HomeActivity.kt @@ -0,0 +1,7 @@ +package com.hako.friendlists.home + +import androidx.appcompat.app.AppCompatActivity + +class HomeActivity : AppCompatActivity() { + +} \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 69b2233..3743e89 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,7 @@ - #008577 - #00574B - #D81B60 + #37474F + #324047 + #CBCFD1 + #D32F2F diff --git a/core.gradle b/core.gradle new file mode 100644 index 0000000..e0be423 --- /dev/null +++ b/core.gradle @@ -0,0 +1,29 @@ +apply from: '../versions.gradle' +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' +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 + } + + testOptions { + unitTests.returnDefaultValues = true + } + + lintOptions { + abortOnError false + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index c723749..0e9eb61 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -include ':app', ':base' +include ':app', ':base', ':userlist' rootProject.name='Friendlists' diff --git a/userlist/.gitignore b/userlist/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/userlist/.gitignore @@ -0,0 +1 @@ +/build diff --git a/userlist/build.gradle b/userlist/build.gradle new file mode 100644 index 0000000..298aaa6 --- /dev/null +++ b/userlist/build.gradle @@ -0,0 +1,6 @@ +apply plugin: 'com.android.library' +apply from: '../core.gradle' + +dependencies { + implementation project(':base') +} diff --git a/userlist/consumer-rules.pro b/userlist/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/userlist/proguard-rules.pro b/userlist/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/userlist/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/userlist/src/androidTest/java/com/hako/friendlist_userlist/ExampleInstrumentedTest.kt b/userlist/src/androidTest/java/com/hako/friendlist_userlist/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..fe782da --- /dev/null +++ b/userlist/src/androidTest/java/com/hako/friendlist_userlist/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.hako.friendlist_userlist + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.hako.friendlist_userlist.test", appContext.packageName) + } +} diff --git a/userlist/src/main/AndroidManifest.xml b/userlist/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d577ea7 --- /dev/null +++ b/userlist/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + diff --git a/userlist/src/main/res/values/strings.xml b/userlist/src/main/res/values/strings.xml new file mode 100644 index 0000000..1d5d98a --- /dev/null +++ b/userlist/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + userlist + diff --git a/userlist/src/test/java/com/hako/friendlist_userlist/ExampleUnitTest.kt b/userlist/src/test/java/com/hako/friendlist_userlist/ExampleUnitTest.kt new file mode 100644 index 0000000..fc064f1 --- /dev/null +++ b/userlist/src/test/java/com/hako/friendlist_userlist/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.hako.friendlist_userlist + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +}