diff --git a/README.md b/README.md index 79312719..fcef98f4 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,8 @@ Does not use internet permission, and thus is 100% offline. ## Hidden Functionality Features that may go unnoticed, and further potentially useful information -* Long-pressing the Clipboard Key (the optional one in the suggestion strip) pastes system clipboard contents. +* Long-pressing pinned toolbar keys results in additional functionality + * clipboard -> paste, move left/right -> move full left/right, move up/down -> page up/down, copy -> copy all, select word -> select all, undo <-> redo, * Long-pressing keys in the suggestion strip toolbar pins them to the suggestion strip. * Long-press the Comma-key to access Clipboard View, Emoji View, One-handed Mode, Settings, or Switch Language: * Emoji View and Language Switch will disappear if you have the corresponding key enabled; diff --git a/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt b/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt index ec89e7a4..33d4a5c5 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt +++ b/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt @@ -233,7 +233,7 @@ class ClipboardHistoryView @JvmOverloads constructor( val tag = view.tag if (tag is ToolbarKey) { val code = getCodeForToolbarKey(tag) - if (code != null) { + if (code != KeyCode.UNSPECIFIED) { keyboardActionListener?.onCodeInput(code, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false) return } diff --git a/app/src/main/java/helium314/keyboard/latin/LatinIME.java b/app/src/main/java/helium314/keyboard/latin/LatinIME.java index e0a7a154..4a845a12 100644 --- a/app/src/main/java/helium314/keyboard/latin/LatinIME.java +++ b/app/src/main/java/helium314/keyboard/latin/LatinIME.java @@ -1509,8 +1509,6 @@ public class LatinIME extends InputMethodService implements return Event.createSoftwareKeypressEvent(codePoint, keyCode, keyX, keyY, isKeyRepeat); } - // Called from PointerTracker through the KeyboardActionListener interface - @Override public void onTextInput(final String rawText) { // TODO: have the keyboard pass the correct key code when we need it. final Event event = Event.createSoftwareTextEvent(rawText, KeyCode.MULTIPLE_CODE_POINTS); diff --git a/app/src/main/java/helium314/keyboard/latin/RichInputConnection.java b/app/src/main/java/helium314/keyboard/latin/RichInputConnection.java index 1ecb2d95..8e4dc057 100644 --- a/app/src/main/java/helium314/keyboard/latin/RichInputConnection.java +++ b/app/src/main/java/helium314/keyboard/latin/RichInputConnection.java @@ -654,7 +654,7 @@ public final class RichInputConnection implements PrivateCommandPerformer { } public void copyText(final boolean getSelection) { - CharSequence text = ""; + CharSequence text = null; if (getSelection) { // copy selected text, and if nothing is selected copy the whole text text = getSelectedText(InputConnection.GET_TEXT_WITH_STYLES); diff --git a/app/src/main/java/helium314/keyboard/latin/suggestions/SuggestionStripView.java b/app/src/main/java/helium314/keyboard/latin/suggestions/SuggestionStripView.java index 3994e0a2..20fc3ee3 100644 --- a/app/src/main/java/helium314/keyboard/latin/suggestions/SuggestionStripView.java +++ b/app/src/main/java/helium314/keyboard/latin/suggestions/SuggestionStripView.java @@ -75,7 +75,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick public interface Listener { void pickSuggestionManually(SuggestedWordInfo word); void onCodeInput(int primaryCode, int x, int y, boolean isKeyRepeat); - void onTextInput(final String rawText); void removeSuggestion(final String word); CharSequence getSelection(); } @@ -376,9 +375,9 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick if (!(view.getTag() instanceof ToolbarKey tag)) return; if (view.getParent() == mPinnedKeys) { final int longClickCode = getCodeForToolbarKeyLongClick(tag); - if (longClickCode != KeyCode.UNSPECIFIED) { +// if (longClickCode != KeyCode.UNSPECIFIED) { mListener.onCodeInput(longClickCode, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, false); - } +// } } else if (view.getParent() == mToolbar) { final View pinnedKeyView = mPinnedKeys.findViewWithTag(tag); if (pinnedKeyView == null) { @@ -639,7 +638,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick final Object tag = view.getTag(); if (tag instanceof ToolbarKey) { final Integer code = getCodeForToolbarKey((ToolbarKey) tag); - if (code != null) { + if (code != KeyCode.UNSPECIFIED) { Log.d(TAG, "click toolbar key "+tag); mListener.onCodeInput(code, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, false); if (tag == ToolbarKey.INCOGNITO || tag == ToolbarKey.AUTOCORRECT || tag == ToolbarKey.ONE_HANDED) { diff --git a/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt b/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt index 44e62729..593493ae 100644 --- a/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt +++ b/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt @@ -56,7 +56,7 @@ fun getCodeForToolbarKey(key: ToolbarKey) = when (key) { FULL_LEFT -> KeyCode.MOVE_START_OF_LINE FULL_RIGHT -> KeyCode.MOVE_END_OF_LINE SELECT_WORD -> KeyCode.CLIPBOARD_SELECT_WORD - CLEAR_CLIPBOARD -> null // not managed via code input + CLEAR_CLIPBOARD -> KeyCode.UNSPECIFIED // not managed via code input CLOSE_HISTORY -> KeyCode.ALPHA }