From b5552eed928466dd41ccf8a39f904007d5645a3c Mon Sep 17 00:00:00 2001 From: Enoch Date: Sat, 2 Dec 2023 21:18:34 +0100 Subject: [PATCH] Add date started and completed to BookDetailScreen, Rename composable packages to components --- .../com/enoch02/literarylinc/MainActivity.kt | 9 +- ...igationGraph.kt => LiteraryLincNavHost.kt} | 2 +- .../enoch02/literarylinc/ui/theme/Theme.kt | 4 +- .../enoch02/bookdetail/BookDetailScreen.kt | 46 ++- .../BookDetailHeader.kt | 2 +- .../BookInfoText.kt | 3 +- .../BackArrowButton.kt | 2 +- .../FormDatePicker.kt | 273 +++++++++--------- .../FormIntField.kt | 4 +- .../{composables => components}/FormSlider.kt | 2 +- .../FormSpinner.kt | 4 +- .../FormTextField.kt | 2 +- .../ImagePicker.kt | 2 +- .../com/enoch02/modifybook/AddBookScreen.kt | 18 +- .../com/enoch02/modifybook/EditBookScreen.kt | 18 +- 15 files changed, 210 insertions(+), 181 deletions(-) rename app/src/main/java/com/enoch02/literarylinc/navigation/{NavigationGraph.kt => LiteraryLincNavHost.kt} (97%) rename features/bookdetail/src/main/java/com/enoch02/{composables => components}/BookDetailHeader.kt (98%) rename features/bookdetail/src/main/java/com/enoch02/{composables => components}/BookInfoText.kt (90%) rename features/modifybook/src/main/java/com/enoch02/{composables => components}/BackArrowButton.kt (95%) rename features/modifybook/src/main/java/com/enoch02/{composables => components}/FormDatePicker.kt (95%) rename features/modifybook/src/main/java/com/enoch02/{composables => components}/FormIntField.kt (97%) rename features/modifybook/src/main/java/com/enoch02/{composables => components}/FormSlider.kt (96%) rename features/modifybook/src/main/java/com/enoch02/{composables => components}/FormSpinner.kt (96%) rename features/modifybook/src/main/java/com/enoch02/{composables => components}/FormTextField.kt (97%) rename features/modifybook/src/main/java/com/enoch02/{composables => components}/ImagePicker.kt (99%) diff --git a/app/src/main/java/com/enoch02/literarylinc/MainActivity.kt b/app/src/main/java/com/enoch02/literarylinc/MainActivity.kt index b649e4a..c0814da 100644 --- a/app/src/main/java/com/enoch02/literarylinc/MainActivity.kt +++ b/app/src/main/java/com/enoch02/literarylinc/MainActivity.kt @@ -7,14 +7,9 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.ui.Modifier -import com.enoch02.literarylinc.navigation.NavigationGraph +import com.enoch02.literarylinc.navigation.LiteraryLincNavHost import com.enoch02.literarylinc.ui.theme.LiteraryLincTheme -import dagger.hilt.EntryPoint -import dagger.hilt.InstallIn import dagger.hilt.android.AndroidEntryPoint -import dagger.hilt.android.HiltAndroidApp -import dagger.hilt.components.SingletonComponent -import javax.inject.Inject @AndroidEntryPoint class MainActivity : ComponentActivity() { @@ -27,7 +22,7 @@ class MainActivity : ComponentActivity() { modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { - NavigationGraph() + LiteraryLincNavHost() } } } diff --git a/app/src/main/java/com/enoch02/literarylinc/navigation/NavigationGraph.kt b/app/src/main/java/com/enoch02/literarylinc/navigation/LiteraryLincNavHost.kt similarity index 97% rename from app/src/main/java/com/enoch02/literarylinc/navigation/NavigationGraph.kt rename to app/src/main/java/com/enoch02/literarylinc/navigation/LiteraryLincNavHost.kt index b1924da..a4c58a4 100644 --- a/app/src/main/java/com/enoch02/literarylinc/navigation/NavigationGraph.kt +++ b/app/src/main/java/com/enoch02/literarylinc/navigation/LiteraryLincNavHost.kt @@ -22,7 +22,7 @@ import com.enoch02.more.navigation.MoreScreenDestination import com.enoch02.more.settings.SettingsScreen @Composable -fun NavigationGraph(navController: NavHostController = rememberNavController()) { +fun LiteraryLincNavHost(navController: NavHostController = rememberNavController()) { NavHost( navController = navController, startDestination = Screen.LiteraryLincApp.route, diff --git a/app/src/main/java/com/enoch02/literarylinc/ui/theme/Theme.kt b/app/src/main/java/com/enoch02/literarylinc/ui/theme/Theme.kt index 645a3b9..3bb88ed 100644 --- a/app/src/main/java/com/enoch02/literarylinc/ui/theme/Theme.kt +++ b/app/src/main/java/com/enoch02/literarylinc/ui/theme/Theme.kt @@ -2,6 +2,8 @@ package com.enoch02.literarylinc.ui.theme import android.app.Activity import android.os.Build +import androidx.compose.animation.AnimatedContent +import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme @@ -73,4 +75,4 @@ fun LiteraryLincTheme( typography = Typography, content = content ) -} \ No newline at end of file +} diff --git a/features/bookdetail/src/main/java/com/enoch02/bookdetail/BookDetailScreen.kt b/features/bookdetail/src/main/java/com/enoch02/bookdetail/BookDetailScreen.kt index 5e3f68c..33be962 100644 --- a/features/bookdetail/src/main/java/com/enoch02/bookdetail/BookDetailScreen.kt +++ b/features/bookdetail/src/main/java/com/enoch02/bookdetail/BookDetailScreen.kt @@ -1,5 +1,7 @@ package com.enoch02.bookdetail +import android.icu.text.SimpleDateFormat +import android.os.Build import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -30,9 +32,15 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController -import com.enoch02.composables.BookDetailHeader -import com.enoch02.composables.BookInfoText +import com.enoch02.components.BookDetailHeader +import com.enoch02.components.BookInfoText import com.enoch02.database.model.Book +import java.time.Instant +import java.time.LocalDateTime +import java.time.ZoneId +import java.time.format.DateTimeFormatter +import java.util.Date +import java.util.Locale @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -159,11 +167,16 @@ fun BookDetailScreen( value = "${book.pageCount}" ) } - item { BookInfoText(header = "Date Started", value = "Demo value") } + item { + BookInfoText( + header = "Date Started", + value = formatEpochDate(book.dateStarted) + ) + } item { BookInfoText( header = "Date Completed", - value = "Demo value" + value = formatEpochDate(book.dateCompleted) ) } item { @@ -175,7 +188,7 @@ fun BookDetailScreen( item { BookInfoText( header = "Personal Rating", - value = "${book.personalRating}" + value = "${book.personalRating}/10" ) } item { BookInfoText(header = "ISBN", value = book.isbn) } @@ -188,3 +201,26 @@ fun BookDetailScreen( } ) } + +//TODO: move to some module or package... +fun formatEpochDate(date: Long?): String { + return when { + Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && date != null -> { + val formatter = DateTimeFormatter.ofPattern("dd MMM yyyy") + val dateObj = LocalDateTime.ofInstant( + Instant.ofEpochMilli(date), + ZoneId.systemDefault() + ) + formatter.format(dateObj) + } + + Build.VERSION.SDK_INT <= Build.VERSION_CODES.O && date != null -> { + val formatter = SimpleDateFormat("dd MMM yyyy", Locale.ROOT) + formatter.format(Date(date)) + } + + else -> { + "" + } + } +} diff --git a/features/bookdetail/src/main/java/com/enoch02/composables/BookDetailHeader.kt b/features/bookdetail/src/main/java/com/enoch02/components/BookDetailHeader.kt similarity index 98% rename from features/bookdetail/src/main/java/com/enoch02/composables/BookDetailHeader.kt rename to features/bookdetail/src/main/java/com/enoch02/components/BookDetailHeader.kt index 08962aa..c539e48 100644 --- a/features/bookdetail/src/main/java/com/enoch02/composables/BookDetailHeader.kt +++ b/features/bookdetail/src/main/java/com/enoch02/components/BookDetailHeader.kt @@ -1,4 +1,4 @@ -package com.enoch02.composables +package com.enoch02.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row diff --git a/features/bookdetail/src/main/java/com/enoch02/composables/BookInfoText.kt b/features/bookdetail/src/main/java/com/enoch02/components/BookInfoText.kt similarity index 90% rename from features/bookdetail/src/main/java/com/enoch02/composables/BookInfoText.kt rename to features/bookdetail/src/main/java/com/enoch02/components/BookInfoText.kt index 1f53691..4c251c9 100644 --- a/features/bookdetail/src/main/java/com/enoch02/composables/BookInfoText.kt +++ b/features/bookdetail/src/main/java/com/enoch02/components/BookInfoText.kt @@ -1,4 +1,4 @@ -package com.enoch02.composables +package com.enoch02.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -7,7 +7,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp diff --git a/features/modifybook/src/main/java/com/enoch02/composables/BackArrowButton.kt b/features/modifybook/src/main/java/com/enoch02/components/BackArrowButton.kt similarity index 95% rename from features/modifybook/src/main/java/com/enoch02/composables/BackArrowButton.kt rename to features/modifybook/src/main/java/com/enoch02/components/BackArrowButton.kt index e2cd5d2..d7e444d 100644 --- a/features/modifybook/src/main/java/com/enoch02/composables/BackArrowButton.kt +++ b/features/modifybook/src/main/java/com/enoch02/components/BackArrowButton.kt @@ -1,4 +1,4 @@ -package com.enoch02.composables +package com.enoch02.components import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ArrowBack diff --git a/features/modifybook/src/main/java/com/enoch02/composables/FormDatePicker.kt b/features/modifybook/src/main/java/com/enoch02/components/FormDatePicker.kt similarity index 95% rename from features/modifybook/src/main/java/com/enoch02/composables/FormDatePicker.kt rename to features/modifybook/src/main/java/com/enoch02/components/FormDatePicker.kt index 1603a9c..74b68f5 100644 --- a/features/modifybook/src/main/java/com/enoch02/composables/FormDatePicker.kt +++ b/features/modifybook/src/main/java/com/enoch02/components/FormDatePicker.kt @@ -1,138 +1,137 @@ -package com.enoch02.composables - -import android.icu.text.SimpleDateFormat -import android.os.Build -import androidx.compose.foundation.clickable -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.padding -import androidx.compose.material3.DatePicker -import androidx.compose.material3.DatePickerDialog -import androidx.compose.material3.DatePickerState -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.OutlinedTextFieldDefaults -import androidx.compose.material3.Text -import androidx.compose.material3.TextButton -import androidx.compose.runtime.Composable -import androidx.compose.runtime.derivedStateOf -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.dp -import com.enoch02.addbook.R -import java.time.Instant -import java.time.LocalDateTime -import java.time.ZoneId -import java.time.format.DateTimeFormatter -import java.util.Date -import java.util.Locale - -@OptIn(ExperimentalMaterial3Api::class) -@Composable -fun FormDatePicker( - modifier: Modifier, - label: String, - datePickerState: DatePickerState -) { - var showDialog by remember { mutableStateOf(false) } - var formattedDate by rememberSaveable { mutableStateOf("") } - - val formatDate: () -> Unit = { - formattedDate = - when { - Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && datePickerState.selectedDateMillis != null -> { - val formatter = DateTimeFormatter.ofPattern("dd MMM yyyy") - val date = LocalDateTime.ofInstant( - Instant.ofEpochMilli(datePickerState.selectedDateMillis!!), - ZoneId.systemDefault() - ) - formatter.format(date) - } - - Build.VERSION.SDK_INT <= Build.VERSION_CODES.O && datePickerState.selectedDateMillis != null -> { - val formatter = SimpleDateFormat("dd MMM yyyy", Locale.ROOT) - formatter.format(Date(datePickerState.selectedDateMillis!!)) - } - - else -> { - "" - } - } - } - formatDate() - - Column(modifier = modifier) { - Text(text = label, fontWeight = FontWeight.Bold) - Spacer(modifier = Modifier.height(8.dp)) - - OutlinedTextField( - readOnly = true, - value = formattedDate, - onValueChange = { }, - trailingIcon = { - IconButton( - onClick = { showDialog = true }, - content = { - Icon( - painter = painterResource(R.drawable.round_arrow_drop_down_24), - contentDescription = null - ) - } - ) - }, - enabled = false, - colors = OutlinedTextFieldDefaults.colors( - disabledTextColor = MaterialTheme.colorScheme.onSurface, - disabledBorderColor = MaterialTheme.colorScheme.outline, - disabledLeadingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledTrailingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledLabelColor = MaterialTheme.colorScheme.onSurfaceVariant, - disabledPlaceholderColor = MaterialTheme.colorScheme.onSurfaceVariant - ), - modifier = Modifier - .fillMaxWidth() - .clickable { showDialog = true }, - ) - - //TODO: extract string resources - if (showDialog) { - val confirmEnabled by remember { derivedStateOf { datePickerState.selectedDateMillis != null } } - - DatePickerDialog( - onDismissRequest = { showDialog = false }, - confirmButton = { - TextButton( - onClick = { - showDialog = false - formatDate() - }, - enabled = confirmEnabled, - content = { Text(text = "OK") } - ) - }, - dismissButton = { - TextButton( - onClick = { showDialog = false }, - content = { - Text(text = "Cancel") - } - ) - }, - content = { - DatePicker(state = datePickerState) - } - ) - } - } +package com.enoch02.components + +import android.icu.text.SimpleDateFormat +import android.os.Build +import androidx.compose.foundation.clickable +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.material3.DatePicker +import androidx.compose.material3.DatePickerDialog +import androidx.compose.material3.DatePickerState +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.OutlinedTextFieldDefaults +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import com.enoch02.addbook.R +import java.time.Instant +import java.time.LocalDateTime +import java.time.ZoneId +import java.time.format.DateTimeFormatter +import java.util.Date +import java.util.Locale + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun FormDatePicker( + modifier: Modifier, + label: String, + datePickerState: DatePickerState +) { + var showDialog by remember { mutableStateOf(false) } + var formattedDate by rememberSaveable { mutableStateOf("") } + + val formatDate: () -> Unit = { + formattedDate = + when { + Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && datePickerState.selectedDateMillis != null -> { + val formatter = DateTimeFormatter.ofPattern("dd MMM yyyy") + val date = LocalDateTime.ofInstant( + Instant.ofEpochMilli(datePickerState.selectedDateMillis!!), + ZoneId.systemDefault() + ) + formatter.format(date) + } + + Build.VERSION.SDK_INT <= Build.VERSION_CODES.O && datePickerState.selectedDateMillis != null -> { + val formatter = SimpleDateFormat("dd MMM yyyy", Locale.ROOT) + formatter.format(Date(datePickerState.selectedDateMillis!!)) + } + + else -> { + "" + } + } + } + formatDate() + + Column(modifier = modifier) { + Text(text = label, fontWeight = FontWeight.Bold) + Spacer(modifier = Modifier.height(8.dp)) + + OutlinedTextField( + readOnly = true, + value = formattedDate, + onValueChange = { }, + trailingIcon = { + IconButton( + onClick = { showDialog = true }, + content = { + Icon( + painter = painterResource(R.drawable.round_arrow_drop_down_24), + contentDescription = null + ) + } + ) + }, + enabled = false, + colors = OutlinedTextFieldDefaults.colors( + disabledTextColor = MaterialTheme.colorScheme.onSurface, + disabledBorderColor = MaterialTheme.colorScheme.outline, + disabledLeadingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, + disabledTrailingIconColor = MaterialTheme.colorScheme.onSurfaceVariant, + disabledLabelColor = MaterialTheme.colorScheme.onSurfaceVariant, + disabledPlaceholderColor = MaterialTheme.colorScheme.onSurfaceVariant + ), + modifier = Modifier + .fillMaxWidth() + .clickable { showDialog = true }, + ) + + //TODO: extract string resources + if (showDialog) { + val confirmEnabled by remember { derivedStateOf { datePickerState.selectedDateMillis != null } } + + DatePickerDialog( + onDismissRequest = { showDialog = false }, + confirmButton = { + TextButton( + onClick = { + showDialog = false + formatDate() + }, + enabled = confirmEnabled, + content = { Text(text = "OK") } + ) + }, + dismissButton = { + TextButton( + onClick = { showDialog = false }, + content = { + Text(text = "Cancel") + } + ) + }, + content = { + DatePicker(state = datePickerState) + } + ) + } + } } \ No newline at end of file diff --git a/features/modifybook/src/main/java/com/enoch02/composables/FormIntField.kt b/features/modifybook/src/main/java/com/enoch02/components/FormIntField.kt similarity index 97% rename from features/modifybook/src/main/java/com/enoch02/composables/FormIntField.kt rename to features/modifybook/src/main/java/com/enoch02/components/FormIntField.kt index 8a2a5d1..7007481 100644 --- a/features/modifybook/src/main/java/com/enoch02/composables/FormIntField.kt +++ b/features/modifybook/src/main/java/com/enoch02/components/FormIntField.kt @@ -1,4 +1,4 @@ -package com.enoch02.composables +package com.enoch02.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -44,7 +44,7 @@ internal fun FormIntField( } }, - modifier = Modifier, + modifier = Modifier.fillMaxWidth(), keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Number, imeAction = ImeAction.Next, diff --git a/features/modifybook/src/main/java/com/enoch02/composables/FormSlider.kt b/features/modifybook/src/main/java/com/enoch02/components/FormSlider.kt similarity index 96% rename from features/modifybook/src/main/java/com/enoch02/composables/FormSlider.kt rename to features/modifybook/src/main/java/com/enoch02/components/FormSlider.kt index b6991b4..fba1f40 100644 --- a/features/modifybook/src/main/java/com/enoch02/composables/FormSlider.kt +++ b/features/modifybook/src/main/java/com/enoch02/components/FormSlider.kt @@ -1,4 +1,4 @@ -package com.enoch02.composables +package com.enoch02.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer diff --git a/features/modifybook/src/main/java/com/enoch02/composables/FormSpinner.kt b/features/modifybook/src/main/java/com/enoch02/components/FormSpinner.kt similarity index 96% rename from features/modifybook/src/main/java/com/enoch02/composables/FormSpinner.kt rename to features/modifybook/src/main/java/com/enoch02/components/FormSpinner.kt index 353a85b..4ff6eac 100644 --- a/features/modifybook/src/main/java/com/enoch02/composables/FormSpinner.kt +++ b/features/modifybook/src/main/java/com/enoch02/components/FormSpinner.kt @@ -1,4 +1,4 @@ -package com.enoch02.composables +package com.enoch02.components import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column @@ -8,14 +8,12 @@ import androidx.compose.foundation.layout.height import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.ExposedDropdownMenuDefaults import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text -import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf diff --git a/features/modifybook/src/main/java/com/enoch02/composables/FormTextField.kt b/features/modifybook/src/main/java/com/enoch02/components/FormTextField.kt similarity index 97% rename from features/modifybook/src/main/java/com/enoch02/composables/FormTextField.kt rename to features/modifybook/src/main/java/com/enoch02/components/FormTextField.kt index 130e5f3..6f810af 100644 --- a/features/modifybook/src/main/java/com/enoch02/composables/FormTextField.kt +++ b/features/modifybook/src/main/java/com/enoch02/components/FormTextField.kt @@ -1,4 +1,4 @@ -package com.enoch02.composables +package com.enoch02.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer diff --git a/features/modifybook/src/main/java/com/enoch02/composables/ImagePicker.kt b/features/modifybook/src/main/java/com/enoch02/components/ImagePicker.kt similarity index 99% rename from features/modifybook/src/main/java/com/enoch02/composables/ImagePicker.kt rename to features/modifybook/src/main/java/com/enoch02/components/ImagePicker.kt index 7793fff..a8c0e89 100644 --- a/features/modifybook/src/main/java/com/enoch02/composables/ImagePicker.kt +++ b/features/modifybook/src/main/java/com/enoch02/components/ImagePicker.kt @@ -1,4 +1,4 @@ -package com.enoch02.composables +package com.enoch02.components import android.content.Intent import android.net.Uri diff --git a/features/modifybook/src/main/java/com/enoch02/modifybook/AddBookScreen.kt b/features/modifybook/src/main/java/com/enoch02/modifybook/AddBookScreen.kt index e2ade45..683f473 100644 --- a/features/modifybook/src/main/java/com/enoch02/modifybook/AddBookScreen.kt +++ b/features/modifybook/src/main/java/com/enoch02/modifybook/AddBookScreen.kt @@ -46,14 +46,14 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController import com.enoch02.addbook.R -import com.enoch02.composables.BackArrowButton -import com.enoch02.composables.FormDatePicker -import com.enoch02.composables.FormIntField -import com.enoch02.composables.FormSlider -import com.enoch02.composables.FormSpinner -import com.enoch02.composables.FormTextField -import com.enoch02.composables.ImagePicker -import com.enoch02.composables.IncrementalFormIntField +import com.enoch02.components.BackArrowButton +import com.enoch02.components.FormDatePicker +import com.enoch02.components.FormIntField +import com.enoch02.components.FormSlider +import com.enoch02.components.FormSpinner +import com.enoch02.components.FormTextField +import com.enoch02.components.ImagePicker +import com.enoch02.components.IncrementalFormIntField import com.enoch02.database.model.Book import kotlinx.coroutines.launch @@ -272,7 +272,7 @@ fun AddBookScreen( } item { - FormTextField( + FormIntField( label = stringResource(R.string.isbn_label), value = isbn, onValueChange = { isbn = it }, diff --git a/features/modifybook/src/main/java/com/enoch02/modifybook/EditBookScreen.kt b/features/modifybook/src/main/java/com/enoch02/modifybook/EditBookScreen.kt index c7a64f3..357a6eb 100644 --- a/features/modifybook/src/main/java/com/enoch02/modifybook/EditBookScreen.kt +++ b/features/modifybook/src/main/java/com/enoch02/modifybook/EditBookScreen.kt @@ -45,14 +45,14 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import com.enoch02.addbook.R -import com.enoch02.composables.BackArrowButton -import com.enoch02.composables.FormDatePicker -import com.enoch02.composables.FormIntField -import com.enoch02.composables.FormSlider -import com.enoch02.composables.FormSpinner -import com.enoch02.composables.FormTextField -import com.enoch02.composables.ImagePicker -import com.enoch02.composables.IncrementalFormIntField +import com.enoch02.components.BackArrowButton +import com.enoch02.components.FormDatePicker +import com.enoch02.components.FormIntField +import com.enoch02.components.FormSlider +import com.enoch02.components.FormSpinner +import com.enoch02.components.FormTextField +import com.enoch02.components.ImagePicker +import com.enoch02.components.IncrementalFormIntField import com.enoch02.database.model.Book import kotlinx.coroutines.launch @@ -293,7 +293,7 @@ fun EditBookScreen( } item { - FormTextField( + FormIntField( label = stringResource(R.string.isbn_label), value = isbn, onValueChange = { isbn = it },