mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-12-23 22:48:54 +01:00
Launcher activity: Input box
For trying the keyboard without having to mess with an other app.
This commit is contained in:
parent
3caca59ff4
commit
351355b3a7
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user