🛠️ Fix issues with dark theme switching
* Fixed issue with dark theme switching incorrectly on API 35
This commit is contained in:
parent
812584b5bb
commit
c40b068e11
3 changed files with 9 additions and 18 deletions
|
|
@ -35,7 +35,7 @@
|
|||
<activity
|
||||
android:name=".Activity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|locale|density"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|locale|density|uiMode"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.Start.Splash">
|
||||
<intent-filter>
|
||||
|
|
|
|||
|
|
@ -329,8 +329,8 @@ class HistoryViewModel @Inject constructor(
|
|||
return
|
||||
}
|
||||
|
||||
val history = historyWithoutBooks.map {
|
||||
val book = books.find { book -> book.id == it.bookId }!!
|
||||
val history = historyWithoutBooks.mapNotNull {
|
||||
val book = books.find { book -> book.id == it.bookId } ?: return@mapNotNull null
|
||||
it.copy(
|
||||
book = book
|
||||
)
|
||||
|
|
@ -340,8 +340,8 @@ class HistoryViewModel @Inject constructor(
|
|||
|
||||
history
|
||||
.filter {
|
||||
val book = books.find { book -> book.id == it.bookId }!!
|
||||
book.title.lowercase().trim().contains(query.lowercase().trim())
|
||||
val book = books.find { book -> book.id == it.bookId }
|
||||
book?.title?.lowercase()?.trim()?.contains(query.lowercase().trim()) == true
|
||||
}.groupBy { item ->
|
||||
val calendar = Calendar.getInstance().apply {
|
||||
timeInMillis = item.time
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import androidx.compose.material3.IconButtonDefaults
|
|||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
@ -55,18 +54,10 @@ fun LibraryBookItem(
|
|||
onLongClick: () -> Unit,
|
||||
onButtonClick: () -> Unit
|
||||
) {
|
||||
val primaryColor = MaterialTheme.colorScheme.primary
|
||||
val onPrimaryColor = MaterialTheme.colorScheme.onPrimary
|
||||
val onSurfaceColor = MaterialTheme.colorScheme.onSurface
|
||||
|
||||
val backgroundColor = remember(book.second) {
|
||||
if (book.second) primaryColor
|
||||
else Color.Transparent
|
||||
}
|
||||
val fontColor = remember(book.second) {
|
||||
if (book.second) onPrimaryColor
|
||||
else onSurfaceColor
|
||||
}
|
||||
val backgroundColor = if (book.second) MaterialTheme.colorScheme.primary
|
||||
else Color.Transparent
|
||||
val fontColor = if (book.second) MaterialTheme.colorScheme.onPrimary
|
||||
else MaterialTheme.colorScheme.onSurface
|
||||
|
||||
val progress = rememberSaveable(book.first.progress) {
|
||||
"${book.first.progress.calculateProgress(1)}%"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue