diff --git a/app/build.gradle.kts b/app/build.gradle.kts deleted file mode 100644 index 62c33a4..0000000 --- a/app/build.gradle.kts +++ /dev/null @@ -1,71 +0,0 @@ -plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") -} - -android { - namespace = "com.droidconke.doko" - compileSdk = 33 - - defaultConfig { - applicationId = "com.droidconke.doko" - minSdk = 26 - targetSdk = 33 - versionCode = 1 - versionName = "1.0" - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary = true - } - } - - buildTypes { - getByName("release") { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") - } - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - - kotlinOptions { - jvmTarget = "11" - } - - buildFeatures { - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = "1.5.15" - } - - packagingOptions { - resources { - excludes += "/META-INF/{AL2.0,LGPL2.1}" - } - } -} - -dependencies { - - implementation("androidx.core:core-ktx:1.13.1") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6") - - implementation("androidx.activity:activity-compose:1.9.3") - implementation("androidx.compose.ui:ui:1.7.4") - implementation("androidx.compose.ui:ui-tooling-preview:1.7.4") - implementation("androidx.compose.material:material:1.7.4") - debugImplementation("androidx.compose.ui:ui-tooling:1.7.4") - debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.4") - - testImplementation("junit:junit:4.13.2") - - androidTestImplementation("androidx.test.ext:junit:1.2.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") - androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.7.4") -} diff --git a/buildLogic/convention/src/main/kotlin/com/droidconke/doko/AndroidCompose.kt b/buildLogic/convention/src/main/kotlin/com/droidconke/doko/AndroidCompose.kt index 9ab14ca..43b5dfd 100644 --- a/buildLogic/convention/src/main/kotlin/com/droidconke/doko/AndroidCompose.kt +++ b/buildLogic/convention/src/main/kotlin/com/droidconke/doko/AndroidCompose.kt @@ -3,6 +3,7 @@ package com.droidconke.doko import com.android.build.api.dsl.CommonExtension import org.gradle.api.Project import org.gradle.api.provider.Provider +import org.gradle.kotlin.dsl.assign import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.dependencies import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension diff --git a/app/.gitignore b/ddsdemo/.gitignore similarity index 100% rename from app/.gitignore rename to ddsdemo/.gitignore diff --git a/ddsdemo/build.gradle.kts b/ddsdemo/build.gradle.kts new file mode 100644 index 0000000..de4c3ee --- /dev/null +++ b/ddsdemo/build.gradle.kts @@ -0,0 +1,59 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.jetbrains.kotlin.android) + alias(libs.plugins.compose.compiler) +} + +android { + namespace = "com.droidconke.ddsdemo" + compileSdk = 34 + + defaultConfig { + applicationId = "com.droidconke.ddsdemo" + minSdk = 28 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = "11" + } + buildFeatures { + compose = true + } +} + +dependencies { + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.activity.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.ui) + implementation(libs.androidx.ui.graphics) + implementation(libs.androidx.ui.tooling.preview) + implementation(libs.androidx.compose.material3) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.ui.test.junit4) + debugImplementation(libs.androidx.ui.tooling) + debugImplementation(libs.androidx.ui.test.manifest) +} \ No newline at end of file diff --git a/ddsdemo/proguard-rules.pro b/ddsdemo/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/ddsdemo/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 \ No newline at end of file diff --git a/ddsdemo/src/androidTest/java/com/droidconke/ddsdemo/ExampleInstrumentedTest.kt b/ddsdemo/src/androidTest/java/com/droidconke/ddsdemo/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..f1b755b --- /dev/null +++ b/ddsdemo/src/androidTest/java/com/droidconke/ddsdemo/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.droidconke.ddsdemo + +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.droidconke.ddsdemo", appContext.packageName) + } +} \ No newline at end of file diff --git a/ddsdemo/src/main/AndroidManifest.xml b/ddsdemo/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6e34c8c --- /dev/null +++ b/ddsdemo/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ddsdemo/src/main/java/com/droidconke/ddsdemo/MainActivity.kt b/ddsdemo/src/main/java/com/droidconke/ddsdemo/MainActivity.kt new file mode 100644 index 0000000..e2ea485 --- /dev/null +++ b/ddsdemo/src/main/java/com/droidconke/ddsdemo/MainActivity.kt @@ -0,0 +1,47 @@ +package com.droidconke.ddsdemo + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.droidconke.ddsdemo.ui.theme.DokoTheme + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContent { + DokoTheme { + Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> + Greeting( + name = "Android", + modifier = Modifier.padding(innerPadding) + ) + } + } + } + } +} + +@Composable +fun Greeting(name: String, modifier: Modifier = Modifier) { + Text( + text = "Hello $name!", + modifier = modifier + ) +} + +@Preview(showBackground = true) +@Composable +fun GreetingPreview() { + DokoTheme { + Greeting("Android") + } +} \ No newline at end of file diff --git a/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Color.kt b/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Color.kt new file mode 100644 index 0000000..22a40ab --- /dev/null +++ b/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.droidconke.ddsdemo.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Theme.kt b/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Theme.kt new file mode 100644 index 0000000..602e395 --- /dev/null +++ b/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Theme.kt @@ -0,0 +1,58 @@ +package com.droidconke.ddsdemo.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun DokoTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Type.kt b/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Type.kt new file mode 100644 index 0000000..0e96ad2 --- /dev/null +++ b/ddsdemo/src/main/java/com/droidconke/ddsdemo/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.droidconke.ddsdemo.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/ddsdemo/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from app/src/main/res/drawable/ic_launcher_background.xml rename to ddsdemo/src/main/res/drawable/ic_launcher_background.xml diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/ddsdemo/src/main/res/drawable/ic_launcher_foreground.xml similarity index 100% rename from app/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to ddsdemo/src/main/res/drawable/ic_launcher_foreground.xml diff --git a/app/src/main/res/mipmap-anydpi-v33/ic_launcher.xml b/ddsdemo/src/main/res/mipmap-anydpi/ic_launcher.xml similarity index 100% rename from app/src/main/res/mipmap-anydpi-v33/ic_launcher.xml rename to ddsdemo/src/main/res/mipmap-anydpi/ic_launcher.xml diff --git a/ddsdemo/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/ddsdemo/src/main/res/mipmap-anydpi/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/ddsdemo/src/main/res/mipmap-anydpi/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/ddsdemo/src/main/res/mipmap-hdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-hdpi/ic_launcher.webp rename to ddsdemo/src/main/res/mipmap-hdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/ddsdemo/src/main/res/mipmap-hdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-hdpi/ic_launcher_round.webp rename to ddsdemo/src/main/res/mipmap-hdpi/ic_launcher_round.webp diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/ddsdemo/src/main/res/mipmap-mdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-mdpi/ic_launcher.webp rename to ddsdemo/src/main/res/mipmap-mdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/ddsdemo/src/main/res/mipmap-mdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-mdpi/ic_launcher_round.webp rename to ddsdemo/src/main/res/mipmap-mdpi/ic_launcher_round.webp diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/ddsdemo/src/main/res/mipmap-xhdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_launcher.webp rename to ddsdemo/src/main/res/mipmap-xhdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/ddsdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp rename to ddsdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.webp diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/ddsdemo/src/main/res/mipmap-xxhdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/ic_launcher.webp rename to ddsdemo/src/main/res/mipmap-xxhdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/ddsdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp rename to ddsdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/ddsdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp rename to ddsdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/ddsdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp rename to ddsdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp diff --git a/app/src/main/res/values/colors.xml b/ddsdemo/src/main/res/values/colors.xml similarity index 100% rename from app/src/main/res/values/colors.xml rename to ddsdemo/src/main/res/values/colors.xml diff --git a/ddsdemo/src/main/res/values/strings.xml b/ddsdemo/src/main/res/values/strings.xml new file mode 100644 index 0000000..7da2f15 --- /dev/null +++ b/ddsdemo/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + ddsdemo + \ No newline at end of file diff --git a/ddsdemo/src/main/res/values/themes.xml b/ddsdemo/src/main/res/values/themes.xml new file mode 100644 index 0000000..8d7fdb6 --- /dev/null +++ b/ddsdemo/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +