diff --git a/app/src/main/java/info/plateaukao/einkbro/view/handlers/ToolbarActionHandler.kt b/app/src/main/java/info/plateaukao/einkbro/view/handlers/ToolbarActionHandler.kt index af1a866f..8e80b4af 100644 --- a/app/src/main/java/info/plateaukao/einkbro/view/handlers/ToolbarActionHandler.kt +++ b/app/src/main/java/info/plateaukao/einkbro/view/handlers/ToolbarActionHandler.kt @@ -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 @@ -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) + } } } \ No newline at end of file diff --git a/app/src/main/java/info/plateaukao/einkbro/view/toolbaricons/ToolbarAction.kt b/app/src/main/java/info/plateaukao/einkbro/view/toolbaricons/ToolbarAction.kt index 52b85e80..2fbe7ddf 100644 --- a/app/src/main/java/info/plateaukao/einkbro/view/toolbaricons/ToolbarAction.kt +++ b/app/src/main/java/info/plateaukao/einkbro/view/toolbaricons/ToolbarAction.kt @@ -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 @@ -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, + ), ;