Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add key codes for Nokia E62 #1037

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions app/src/main/java/javax/microedition/lcdui/keyboard/KeyMapper.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2018 Nikita Shakarun
* Copyright 2021 Yury Kharchenko
* Copyright 2023 Cansor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,6 +37,7 @@ public class KeyMapper {
private static final int SIEMENS_LAYOUT = 1;
private static final int MOTOROLA_LAYOUT = 2;
private static final int CUSTOM_LAYOUT = 3;
private static final int NOKIA_E62_LAYOUT = 4;

private static final int SIEMENS_KEY_UP = -59;
private static final int SIEMENS_KEY_DOWN = -60;
Expand All @@ -50,6 +52,18 @@ public class KeyMapper {
private static final int MOTOROLA_KEY_FIRE = -20;
private static final int MOTOROLA_KEY_SOFT_LEFT = -21;
private static final int MOTOROLA_KEY_SOFT_RIGHT = -22;
private static final int NOKIA_E62_KEY_NUM0 = 109;
private static final int NOKIA_E62_KEY_NUM1 = 114;
private static final int NOKIA_E62_KEY_NUM2 = 116;
private static final int NOKIA_E62_KEY_NUM3 = 121;
private static final int NOKIA_E62_KEY_NUM4 = 102;
private static final int NOKIA_E62_KEY_NUM5 = 103;
private static final int NOKIA_E62_KEY_NUM6 = 104;
private static final int NOKIA_E62_KEY_NUM7 = 118;
private static final int NOKIA_E62_KEY_NUM8 = 98;
private static final int NOKIA_E62_KEY_NUM9 = 110;
private static final int NOKIA_E62_KEY_STAR = 117;
private static final int NOKIA_E62_KEY_POUND = 106;

private static final SparseArrayCompat<String> keyCodeToKeyName = new SparseArrayCompat<>();
private static final SparseIntArray keyCodeToCustom = new SparseIntArray();
Expand Down Expand Up @@ -135,6 +149,19 @@ private static void remapKeys() {
mapKeyCode(MOTOROLA_KEY_FIRE, FIRE, "SELECT");
mapKeyCode(MOTOROLA_KEY_SOFT_LEFT, 0, "SOFT1");
mapKeyCode(MOTOROLA_KEY_SOFT_RIGHT, 0, "SOFT2");
} else if (layoutType == NOKIA_E62_LAYOUT) {
keyCodeToCustom.put(KEY_NUM0, NOKIA_E62_KEY_NUM0);
keyCodeToCustom.put(KEY_NUM1, NOKIA_E62_KEY_NUM1);
keyCodeToCustom.put(KEY_NUM2, NOKIA_E62_KEY_NUM2);
keyCodeToCustom.put(KEY_NUM3, NOKIA_E62_KEY_NUM3);
keyCodeToCustom.put(KEY_NUM4, NOKIA_E62_KEY_NUM4);
keyCodeToCustom.put(KEY_NUM5, NOKIA_E62_KEY_NUM5);
keyCodeToCustom.put(KEY_NUM6, NOKIA_E62_KEY_NUM6);
keyCodeToCustom.put(KEY_NUM7, NOKIA_E62_KEY_NUM7);
keyCodeToCustom.put(KEY_NUM8, NOKIA_E62_KEY_NUM8);
keyCodeToCustom.put(KEY_NUM9, NOKIA_E62_KEY_NUM9);
keyCodeToCustom.put(KEY_STAR, NOKIA_E62_KEY_STAR);
keyCodeToCustom.put(KEY_POUND, NOKIA_E62_KEY_POUND);
}
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<item>Siemens</item>
<item>Motorola</item>
<item>Custom</item>
<item>Nokia E62</item>
</string-array>
<string-array name="pref_graphics_mode_entries" tools:ignore="InconsistentArrays">
<item>@string/pref_graphics_software</item>
Expand Down