From e22fc226a165840f90815954b5d0419b204a6879 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 6 Jul 2024 22:05:45 +0200 Subject: [PATCH] history entry: Swap the remove button for a paste button --- res/layout/clipboard_history_entry.xml | 2 +- .../juloo.keyboard2/ClipboardHistoryView.java | 44 +++++++++++-------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/res/layout/clipboard_history_entry.xml b/res/layout/clipboard_history_entry.xml index ef1b5ca..9d34a9e 100644 --- a/res/layout/clipboard_history_entry.xml +++ b/res/layout/clipboard_history_entry.xml @@ -2,7 +2,7 @@ + - diff --git a/srcs/juloo.keyboard2/ClipboardHistoryView.java b/srcs/juloo.keyboard2/ClipboardHistoryView.java index 11871e7..b4eb6fe 100644 --- a/srcs/juloo.keyboard2/ClipboardHistoryView.java +++ b/srcs/juloo.keyboard2/ClipboardHistoryView.java @@ -43,10 +43,10 @@ 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) + /** Send the specified entry to the editor. */ + public void paste_entry(int pos) { - _service.remove_history_entry(_history.get(pos)); + ClipboardHistoryService.paste(_history.get(pos)); } @Override @@ -93,26 +93,32 @@ public final class ClipboardHistoryView extends NonScrollListView @Override public void onClick(View v) { pin_entry(pos); } }); - v.findViewById(R.id.clipboard_entry_removehist).setOnClickListener( + v.findViewById(R.id.clipboard_entry_paste).setOnClickListener( new View.OnClickListener() { @Override - public void onClick(View v) - { - AlertDialog d = new AlertDialog.Builder(getContext()) - .setTitle(R.string.clipboard_remove_confirm) - .setPositiveButton(R.string.clipboard_remove_confirmed, - new DialogInterface.OnClickListener(){ - public void onClick(DialogInterface _dialog, int _which) - { - remove_entry(pos); - } - }) - .setNegativeButton(android.R.string.cancel, null) - .create(); - Utils.show_dialog_on_ime(d, v.getWindowToken()); - } + public void onClick(View v) { paste_entry(pos); } }); + // v.findViewById(R.id.clipboard_entry_removehist).setOnClickListener( + // new View.OnClickListener() + // { + // @Override + // public void onClick(View v) + // { + // AlertDialog d = new AlertDialog.Builder(getContext()) + // .setTitle(R.string.clipboard_remove_confirm) + // .setPositiveButton(R.string.clipboard_remove_confirmed, + // new DialogInterface.OnClickListener(){ + // public void onClick(DialogInterface _dialog, int _which) + // { + // _service.remove_history_entry(_history.get(pos)); + // } + // }) + // .setNegativeButton(android.R.string.cancel, null) + // .create(); + // Utils.show_dialog_on_ime(d, v.getWindowToken()); + // } + // }); return v; } }