Skip to content

Commit

Permalink
Clipboard pane (#681)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Julow committed Jul 6, 2024
1 parent 6021a0b commit bf3b9c3
Show file tree
Hide file tree
Showing 43 changed files with 711 additions and 7 deletions.
Binary file modified assets/special_font.ttf
Binary file not shown.
5 changes: 3 additions & 2 deletions check_layout.output
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {
0 warnings
# latn_bone
Layout includes some ASCII punctuation but not all, missing: $
Layout redefines the bottom row but some important keys are missing, missing: cursor_left, cursor_right, loc compose, loc end, loc home, loc page_down, loc page_up, loc switch_greekmath, loc voice_typing, switch_backward
Layout redefines the bottom row but some important keys are missing, missing: cursor_left, cursor_right, loc compose, loc end, loc home, loc page_down, loc page_up, loc switch_clipboard, loc switch_greekmath, loc voice_typing, switch_backward
2 warnings
# latn_colemak
Some keys contain whitespaces, unexpected: ́
1 warnings
# latn_dvorak
0 warnings
# latn_neo2
0 warnings
Layout redefines the bottom row but some important keys are missing, missing: loc switch_clipboard
1 warnings
# latn_qwerty_br
0 warnings
# latn_qwerty_cz
Expand Down
3 changes: 2 additions & 1 deletion check_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
KNOWN_NOT_LAYOUT = set([
"number_row", "numpad", "pin",
"bottom_row", "settings", "method",
"greekmath", "numeric", "emoji_bottom_row" ])
"greekmath", "numeric", "emoji_bottom_row",
"clipboard_bottom_row" ])

