Compare commits

..

3 Commits

Author SHA1 Message Date
Yuriy Liskov
37243e4d11 hide soft kbd on physical key 2018-08-03 19:00:34 +03:00
Yuriy Liskov
0c7052be55 Swedish translate fix 2018-07-19 00:02:24 +03:00
Yuriy Liskov
5bf9563011 Swedish translate fix 2018-07-18 22:25:27 +03:00
5 changed files with 38 additions and 6 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "org.liskovsoft.leankeykeyboard.pro"
minSdkVersion project.properties.minSdkVersion
targetSdkVersion project.properties.targetSdkVersion
versionCode 68
versionName "4.3.18"
versionCode 71
versionName "4.3.21"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

View File

@@ -14,7 +14,9 @@
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>
</activity>
<service android:label="@string/ime_service_name" android:name="com.google.leanback.ime.LeanbackImeService" android:permission="android.permission.BIND_INPUT_METHOD">
<service android:label="@string/ime_service_name"
android:name="com.google.leanback.ime.LeanbackImeService"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod"/>
</intent-filter>

View File

@@ -5,6 +5,7 @@ import android.graphics.Rect;
import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.Keyboard.Key;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.text.InputType;
import android.util.Log;
import android.view.KeyEvent;
@@ -51,6 +52,8 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
private LeanbackKeyboardController.TouchEventListener mTouchEventListener;
private long prevTime;
private boolean mShowInput;
private int mLastEditorIdPhysicalKeyboardWasUsed;
private boolean mHideKeyboardWhenPhysicalKeyboardUsed = true;
public LeanbackKeyboardController(final InputMethodService context, final LeanbackKeyboardController.InputListener listener) {
this(context, listener, new TouchNavSpaceTracker(), new LeanbackKeyboardContainer(context));
@@ -647,7 +650,11 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
* @param event {@link KeyEvent KeyEvent}
* @return is event handled
*/
public boolean onKeyDown(int keyCode, KeyEvent event) {
public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
//greater than zero means it is a physical keyboard.
//we also want to hide the view if it's a glyph (for example, not physical volume-up key)
if (event.getDeviceId() > 0 && event.isPrintingKey()) onPhysicalKeyboardKeyPressed();
mDownFocus.set(mContainer.getCurrFocus());
if (mSpaceTracker != null && mSpaceTracker.onKeyDown(keyCode, event)) {
return true;
@@ -663,6 +670,24 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
}
}
private void onPhysicalKeyboardKeyPressed() {
EditorInfo editorInfo = mContext.getCurrentInputEditorInfo();
mLastEditorIdPhysicalKeyboardWasUsed = editorInfo == null ? 0 : editorInfo.fieldId;
if (mHideKeyboardWhenPhysicalKeyboardUsed) {
mContext.hideWindow();
}
// For all other keys, if we want to do transformations on
// text being entered with a hard keyboard, we need to process
// it and do the appropriate action.
// using physical keyboard is more annoying with candidate view in
// the way
// so we disable it.
// stopping any soft-keyboard prediction
//abortCorrectionAndResetPredictionState(false);
}
public boolean onKeyUp(int keyCode, KeyEvent keyEvent) {
if (mSpaceTracker != null && mSpaceTracker.onKeyUp(keyCode, keyEvent)) {
return true;

View File

@@ -20,4 +20,6 @@
<string name="keyboardview_keycode_right">Стрелка вправо</string>
<string name="keyboard_headset_required_to_hear_password">Подключите гарнитуру, чтобы услышать пароль.</string>
<string name="keyboard_password_character_no_headset">Точка</string>
<string name="language_dialog_title">Выберите дополнительные раскладки</string>
<string name="language_dialog_subtitle">Чтобы открыть этот диалог, зажмите кнопку \'земной шар\'</string>
</resources>

View File

@@ -2,12 +2,12 @@
<resources>
<string name="ime_name">Tangentbord för Leanback</string>
<string name="ime_service_name">Tangentbord för Leanback</string>
<string name="label_go_key">OK</string>
<string name="label_go_key">Kör</string>
<string name="label_next_key">Nästa</string>
<string name="label_send_key">Skicka</string>
<string name="label_search_key">Sök</string>
<string name="label_done_key">Klar</string>
<string name="settings_title">Tangentbordsalternativ</string>
<string name="settings_title">Tangentbordsinställningar</string>
<string name="title_movement_sensitivity">Rörelsekänslighet</string>
<string name="btn_on"></string>
<string name="btn_off">Av</string>
@@ -20,4 +20,7 @@
<string name="keyboardview_keycode_right">Höger</string>
<string name="keyboard_headset_required_to_hear_password">Anslut hörlurar om du vill höra lösenordet tecken för tecken.</string>
<string name="keyboard_password_character_no_headset">Punkt.</string>
<string name="keyboardview_keycode_lang">Språk</string>
<string name="language_dialog_title">Välj layouter</string>
<string name="language_dialog_subtitle">"För att öppna dialogen nästa gång, tryck länge på knappen med världsikonen</string>
</resources>