Skip to content

Commit

Permalink
feat: add invert color to toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Nov 1, 2024
1 parent f908bc6 commit 0b8607d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import info.plateaukao.einkbro.preference.ConfigManager
import info.plateaukao.einkbro.preference.TranslationMode
import info.plateaukao.einkbro.preference.toggle
import info.plateaukao.einkbro.unit.IntentUnit
import info.plateaukao.einkbro.unit.ViewUnit
import info.plateaukao.einkbro.view.EBWebView
import info.plateaukao.einkbro.view.dialog.compose.TtsSettingDialogFragment
import info.plateaukao.einkbro.view.toolbaricons.ToolbarAction
Expand Down Expand Up @@ -91,5 +92,9 @@ class ToolbarActionHandler(
ToolbarAction.VerticalLayout -> browserController.toggleVerticalRead()
ToolbarAction.SaveEpub -> browserController.showSaveEpubDialog()
ToolbarAction.ShareLink -> IntentUnit.share(activity, ebWebView.title, ebWebView.url)
ToolbarAction.InvertColor -> {
val hasInvertedColor = config.toggleInvertedColor(ebWebView.url.orEmpty())
ViewUnit.invertColor(ebWebView, hasInvertedColor)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.material.icons.outlined.FormatSize
import androidx.compose.material.icons.outlined.Fullscreen
import androidx.compose.material.icons.outlined.GTranslate
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.InvertColors
import androidx.compose.material.icons.outlined.LibraryAdd
import androidx.compose.material.icons.outlined.LooksOne
import androidx.compose.material.icons.outlined.Menu
Expand Down Expand Up @@ -166,6 +167,10 @@ enum class ToolbarAction(
imageVector = Icons.AutoMirrored.Outlined.Article,
titleResId = R.string.menu_save_epub,
),
InvertColor(
imageVector = Icons.Outlined.InvertColors,
titleResId = R.string.menu_invert_color,
),
;


Expand Down

0 comments on commit 0b8607d

Please sign in to comment.