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