diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e9ff972..67c883c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,7 +20,7 @@ android { minSdkVersion(23) targetSdkVersion(30) versionCode = 2 - versionName = "0.0.2" + versionName = "0.0.3" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildFeatures { @@ -72,6 +72,7 @@ dependencies { implementation("androidx.core:core-ktx:1.5.0") implementation("androidx.datastore:datastore-preferences:1.0.0-alpha01") implementation("androidx.hilt:hilt-navigation-compose:1.0.0-alpha03") + implementation("com.google.dagger:hilt-android:$hiltVersion") implementation("androidx.lifecycle:lifecycle-extensions:2.2.0") implementation("androidx.lifecycle:lifecycle-runtime:2.3.1") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1") @@ -86,7 +87,6 @@ dependencies { implementation("com.google.accompanist:accompanist-swiperefresh:0.11.1") implementation("com.google.accompanist:accompanist-systemuicontroller:0.11.1") implementation("com.google.android.material:material:1.3.0") - implementation("com.google.dagger:hilt-android:$hiltVersion") implementation("com.jakewharton:process-phoenix:2.0.0") implementation("com.jakewharton.timber:timber:4.7.1") implementation("io.coil-kt:coil:1.2.2") diff --git a/app/src/main/kotlin/io/github/jbarr21/appdialer/ui/main/apps/AppItem.kt b/app/src/main/kotlin/io/github/jbarr21/appdialer/ui/main/apps/AppItem.kt index 605cadf..d4e4a4c 100644 --- a/app/src/main/kotlin/io/github/jbarr21/appdialer/ui/main/apps/AppItem.kt +++ b/app/src/main/kotlin/io/github/jbarr21/appdialer/ui/main/apps/AppItem.kt @@ -6,11 +6,9 @@ import androidx.compose.foundation.background import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.MaterialTheme @@ -22,6 +20,8 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.tooling.preview.PreviewParameter +import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp import com.google.accompanist.coil.rememberCoilPainter import com.google.accompanist.imageloading.ImageLoadState @@ -77,17 +77,16 @@ fun AppItem( } } +private class AppProvider : PreviewParameterProvider { + override val values = listOf("Name", "Application Name", "Really Long Application Name") + .map { previewApp.copy(name = it) } + .asSequence() +} + @Preview(widthDp = 150) @Composable -fun AppItemPreview() { +fun AppItemPreview(@PreviewParameter(AppProvider::class) app: App) { AppTheme(darkTheme = true) { - Column { - listOf("Name", "Application Name", "Really Long Application Name") - .forEach { - AppItem(previewApp.copy(name = it)) - Spacer(modifier = Modifier.height(16.dp)) - } - AppItem(previewApp.copy(name = "Calm"), query = "AA") - } + AppItem(app) } } diff --git a/app/src/main/kotlin/io/github/jbarr21/appdialer/ui/main/dialer/DialerItem.kt b/app/src/main/kotlin/io/github/jbarr21/appdialer/ui/main/dialer/DialerItem.kt index 7ec2489..c0fa846 100644 --- a/app/src/main/kotlin/io/github/jbarr21/appdialer/ui/main/dialer/DialerItem.kt +++ b/app/src/main/kotlin/io/github/jbarr21/appdialer/ui/main/dialer/DialerItem.kt @@ -2,10 +2,7 @@ package io.github.jbarr21.appdialer.ui.main.dialer import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.combinedClickable -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.material.MaterialTheme @@ -18,6 +15,8 @@ import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.tooling.preview.PreviewParameter +import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp import io.github.jbarr21.appdialer.data.DialerButton import io.github.jbarr21.appdialer.ui.AppTheme @@ -54,19 +53,18 @@ fun DialerItem( ) } +private class ButtonProvider : PreviewParameterProvider { + override val values = listOf( + 4 to "GHI", + 5 to "JKL", + -1 to "CLEAR*" + ).map { (digit, letters) -> DialerButton(digit = digit, letters = letters) }.asSequence() +} + @Preview @Composable -fun DialerItemPreview() { +fun DialerItemPreview(@PreviewParameter(ButtonProvider::class) button: DialerButton) { AppTheme(darkTheme = true) { - Column { - listOf( - 4 to "GHI", - 5 to "JKL", - -1 to "CLEAR*" - ).forEach { (digit, letters) -> - DialerItem(DialerButton(digit = digit, letters = letters)) - Spacer(modifier = Modifier.height(16.dp)) - } - } + DialerItem(button) } }