diff options
| author | Menny Even Danan <menny@evendanan.net> | 2020-01-29 03:46:03 +0000 |
|---|---|---|
| committer | Menny Even Danan <menny@evendanan.net> | 2020-01-30 16:44:01 +0000 |
| commit | 6d5481428b7eecfe0c2d00e8aa7ec4fe6cff411c (patch) | |
| tree | 457dbd6e2e612f93b226134ce50b2f3320af6000 /api | |
| parent | 082f1459e97f6243857dd4c23831ff2568ec1cf4 (diff) | |
| download | AnySoftKeyboard-6d5481428b7eecfe0c2d00e8aa7ec4fe6cff411c.tar.gz AnySoftKeyboard-6d5481428b7eecfe0c2d00e8aa7ec4fe6cff411c.tar.bz2 | |
Initial language-packs merge
Diffstat (limited to 'api')
| -rw-r--r-- | api/build.gradle | 7 | ||||
| -rw-r--r-- | api/src/main/AndroidManifest.xml | 5 | ||||
| -rw-r--r-- | api/src/main/java/com/anysoftkeyboard/api/KeyCodes.java | 70 | ||||
| -rw-r--r-- | api/src/main/java/com/anysoftkeyboard/api/MediaInsertion.java | 19 | ||||
| -rw-r--r-- | api/src/main/res/values/attrs.xml | 37 | ||||
| -rw-r--r-- | api/src/main/res/values/extension_keyboard_types.xml | 7 | ||||
| -rw-r--r-- | api/src/main/res/values/functional_key_codes.xml | 65 | ||||
| -rw-r--r-- | api/src/main/res/values/key_heights.xml | 7 | ||||
| -rw-r--r-- | api/src/main/res/values/keyboard_layout_api.xml | 105 | ||||
| -rw-r--r-- | api/src/main/res/values/keyboard_modes.xml | 8 | ||||
| -rw-r--r-- | api/src/main/res/values/keyboard_theme_api.xml | 271 | ||||
| -rw-r--r-- | api/src/main/res/values/strings.xml | 3 | ||||
| -rw-r--r-- | api/src/main/res/values/version.xml | 4 | ||||
| -rw-r--r-- | api/src/test/java/com/anysoftkeyboard/api/KeyCodesTest.java | 76 |
14 files changed, 684 insertions, 0 deletions
diff --git a/api/build.gradle b/api/build.gradle new file mode 100644 index 000000000..2a9f1172e --- /dev/null +++ b/api/build.gradle @@ -0,0 +1,7 @@ +apply plugin: 'com.android.library' + +apply from: "${rootDir}/gradle/android_general.gradle" + +dependencies { + testImplementation project(":base-test") +} diff --git a/api/src/main/AndroidManifest.xml b/api/src/main/AndroidManifest.xml new file mode 100644 index 000000000..2a7323cff --- /dev/null +++ b/api/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ +<manifest xmlns:tools="http://schemas.android.com/tools" + package="com.anysoftkeyboard.api"> + + <uses-sdk tools:overrideLibrary="androidx.test,androidx.test.core" /> +</manifest> diff --git a/api/src/main/java/com/anysoftkeyboard/api/KeyCodes.java b/api/src/main/java/com/anysoftkeyboard/api/KeyCodes.java new file mode 100644 index 000000000..1174608b9 --- /dev/null +++ b/api/src/main/java/com/anysoftkeyboard/api/KeyCodes.java @@ -0,0 +1,70 @@ +package com.anysoftkeyboard.api; + +public class KeyCodes { + + public static final int SPACE = 32; + public static final int ENTER = 10; + public static final int TAB = 9; + public static final int ESCAPE = 27; + + public static final int DELETE = -5; + public static final int DELETE_WORD = -7; + public static final int FORWARD_DELETE = -8; + + public static final int QUICK_TEXT = -10; + public static final int QUICK_TEXT_POPUP = -102; + public static final int DOMAIN = -9; + + public static final int SHIFT = -1; + public static final int ALT = -6; + public static final int CTRL = -11; + public static final int SHIFT_LOCK = -14; + public static final int CTRL_LOCK = -15; + + public static final int MODE_SYMOBLS = -2; + public static final int MODE_ALPHABET = -99; + public static final int MODE_ALPHABET_POPUP = -98; + public static final int KEYBOARD_CYCLE = -97; + public static final int KEYBOARD_REVERSE_CYCLE = -96; + public static final int KEYBOARD_CYCLE_INSIDE_MODE = -95; + public static final int KEYBOARD_MODE_CHANGE = -94; + + public static final int ARROW_LEFT = -20; + public static final int ARROW_RIGHT = -21; + public static final int ARROW_UP = -22; + public static final int ARROW_DOWN = -23; + public static final int MOVE_HOME = -24; + public static final int MOVE_END = -25; + + public static final int SETTINGS = -100; + public static final int CANCEL = -3; + public static final int CLEAR_INPUT = -13; + public static final int VOICE_INPUT = -4; + + public static final int DISABLED = 0; + + public static final int SPLIT_LAYOUT = -110; + public static final int MERGE_LAYOUT = -111; + public static final int COMPACT_LAYOUT_TO_LEFT = -112; + public static final int COMPACT_LAYOUT_TO_RIGHT = -113; + + public static final int UTILITY_KEYBOARD = -120; + + public static final int CLIPBOARD_COPY = -130; + public static final int CLIPBOARD_CUT = -131; + public static final int CLIPBOARD_PASTE = -132; + public static final int CLIPBOARD_PASTE_POPUP = -133; + public static final int CLIPBOARD_SELECT = -134; + public static final int CLIPBOARD_SELECT_ALL = -135; + + public static final int UNDO = -136; + public static final int REDO = -137; + + public static final int IMAGE_MEDIA_POPUP = -140; + + public static final int PRE_PREPARED_ABBREVIATIONS_POPUP = -150; + public static final int PRE_PREPARED_TEXT_POPUP = -151; + public static final int PRE_PREPARED_EMAILS_POPUP = -152; + + public static final int EXTERNAL_INTEGRATION = -200; +} diff --git a/api/src/main/java/com/anysoftkeyboard/api/MediaInsertion.java b/api/src/main/java/com/anysoftkeyboard/api/MediaInsertion.java new file mode 100644 index 000000000..89abe7d5f --- /dev/null +++ b/api/src/main/java/com/anysoftkeyboard/api/MediaInsertion.java @@ -0,0 +1,19 @@ +package com.anysoftkeyboard.api; + +public class MediaInsertion { + public static final String INTENT_MEDIA_INSERTION_REQUEST_ACTION = + "com.anysoftkeyboard.api.INTENT_MEDIA_INSERTION_REQUEST_ACTION"; + public static final String INTENT_MEDIA_INSERTION_REQUEST_MEDIA_REQUEST_ID_KEY = + "com.anysoftkeyboard.api.INTENT_MEDIA_INSERTION_REQUEST_MEDIA_REQUEST_ID_KEY"; + public static final String INTENT_MEDIA_INSERTION_REQUEST_MEDIA_MIMES_KEY = + "com.anysoftkeyboard.api.INTENT_MEDIA_INSERTION_REQUEST_MEDIA_MIMES_KEY"; + + public static final String BROADCAST_INTENT_MEDIA_INSERTION_AVAILABLE_ACTION = + "com.anysoftkeyboard.api.BROADCAST_INTENT_MEDIA_INSERTION_AVAILABLE_ACTION"; + public static final String BROADCAST_INTENT_MEDIA_INSERTION_MEDIA_URI_KEY = + "com.anysoftkeyboard.api.BROADCAST_INTENT_MEDIA_INSERTION_MEDIA_URI_KEY"; + public static final String BROADCAST_INTENT_MEDIA_INSERTION_REQUEST_ID_KEY = + "com.anysoftkeyboard.api.BROADCAST_INTENT_MEDIA_INSERTION_REQUEST_ID_KEY"; + public static final String BROADCAST_INTENT_MEDIA_INSERTION_MEDIA_MIMES_KEY = + "com.anysoftkeyboard.api.BROADCAST_INTENT_MEDIA_INSERTION_MEDIA_MIMES_KEY"; +} diff --git a/api/src/main/res/values/attrs.xml b/api/src/main/res/values/attrs.xml new file mode 100644 index 000000000..84f71de6e --- /dev/null +++ b/api/src/main/res/values/attrs.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 Android Open Source Project + Copyright (C) 2013 Menny Even-Danan + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <!-- Whether should show preview. --> + <attr name="showPreview" format="reference|boolean"/> + + <declare-styleable name="keyType"> + <attr name="key_type_function" format="boolean"/> + <attr name="key_type_action" format="boolean"/> + <attr name="key_type_feedback" format="boolean"/> + </declare-styleable> + + <declare-styleable name="keyActionType"> + <attr name="action_done" format="boolean"/> + <attr name="action_search" format="boolean"/> + <attr name="action_go" format="boolean"/> + <attr name="action_send" format="boolean"/> + <attr name="action_previous" format="boolean"/> + <attr name="action_next" format="boolean"/> + </declare-styleable> + +</resources> diff --git a/api/src/main/res/values/extension_keyboard_types.xml b/api/src/main/res/values/extension_keyboard_types.xml new file mode 100644 index 000000000..a2324fbbb --- /dev/null +++ b/api/src/main/res/values/extension_keyboard_types.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources"> + <integer name="extension_keyboard_type_bottom_row">1</integer> + <integer name="extension_keyboard_type_top_row">2</integer> + <integer name="extension_keyboard_type_extension_keyboard">3</integer> + <integer name="extension_keyboard_type_utility_keyboard">4</integer> +</resources> diff --git a/api/src/main/res/values/functional_key_codes.xml b/api/src/main/res/values/functional_key_codes.xml new file mode 100644 index 000000000..55962daa5 --- /dev/null +++ b/api/src/main/res/values/functional_key_codes.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources"> + <integer name="key_code_disabled">0</integer> + + <integer name="key_code_esc">27</integer> + <integer name="key_code_tab">9</integer> + + <integer name="key_code_space">32</integer> + <integer name="key_code_enter">10</integer> + <integer name="key_code_delete">-5</integer> + <integer name="key_code_clear_input">-13</integer> + <integer name="key_code_voice_input">-4</integer> + + <integer name="key_code_quick_text">-10</integer> + <integer name="key_code_quick_text_popup">-102</integer> + <integer name="key_code_image_media_popup">-140</integer> + <integer name="key_code_pre_prepared_abbreviations_popup">-150</integer> + <integer name="key_code_pre_prepared_text_popup">-151</integer> + <integer name="key_code_pre_prepared_emails_popup">-152</integer> + <integer name="key_code_external_integration">-200</integer> + <integer name="key_code_domain">-9</integer> + + <integer name="key_code_shift">-1</integer> + <integer name="key_code_alt">-6</integer> + <integer name="key_code_ctrl">-11</integer> + <integer name="key_code_shift_lock">-14</integer> + <integer name="key_code_ctrl_lock">-15</integer> + + <integer name="key_code_mode_symbols">-2</integer> + <integer name="key_code_mode_alphabet">-99</integer> + <integer name="key_code_mode_alphabet_popup">-98</integer> + <integer name="key_code_keyboard_cycle">-97</integer> + <integer name="key_code_keyboard_reverse_cycle">-96</integer> + <integer name="key_code_keyboard_cycle_inside_mode">-95</integer> + <integer name="key_code_keyboard_mode_change">-94</integer> + + <integer name="key_code_arrow_left">-20</integer> + <integer name="key_code_arrow_right">-21</integer> + <integer name="key_code_arrow_up">-22</integer> + <integer name="key_code_arrow_down">-23</integer> + <integer name="key_code_move_home">-24</integer> + <integer name="key_code_move_end">-25</integer> + + <integer name="key_code_settings">-100</integer> + <integer name="key_code_cancel">-3</integer> + + <integer name="key_code_split_layout">-110</integer> + <integer name="key_code_merge_layout">-111</integer> + <integer name="key_code_compact_layout_to_left">-112</integer> + <integer name="key_code_compact_layout_to_right">-113</integer> + + <integer name="key_code_utility_keyboard">-120</integer> + + <integer name="key_code_clipboard_copy">-130</integer> + <integer name="key_code_clipboard_cut">-131</integer> + <integer name="key_code_clipboard_paste">-132</integer> + <integer name="key_code_clipboard_paste_popup">-133</integer> + <integer name="key_code_clipboard_select">-134</integer> + <integer name="key_code_clipboard_select_all">-135</integer> + <integer name="key_code_undo">-136</integer> + <integer name="key_code_redo">-137</integer> + + <integer name="key_code_delete_word">-7</integer> + <integer name="key_code_forward_delete">-8</integer> +</resources> diff --git a/api/src/main/res/values/key_heights.xml b/api/src/main/res/values/key_heights.xml new file mode 100644 index 000000000..6f0c69e5e --- /dev/null +++ b/api/src/main/res/values/key_heights.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources"> + <integer name="key_zero_height">0</integer> + <integer name="key_normal_height">-1</integer> + <integer name="key_short_height">-2</integer> + <integer name="key_tall_height">-3</integer> +</resources> diff --git a/api/src/main/res/values/keyboard_layout_api.xml b/api/src/main/res/values/keyboard_layout_api.xml new file mode 100644 index 000000000..e34dda3ee --- /dev/null +++ b/api/src/main/res/values/keyboard_layout_api.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 Android Open Source Project +Copyright (C) 2013 Menny Even-Danan + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + + <declare-styleable name="KeyboardLayout"> + <!-- Default width of a key, in pixels or percentage of display width. --> + <attr name="android:keyWidth"/> + <!-- Default height of a key, in pixels or percentage of display width. --> + <attr name="android:keyHeight"/> + <!-- Default horizontal gap between keys. --> + <attr name="android:horizontalGap"/> + <!-- Default vertical gap between rows of keys. --> + <attr name="android:verticalGap"/> + <!-- Whether should show preview. --> + <attr name="showPreview"/> + </declare-styleable> + + <declare-styleable name="KeyboardLayout_Row"> + <!-- Row edge flags. --> + <attr name="android:rowEdgeFlags"> + </attr> + <!-- Mode of the keyboard. If the mode doesn't match the + requested keyboard mode, the row will be skipped. --> + <attr name="android:keyboardMode"/> + </declare-styleable> + + <declare-styleable name="KeyboardLayout_Key"> + <!-- The unicode value or comma-separated values that this key outputs. --> + <attr name="android:codes"/> + + <!-- The XML keyboard layout of any popup keyboard. --> + <attr name="android:popupKeyboard"/> + <!-- The characters to display in the popup keyboard. --> + <attr name="android:popupCharacters"/> + <!-- Key edge flags. --> + <attr name="android:keyEdgeFlags"> + </attr> + <!-- Whether this is a modifier key such as Alt or Shift. --> + <attr name="android:isModifier"/> + <!-- Whether this is a toggle key. --> + <attr name="android:isSticky"/> + <!-- Whether long-pressing on this key will make it repeat. --> + <attr name="android:isRepeatable"/> + <!-- The icon to show in the popup preview. --> + <attr name="android:iconPreview"/> + <!-- The string of characters to output when this key is pressed. --> + <attr name="android:keyOutputText"/> + <!-- The label to display on the key. --> + <attr name="android:keyLabel"/> + <!-- The icon to display on the key instead of the label. --> + <attr name="android:keyIcon"/> + <!-- Mode of the keyboard. If the mode doesn't match the + requested keyboard mode, the key will be skipped. --> + <attr name="android:keyboardMode"/> + + <attr name="longPressCode" format="reference|integer"/> + + <attr name="isFunctional" format="reference|boolean"/> + + <attr name="shiftedCodes" format="reference|integer|string"/> + + <attr name="shiftedKeyLabel" format="reference|string"/> + + <!-- Whether should show preview. --> + <attr name="showPreview"/> + + <attr name="keyDynamicEmblem"> + <flag name="none" value="0"/> + <flag name="text" value="1"/> + <flag name="icon" value="2"/> + </attr> + + <!-- The characters to display as a hint for the popup keyboard --> + + <!-- The characters to display as a hint for the popup keyboard --> + <attr name="hintLabel" format="reference|string"/> + + <attr name="showInLayout"> + <!--default value--> + <flag name="always" value="0"/> + <flag name="if_applicable" value="1"/> + <flag name="never" value="2"/> + </attr> + + <!-- coma separated tags for this key. Might be used for completions --> + <attr name="tags" format="reference|string"/> + + <attr name="extra_key_data" format="reference|string"/> + </declare-styleable> +</resources>
\ No newline at end of file diff --git a/api/src/main/res/values/keyboard_modes.xml b/api/src/main/res/values/keyboard_modes.xml new file mode 100644 index 000000000..2968c7034 --- /dev/null +++ b/api/src/main/res/values/keyboard_modes.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources"> + <integer name="keyboard_mode_normal">1</integer> + <integer name="keyboard_mode_im">2</integer> + <integer name="keyboard_mode_url">3</integer> + <integer name="keyboard_mode_email">4</integer> + <integer name="keyboard_mode_password">5</integer> +</resources> diff --git a/api/src/main/res/values/keyboard_theme_api.xml b/api/src/main/res/values/keyboard_theme_api.xml new file mode 100644 index 000000000..d1460ac95 --- /dev/null +++ b/api/src/main/res/values/keyboard_theme_api.xml @@ -0,0 +1,271 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 Android Open Source Project + Copyright (C) 2013 Menny Even-Danan + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <declare-styleable name="AnyKeyboardViewTheme"> + <!-- Image for the key. This image needs to be a StateListDrawable, with the following + possible states: normal, pressed, checkable, checkable+pressed, checkable+checked, + checkable+checked+pressed. --> + <attr name="keyBackground" format="reference"/> + + <!-- Size of the text for character keys. --> + <attr name="keyTextSize" format="reference|dimension"/> + + <!-- Size of the text for custom keys with some text and no icon. --> + <attr name="labelTextSize" format="reference|dimension"/> + + <!-- Color to use for the label in a key. --> + <attr name="keyTextColor" format="reference|color"/> + + <!-- size of different keys height --> + <attr name="keyNormalHeight" format="reference|dimension"/> + <attr name="keySmallHeight" format="reference|dimension"/> + <attr name="keyLargeHeight" format="reference|dimension"/> + + <attr name="keyHorizontalGap" format="reference|dimension"/> + <attr name="keyVerticalGap" format="reference|dimension"/> + + <!-- Vertical offset of the key press feedback from the key. --> + <attr name="keyPreviewOffset" format="reference|dimension"/> + <attr name="keyPreviewBackground" format="reference"/> + <attr name="keyPreviewTextSize" format="reference|dimension"/> + <attr name="keyPreviewTextColor" format="reference|color"/> + <attr name="keyPreviewLabelTextSize" format="reference|dimension"/> + + <!-- Hysteresis distance for key debouncing --> + <attr name="keyHysteresisDistance" format="reference|dimension"/> + + <!-- Amount to offset the touch Y coordinate by, for bias correction. --> + <attr name="verticalCorrection" format="reference|dimension"/> + + <attr name="shadowColor" format="reference|color"/> + <attr name="shadowRadius" format="reference|dimension"/> + <attr name="shadowOffsetX" format="reference|dimension"/> + <attr name="shadowOffsetY" format="reference|dimension"/> + + <attr name="backgroundDimAmount" format="reference|float"/> + + <attr name="keyTextStyle"> + <flag name="normal" value="0"/> + <flag name="bold" value="1"/> + <flag name="italic" value="2"/> + </attr> + + <attr name="keyTextCaseStyle"> + <flag name="auto" value="0"/> + <flag name="lowercase" value="1"/> + <flag name="uppercase" value="2"/> + </attr> + + <attr name="symbolColorScheme"> + <flag name="white" value="0"/> + <flag name="black" value="1"/> + </attr> + + <attr name="android:background"/> + <attr name="android:paddingLeft"/> + <attr name="android:paddingTop"/> + <attr name="android:paddingRight"/> + <attr name="android:paddingBottom"/> + + <attr name="suggestionNormalTextColor" format="reference|color"/> + <attr name="suggestionRecommendedTextColor" format="reference|color"/> + <attr name="suggestionOthersTextColor" format="reference|color"/> + <attr name="suggestionTextSize" format="reference|dimension"/> + <attr name="suggestionBackgroundImage" format="reference"/> + <attr name="suggestionDividerImage" format="reference"/> + <attr name="suggestionCloseImage" format="reference"/> + <attr name="suggestionStripHeight" format="reference|dimension"/> + + <!-- Size of the text for hinting about long press output. --> + <attr name="hintTextSize" format="reference|dimension"/> + + <!-- Color to use for hint text. --> + <attr name="hintTextColor" format="reference|color"/> + + <!-- Size of the text for the prefered word. --> + <attr name="suggestionPreferedWordTextSize" format="reference|dimension"/> + <!-- vertical padding. --> + <attr name="suggestionWordXGap" format="reference|dimension"/> + + <!-- location of hint labels --> + <attr name="hintLabelAlign"> + <flag name="left" value="3"/> + <flag name="center" value="17"/> + <flag name="right" value="5"/> + </attr> + <attr name="hintLabelVAlign"> + <flag name="top" value="48"/> + <flag name="bottom" value="80"/> + <!-- currently not supported --> + <flag name="center" value="17"/> + </attr> + + <!-- hint label to use when hintLabel unspecified and more than 3 characters in --> + <!-- popupCharacters or when longPressCode instead of popupCharacters --> + <!-- (if none specified, app default used) --> + <attr name="hintOverflowLabel" format="reference|string"/> + + <!-- FOR FUTURE EXPANSION - NOT YET SUPPORTED --> + + <!-- hint icon to use when no hintLabel given and more than 3 characters in popupCharacters --> + <!-- or when longPressCode instead of popupCharacters (if not specified, app default used) --> + <!-- if both icon and label specified, icon wins --> + <attr name="hintOverflowIcon" format="reference"/> + <!-- allow the key to have another hint to show that there are more characters in --> + <!-- popupCharacters than shown by the hint label (if not specified, none used) --> + <attr name="extraHintLabel" format="reference|string"/> + <attr name="extraHintIcon" format="reference"/> + <attr name="extraHintLabelAlign"> + <flag name="left" value="3"/> + <flag name="center" value="17"/> + <flag name="right" value="5"/> + </attr> + <attr name="extraHintLabelVAlign"> + <flag name="top" value="48"/> + <flag name="bottom" value="80"/> + <!-- less likely to support... --> + <flag name="center" value="17"/> + </attr> + <!-- allow main key label/icon to be in different positions --> + <!-- behavior before implemented: keyLabelIconAlign="center" keyLabelIconVAlign="auto" --> + <attr name="keyLabelIconAlign"> + <!-- against left or right edge of key --> + <flag name="left" value="3"/> + <flag name="right" value="5"/> + <!-- horizontally centered at center of key (adjusted only for key padding) --> + <flag name="center" value="17"/> + <!-- centered, but also adjust position to account for hint label location --> + <flag name="auto" value="7"/> + </attr> + + <attr name="keyLabelIconVAlign"> + <!-- against top or bottom edge of key --> + <flag name="top" value="48"/> + <flag name="bottom" value="80"/> + <!-- vertically centered at center of key (adjusted only for key padding) --> + <flag name="center" value="17"/> + <!-- centered, but also adjust position to account for hint label location --> + <flag name="auto" value="112"/> + </attr> + <!-- expected behavior if showHintOnPreview="false" and showExtraHintOnPreview="true" --> + <!-- is that extra hint is shown if any long press or popupCharacters for key --> + + <!-- keyboard wallpaper - this is the image BEHIND the keyboard, it is visible when switching layout with animation --> + <attr name="keyboardWallpaper" format="reference"/> + + <attr name="keyboardNameTextSize" format="reference|dimension"/> + <attr name="keyboardNameTextColor" format="reference|color"/> + + <attr name="previewGestureTextSize" format="reference|dimension"/> + <attr name="previewGestureTextColor" format="reference|color"/> + <!-- show hint and/or extra hint on preview --> + <attr name="showHintOnPreview" format="reference|boolean"/> + <attr name="showExtraHintOnPreview" format="reference|boolean"/> + <attr name="previewAnimationType"> + <flag name="none" value="0"/> + <!--default value--> + <flag name="extend_key" value="1"/> + <flag name="appear" value="2"/> + </attr> + + <attr name="swipeTypingColor" format="reference|color"/> + <attr name="swipeTypingStrokeWidth" format="reference|dimension"/> + <attr name="swipeTypingStrokeMinWidth" format="reference|dimension"/> + <attr name="swipeTypingStrokeWidthStep" format="reference|dimension"/> + <attr name="swipeTypingStrokeMinAlpha" format="reference|float"/> + <attr name="swipeTypingStrokeAlphaStep" format="reference|integer"/> + <attr name="swipeTypingShadowColor" format="reference|color"/> + <attr name="swipeTypingShadowRadius" format="reference|dimension"/> + <attr name="swipeTypingShadowOffsetX" format="reference|dimension"/> + <attr name="swipeTypingShadowOffsetY" format="reference|dimension"/> + </declare-styleable> + + <declare-styleable name="AnyKeyboardViewIconsTheme"> + <!-- should support normal, android:state_pressed, key_type_feedback, android:state_pressed+key_type_feedback, android:state_checked, state_checked+key_type_feedback --> + <attr name="iconKeyShift" format="reference"/> + <!-- should support normal, android:state_pressed, key_type_feedback, android:state_pressed+key_type_feedback, android:state_checked, state_checked+key_type_feedback --> + <attr name="iconKeyControl" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyBackspace" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeySpace" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyTab" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyCancel" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyGlobe" format="reference"/> + <!-- should support normal, key_type_feedback, action_done, action_done+key_type_feedback, action_search, action_search+key_type_feedback, action_go, action_go+key_type_feedback --> + <attr name="iconKeyAction" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyArrowRight" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyArrowLeft" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyArrowUp" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyArrowDown" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyMic" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeySettings" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyInputClear" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyInputSelectAll" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyInputClipboardCopy" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyInputClipboardCut" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyInputClipboardPaste" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyInputMoveEnd" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyInputMoveHome" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyCondenseNormal" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyCondenseSplit" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyCondenseCompactToRight" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyCondenseCompactToLeft" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyClipboardCopy" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyClipboardCut" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyClipboardPaste" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyClipboardSelect" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyClipboardFineSelect" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyQuickText" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyUndo" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyRedo" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyForwardDelete" format="reference"/> + <!-- should support normal, key_type_feedback --> + <attr name="iconKeyImageInsert" format="reference"/> + </declare-styleable> + +</resources>
\ No newline at end of file diff --git a/api/src/main/res/values/strings.xml b/api/src/main/res/values/strings.xml new file mode 100644 index 000000000..045e125f3 --- /dev/null +++ b/api/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> +</resources> diff --git a/api/src/main/res/values/version.xml b/api/src/main/res/values/version.xml new file mode 100644 index 000000000..1058bc13c --- /dev/null +++ b/api/src/main/res/values/version.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <integer name="anysoftkeyboard_api_version_code">10</integer> +</resources>
\ No newline at end of file diff --git a/api/src/test/java/com/anysoftkeyboard/api/KeyCodesTest.java b/api/src/test/java/com/anysoftkeyboard/api/KeyCodesTest.java new file mode 100644 index 000000000..6190ff6a9 --- /dev/null +++ b/api/src/test/java/com/anysoftkeyboard/api/KeyCodesTest.java @@ -0,0 +1,76 @@ +package com.anysoftkeyboard.api; + +import android.content.res.Resources; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.HashSet; +import java.util.function.BinaryOperator; +import java.util.function.Function; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; + +@RunWith(RobolectricTestRunner.class) +public class KeyCodesTest { + + @Test + public void testVerifyKeyCodesHasUniques() throws Exception { + HashSet<Integer> seenValues = new HashSet<>(); + + for (Field field : KeyCodes.class.getFields()) { + final int intValue = (int) field.get(null /*This is a static field*/); + Assert.assertTrue("Field " + field, seenValues.add(intValue)); + } + + // verifying that the R integers match + testVerifyKeyCodesResourcesHasUniques(seenValues); + } + + private void testVerifyKeyCodesResourcesHasUniques(HashSet<Integer> seenValues) + throws Exception { + Resources resources = RuntimeEnvironment.application.getResources(); + for (Field field : R.integer.class.getFields()) { + if (field.getName().startsWith("key_code_")) { + final int idValue = (int) field.get(null /*This is a static field*/); + final int intValue = resources.getInteger(idValue); + + Assert.assertTrue("Field " + field, seenValues.remove(intValue)); + } + } + + Assert.assertEquals( + seenValues.stream() + .map( + new Function<Integer, String>() { + @Override + public String apply(Integer integer) { + return integer.toString(); + } + }) + .reduce( + new BinaryOperator<String>() { + @Override + public String apply(String s, String s2) { + return s + ", " + s2; + } + }) + .orElse("EMPTY"), + 0, + seenValues.size()); + } + + @Test + public void testAllFieldsArePublicStaticFinalInt() { + for (Field field : KeyCodes.class.getFields()) { + Assert.assertEquals( + "Field " + field, Modifier.PUBLIC, field.getModifiers() & Modifier.PUBLIC); + Assert.assertEquals( + "Field " + field, Modifier.STATIC, field.getModifiers() & Modifier.STATIC); + Assert.assertEquals( + "Field " + field, Modifier.FINAL, field.getModifiers() & Modifier.FINAL); + Assert.assertEquals("Field " + field, int.class, field.getType()); + } + } +} |
