diff --git a/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt b/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt index b958d7ae6..bb733a474 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt +++ b/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt @@ -69,7 +69,7 @@ class ClipboardHistoryView @JvmOverloads constructor( // even when state is activated, the not activated color is set // in suggestionStripView the same thing works correctly, wtf? // need to properly fix it (and maybe undo the inverted isActivated) when adding a toggle key - listOf(ToolbarKey.LEFT, ToolbarKey.RIGHT, ToolbarKey.COPY, ToolbarKey.CLEAR_CLIPBOARD, ToolbarKey.SELECT_WORD, ToolbarKey.SELECT_ALL) + listOf(ToolbarKey.LEFT, ToolbarKey.RIGHT, ToolbarKey.COPY, ToolbarKey.CLEAR_CLIPBOARD, ToolbarKey.SELECT_WORD, ToolbarKey.SELECT_ALL, ToolbarKey.CLOSE_HISTORY) .forEach { toolbarKeys.add(createToolbarKey(context, keyboardAttr, it)) } keyboardAttr.recycle() } diff --git a/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt b/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt index 57ea19bd9..58ca8d318 100644 --- a/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt +++ b/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt @@ -56,6 +56,7 @@ fun getCodeForToolbarKey(key: ToolbarKey) = when (key) { FULL_RIGHT -> KeyCode.MOVE_END_OF_LINE SELECT_WORD -> KeyCode.CLIPBOARD_SELECT_WORD CLEAR_CLIPBOARD -> null // not managed via code input + CLOSE_HISTORY -> KeyCode.ALPHA } private fun getStyleableIconId(key: ToolbarKey) = when (key) { @@ -77,6 +78,7 @@ private fun getStyleableIconId(key: ToolbarKey) = when (key) { FULL_LEFT -> R.styleable.Keyboard_iconFullLeft FULL_RIGHT -> R.styleable.Keyboard_iconFullRight SELECT_WORD -> R.styleable.Keyboard_iconSelectWord + CLOSE_HISTORY -> R.styleable.Keyboard_iconCloseView } fun getToolbarIconByName(name: String, context: Context): Drawable? { @@ -91,12 +93,12 @@ fun getToolbarIconByName(name: String, context: Context): Drawable? { // names need to be aligned with resources strings (using lowercase of key.name) enum class ToolbarKey { VOICE, CLIPBOARD, UNDO, REDO, SETTINGS, SELECT_ALL, SELECT_WORD, COPY, ONE_HANDED, LEFT, RIGHT, UP, DOWN, - FULL_LEFT, FULL_RIGHT, INCOGNITO, AUTOCORRECT, CLEAR_CLIPBOARD + FULL_LEFT, FULL_RIGHT, INCOGNITO, AUTOCORRECT, CLEAR_CLIPBOARD, CLOSE_HISTORY } fun toToolbarKeyString(keys: Collection) = keys.joinToString(";") { it.name } -val defaultToolbarPref = entries.filterNot { it == CLEAR_CLIPBOARD }.joinToString(";") { +val defaultToolbarPref = entries.filterNot { it == CLEAR_CLIPBOARD || it == CLOSE_HISTORY }.joinToString(";") { when (it) { INCOGNITO, AUTOCORRECT, UP, DOWN, ONE_HANDED, FULL_LEFT, FULL_RIGHT -> "${it.name},false" else -> "${it.name},true" diff --git a/app/src/main/res/drawable/ic_close_view.xml b/app/src/main/res/drawable/ic_close_view.xml new file mode 100644 index 000000000..9233cb0c3 --- /dev/null +++ b/app/src/main/res/drawable/ic_close_view.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_close_view_rounded.xml b/app/src/main/res/drawable/ic_close_view_rounded.xml new file mode 100644 index 000000000..5dfc36d10 --- /dev/null +++ b/app/src/main/res/drawable/ic_close_view_rounded.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 1897a200a..d9d3668f5 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -278,6 +278,7 @@ + diff --git a/app/src/main/res/values/keyboard-icons-holo.xml b/app/src/main/res/values/keyboard-icons-holo.xml index ba5d6ab40..c7781265d 100644 --- a/app/src/main/res/values/keyboard-icons-holo.xml +++ b/app/src/main/res/values/keyboard-icons-holo.xml @@ -47,5 +47,6 @@ @drawable/ic_to_start @drawable/ic_to_end @drawable/ic_select + @drawable/ic_close_view diff --git a/app/src/main/res/values/keyboard-icons-lxx-light.xml b/app/src/main/res/values/keyboard-icons-lxx-light.xml index 7bd0d40ff..bb6bf19f9 100644 --- a/app/src/main/res/values/keyboard-icons-lxx-light.xml +++ b/app/src/main/res/values/keyboard-icons-lxx-light.xml @@ -52,5 +52,6 @@ @drawable/ic_to_start @drawable/ic_to_end @drawable/ic_select + @drawable/ic_close_view diff --git a/app/src/main/res/values/keyboard-icons-rounded.xml b/app/src/main/res/values/keyboard-icons-rounded.xml index 987037377..a7dce0946 100644 --- a/app/src/main/res/values/keyboard-icons-rounded.xml +++ b/app/src/main/res/values/keyboard-icons-rounded.xml @@ -51,5 +51,6 @@ @drawable/ic_to_start_rounded @drawable/ic_to_end_rounded @drawable/ic_select_rounded + @drawable/ic_close_view_rounded \ No newline at end of file