From bf3b9c374e1e68b1244da392666b571ab37e51fb Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 6 Jul 2024 22:16:37 +0200 Subject: Clipboard pane (#681) This adds the clipboard pane, which allows to save an arbitrary number of clipboards and to paste them later. The key can be disabled in settings. Checking the "Recently copied text" checkbox will cause the keyboard to keep a temporary history of copied text. This history can only contain 3 elements which expire after 5 minutes. If this is unchecked, no history is collected. History entries can be pinned into the persisted list of pins. --- srcs/juloo.keyboard2/Keyboard2.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'srcs/juloo.keyboard2/Keyboard2.java') diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index c332375..0c82aaf 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -36,6 +36,7 @@ public class Keyboard2 extends InputMethodService /** Layout associated with the currently selected locale. Not 'null'. */ private KeyboardData _localeTextLayout; private ViewGroup _emojiPane = null; + private ViewGroup _clipboard_pane = null; public int actionId; // Action performed by the Action key. private Config _config; @@ -113,6 +114,7 @@ public class Keyboard2 extends InputMethodService _keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard); _keyboardView.reset(); Logs.set_debug_logs(getResources().getBoolean(R.bool.debug_logs)); + ClipboardHistoryService.on_startup(this, _keyeventhandler); } private List getEnabledSubtypes(InputMethodManager imm) @@ -223,6 +225,7 @@ public class Keyboard2 extends InputMethodService { _keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard); _emojiPane = null; + _clipboard_pane = null; setInputView(_keyboardView); } _keyboardView.reset(); @@ -384,7 +387,14 @@ public class Keyboard2 extends InputMethodService setInputView(_emojiPane); break; + case SWITCH_CLIPBOARD: + if (_clipboard_pane == null) + _clipboard_pane = (ViewGroup)inflate_view(R.layout.clipboard_pane); + setInputView(_clipboard_pane); + break; + case SWITCH_BACK_EMOJI: + case SWITCH_BACK_CLIPBOARD: setInputView(_keyboardView); break; -- cgit v1.2.3