Use same icons as action bar in swipe actions

This commit is contained in:
arkon 2023-06-25 14:50:48 -04:00
parent 88e9fefa59
commit a07e0df815

View file

@ -17,13 +17,14 @@ import androidx.compose.material.DismissValue
import androidx.compose.material.SwipeToDismiss import androidx.compose.material.SwipeToDismiss
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Bookmark import androidx.compose.material.icons.filled.Bookmark
import androidx.compose.material.icons.filled.BookmarkRemove
import androidx.compose.material.icons.filled.Circle import androidx.compose.material.icons.filled.Circle
import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.outlined.BookmarkAdd
import androidx.compose.material.icons.filled.Download import androidx.compose.material.icons.outlined.BookmarkRemove
import androidx.compose.material.icons.filled.FileDownloadOff import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.filled.Visibility import androidx.compose.material.icons.outlined.Done
import androidx.compose.material.icons.filled.VisibilityOff import androidx.compose.material.icons.outlined.Download
import androidx.compose.material.icons.outlined.FileDownloadOff
import androidx.compose.material.icons.outlined.RemoveDone
import androidx.compose.material.rememberDismissState import androidx.compose.material.rememberDismissState
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.LocalContentColor import androidx.compose.material3.LocalContentColor
@ -294,32 +295,30 @@ private fun SwipeBackgroundIcon(
val imageVector = when (swipeAction) { val imageVector = when (swipeAction) {
LibraryPreferences.ChapterSwipeAction.ToggleRead -> { LibraryPreferences.ChapterSwipeAction.ToggleRead -> {
if (!read) { if (!read) {
Icons.Default.Visibility Icons.Outlined.Done
} else { } else {
Icons.Default.VisibilityOff Icons.Outlined.RemoveDone
} }
} }
LibraryPreferences.ChapterSwipeAction.ToggleBookmark -> { LibraryPreferences.ChapterSwipeAction.ToggleBookmark -> {
if (!bookmark) { if (!bookmark) {
Icons.Default.Bookmark Icons.Outlined.BookmarkAdd
} else { } else {
Icons.Default.BookmarkRemove Icons.Outlined.BookmarkRemove
} }
} }
LibraryPreferences.ChapterSwipeAction.Download -> { LibraryPreferences.ChapterSwipeAction.Download -> {
when (downloadState) { when (downloadState) {
Download.State.NOT_DOWNLOADED, Download.State.NOT_DOWNLOADED,
Download.State.ERROR, Download.State.ERROR,
-> { Icons.Default.Download } -> { Icons.Outlined.Download }
Download.State.QUEUE, Download.State.QUEUE,
Download.State.DOWNLOADING, Download.State.DOWNLOADING,
-> { Icons.Default.FileDownloadOff } -> { Icons.Outlined.FileDownloadOff }
Download.State.DOWNLOADED -> { Icons.Default.Delete } Download.State.DOWNLOADED -> { Icons.Outlined.Delete }
} }
} }
LibraryPreferences.ChapterSwipeAction.Disabled -> { LibraryPreferences.ChapterSwipeAction.Disabled -> null
null
}
} }
imageVector?.let { imageVector?.let {
Icon( Icon(