convert to m3

This commit is contained in:
Owen LeJeune
2022-02-09 11:58:56 -05:00
parent 82497157e0
commit a9e916abb9
10 changed files with 136 additions and 51 deletions

View File

@@ -1,17 +1,22 @@
import com.owenlejeune.tvtime.buildsrc.Dependencies
import com.owenlejeune.tvtime.buildsrc.Versions
import com.owenlejeune.tvtime.buildsrc.Config
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
}
android {
compileSdk 32
compileSdkVersion(Config.compileSdk)
defaultConfig {
applicationId "com.owenlejeune.tvtime"
minSdk 23
targetSdk 32
versionCode 1
versionName "1.0"
minSdkVersion(Config.minSdk)
targetSdkVersion(Config.targetSdk)
versionCode = Config.versionCode
versionName = Config.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
@@ -36,7 +41,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerExtensionVersion Versions.compose
}
packagingOptions {
resources {
@@ -47,15 +52,15 @@ android {
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation Dependencies.AndroidX.ktxCore
implementation Dependencies.Compose.ui
implementation Dependencies.Compose.material3
implementation Dependencies.Compose.uiToolingPreview
implementation Dependencies.Lifecycle.runtime
implementation Dependencies.Compose.activity
testImplementation Dependencies.Testing.junit
androidTestImplementation Dependencies.Testing.androidXJunit
androidTestImplementation Dependencies.Testing.espressoCore
androidTestImplementation Dependencies.Testing.composeJunit
debugImplementation Dependencies.Compose.uiTooling
}

View File

@@ -4,9 +4,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
@@ -25,8 +23,7 @@ class MainActivity : ComponentActivity() {
fun MyApp() {
TVTimeTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
modifier = Modifier.fillMaxSize()
) {
}

View File

@@ -1,11 +1,11 @@
package com.owenlejeune.tvtime.ui.theme
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
import androidx.compose.ui.unit.dp
val Shapes = Shapes(
small = RoundedCornerShape(4.dp),
medium = RoundedCornerShape(4.dp),
large = RoundedCornerShape(0.dp)
)
//import androidx.compose.foundation.shape.RoundedCornerShape
//import androidx.compose.material.Shapes
//import androidx.compose.ui.unit.dp
//
//val Shapes = Shapes(
// small = RoundedCornerShape(4.dp),
// medium = RoundedCornerShape(4.dp),
// large = RoundedCornerShape(0.dp)
//)

View File

@@ -1,21 +1,21 @@
package com.owenlejeune.tvtime.ui.theme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
private val DarkColorPalette = darkColors(
private val DarkColorPalette = darkColorScheme(
primary = Purple200,
primaryVariant = Purple700,
secondary = Teal200
secondary = Purple700,
tertiary = Teal200
)
private val LightColorPalette = lightColors(
private val LightColorPalette = lightColorScheme(
primary = Purple500,
primaryVariant = Purple700,
secondary = Teal200
secondary = Purple700,
tertiary = Teal200
/* Other default colors to override
background = Color.White,
@@ -36,9 +36,8 @@ fun TVTimeTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable
}
MaterialTheme(
colors = colors,
colorScheme = colors,
typography = Typography,
shapes = Shapes,
content = content
)
}

View File

@@ -1,6 +1,6 @@
package com.owenlejeune.tvtime.ui.theme
import androidx.compose.material.Typography
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
@@ -8,7 +8,7 @@ import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography = Typography(
body1 = TextStyle(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp

View File

@@ -1,12 +1,22 @@
import com.owenlejeune.tvtime.buildsrc.Dependencies
buildscript {
ext {
compose_version = '1.0.1'
repositories {
google()
mavenCentral()
dependencies {
classpath Dependencies.BuildPlugins.kotlinGradle
classpath Dependencies.BuildPlugins.androidGradle
}
}
}
subprojects {
repositories {
google()
mavenCentral()
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.5.21' apply false
}
task clean(type: Delete) {

View File

@@ -0,0 +1,9 @@
import org.gradle.kotlin.dsl.`kotlin-dsl`
plugins {
`kotlin-dsl`
}
repositories {
mavenCentral()
}

View File

@@ -0,0 +1,11 @@
package com.owenlejeune.tvtime.buildsrc
object Config {
const val compileSdk = 32
const val minSdk = 23
const val targetSdk = 32
const val versionCode = 1
const val versionName = "1.0"
}

View File

@@ -0,0 +1,35 @@
package com.owenlejeune.tvtime.buildsrc
object Dependencies {
object AndroidX {
const val appCompat = "androidx.appcompat:appcompat:${Versions.androidx}"
const val ktxCore = "androidx.core:core-ktx:${Versions.core_ktx}"
}
object Compose {
const val material3 = "androidx.compose.material3:material3:${Versions.compose_material3}"
const val ui = "androidx.compose.ui:ui:${Versions.compose}"
const val uiToolingPreview = "androidx.compose.ui:ui-tooling-preview:${Versions.compose}"
const val uiTooling = "androidx.compose.ui:ui-tooling:${Versions.compose}"
const val activity = "androidx.activity:activity-compose:${Versions.activity_compose}"
}
object Lifecycle {
const val runtime = "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.lifecycle_runtime}"
}
object Testing {
const val junit = "junit:junit:${Versions.junit}"
const val composeJunit = "androidx.compose.ui:ui-test-junit4:${Versions.compose}"
const val androidXJunit = "androidx.test.ext:junit:${Versions.androidx_junit}"
const val espressoCore = "androidx.test.espresso:espresso-core:${Versions.espresso_core}"
}
object BuildPlugins {
const val kotlin = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.kotlin}"
const val androidGradle = "com.android.tools.build:gradle:${Versions.gradle}"
const val kotlinGradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:${Versions.kotlin}"
}
}

View File

@@ -0,0 +1,19 @@
package com.owenlejeune.tvtime.buildsrc
object Versions {
const val ktlint = "0.43.2"
const val compose = "1.1.0-rc03"
const val compose_material3 = "1.0.0-alpha04"
const val gradle = "7.1.0"
const val junit = "4.13.2"
const val androidx_junit = "1.1.3"
const val espresso_core = "3.4.0"
const val kotlin = "1.6.10"
const val androidx = "1.4.1"
const val core_ktx = "1.7.0"
const val activity_compose = "1.4.0"
const val navigation = "2.4.0"
const val lifecycle_runtime = "2.4.0"
}