small adjustments after #691

This commit is contained in:
Helium314 2024-05-01 22:59:16 +02:00
parent 83fc10ff02
commit edd4ae2c68
6 changed files with 8 additions and 10 deletions

View file

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

View file

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

View file

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

View file

@ -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) {

View file

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