From 461f966e6ecd8798b8a9ba316995ce3e2cc238bd Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 16 Jun 2024 21:20:54 +0200 Subject: [PATCH] clipboard: Allow removing history entries --- res/layout/clipboard_history_entry.xml | 1 + srcs/juloo.keyboard2/ClipboardHistoryView.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/res/layout/clipboard_history_entry.xml b/res/layout/clipboard_history_entry.xml index 45bc22a..0c81bcc 100644 --- a/res/layout/clipboard_history_entry.xml +++ b/res/layout/clipboard_history_entry.xml @@ -3,5 +3,6 @@ + diff --git a/srcs/juloo.keyboard2/ClipboardHistoryView.java b/srcs/juloo.keyboard2/ClipboardHistoryView.java index 88684a9..e13bec8 100644 --- a/srcs/juloo.keyboard2/ClipboardHistoryView.java +++ b/srcs/juloo.keyboard2/ClipboardHistoryView.java @@ -41,6 +41,12 @@ public final class ClipboardHistoryView extends NonScrollListView _service.remove_history_entry(clip); } + /** The history entry at index [pos] is removed from the history. */ + public void remove_entry(int pos) + { + _service.remove_history_entry(_history.get(pos)); + } + @Override public void on_clipboard_history_change() { @@ -85,6 +91,12 @@ public final class ClipboardHistoryView extends NonScrollListView @Override public void onClick(View v) { pin_entry(pos); } }); + v.findViewById(R.id.clipboard_entry_removehist).setOnClickListener( + new View.OnClickListener() + { + @Override + public void onClick(View v) { remove_entry(pos); } + }); return v; } }