Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch #18

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app/release/baselineProfiles/0/app-release.dm
Binary file not shown.
Binary file added app/release/baselineProfiles/1/app-release.dm
Binary file not shown.
37 changes: 37 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.shahin.bookmine",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File",
"baselineProfiles": [
{
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/app-release.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/app-release.dm"
]
}
],
"minSdkVersionForDexing": 23
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,19 @@ interface BooksDao {
* [getBooksByTitle] returns all [BookEntity]s when [title] is empty and not blank
*/
@Transaction
@Query(" SELECT * FROM books WHERE title LIKE '%' || :title || '%' ")
@Query("""
SELECT * FROM books
WHERE title LIKE '%' || :title || '%'
ORDER BY
CASE
WHEN release_date LIKE '% BC' THEN -CAST(SUBSTR(release_date, 1, LENGTH(release_date) - 3) AS INT)
ELSE CAST(SUBSTR(release_date, -4) AS INT)
END DESC,
CASE
WHEN release_date LIKE '%/%/%' THEN STRFTIME('%Y-%m-%d', release_date)
ELSE STRFTIME('%Y-01-01', release_date || '-01-01')
END DESC
""")
fun getBooksByTitle(title: String): PagingSource<Int, BookEntity>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -322,7 +323,7 @@ private fun DetailsScreenContent(
modifier = Modifier.testTag("details-author"),
text = buildAnnotatedString {
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
append("Author:")
append(stringResource(R.string.author))
}
append(" ")
append(bookDetails?.author.orEmpty())
Expand Down
4 changes: 4 additions & 0 deletions feature/book_details/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="author">Author:</string>
</resources>
Loading