-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated UI of BookInfo screen * Dialogs to update fields (title, author and description) * Simplified updating mechanism
- Loading branch information
Showing
44 changed files
with
957 additions
and
1,242 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
app/src/main/java/ua/acclorite/book_story/presentation/book_info/BookInfoAuthorDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ua.acclorite.book_story.presentation.book_info | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.platform.LocalContext | ||
import ua.acclorite.book_story.R | ||
import ua.acclorite.book_story.domain.library.book.Book | ||
import ua.acclorite.book_story.domain.ui.UIText | ||
import ua.acclorite.book_story.presentation.core.components.dialog.DialogWithTextField | ||
import ua.acclorite.book_story.ui.book_info.BookInfoEvent | ||
|
||
@Composable | ||
fun BookInfoAuthorDialog( | ||
book: Book, | ||
actionAuthorDialog: (BookInfoEvent.OnActionAuthorDialog) -> Unit, | ||
dismissDialog: (BookInfoEvent.OnDismissDialog) -> Unit | ||
) { | ||
val context = LocalContext.current | ||
DialogWithTextField( | ||
initialValue = book.author.getAsString() ?: "", | ||
lengthLimit = 100, | ||
onDismiss = { | ||
dismissDialog(BookInfoEvent.OnDismissDialog) | ||
}, | ||
onAction = { | ||
actionAuthorDialog( | ||
BookInfoEvent.OnActionAuthorDialog( | ||
author = if (it.isBlank()) UIText.StringResource(R.string.unknown_author) | ||
else UIText.StringValue(it.trim().replace("\n", "")), | ||
context = context | ||
) | ||
) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...src/main/java/ua/acclorite/book_story/presentation/book_info/BookInfoDescriptionDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package ua.acclorite.book_story.presentation.book_info | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.platform.LocalContext | ||
import ua.acclorite.book_story.domain.library.book.Book | ||
import ua.acclorite.book_story.presentation.core.components.dialog.DialogWithTextField | ||
import ua.acclorite.book_story.ui.book_info.BookInfoEvent | ||
|
||
@Composable | ||
fun BookInfoDescriptionDialog( | ||
book: Book, | ||
actionDescriptionDialog: (BookInfoEvent.OnActionDescriptionDialog) -> Unit, | ||
dismissDialog: (BookInfoEvent.OnDismissDialog) -> Unit | ||
) { | ||
val context = LocalContext.current | ||
DialogWithTextField( | ||
initialValue = book.description ?: "", | ||
lengthLimit = 5000, | ||
onDismiss = { | ||
dismissDialog(BookInfoEvent.OnDismissDialog) | ||
}, | ||
onAction = { | ||
actionDescriptionDialog( | ||
BookInfoEvent.OnActionDescriptionDialog( | ||
description = if (it.isBlank()) null | ||
else it.trim().replace("\n", ""), | ||
context = context | ||
) | ||
) | ||
} | ||
) | ||
} |
Oops, something went wrong.