def warn(msg):
global warning_count
Expand Down
1 change: 1 addition & 0 deletions res/drawable/ic_clipboard_paste.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- drawable/file_send.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M14,2H6C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M12.54,19.37V17.37H8.54V15.38H12.54V13.38L15.54,16.38L12.54,19.37M13,9V3.5L18.5,9H13Z" /></vector>
1 change: 1 addition & 0 deletions res/drawable/ic_clipboard_save.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- drawable/bookmark_plus.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M17,3A2,2 0 0,1 19,5V21L12,18L5,21V5C5,3.89 5.9,3 7,3H17M11,7V9H9V11H11V13H13V11H15V9H13V7H11Z" /></vector>
1 change: 1 addition & 0 deletions res/drawable/ic_delete.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- drawable/delete.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" /></vector>
8 changes: 8 additions & 0 deletions res/layout/clipboard_history_entry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:id="@+id/clipboard_entry_text" style="@style/clipboardEntry"/>
<LinearLayout style="@style/clipboardEntryButtons">
<View android:id="@+id/clipboard_entry_paste" style="@style/clipboardEntryButton" android:background="@drawable/ic_clipboard_paste"/>
<View android:id="@+id/clipboard_entry_addpin" style="@style/clipboardEntryButton" android:background="@drawable/ic_clipboard_save"/>
</LinearLayout>
</LinearLayout>
12 changes: 12 additions & 0 deletions res/layout/clipboard_pane.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:background="?attr/colorKeyboard" android:hardwareAccelerated="false">
<ScrollView android:layout_width="fill_parent" android:layout_height="@dimen/clipboard_view_height">
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<juloo.keyboard2.ClipboardHistoryCheckBox android:text="@string/clipboard_history_heading" style="@style/clipboardHeading" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<juloo.keyboard2.ClipboardHistoryView android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:divider="?attr/clipboard_divider_color" android:dividerHeight="?attr/clipboard_divider_height"/>
<TextView android:text="@string/clipboard_pin_heading" style="@style/clipboardHeading" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<juloo.keyboard2.ClipboardPinView android:id="@+id/clipboard_pin_view" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:divider="?attr/clipboard_divider_color" android:dividerHeight="?attr/clipboard_divider_height"/>
</LinearLayout>
</ScrollView>
<juloo.keyboard2.Keyboard2View layout="@xml/clipboard_bottom_row" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="?attr/colorKeyboard"/>
</LinearLayout>
8 changes: 8 additions & 0 deletions res/layout/clipboard_pin_entry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:id="@+id/clipboard_pin_text" style="@style/clipboardEntry" android:maxLines="3"/>
<LinearLayout style="@style/clipboardEntryButtons">
<View android:id="@+id/clipboard_pin_paste" style="@style/clipboardEntryButton" android:background="@drawable/ic_clipboard_paste"/>
<View android:id="@+id/clipboard_pin_remove" style="@style/clipboardEntryButton" android:background="@drawable/ic_delete"/>
</LinearLayout>
</LinearLayout>
5 changes: 5 additions & 0 deletions res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ Tato aplikace neobsahuje žádné reklamy, nevyužívá připojení k síti a je
<string name="key_descr_page_down">Page Down</string>
<string name="key_descr_home">Home</string>
<string name="key_descr_end">End</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell
<string name="key_descr_page_down">Bild ab</string>
<string name="key_descr_home">Pos1</string>
<string name="key_descr_end">Ende</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y
<string name="key_descr_page_down">Re Pág</string>
<string name="key_descr_home">Inicio</string>
<string name="key_descr_end">Fin</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ This application contains no ads, doesn't make any network requests and is Open
<!-- <string name="key_descr_page_down">Page Down</string> -->
<!-- <string name="key_descr_home">Home</string> -->
<!-- <string name="key_descr_end">End</string> -->
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est
<string name="key_descr_page_down">Page suivante</string>
<string name="key_descr_home">Début</string>
<string name="key_descr_end">Fin</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ This application contains no ads, doesn't make any network requests and is Open
<!-- <string name="key_descr_page_down">Page Down</string> -->
<!-- <string name="key_descr_home">Home</string> -->
<!-- <string name="key_descr_end">End</string> -->
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ This application contains no ads, doesn't make any network requests and is Open
<!-- <string name="key_descr_page_down">Page Down</string> -->
<!-- <string name="key_descr_home">Home</string> -->
<!-- <string name="key_descr_end">End</string> -->
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-lv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,9 @@ Tagad lieliski piemērota izmantošanai ikdienā.
<string name="key_descr_page_down">Lejupšķirt</string>
<string name="key_descr_home">Sākums</string>
<string name="key_descr_end">Beigas</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród
<string name="key_descr_page_down">Page Down</string>
<string name="key_descr_home">Home</string>
<string name="key_descr_end">End</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ Este aplicativo não contém anúncios, não faz nenhuma solicitação de rede e
<string name="key_descr_page_down">Page Down</string>
<string name="key_descr_home">Home</string>
<string name="key_descr_end">End</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-ro/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e
<!-- <string name="key_descr_page_down">Page Down</string> -->
<!-- <string name="key_descr_home">Home</string> -->
<!-- <string name="key_descr_end">End</string> -->
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@
<string name="key_descr_page_down">Страница вниз</string>
<string name="key_descr_home">Home</string>
<string name="key_descr_end">End</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."</str
<string name="key_descr_page_down">Aşağı</string>
<string name="key_descr_home">BAŞ(Sol yön tuşu)</string>
<string name="key_descr_end">SON(Sağ yön tuşu)</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@
<string name="key_descr_page_down">Page Down</string>
<string name="key_descr_home">Home</string>
<string name="key_descr_end">End</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày.
<!-- <string name="key_descr_page_down">Page Down</string> -->
<!-- <string name="key_descr_home">Home</string> -->
<!-- <string name="key_descr_end">End</string> -->
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@
<string name="key_descr_page_down">下一页</string>
<string name="key_descr_home">Home</string>
<string name="key_descr_end">End</string>
<!-- <string name="key_descr_clipboard">Clipboard manager</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
</resources>
5 changes: 5 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="key_descr_page_down">Page Down</string>
<string name="key_descr_home">Home</string>
<string name="key_descr_end">End</string>
<string name="key_descr_clipboard">Clipboard manager</string>
<string name="clipboard_history_heading">Recently copied text</string>
<string name="clipboard_pin_heading">Pinned</string>
<string name="clipboard_remove_confirm">Remove this clipboard?</string>
<string name="clipboard_remove_confirmed">Yes</string>
</resources>
34 changes: 34 additions & 0 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Emoji pane -->
<style name="emojiTypeButton">
<item name="android:padding">1px</item>
<item name="android:gravity">center</item>
Expand All @@ -15,6 +16,39 @@
<item name="android:textSize">@dimen/emoji_text_size</item>
<item name="android:textColor">?attr/emoji_color</item>
</style>
<!-- Clipboard pane -->
<style name="clipboardEntry">
<item name="android:layout_weight">1</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginHorizontal">14dp</item>
<item name="android:layout_marginVertical">14dp</item>
<item name="android:textSize">16dp</item>
<item name="android:textColor">?attr/colorLabel</item>
</style>
<style name="clipboardHeading">
<item name="android:layout_marginHorizontal">6dp</item>
<item name="android:layout_marginTop">14dp</item>
<item name="android:layout_marginBottom">0dp</item>
<item name="android:textSize">14dp</item>
<item name="android:fontWeight">700</item>
<item name="android:textColor">?attr/colorSubLabel</item>
</style>
<style name="clipboardEntryButtons">
<item name="android:orientation">horizontal</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_marginRight">12dp</item>
</style>
<style name="clipboardEntryButton">
<item name="android:layout_width">24dp</item>
<item name="android:layout_height">24dp</item>
<item name="android:layout_marginHorizontal">2dp</item>
<item name="android:backgroundTint">?attr/colorLabel</item>
<item name="android:backgroundTintMode">src_in</item>
</style>
<!-- Launcher activity -->
<style name="paragraph">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
Expand Down
10 changes: 9 additions & 1 deletion res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
<attr name="keyBorderColorTop" format="color"/>
<attr name="keyBorderColorRight" format="color"/>
<attr name="keyBorderColorBottom" format="color"/>
<!-- Emoji panel -->
<!-- Emoji pane -->
<attr name="emoji_button_bg" type="color" format="color"/>
<attr name="emoji_color" type="color" format="color"/>
<attr name="emoji_key_bg" type="color" format="color"/>
<attr name="emoji_key_text" type="color" format="color"/>
<!-- Clipboard pane -->
<attr name="clipboard_divider_color" type="color" format="color"/>
<attr name="clipboard_divider_height" format="dimension"/>
<!-- System integration -->
<attr name="navigationBarColor" format="color"/>
<attr name="windowLightNavigationBar" format="boolean"/>
Expand All @@ -43,6 +46,8 @@
<item name="greyedDimming">0.5</item>
<item name="emoji_key_bg" type="color">?attr/emoji_button_bg</item>
<item name="emoji_key_text" type="color">?attr/colorLabel</item>
<item name="clipboard_divider_color" type="color">?attr/colorKey</item>
<item name="clipboard_divider_height">1px</item>
</style>
<style name="Dark" parent="BaseTheme">
<item name="android:isLightTheme">false</item>
Expand Down Expand Up @@ -116,6 +121,7 @@
<item name="colorSubLabel">#333333</item>
<item name="emoji_button_bg">#ffffff</item>
<item name="emoji_color">#000000</item>
<item name="clipboard_divider_color" type="color">#eeeeee</item>
</style>
<style name="ePaper" parent="BaseTheme">
<item name="android:isLightTheme">true</item>
Expand All @@ -134,6 +140,8 @@
<item name="colorSubLabel">#333333</item>
<item name="emoji_button_bg">#ffffff</item>
<item name="emoji_color">#000000</item>
<item name="clipboard_divider_color" type="color">#000000</item>
<item name="clipboard_divider_height">2dp</item>
</style>
<style name="Desert" parent="@style/BaseTheme">
<item name="android:isLightTheme">true</item>
Expand Down
Loading

0 comments on commit bf3b9c3

Please sign in to comment.