From 247ed0607d4b2929710e33be17a401f8e3a664e8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 26 Jan 2022 22:08:14 +0100 Subject: [PATCH] adding a Clipboard button at the top toolbar --- .../keyboard/views/MyKeyboardView.kt | 17 ++++++++++++----- .../main/res/drawable/ic_clipboard_vector.xml | 4 ++++ .../main/res/layout/keyboard_view_keyboard.xml | 18 +++++++++++++++++- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 app/src/main/res/drawable/ic_clipboard_vector.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt index 2d37201..a31b1be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt @@ -278,6 +278,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut } settings_cog.applyColorFilter(mTextColor) + pinned_clipboard_items.applyColorFilter(mTextColor) clipboard_clear.applyColorFilter(mTextColor) } } @@ -319,6 +320,17 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut context.startActivity(this) } } + + pinned_clipboard_items.setOnLongClickListener { context.toast(R.string.clipboard); true; } + pinned_clipboard_items.setOnClickListener { + + } + + clipboard_clear.setOnLongClickListener { context.toast(R.string.clear_clipboard_data); true; } + clipboard_clear.setOnClickListener { + clearClipboardContent() + toggleClipboardVisibility(false) + } } val clipboardManager = (context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager) @@ -552,11 +564,6 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut } } - clipboard_clear.setOnLongClickListener { context.toast(R.string.clear_clipboard_data); true; } - clipboard_clear.setOnClickListener { - clearClipboardContent() - toggleClipboardVisibility(false) - } toggleClipboardVisibility(true) } } else { diff --git a/app/src/main/res/drawable/ic_clipboard_vector.xml b/app/src/main/res/drawable/ic_clipboard_vector.xml new file mode 100644 index 0000000..e5e1a13 --- /dev/null +++ b/app/src/main/res/drawable/ic_clipboard_vector.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/res/layout/keyboard_view_keyboard.xml b/app/src/main/res/layout/keyboard_view_keyboard.xml index c8fefbb..73d16b2 100644 --- a/app/src/main/res/layout/keyboard_view_keyboard.xml +++ b/app/src/main/res/layout/keyboard_view_keyboard.xml @@ -26,13 +26,28 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + +