├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── themes.xml │ │ │ │ └── colors.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── dj │ │ │ │ └── composetheming │ │ │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── dj │ │ │ └── composetheming │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── dj │ │ └── composetheming │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── components ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── dj │ │ │ └── components │ │ │ ├── InputField.kt │ │ │ └── OutlinedInputField.kt │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── dj │ │ │ └── components │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── dj │ │ └── components │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── applications ├── facebook │ ├── .gitignore │ ├── consumer-rules.pro │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── font │ │ │ │ │ └── interregular.ttf │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── dj │ │ │ │ └── facebook │ │ │ │ ├── ui │ │ │ │ └── theme │ │ │ │ │ ├── ComponentType.kt │ │ │ │ │ ├── Shape.kt │ │ │ │ │ ├── Color.kt │ │ │ │ │ ├── Theme.kt │ │ │ │ │ └── Type.kt │ │ │ │ └── FacebookApp.kt │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── dj │ │ │ │ └── facebook │ │ │ │ └── ExampleUnitTest.kt │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── dj │ │ │ └── facebook │ │ │ └── ExampleInstrumentedTest.kt │ ├── proguard-rules.pro │ └── build.gradle └── linkedin │ ├── .gitignore │ ├── consumer-rules.pro │ ├── src │ ├── main │ │ ├── res │ │ │ └── font │ │ │ │ └── playfairdisplayregular.ttf │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── dj │ │ │ └── linkedin │ │ │ ├── ui │ │ │ └── theme │ │ │ │ ├── ComponentType.kt │ │ │ │ ├── Shape.kt │ │ │ │ ├── Color.kt │ │ │ │ ├── Theme.kt │ │ │ │ └── Type.kt │ │ │ └── LinkedInApp.kt │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── dj │ │ │ └── linkedin │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── dj │ │ └── linkedin │ │ └── ExampleInstrumentedTest.kt │ ├── proguard-rules.pro │ └── build.gradle ├── features └── registration │ ├── .gitignore │ ├── consumer-rules.pro │ ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── dj │ │ │ └── registration │ │ │ ├── theme │ │ │ ├── ComponentType.kt │ │ │ ├── ExtendedShape.kt │ │ │ ├── ExtendedTypography.kt │ │ │ ├── ExtendedTheme.kt │ │ │ └── ExtendedColor.kt │ │ │ ├── RegistrationScreen.kt │ │ │ └── common │ │ │ └── UserInput.kt │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── dj │ │ │ └── registration │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── dj │ │ └── registration │ │ └── ExampleInstrumentedTest.kt │ ├── proguard-rules.pro │ └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── readmeAssets ├── Screenshot_20220712_225015.png ├── Screenshot_20220712_225203.png ├── Screenshot_20220712_232631.png ├── Screenshot_20220715_003025.png └── Screenshot_20220715_004244.png ├── .gitignore ├── settings.gradle ├── LICENSE.md ├── gradle.properties ├── dependencies.gradle ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /components/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /components/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/facebook/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /applications/linkedin/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /features/registration/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /applications/facebook/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /applications/linkedin/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /features/registration/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ComposeTheming 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /readmeAssets/Screenshot_20220712_225015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/readmeAssets/Screenshot_20220712_225015.png -------------------------------------------------------------------------------- /readmeAssets/Screenshot_20220712_225203.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/readmeAssets/Screenshot_20220712_225203.png -------------------------------------------------------------------------------- /readmeAssets/Screenshot_20220712_232631.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/readmeAssets/Screenshot_20220712_232631.png -------------------------------------------------------------------------------- /readmeAssets/Screenshot_20220715_003025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/readmeAssets/Screenshot_20220715_003025.png -------------------------------------------------------------------------------- /readmeAssets/Screenshot_20220715_004244.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/readmeAssets/Screenshot_20220715_004244.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /applications/facebook/src/main/res/font/interregular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/applications/facebook/src/main/res/font/interregular.ttf -------------------------------------------------------------------------------- /applications/linkedin/src/main/res/font/playfairdisplayregular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daniyaljavaid/ThemingInCompose/HEAD/applications/linkedin/src/main/res/font/playfairdisplayregular.ttf -------------------------------------------------------------------------------- /components/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /applications/facebook/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /applications/linkedin/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /features/registration/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /applications/facebook/src/main/java/com/dj/facebook/ui/theme/ComponentType.kt: -------------------------------------------------------------------------------- 1 | package com.dj.facebook.ui.theme 2 | 3 | import com.dj.registration.theme.* 4 | 5 | val FacebookComponentTypes = ComponentType( 6 | inputField = InputFieldType.Outlined 7 | ) -------------------------------------------------------------------------------- /applications/linkedin/src/main/java/com/dj/linkedin/ui/theme/ComponentType.kt: -------------------------------------------------------------------------------- 1 | package com.dj.linkedin.ui.theme 2 | 3 | import com.dj.registration.theme.* 4 | 5 | val LinkedInComponentTypes = ComponentType( 6 | inputField = InputFieldType.Filled 7 | ) -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jul 08 22:48:43 PKT 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | /.idea/caches 6 | /.idea/libraries 7 | /.idea/modules.xml 8 | /.idea/workspace.xml 9 | /.idea/navEditor.xml 10 | /.idea/assetWizardSettings.xml 11 | .DS_Store 12 | /build 13 | /captures 14 | .externalNativeBuild 15 | .cxx 16 | local.properties 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /applications/facebook/src/main/java/com/dj/facebook/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | package com.dj.facebook.ui.theme 2 | 3 | import androidx.compose.foundation.shape.RoundedCornerShape 4 | import androidx.compose.ui.unit.dp 5 | import com.dj.registration.theme.* 6 | 7 | val FacebookExtendedShapes = ExtendedShape( 8 | submitButtonShape = RoundedCornerShape(10.dp) 9 | ) -------------------------------------------------------------------------------- /applications/linkedin/src/main/java/com/dj/linkedin/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | package com.dj.linkedin.ui.theme 2 | 3 | import androidx.compose.foundation.shape.RoundedCornerShape 4 | import androidx.compose.ui.unit.dp 5 | import com.dj.registration.theme.* 6 | 7 | val LinkedInExtendedShapes = ExtendedShape( 8 | submitButtonShape = RoundedCornerShape(100.dp) 9 | ) -------------------------------------------------------------------------------- /applications/facebook/src/main/java/com/dj/facebook/FacebookApp.kt: -------------------------------------------------------------------------------- 1 | package com.dj.facebook 2 | 3 | import androidx.compose.runtime.Composable 4 | import com.dj.facebook.ui.theme.FacebookTheme 5 | import com.dj.registration.RegistrationScreen 6 | 7 | @Composable 8 | fun FacebookApp() { 9 | FacebookTheme { 10 | RegistrationScreen() 11 | } 12 | } -------------------------------------------------------------------------------- /applications/linkedin/src/main/java/com/dj/linkedin/LinkedInApp.kt: -------------------------------------------------------------------------------- 1 | package com.dj.linkedin 2 | 3 | import androidx.compose.runtime.Composable 4 | import com.dj.linkedin.ui.theme.LinkedInTheme 5 | import com.dj.registration.RegistrationScreen 6 | 7 | @Composable 8 | fun LinkedInApp() { 9 | LinkedInTheme { 10 | RegistrationScreen() 11 | } 12 | } -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /components/src/test/java/com/dj/components/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.components 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 | } -------------------------------------------------------------------------------- /app/src/test/java/com/dj/composetheming/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.composetheming 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 | } -------------------------------------------------------------------------------- /applications/facebook/src/test/java/com/dj/facebook/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.facebook 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 | } -------------------------------------------------------------------------------- /applications/linkedin/src/test/java/com/dj/linkedin/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.linkedin 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 | } -------------------------------------------------------------------------------- /features/registration/src/test/java/com/dj/registration/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration 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 | } -------------------------------------------------------------------------------- /features/registration/src/main/java/com/dj/registration/theme/ComponentType.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration.theme 2 | 3 | import androidx.compose.runtime.Immutable 4 | import androidx.compose.runtime.staticCompositionLocalOf 5 | 6 | 7 | enum class InputFieldType { 8 | Filled, Outlined 9 | } 10 | 11 | @Immutable 12 | data class ComponentType( 13 | val inputField: InputFieldType 14 | ) 15 | 16 | val LocalComponentTypes = staticCompositionLocalOf { 17 | ComponentType( 18 | inputField = InputFieldType.Filled 19 | ) 20 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | rootProject.name = "ComposeTheming" 16 | include ':app' 17 | include ':components' 18 | include ':features:registration' 19 | include ':applications:linkedin' 20 | include ':applications:facebook' 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/dj/composetheming/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.dj.composetheming 2 | 3 | import android.os.Bundle 4 | import androidx.activity.ComponentActivity 5 | import androidx.activity.compose.setContent 6 | import com.dj.facebook.FacebookApp 7 | import com.dj.linkedin.LinkedInApp 8 | 9 | class MainActivity : ComponentActivity() { 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | setContent { 13 | // LinkedInApp() 14 | FacebookApp() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /features/registration/src/main/java/com/dj/registration/theme/ExtendedShape.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration.theme 2 | 3 | import androidx.compose.foundation.shape.RoundedCornerShape 4 | import androidx.compose.runtime.Immutable 5 | import androidx.compose.runtime.staticCompositionLocalOf 6 | import androidx.compose.ui.graphics.Shape 7 | import androidx.compose.ui.unit.dp 8 | 9 | @Immutable 10 | data class ExtendedShape( 11 | val submitButtonShape: Shape 12 | ) 13 | 14 | val LocalExtendedShapes = staticCompositionLocalOf { 15 | ExtendedShape( 16 | submitButtonShape = RoundedCornerShape(4.dp) 17 | ) 18 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/dj/composetheming/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.composetheming 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.dj.composetheming", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /components/src/androidTest/java/com/dj/components/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.components 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.dj.components.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /applications/facebook/src/androidTest/java/com/dj/facebook/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.facebook 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.dj.facebook.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /applications/linkedin/src/androidTest/java/com/dj/linkedin/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.linkedin 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.dj.linkedin.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /features/registration/src/androidTest/java/com/dj/registration/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.dj.registration.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /components/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 -------------------------------------------------------------------------------- /applications/facebook/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 -------------------------------------------------------------------------------- /applications/linkedin/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 -------------------------------------------------------------------------------- /features/registration/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 -------------------------------------------------------------------------------- /applications/linkedin/src/main/java/com/dj/linkedin/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | package com.dj.linkedin.ui.theme 2 | 3 | import androidx.compose.ui.graphics.Color 4 | import com.dj.registration.theme.ExtendedColors 5 | import com.dj.registration.theme.InputFieldColors 6 | import com.dj.registration.theme.SubmitButtonColors 7 | 8 | val Red200 = Color(0xFFEF9A9A) 9 | val Red500 = Color(0xFFF44336) 10 | val Red700 = Color(0xFFD32F2F) 11 | val Teal200 = Color(0xFF03DAC5) 12 | 13 | val LinkedInExtendedColors = ExtendedColors( 14 | inputFieldColors = InputFieldColors( 15 | unFocusedBorderColor = Red200, 16 | focusedBorderColor = Red500, 17 | focusedLabelColor = Red500, 18 | cursorColor = Red500, 19 | backgroundColor = Color.Transparent 20 | ), 21 | submitButtonColors = SubmitButtonColors( 22 | bgColor = Red500, 23 | textColor = Color.White 24 | ) 25 | ) -------------------------------------------------------------------------------- /applications/facebook/src/main/java/com/dj/facebook/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | package com.dj.facebook.ui.theme 2 | 3 | import androidx.compose.ui.graphics.Color 4 | import com.dj.registration.theme.ExtendedColors 5 | import com.dj.registration.theme.InputFieldColors 6 | import com.dj.registration.theme.SubmitButtonColors 7 | 8 | val Purple200 = Color(0xFFBB86FC) 9 | val Purple500 = Color(0xFF6200EE) 10 | val Purple700 = Color(0xFF3700B3) 11 | val Teal200 = Color(0xFF03DAC5) 12 | 13 | val FacebookExtendedColors = ExtendedColors( 14 | inputFieldColors = InputFieldColors( 15 | unFocusedBorderColor = Purple200, 16 | focusedBorderColor = Purple700, 17 | focusedLabelColor = Purple500, 18 | cursorColor = Purple200, 19 | backgroundColor = Color.Transparent 20 | ), 21 | submitButtonColors = SubmitButtonColors( 22 | bgColor = Purple700, 23 | textColor = Color.White 24 | ) 25 | ) -------------------------------------------------------------------------------- /features/registration/src/main/java/com/dj/registration/theme/ExtendedTypography.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration.theme 2 | 3 | import androidx.compose.runtime.Immutable 4 | import androidx.compose.runtime.staticCompositionLocalOf 5 | import androidx.compose.ui.text.TextStyle 6 | 7 | @Immutable 8 | data class ExtendedTypography( 9 | val inputFieldTypography: InputFieldTypography 10 | ) 11 | 12 | @Immutable 13 | data class InputFieldTypography( 14 | val label: TextStyle, 15 | val text: TextStyle 16 | ) 17 | 18 | // Note: accessible using -==- LocalExtendedTypography.current.inputField -==- 19 | // LocalExtendedTypography is to be provided by applications, else these default values will be used 20 | val LocalExtendedTypography = staticCompositionLocalOf { 21 | ExtendedTypography( 22 | inputFieldTypography = InputFieldTypography( 23 | label = TextStyle.Default, 24 | text = TextStyle.Default 25 | ) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /features/registration/src/main/java/com/dj/registration/theme/ExtendedTheme.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration.theme 2 | 3 | import androidx.compose.material.MaterialTheme 4 | import androidx.compose.runtime.Composable 5 | 6 | // Note: accessible using -==- MaterialTheme.customTypography.* -==- 7 | // Note: accessible using -==- MaterialTheme.customColors.* -==- 8 | // Note: accessible using -==- MaterialTheme.componentTypes.* -==- 9 | // Note: accessible using -==- MaterialTheme.customShapes.* -==- 10 | val MaterialTheme.customTypography: ExtendedTypography 11 | @Composable 12 | get() = LocalExtendedTypography.current 13 | 14 | val MaterialTheme.customColors: ExtendedColors 15 | @Composable 16 | get() = LocalExtendedColors.current 17 | 18 | val MaterialTheme.componentTypes: ComponentType 19 | @Composable 20 | get() = LocalComponentTypes.current 21 | 22 | val MaterialTheme.customShapes: ExtendedShape 23 | @Composable 24 | get() = LocalExtendedShapes.current 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 daniyaljavaid 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. 22 | -------------------------------------------------------------------------------- /components/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'org.jetbrains.kotlin.android' 4 | } 5 | 6 | android { 7 | compileSdk compileVersion 8 | 9 | defaultConfig { 10 | minSdk minVersion 11 | targetSdk targetVersion 12 | 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | consumerProguardFiles "consumer-rules.pro" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | compileOptions { 24 | sourceCompatibility JavaVersion.VERSION_1_8 25 | targetCompatibility JavaVersion.VERSION_1_8 26 | } 27 | kotlinOptions { 28 | jvmTarget = jvmVersion 29 | } 30 | buildFeatures { 31 | compose true 32 | } 33 | composeOptions { 34 | kotlinCompilerExtensionVersion compose_version 35 | } 36 | } 37 | 38 | dependencies { 39 | 40 | implementation coreDependency.values() 41 | implementation composeDependency.values() 42 | implementation lifecycleDependency.values() 43 | 44 | testImplementation testImplDependency.values() 45 | androidTestImplementation androidTestImplDependency.values() 46 | 47 | debugImplementation debugImplDependency.values() 48 | } -------------------------------------------------------------------------------- /features/registration/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'org.jetbrains.kotlin.android' 4 | } 5 | 6 | android { 7 | compileSdk compileVersion 8 | 9 | defaultConfig { 10 | minSdk minVersion 11 | targetSdk targetVersion 12 | 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | consumerProguardFiles "consumer-rules.pro" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | compileOptions { 24 | sourceCompatibility JavaVersion.VERSION_1_8 25 | targetCompatibility JavaVersion.VERSION_1_8 26 | } 27 | kotlinOptions { 28 | jvmTarget = jvmVersion 29 | } 30 | buildFeatures { 31 | compose true 32 | } 33 | composeOptions { 34 | kotlinCompilerExtensionVersion compose_version 35 | } 36 | } 37 | 38 | dependencies { 39 | implementation project(":components") 40 | 41 | implementation coreDependency.values() 42 | implementation composeDependency.values() 43 | implementation lifecycleDependency.values() 44 | 45 | testImplementation testImplDependency.values() 46 | androidTestImplementation androidTestImplDependency.values() 47 | 48 | debugImplementation debugImplDependency.values() 49 | } -------------------------------------------------------------------------------- /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=-Xmx2048m -Dfile.encoding=UTF-8 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 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official 20 | # Enables namespacing of each library's R class so that its R class includes only the 21 | # resources declared in the library itself and none from the library's dependencies, 22 | # thereby reducing the size of the R class for that library 23 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /applications/facebook/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'org.jetbrains.kotlin.android' 4 | } 5 | 6 | android { 7 | compileSdk compileVersion 8 | 9 | defaultConfig { 10 | minSdk minVersion 11 | targetSdk targetVersion 12 | 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | consumerProguardFiles "consumer-rules.pro" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | compileOptions { 24 | sourceCompatibility JavaVersion.VERSION_1_8 25 | targetCompatibility JavaVersion.VERSION_1_8 26 | } 27 | kotlinOptions { 28 | jvmTarget = jvmVersion 29 | } 30 | buildFeatures { 31 | compose true 32 | } 33 | composeOptions { 34 | kotlinCompilerExtensionVersion compose_version 35 | } 36 | } 37 | 38 | dependencies { 39 | implementation project(":features:registration") 40 | 41 | implementation coreDependency.values() 42 | implementation composeDependency.values() 43 | implementation lifecycleDependency.values() 44 | 45 | testImplementation testImplDependency.values() 46 | androidTestImplementation androidTestImplDependency.values() 47 | 48 | debugImplementation debugImplDependency.values() 49 | } -------------------------------------------------------------------------------- /applications/linkedin/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'org.jetbrains.kotlin.android' 4 | } 5 | 6 | android { 7 | compileSdk compileVersion 8 | 9 | defaultConfig { 10 | minSdk minVersion 11 | targetSdk targetVersion 12 | 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | consumerProguardFiles "consumer-rules.pro" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | compileOptions { 24 | sourceCompatibility JavaVersion.VERSION_1_8 25 | targetCompatibility JavaVersion.VERSION_1_8 26 | } 27 | kotlinOptions { 28 | jvmTarget = jvmVersion 29 | } 30 | buildFeatures { 31 | compose true 32 | } 33 | composeOptions { 34 | kotlinCompilerExtensionVersion compose_version 35 | } 36 | } 37 | 38 | dependencies { 39 | implementation project(":features:registration") 40 | 41 | implementation coreDependency.values() 42 | implementation composeDependency.values() 43 | implementation lifecycleDependency.values() 44 | 45 | testImplementation testImplDependency.values() 46 | androidTestImplementation androidTestImplDependency.values() 47 | 48 | debugImplementation debugImplDependency.values() 49 | } -------------------------------------------------------------------------------- /features/registration/src/main/java/com/dj/registration/theme/ExtendedColor.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration.theme 2 | 3 | import androidx.compose.runtime.Immutable 4 | import androidx.compose.runtime.staticCompositionLocalOf 5 | import androidx.compose.ui.graphics.Color 6 | 7 | 8 | @Immutable 9 | data class ExtendedColors( 10 | val inputFieldColors: InputFieldColors, 11 | val submitButtonColors: SubmitButtonColors 12 | ) 13 | 14 | @Immutable 15 | data class InputFieldColors( 16 | val unFocusedBorderColor: Color, 17 | val focusedBorderColor: Color, 18 | val focusedLabelColor: Color, 19 | val cursorColor: Color, 20 | val backgroundColor: Color 21 | ) 22 | 23 | @Immutable 24 | data class SubmitButtonColors( 25 | val bgColor: Color, 26 | val textColor: Color 27 | ) 28 | 29 | // if no app provides LocalExtendedColors object then this default instance 30 | // will be used within this module 31 | val LocalExtendedColors = staticCompositionLocalOf { 32 | ExtendedColors( 33 | inputFieldColors = InputFieldColors( 34 | unFocusedBorderColor = Color.Gray, 35 | focusedBorderColor = Color.Gray, 36 | focusedLabelColor = Color.Gray, 37 | cursorColor = Color.Gray, 38 | backgroundColor = Color.Transparent 39 | ), 40 | submitButtonColors = SubmitButtonColors( 41 | bgColor = Color.Gray, 42 | textColor = Color.White 43 | ) 44 | ) 45 | } -------------------------------------------------------------------------------- /applications/linkedin/src/main/java/com/dj/linkedin/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.dj.linkedin.ui.theme 2 | 3 | import androidx.compose.foundation.isSystemInDarkTheme 4 | import androidx.compose.material.MaterialTheme 5 | import androidx.compose.material.darkColors 6 | import androidx.compose.material.lightColors 7 | import androidx.compose.runtime.Composable 8 | import androidx.compose.runtime.CompositionLocalProvider 9 | import com.dj.registration.theme.LocalComponentTypes 10 | import com.dj.registration.theme.LocalExtendedColors 11 | import com.dj.registration.theme.LocalExtendedShapes 12 | import com.dj.registration.theme.LocalExtendedTypography 13 | 14 | private val DarkColorPalette = darkColors( 15 | primary = Red200, 16 | primaryVariant = Red700, 17 | secondary = Teal200 18 | ) 19 | 20 | private val LightColorPalette = lightColors( 21 | primary = Red500, 22 | primaryVariant = Red700, 23 | secondary = Teal200 24 | ) 25 | 26 | @Composable 27 | fun LinkedInTheme( 28 | darkTheme: Boolean = isSystemInDarkTheme(), 29 | content: @Composable () -> Unit 30 | ) { 31 | val colors = if (darkTheme) { 32 | DarkColorPalette 33 | } else { 34 | LightColorPalette 35 | } 36 | CompositionLocalProvider( 37 | LocalExtendedTypography provides LinkedInExtendedTypography, 38 | LocalExtendedColors provides LinkedInExtendedColors, 39 | LocalComponentTypes provides LinkedInComponentTypes, 40 | LocalExtendedShapes provides LinkedInExtendedShapes 41 | ) { 42 | MaterialTheme( 43 | colors = colors, 44 | typography = LinkedInTypography, 45 | content = content 46 | ) 47 | } 48 | } -------------------------------------------------------------------------------- /applications/facebook/src/main/java/com/dj/facebook/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.dj.facebook.ui.theme 2 | 3 | import androidx.compose.foundation.isSystemInDarkTheme 4 | import androidx.compose.material.MaterialTheme 5 | import androidx.compose.material.darkColors 6 | import androidx.compose.material.lightColors 7 | import androidx.compose.runtime.Composable 8 | import androidx.compose.runtime.CompositionLocalProvider 9 | import com.dj.registration.theme.LocalComponentTypes 10 | import com.dj.registration.theme.LocalExtendedColors 11 | import com.dj.registration.theme.LocalExtendedShapes 12 | import com.dj.registration.theme.LocalExtendedTypography 13 | 14 | private val DarkColorPalette = darkColors( 15 | primary = Purple200, 16 | primaryVariant = Purple700, 17 | secondary = Teal200 18 | ) 19 | 20 | private val LightColorPalette = lightColors( 21 | primary = Purple500, 22 | primaryVariant = Purple700, 23 | secondary = Teal200 24 | ) 25 | 26 | 27 | @Composable 28 | fun FacebookTheme( 29 | darkTheme: Boolean = isSystemInDarkTheme(), 30 | content: @Composable () -> Unit 31 | ) { 32 | val colors = if (darkTheme) { 33 | DarkColorPalette 34 | } else { 35 | LightColorPalette 36 | } 37 | CompositionLocalProvider( 38 | LocalExtendedTypography provides FacebookExtendedTypography, 39 | LocalExtendedColors provides FacebookExtendedColors, 40 | LocalComponentTypes provides FacebookComponentTypes, 41 | LocalExtendedShapes provides FacebookExtendedShapes 42 | ) { 43 | MaterialTheme( 44 | colors = colors, 45 | typography = FacebookTypography, 46 | content = content 47 | ) 48 | } 49 | } -------------------------------------------------------------------------------- /components/src/main/java/com/dj/components/InputField.kt: -------------------------------------------------------------------------------- 1 | package com.dj.components 2 | 3 | import androidx.compose.foundation.text.KeyboardActions 4 | import androidx.compose.foundation.text.KeyboardOptions 5 | import androidx.compose.material.* 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.ui.ExperimentalComposeUiApi 8 | import androidx.compose.ui.Modifier 9 | import androidx.compose.ui.platform.LocalSoftwareKeyboardController 10 | import androidx.compose.ui.text.TextStyle 11 | import androidx.compose.ui.text.input.KeyboardType 12 | import androidx.compose.ui.text.input.PasswordVisualTransformation 13 | import androidx.compose.ui.text.input.VisualTransformation 14 | 15 | @OptIn(ExperimentalComposeUiApi::class) 16 | @Composable 17 | fun InputField( 18 | text: String, 19 | label: String, 20 | onValueChange: (value: String) -> Unit, 21 | modifier: Modifier = Modifier, 22 | keyboardOptions: KeyboardOptions, 23 | textStyle: TextStyle, 24 | labelTextStyle: TextStyle, 25 | colors: TextFieldColors 26 | ) { 27 | val keyboardController = LocalSoftwareKeyboardController.current 28 | 29 | TextField( 30 | value = text, 31 | onValueChange = onValueChange, 32 | label = { Text(label, style = labelTextStyle) }, 33 | modifier = modifier, 34 | keyboardOptions = keyboardOptions, 35 | keyboardActions = KeyboardActions( 36 | onDone = { keyboardController?.hide() } 37 | ), 38 | visualTransformation = if (keyboardOptions.keyboardType == KeyboardType.Password) 39 | PasswordVisualTransformation() 40 | else VisualTransformation.None, 41 | textStyle = textStyle, 42 | colors = colors 43 | ) 44 | } -------------------------------------------------------------------------------- /dependencies.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | 3 | minVersion = 21 4 | compileVersion = 32 5 | targetVersion = 32 6 | jvmVersion = '1.8' 7 | 8 | def composeVersion = '1.1.1' 9 | 10 | compose_version = composeVersion 11 | 12 | def coreVersion = '1.8.0' 13 | def lifecycleVersion = '2.5.0' 14 | def composeActivityVersion = '1.5.0' 15 | def jUnitVersion = '4.13.2' 16 | def extJUnitVersion = '1.1.3' 17 | def espressoCoreVersion = '3.4.0' 18 | def appCompatVersion = '1.4.2' 19 | 20 | coreDependency = [ 21 | core : "androidx.core:core-ktx:$coreVersion" 22 | ] 23 | appCompatDependency = [ 24 | appCompat: "androidx.appcompat:appcompat:$appCompatVersion" 25 | ] 26 | lifecycleDependency = [ 27 | lifecycleRuntime: "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion" 28 | ] 29 | composeDependency = [ 30 | ui : "androidx.compose.ui:ui:$composeVersion", 31 | material: "androidx.compose.material:material:$composeVersion", 32 | preview : "androidx.compose.ui:ui-tooling-preview:$composeVersion", 33 | activity: "androidx.activity:activity-compose:$composeActivityVersion" 34 | ] 35 | testImplDependency = [ 36 | junit: "junit:junit:$jUnitVersion" 37 | ] 38 | androidTestImplDependency = [ 39 | junit : "androidx.test.ext:junit:$extJUnitVersion", 40 | junitComposeTest: "androidx.compose.ui:ui-test-junit4:$composeVersion", 41 | espressoCore : "androidx.test.espresso:espresso-core:$espressoCoreVersion" 42 | ] 43 | debugImplDependency = [ 44 | composeUiTooling: "androidx.compose.ui:ui-tooling:$composeVersion" 45 | ] 46 | } -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'org.jetbrains.kotlin.android' 4 | } 5 | 6 | android { 7 | compileSdk compileVersion 8 | 9 | defaultConfig { 10 | applicationId "com.dj.composetheming" 11 | minSdk minVersion 12 | targetSdk targetVersion 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | vectorDrawables { 18 | useSupportLibrary true 19 | } 20 | } 21 | 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | compileOptions { 29 | sourceCompatibility JavaVersion.VERSION_1_8 30 | targetCompatibility JavaVersion.VERSION_1_8 31 | } 32 | kotlinOptions { 33 | jvmTarget = jvmVersion 34 | } 35 | buildFeatures { 36 | compose true 37 | } 38 | composeOptions { 39 | kotlinCompilerExtensionVersion compose_version 40 | } 41 | packagingOptions { 42 | resources { 43 | excludes += '/META-INF/{AL2.0,LGPL2.1}' 44 | } 45 | } 46 | } 47 | 48 | dependencies { 49 | implementation project(":applications:linkedin") 50 | implementation project(":applications:facebook") 51 | 52 | implementation coreDependency.values() 53 | implementation composeDependency.values() 54 | implementation lifecycleDependency.values() 55 | 56 | testImplementation testImplDependency.values() 57 | androidTestImplementation androidTestImplDependency.values() 58 | 59 | debugImplementation debugImplDependency.values() 60 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /components/src/main/java/com/dj/components/OutlinedInputField.kt: -------------------------------------------------------------------------------- 1 | package com.dj.components 2 | 3 | import androidx.compose.foundation.text.KeyboardActions 4 | import androidx.compose.foundation.text.KeyboardOptions 5 | import androidx.compose.material.OutlinedTextField 6 | import androidx.compose.material.Text 7 | import androidx.compose.material.TextFieldColors 8 | import androidx.compose.runtime.Composable 9 | import androidx.compose.ui.ExperimentalComposeUiApi 10 | import androidx.compose.ui.Modifier 11 | import androidx.compose.ui.platform.LocalSoftwareKeyboardController 12 | import androidx.compose.ui.text.TextStyle 13 | import androidx.compose.ui.text.input.KeyboardType 14 | import androidx.compose.ui.text.input.PasswordVisualTransformation 15 | import androidx.compose.ui.text.input.VisualTransformation 16 | 17 | @OptIn(ExperimentalComposeUiApi::class) 18 | @Composable 19 | fun OutlinedInputField( 20 | text: String, 21 | label: String, 22 | onValueChange: (value: String) -> Unit, 23 | modifier: Modifier = Modifier, 24 | keyboardOptions: KeyboardOptions, 25 | textStyle: TextStyle, 26 | labelTextStyle: TextStyle, 27 | colors: TextFieldColors 28 | ) { 29 | val keyboardController = LocalSoftwareKeyboardController.current 30 | 31 | OutlinedTextField( 32 | value = text, 33 | onValueChange = onValueChange, 34 | label = { Text(label, style = labelTextStyle) }, 35 | modifier = modifier, 36 | keyboardOptions = keyboardOptions, 37 | keyboardActions = KeyboardActions( 38 | onDone = { keyboardController?.hide() } 39 | ), 40 | visualTransformation = if (keyboardOptions.keyboardType == KeyboardType.Password) 41 | PasswordVisualTransformation() 42 | else VisualTransformation.None, 43 | textStyle = textStyle, 44 | colors = colors 45 | ) 46 | } -------------------------------------------------------------------------------- /applications/facebook/src/main/java/com/dj/facebook/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | package com.dj.facebook.ui.theme 2 | 3 | import androidx.compose.material.Typography 4 | import androidx.compose.ui.text.TextStyle 5 | import androidx.compose.ui.text.font.Font 6 | import androidx.compose.ui.text.font.FontFamily 7 | import androidx.compose.ui.text.font.FontWeight 8 | import androidx.compose.ui.unit.sp 9 | import com.dj.facebook.R 10 | import com.dj.registration.theme.ExtendedTypography 11 | import com.dj.registration.theme.InputFieldTypography 12 | 13 | // Set of Material typography styles to start with 14 | val FacebookTypography = Typography( 15 | h1 = TextStyle( 16 | fontFamily = FontFamily( 17 | Font(R.font.interregular) 18 | ), 19 | fontWeight = FontWeight.Bold, 20 | fontSize = 72.sp 21 | ), 22 | h2 = TextStyle( 23 | fontFamily = FontFamily( 24 | Font(R.font.interregular) 25 | ), 26 | fontWeight = FontWeight.Bold, 27 | fontSize = 60.sp 28 | ), 29 | h3 = TextStyle( 30 | fontFamily = FontFamily( 31 | Font(R.font.interregular) 32 | ), 33 | fontWeight = FontWeight.Bold, 34 | fontSize = 48.sp 35 | ), 36 | h4 = TextStyle( 37 | fontFamily = FontFamily( 38 | Font(R.font.interregular) 39 | ), 40 | fontWeight = FontWeight.Bold, 41 | fontSize = 32.sp 42 | ), 43 | h5 = TextStyle( 44 | fontFamily = FontFamily( 45 | Font(R.font.interregular) 46 | ), 47 | fontWeight = FontWeight.Bold, 48 | fontSize = 24.sp 49 | ), 50 | h6 = TextStyle( 51 | fontFamily = FontFamily( 52 | Font(R.font.interregular) 53 | ), 54 | fontWeight = FontWeight.Bold, 55 | fontSize = 20.sp 56 | ) 57 | ) 58 | 59 | val FacebookExtendedTypography = ExtendedTypography( 60 | inputFieldTypography = InputFieldTypography( 61 | label = TextStyle( 62 | fontFamily = FontFamily( 63 | Font(R.font.interregular) 64 | ), 65 | fontWeight = FontWeight.Normal 66 | ), 67 | text = TextStyle( 68 | fontFamily = FontFamily( 69 | Font(R.font.interregular) 70 | ), 71 | fontWeight = FontWeight.Normal, 72 | fontSize = 16.sp 73 | ) 74 | ) 75 | ) -------------------------------------------------------------------------------- /applications/linkedin/src/main/java/com/dj/linkedin/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | package com.dj.linkedin.ui.theme 2 | 3 | import androidx.compose.material.Typography 4 | import androidx.compose.ui.text.TextStyle 5 | import androidx.compose.ui.text.font.Font 6 | import androidx.compose.ui.text.font.FontFamily 7 | import androidx.compose.ui.text.font.FontWeight 8 | import androidx.compose.ui.unit.sp 9 | import com.dj.linkedin.R 10 | import com.dj.registration.theme.ExtendedTypography 11 | import com.dj.registration.theme.InputFieldTypography 12 | 13 | // Set of Material typography styles to start with 14 | val LinkedInTypography = Typography( 15 | h1 = TextStyle( 16 | fontFamily = FontFamily( 17 | Font(R.font.playfairdisplayregular) 18 | ), 19 | fontWeight = FontWeight.Bold, 20 | fontSize = 72.sp 21 | ), 22 | h2 = TextStyle( 23 | fontFamily = FontFamily( 24 | Font(R.font.playfairdisplayregular) 25 | ), 26 | fontWeight = FontWeight.Bold, 27 | fontSize = 60.sp 28 | ), 29 | h3 = TextStyle( 30 | fontFamily = FontFamily( 31 | Font(R.font.playfairdisplayregular) 32 | ), 33 | fontWeight = FontWeight.Bold, 34 | fontSize = 48.sp 35 | ), 36 | h4 = TextStyle( 37 | fontFamily = FontFamily( 38 | Font(R.font.playfairdisplayregular) 39 | ), 40 | fontWeight = FontWeight.Bold, 41 | fontSize = 32.sp 42 | ), 43 | h5 = TextStyle( 44 | fontFamily = FontFamily( 45 | Font(R.font.playfairdisplayregular) 46 | ), 47 | fontWeight = FontWeight.Bold, 48 | fontSize = 24.sp 49 | ), 50 | h6 = TextStyle( 51 | fontFamily = FontFamily( 52 | Font(R.font.playfairdisplayregular) 53 | ), 54 | fontWeight = FontWeight.Bold, 55 | fontSize = 20.sp 56 | ) 57 | ) 58 | 59 | val LinkedInExtendedTypography = ExtendedTypography( 60 | inputFieldTypography = InputFieldTypography( 61 | label = TextStyle( 62 | fontFamily = FontFamily( 63 | Font(R.font.playfairdisplayregular) 64 | ), 65 | fontWeight = FontWeight.Normal 66 | ), 67 | text = TextStyle( 68 | fontFamily = FontFamily( 69 | Font(R.font.playfairdisplayregular) 70 | ), 71 | fontWeight = FontWeight.Normal, 72 | fontSize = 16.sp 73 | ) 74 | ) 75 | ) -------------------------------------------------------------------------------- /features/registration/src/main/java/com/dj/registration/RegistrationScreen.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration 2 | 3 | import androidx.compose.foundation.layout.* 4 | import androidx.compose.foundation.shape.RoundedCornerShape 5 | import androidx.compose.foundation.text.KeyboardOptions 6 | import androidx.compose.material.Button 7 | import androidx.compose.material.ButtonDefaults 8 | import androidx.compose.material.MaterialTheme 9 | import androidx.compose.material.Text 10 | import androidx.compose.runtime.Composable 11 | import androidx.compose.ui.Alignment 12 | import androidx.compose.ui.Modifier 13 | import androidx.compose.ui.text.input.ImeAction 14 | import androidx.compose.ui.text.input.KeyboardType 15 | import androidx.compose.ui.unit.dp 16 | import com.dj.registration.common.UserInput 17 | import com.dj.registration.theme.customColors 18 | import com.dj.registration.theme.customShapes 19 | 20 | @Composable 21 | fun RegistrationScreen() { 22 | Column( 23 | modifier = Modifier 24 | .fillMaxWidth() 25 | .fillMaxHeight() 26 | ) { 27 | Text( 28 | text = "Register", 29 | style = MaterialTheme.typography.h4, 30 | modifier = Modifier 31 | .padding(top = 60.dp, bottom = 20.dp) 32 | .align(Alignment.CenterHorizontally) 33 | ) 34 | UserInput( 35 | "Name", 36 | KeyboardOptions( 37 | keyboardType = KeyboardType.Text, 38 | imeAction = ImeAction.Next 39 | ) 40 | ) 41 | UserInput( 42 | "Email", 43 | KeyboardOptions( 44 | keyboardType = KeyboardType.Email, 45 | imeAction = ImeAction.Next 46 | ) 47 | ) 48 | UserInput( 49 | "Password", 50 | KeyboardOptions( 51 | keyboardType = KeyboardType.Password, 52 | imeAction = ImeAction.Done 53 | ) 54 | ) 55 | Button( 56 | colors = ButtonDefaults.buttonColors( 57 | backgroundColor = MaterialTheme.customColors.submitButtonColors.bgColor, 58 | contentColor = MaterialTheme.customColors.submitButtonColors.textColor, 59 | ), 60 | shape = MaterialTheme.customShapes.submitButtonShape, 61 | elevation = ButtonDefaults.elevation(10.dp), 62 | content = { 63 | Text("Submit") 64 | }, onClick = {}, modifier = Modifier 65 | .align(Alignment.CenterHorizontally) 66 | .fillMaxWidth() 67 | .height(90.dp) 68 | .padding(top = 40.dp, start = 30.dp, end = 30.dp) 69 | ) 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /features/registration/src/main/java/com/dj/registration/common/UserInput.kt: -------------------------------------------------------------------------------- 1 | package com.dj.registration.common 2 | 3 | import androidx.compose.foundation.layout.fillMaxWidth 4 | import androidx.compose.foundation.layout.padding 5 | import androidx.compose.foundation.text.KeyboardOptions 6 | import androidx.compose.material.MaterialTheme 7 | import androidx.compose.material.TextFieldDefaults 8 | import androidx.compose.runtime.* 9 | import androidx.compose.ui.Modifier 10 | import androidx.compose.ui.graphics.Color 11 | import androidx.compose.ui.unit.dp 12 | import com.dj.components.InputField 13 | import com.dj.components.OutlinedInputField 14 | import com.dj.registration.theme.InputFieldType 15 | import com.dj.registration.theme.componentTypes 16 | import com.dj.registration.theme.customColors 17 | import com.dj.registration.theme.customTypography 18 | 19 | 20 | @Composable 21 | fun UserInput(label: String, keyboardOptions: KeyboardOptions) { 22 | var text by remember { mutableStateOf("") } 23 | val inputFieldColors = MaterialTheme.customColors.inputFieldColors 24 | if (MaterialTheme.componentTypes.inputField == InputFieldType.Outlined) { 25 | OutlinedInputField( 26 | text = text, 27 | onValueChange = { 28 | text = it 29 | }, 30 | label = label, 31 | modifier = Modifier 32 | .padding(top = 20.dp, start = 30.dp, end = 30.dp) 33 | .fillMaxWidth(), 34 | keyboardOptions = keyboardOptions, 35 | labelTextStyle = MaterialTheme.customTypography.inputFieldTypography.label, 36 | textStyle = MaterialTheme.customTypography.inputFieldTypography.text, 37 | colors = TextFieldDefaults.outlinedTextFieldColors( 38 | backgroundColor = inputFieldColors.backgroundColor, 39 | unfocusedBorderColor = inputFieldColors.unFocusedBorderColor, 40 | focusedBorderColor = inputFieldColors.focusedBorderColor, 41 | focusedLabelColor = inputFieldColors.focusedLabelColor, 42 | cursorColor = inputFieldColors.cursorColor 43 | ) 44 | ) 45 | } else { 46 | InputField( 47 | text = text, 48 | onValueChange = { 49 | text = it 50 | }, 51 | label = label, 52 | modifier = Modifier 53 | .padding(top = 20.dp, start = 30.dp, end = 30.dp) 54 | .fillMaxWidth(), 55 | keyboardOptions = keyboardOptions, 56 | labelTextStyle = MaterialTheme.customTypography.inputFieldTypography.label, 57 | textStyle = MaterialTheme.customTypography.inputFieldTypography.text, 58 | colors = TextFieldDefaults.textFieldColors( 59 | backgroundColor = inputFieldColors.backgroundColor, 60 | unfocusedIndicatorColor = inputFieldColors.unFocusedBorderColor, 61 | focusedIndicatorColor = inputFieldColors.focusedBorderColor, 62 | focusedLabelColor = inputFieldColors.focusedLabelColor, 63 | cursorColor = inputFieldColors.cursorColor 64 | ) 65 | ) 66 | } 67 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## About The Project 4 | 5 | Sample project to showcase Material & Custom theming using Jetpack Compose. Goal is to design 6 | reusable feature modules which can be used in multiple apps and each app is to provide the theme 7 | which that feature module requires. 8 | 9 | For this project we have following modules: 10 | 11 | * :components - contains reusable UI components 12 | * :feature:registration - customizable registration screen 13 | * :applications:facebook - module which provides its own theme for registration screen 14 | * :applications:linkedin - module which provides its own theme for registration screen 15 | 16 | How things work: 17 | 18 | Registration feature module exposes all of its custom theming classes using 19 | `CompositionLocal` with default values. For example: 20 | 21 | Theming class `ExtendedColors` is exposed using `LocalExtendedColors` composition & 22 | 23 | Theming class `ExtendedTypography` is exposed using `LocalExtendedTypography` composition 24 | 25 | These classes will be used for customizing UI in Registration feature. Both 26 | Applications modules i.e linkedin & facebook will create instances for these custom theming 27 | classes and provide these instances to Registration 28 | feature module by using `CompositionLocalProvider`. 29 | 30 | For example: 31 | 32 | LinkedIn will create an instance of `ExtendedTypography` named 33 | `LinkedInExtendedTypography` and an instance of `ExtendedColors` named 34 | `LinkedInExtendedColors` and will provide to Registration module using 35 | 36 | ``` 37 | CompositionLocalProvider( 38 | LocalExtendedTypography provides LinkedInExtendedTypography, 39 | LocalExtendedColors provides LinkedInExtendedColors 40 | ) { 41 | RegistrationScreen() 42 | } 43 | ``` 44 | 45 | Now use `LocalExtendedTypography.current` & `LocalExtendedColors.current` to 46 | access `ExtendedTypography` 47 | and `ExtendedColors` objects provided by any of the applications modules. 48 | 49 | Note: 50 | Use either `FacebookApp()` or `LinkedInApp()` in `MainActivity` to try out themes provided by these 51 | 2 applications modules. 52 | 53 | 54 | 55 | ## Results 56 | 57 | [](readmeAssets/Screenshot_20220712_232631.png) 58 | [](readmeAssets/Screenshot_20220712_225015.png) 59 | [](readmeAssets/Screenshot_20220712_225203.png) 60 | [](readmeAssets/Screenshot_20220715_003025.png) 61 | [](readmeAssets/Screenshot_20220715_004244.png) 62 | 63 | 64 | 65 | ## Roadmap 66 | 67 | - [x] Add components, features & applications modules 68 | - [x] Add dependencies.gradle to sync dependency versions across modules 69 | - [x] Add registration screen in feature module with MaterialTypography, 70 | CustomTypography & Colors support 71 | - [x] Provide themes from applications module to Registration feature module 72 | - [x] Add support for multiple input types i.e OUTLINED or FILLED 73 | - [x] Add support for button shape 74 | - [ ] Add component spacing support in Registration module as each app can have different 75 | spacing 76 | 77 | 78 | 79 | ## Contributing 80 | 81 | Contributions are what make the open source community such an amazing place to learn, inspire, and 82 | create. Any contributions you make are **greatly appreciated**. 83 | 84 | If you have a suggestion that would make this better, please fork the repo and create a pull 85 | request. You can also simply open an issue with the tag "enhancement". Don't forget to give the 86 | project a star! Thanks again! 87 | 88 | 1. Fork the Project 89 | 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 90 | 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) 91 | 4. Push to the Branch (`git push origin feature/AmazingFeature`) 92 | 5. Open a Pull Request 93 | 94 | 95 | 96 | ## Contact 97 | 98 | Daniyal Javaid - [LinkedIn](https://www.linkedin.com/in/daniyal-javaid/) - daniyaljavaid95@gmail.com 99 | 100 | 101 | 102 | 103 | 104 | ## References 105 | 106 | * [Understanding CompositionLocal](https://developer.android.com/jetpack/compose/compositionlocal) 107 | * [Compose MaterialTheme](https://developer.android.com/jetpack/compose/themes/material) 108 | * [Compose CustomTheme](https://developer.android.com/jetpack/compose/themes/custom) 109 | * [Project Readme Template](https://github.com/othneildrew/Best-README-Template) 110 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | --------------------------------------------------------------------------------