clipboard: Allow removing history entries

This commit is contained in:
Jules Aguillon 2024-06-16 21:20:54 +02:00
parent 3b2fad8996
commit 461f966e6e
2 changed files with 13 additions and 0 deletions

View File

@ -3,5 +3,6 @@
<TextView android:id="@+id/clipboard_entry_text" style="@style/clipboardEntry"/>
<LinearLayout style="@style/clipboardEntryButtons">
<View android:id="@+id/clipboard_entry_addpin" style="@style/clipboardEntryButton" android:background="@android:drawable/ic_menu_add"/>
<View android:id="@+id/clipboard_entry_removehist" style="@style/clipboardEntryButton" android:background="@android:drawable/ic_menu_delete"/>
</LinearLayout>
</LinearLayout>

View File

@ -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;
}
}