Skip to content

Commit e6a550f

Browse files
committed
LatinIME: Add clipboard paste key
In the additional comma keys (beside settings). Change-Id: If715b33874cd2121a4d460748c1d8d053b49cc68
1 parent 61cdd0e commit e6a550f

15 files changed

Lines changed: 96 additions & 31 deletions

common/src/com/android/inputmethod/latin/common/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ public static boolean isValidCoordinate(final int coordinate) {
247247
public static final int CODE_ALPHA_FROM_EMOJI = -14;
248248
// Code value representing the code is not specified.
249249
public static final int CODE_UNSPECIFIED = -15;
250+
public static final int CODE_CLIPBOARD_PASTE = -16;
250251

251252
public static boolean isLetterCode(final int code) {
252253
return code >= CODE_SPACE;
@@ -269,6 +270,7 @@ public static String printableCode(final int code) {
269270
case CODE_SHIFT_ENTER: return "shiftEnter";
270271
case CODE_ALPHA_FROM_EMOJI: return "alpha";
271272
case CODE_UNSPECIFIED: return "unspec";
273+
case CODE_CLIPBOARD_PASTE: return "clipboard_paste";
272274
case CODE_TAB: return "tab";
273275
case CODE_ENTER: return "enter";
274276
case CODE_SPACE: return "space";
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
SPDX-FileCopyrightText: Material Design Authors / Google LLC
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
7+
android:width="24dp"
8+
android:height="24dp"
9+
android:viewportWidth="24"
10+
android:viewportHeight="24">
11+
<path
12+
android:fillColor="#CCFFFFFF"
13+
android:pathData="M19,2h-4.18C14.4,0.84 13.3,0 12,0c-1.3,0 -2.4,0.84 -2.82,2L5,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM12,2c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM19,20L5,20L5,4h2v3h10L17,4h2v16z"/>
14+
</vector>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
SPDX-FileCopyrightText: Material Design Authors / Google LLC
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
7+
android:width="24dp"
8+
android:height="24dp"
9+
android:viewportWidth="24"
10+
android:viewportHeight="24">
11+
<path
12+
android:fillColor="#37474F"
13+
android:pathData="M19,2h-4.18C14.4,0.84 13.3,0 12,0c-1.3,0 -2.4,0.84 -2.82,2L5,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM12,2c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM19,20L5,20L5,4h2v3h10L17,4h2v16z"/>
14+
</vector>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
SPDX-FileCopyrightText: Material Design Authors / Google LLC
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
7+
android:width="24dp"
8+
android:height="24dp"
9+
android:viewportWidth="24"
10+
android:viewportHeight="24">
11+
<path
12+
android:fillColor="@color/icon_color_you"
13+
android:pathData="M19,2h-4.18C14.4,0.84 13.3,0 12,0c-1.3,0 -2.4,0.84 -2.82,2L5,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM12,2c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM19,20L5,20L5,4h2v3h10L17,4h2v16z"/>
14+
</vector>

java/res/values/attrs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@
282282
<attr name="iconImeKey" format="reference" />
283283
<attr name="iconEmojiActionKey" format="reference" />
284284
<attr name="iconEmojiNormalKey" format="reference" />
285+
<attr name="iconClipboardPasteKey" format="reference" />
285286
</declare-styleable>
286287

287288
<declare-styleable name="Keyboard_GridRows">

java/res/values/keyboard-icons-lxx-dark.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
<item name="iconZwjKey">@drawable/sym_keyboard_zwj_lxx_dark</item>
4343
<item name="iconEmojiActionKey">@drawable/sym_keyboard_smiley_lxx_dark</item>
4444
<item name="iconEmojiNormalKey">@drawable/sym_keyboard_smiley_lxx_dark</item>
45+
<item name="iconClipboardPasteKey">@drawable/sym_keyboard_clipboard_paste_lxx_dark</item>
4546
</style>
4647
</resources>

java/res/values/keyboard-icons-lxx-light.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@
4444
<item name="iconEmojiActionKey">@drawable/sym_keyboard_smiley_lxx_dark</item>
4545
<!-- Use dark green emoji icon (for lxx_light) because a normal key has white color background. -->
4646
<item name="iconEmojiNormalKey">@drawable/sym_keyboard_smiley_lxx_light</item>
47+
<item name="iconClipboardPasteKey">@drawable/sym_keyboard_clipboard_paste_lxx_light</item>
4748
</style>
4849
</resources>

java/res/values/keyboard-icons-you.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
<item name="iconZwjKey">@drawable/sym_keyboard_zwj_lxx_dark</item>
2828
<item name="iconEmojiActionKey">@drawable/sym_keyboard_smiley_you</item>
2929
<item name="iconEmojiNormalKey">@drawable/sym_keyboard_smiley_you</item>
30+
<item name="iconClipboardPasteKey">@drawable/sym_keyboard_clipboard_paste_you</item>
3031
</style>
3132
</resources>

java/res/xml/key_styles_settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<key-style
3636
latin:styleName="settingsMoreKeysStyle"
3737
latin:keyLabelFlags="hasPopupHint"
38-
latin:additionalMoreKeys="!text/keyspec_settings"
38+
latin:additionalMoreKeys="!text/keyspec_settings,!text/keyspec_clipboard_paste"
3939
latin:backgroundType="functional" />
4040
</default>
4141
</switch>

java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static int getCode(final String name) {
5353
"key_emoji",
5454
"key_alpha_from_emoji",
5555
"key_unspecified",
56+
"key_clipboard_paste",
5657
};
5758

5859
private static final int[] DEFAULT = {
@@ -73,6 +74,7 @@ public static int getCode(final String name) {
7374
Constants.CODE_EMOJI,
7475
Constants.CODE_ALPHA_FROM_EMOJI,
7576
Constants.CODE_UNSPECIFIED,
77+
Constants.CODE_CLIPBOARD_PASTE,
7678
};
7779

7880
static {

0 commit comments

Comments
 (0)