add cursor keys to toolbar, replace next/previous images with vector arrows

This commit is contained in:
Helium314 2023-09-24 22:00:41 +02:00
parent 25ad4a3178
commit 4b323d4277
32 changed files with 117 additions and 4 deletions

View file

@ -249,8 +249,12 @@ public final class Constants {
public static final int CODE_ALPHA_FROM_NUMPAD = -21;
public static final int CODE_SYMBOL_FROM_NUMPAD = -22;
public static final int CODE_SELECT_ALL = -23;
public static final int CODE_LEFT = -24;
public static final int CODE_RIGHT = -25;
public static final int CODE_UP = -26;
public static final int CODE_DOWN = -27;
// Code value representing the code is not specified.
public static final int CODE_UNSPECIFIED = -24;
public static final int CODE_UNSPECIFIED = -28;
public static boolean isLetterCode(final int code) {
return code >= CODE_SPACE;

View file

@ -766,6 +766,18 @@ public final class InputLogic {
case Constants.CODE_SELECT_ALL:
mConnection.selectAll();
break;
case Constants.CODE_LEFT:
sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_LEFT);
break;
case Constants.CODE_RIGHT:
sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_RIGHT);
break;
case Constants.CODE_UP:
sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_UP);
break;
case Constants.CODE_DOWN:
sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_DOWN);
break;
default:
throw new RuntimeException("Unknown key code : " + event.getMKeyCode());
}

View file

@ -88,6 +88,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
private static final String SETTINGS_KEY_TAG = "settings_key";
private static final String SELECT_ALL_KEY_TAG = "select_all_key";
private static final String ONE_HANDED_KEY_TAG = "one_handed_key";
private static final String LEFT_KEY_TAG = "left_key";
private static final String RIGHT_KEY_TAG = "right_key";
private static final String UP_KEY_TAG = "up_key";
private static final String DOWN_KEY_TAG = "down_key";
private final ViewGroup mSuggestionsStrip;
private final ImageButton mOtherKey;
@ -201,7 +205,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
oneHandedKey.setImageDrawable(keyboardAttr.getDrawable(R.styleable.Keyboard_iconStartOneHandedMode));
keyboardAttr.recycle();
mToolbarArrowIcon = ContextCompat.getDrawable(context, R.drawable.sym_keyboard_next_lxx_light);
mToolbarArrowIcon = ContextCompat.getDrawable(context, R.drawable.ic_arrow_right);
mDefaultBackground = mOtherKey.getBackground();
colors.setBackgroundColor(mDefaultBackground, BackgroundType.SUGGESTION);
mEnabledToolKeyBackground.setColors(new int[] {colors.getAccent(), Color.TRANSPARENT});
@ -615,6 +619,18 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
case SETTINGS_KEY_TAG:
mListener.onCodeInput(Constants.CODE_SETTINGS, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, false);
return;
case LEFT_KEY_TAG:
mListener.onCodeInput(Constants.CODE_LEFT, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, false);
return;
case RIGHT_KEY_TAG:
mListener.onCodeInput(Constants.CODE_RIGHT, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, false);
return;
case UP_KEY_TAG:
mListener.onCodeInput(Constants.CODE_UP, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, false);
return;
case DOWN_KEY_TAG:
mListener.onCodeInput(Constants.CODE_DOWN, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, false);
return;
}
}
if (view == mOtherKey) {
@ -685,6 +701,14 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
return R.layout.suggestions_strip_select_all_key;
case ONE_HANDED_KEY_TAG:
return R.layout.suggestions_strip_one_handed_key;
case LEFT_KEY_TAG:
return R.layout.suggestions_strip_left_key;
case RIGHT_KEY_TAG:
return R.layout.suggestions_strip_right_key;
case UP_KEY_TAG:
return R.layout.suggestions_strip_up_key;
case DOWN_KEY_TAG:
return R.layout.suggestions_strip_down_key;
}
return 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="180"
android:drawable="@drawable/ic_arrow_right">
</rotate>

View file

@ -0,0 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportHeight="24"
android:viewportWidth="24" >
<path android:fillColor="#FFF"
android:pathData="M8.59,16.59L13.17,12 8.59,7.41 10,6l6,6 -6,6 -1.41,-1.41z"/>
</vector>

View file

@ -0,0 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportHeight="24"
android:viewportWidth="24" >
<path android:fillColor="#FFF"
android:pathData="M7.41,15.41L12,10.83l4.59,4.58L18,14l-6,-6 -6,6z"/>
</vector>

View file

@ -62,6 +62,18 @@
<include
android:id="@+id/suggestions_strip_settings_key"
layout="@layout/suggestions_strip_settings_key" />
<include
android:id="@+id/suggestions_strip_left_key"
layout="@layout/suggestions_strip_left_key" />
<include
android:id="@+id/suggestions_strip_right_key"
layout="@layout/suggestions_strip_right_key" />
<include
android:id="@+id/suggestions_strip_up_key"
layout="@layout/suggestions_strip_up_key" />
<include
android:id="@+id/suggestions_strip_down_key"
layout="@layout/suggestions_strip_down_key" />
</LinearLayout>
<!-- Provide audio and haptic feedback by ourselves based on the keyboard settings.
We just need to ignore the system's audio and haptic feedback settings. -->

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
android:layout_height="fill_parent"
android:src="@drawable/ic_arrow_up"
android:scaleX="1.2"
android:scaleY="-1.2"
android:tag="down_key"
style="?attr/suggestionWordStyle" />

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
android:layout_height="fill_parent"
android:src="@drawable/ic_arrow_left"
android:scaleX="1.2"
android:scaleY="1.2"
android:tag="left_key"
style="?attr/suggestionWordStyle" />

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
android:layout_height="fill_parent"
android:src="@drawable/ic_arrow_right"
android:scaleX="1.2"
android:scaleY="1.2"
android:tag="right_key"
style="?attr/suggestionWordStyle" />

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
android:layout_height="fill_parent"
android:src="@drawable/ic_arrow_up"
android:scaleX="1.2"
android:scaleY="1.2"
android:tag="up_key"
style="?attr/suggestionWordStyle" />

View file

@ -31,9 +31,9 @@
<item name="iconGoKey">@drawable/sym_keyboard_go_lxx_light</item>
<item name="iconSearchKey">@drawable/sym_keyboard_search_lxx_light</item>
<item name="iconSendKey">@drawable/sym_keyboard_send_lxx_light</item>
<item name="iconNextKey">@drawable/sym_keyboard_next_lxx_light</item>
<item name="iconNextKey">@drawable/ic_arrow_right</item>
<item name="iconDoneKey">@drawable/sym_keyboard_done_lxx_light</item>
<item name="iconPreviousKey">@drawable/sym_keyboard_previous_lxx_light</item>
<item name="iconPreviousKey">@drawable/ic_arrow_left</item>
<item name="iconShortcutKey">@drawable/sym_keyboard_voice_lxx_light</item>
<item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_lxx_light</item>
<item name="iconIncognitoKey">@drawable/sym_keyboard_incognito_lxx_light</item>