diff options
| author | Jules Aguillon | 2023-04-02 13:28:10 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2023-04-02 13:29:53 +0200 |
| commit | 351355b3a769d2b584733ad0e8924dfe75939fb6 (patch) | |
| tree | 9256361692887ea9cf82e14f33118062a936abd9 | |
| parent | 3caca59ff43e09578838d213b9c2f94c072b0832 (diff) | |
| download | unexpected-keyboard-351355b3a769d2b584733ad0e8924dfe75939fb6.tar.gz unexpected-keyboard-351355b3a769d2b584733ad0e8924dfe75939fb6.zip | |
Launcher activity: Input box
For trying the keyboard without having to mess with an other app.
| -rw-r--r-- | res/layout/launcher_activity.xml | 10 | ||||
| -rw-r--r-- | res/values-cs/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-de/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-es/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-fr/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-it/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-ko/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-lv/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-pl/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-pt/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-ru/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-tr/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-vi/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-zh-rCN/strings.xml | 3 | ||||
| -rw-r--r-- | res/values/strings.xml | 3 | ||||
| -rw-r--r-- | res/values/styles.xml | 7 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/LauncherActivity.java | 32 |
17 files changed, 73 insertions, 18 deletions
diff --git a/res/layout/launcher_activity.xml b/res/layout/launcher_activity.xml index 424e98d..dbd6b33 100644 --- a/res/layout/launcher_activity.xml +++ b/res/layout/launcher_activity.xml @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="16dp"> - <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/launcher_description"/> - <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginVertical="16dp" android:text="@string/launcher_button_imesettings" android:onClick="launch_imesettings"/> - <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/launcher_sourcecode" android:autoLink="web"/> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> + <TextView style="@style/paragraph" android:text="@string/launcher_description"/> + <Button style="@style/paragraph" android:text="@string/launcher_button_imesettings" android:onClick="launch_imesettings" android:layout_width="wrap_content"/> + <TextView style="@style/paragraph" android:text="@string/launcher_sourcecode" android:autoLink="web"/> + <TextView android:id="@+id/launcher_tryhere_text" style="@style/paragraph" android:text="@string/launcher_tryhere"/> + <EditText android:id="@+id/launcher_tryhere_area" style="@style/paragraph" android:inputType="text"/> </LinearLayout> diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 6385849..552d06f 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Předchozí</string> <string name="key_action_search">Hledat</string> <string name="key_action_send">Odeslat</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 03dffe3..6245df9 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Vorheriges</string> <string name="key_action_search">Suchen</string> <string name="key_action_send">Senden</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 930a1fd..41f53ba 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Anterior</string> <string name="key_action_search">Buscar</string> <string name="key_action_send">Enviar</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 3c58a91..8ea5379 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Prec.</string> <string name="key_action_search">Chercher</string> <string name="key_action_send">Envoyer</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 1fd3a3c..2774c6c 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Precedente</string> <string name="key_action_search">Cerca</string> <string name="key_action_send">Invia</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index 3764383..63d57b6 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">이전</string> <string name="key_action_search">검색</string> <string name="key_action_send">보내기</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml index b37fae7..f59e234 100644 --- a/res/values-lv/strings.xml +++ b/res/values-lv/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Iepriekšējais</string> <string name="key_action_search">Meklēt</string> <string name="key_action_send">Sūtīt</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index b6a739d..779ad85 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Wstecz</string> <string name="key_action_search">Szukaj</string> <string name="key_action_send">Wyślij</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 75137f4..c08ea0b 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Anterior</string> <string name="key_action_search">Buscar</string> <string name="key_action_send">Enviar</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index cd3d968..6b27461 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Предыдущий</string> <string name="key_action_search">Поиск</string> <string name="key_action_send">Отправить</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 749eab9..4e5a420 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Geri</string> <string name="key_action_search">Ara</string> <string name="key_action_send">Gönder</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index 6828a30..2f00ac3 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -75,7 +75,8 @@ <string name="key_action_prev">Trước</string> <string name="key_action_search">Tìm</string> <string name="key_action_send">Gửi</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 68b7da6..fc1d70a 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">前一项</string> <string name="key_action_search">搜索</string> <string name="key_action_send">发送</string> + <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> --> - <!-- <string name="launcher_button_imesettings">Enable keyboard</string> --> + <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index e6b1a8d..7b6e0df 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -73,7 +73,8 @@ <string name="key_action_prev">Prev</string> <string name="key_action_search">Search</string> <string name="key_action_send">Send</string> + <string name="launcher_button_imesettings">Enable keyboard</string> <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on <a href="https://github.com/Julow/Unexpected-Keyboard/">Github</a>.</string> - <string name="launcher_button_imesettings">Enable keyboard</string> + <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 94a8551..d3283a7 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -24,4 +24,11 @@ <item name="android:textSize">@dimen/emoji_text_size</item> <item name="android:textColor">?attr/emoji_color</item> </style> + <style name="paragraph"> + <item name="android:layout_width">fill_parent</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:layout_marginVertical">8dp</item> + <item name="android:layout_marginHorizontal">16dp</item> + <item name="android:layout_gravity">center</item> + </style> </resources> diff --git a/srcs/juloo.keyboard2/LauncherActivity.java b/srcs/juloo.keyboard2/LauncherActivity.java index 83217a8..d54ff60 100644 --- a/srcs/juloo.keyboard2/LauncherActivity.java +++ b/srcs/juloo.keyboard2/LauncherActivity.java @@ -7,20 +7,52 @@ import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.provider.Settings; +import android.view.KeyCharacterMap; +import android.view.KeyEvent; import android.view.View; import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; public class LauncherActivity extends Activity { + /** Text is replaced when receiving key events. */ + TextView _tryhere_text; + EditText _tryhere_area; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.launcher_activity); + _tryhere_text = (TextView)findViewById(R.id.launcher_tryhere_text); + _tryhere_area = (EditText)findViewById(R.id.launcher_tryhere_area); + _tryhere_area.addOnUnhandledKeyEventListener( + this.new Tryhere_OnUnhandledKeyEventListener()); } public void launch_imesettings(View _btn) { startActivity(new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS)); } + + final class Tryhere_OnUnhandledKeyEventListener implements View.OnUnhandledKeyEventListener + { + public boolean onUnhandledKeyEvent(View v, KeyEvent ev) + { + // Key release of modifiers would erase interesting data + if (KeyEvent.isModifierKey(ev.getKeyCode())) + return false; + StringBuilder s = new StringBuilder(); + if (ev.isAltPressed()) s.append("Alt+"); + if (ev.isShiftPressed()) s.append("Shift+"); + if (ev.isCtrlPressed()) s.append("Ctrl+"); + if (ev.isMetaPressed()) s.append("Meta+"); + // s.append(ev.getDisplayLabel()); + String kc = KeyEvent.keyCodeToString(ev.getKeyCode()); + s.append(kc.replaceFirst("^KEYCODE_", "")); + _tryhere_text.setText(s.toString()); + return true; + } + } } |
