space key scale fix

This commit is contained in:
Yuriy Liskov
2020-01-22 21:39:42 +02:00
parent b415505ff4
commit 6ff10eaf75
5 changed files with 16 additions and 16 deletions

View File

@@ -78,8 +78,8 @@
<receiver
android:name="com.liskovsoft.leankeyboard.other.RestartServiceReceiver"
android:enabled="true"
android:exported="true">
android:enabled="false"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>

View File

@@ -201,10 +201,17 @@ public class LeanbackKeyboardView extends FrameLayout {
}
}
int dx = (key.width - padding.left - padding.right - key.icon.getIntrinsicWidth()) / 2 + padding.left;
int dy = (key.height - padding.top - padding.bottom - key.icon.getIntrinsicHeight()) / 2 + padding.top;
int iconWidth = key.icon.getIntrinsicWidth();
int iconHeight = key.icon.getIntrinsicHeight();
if (key.width > key.height) { // wide key like space key
iconWidth = key.width;
}
int dx = (key.width - padding.left - padding.right - iconWidth) / 2 + padding.left;
int dy = (key.height - padding.top - padding.bottom - iconHeight) / 2 + padding.top;
canvas.translate((float) dx, (float) dy);
key.icon.setBounds(0, 0, key.icon.getIntrinsicWidth(), key.icon.getIntrinsicHeight());
key.icon.setBounds(0, 0, iconWidth, iconHeight);
key.icon.draw(canvas);
canvas.translate((float) (-dx), (float) (-dy));
} else if (label != null) {

View File

@@ -309,6 +309,9 @@ public class LeanbackImeService extends InputMethodService {
public void onStartInputView(EditorInfo info, boolean restarting) {
super.onStartInputView(info, restarting);
Log.d(TAG, "Restarting ime service...");
setInputView(onCreateInputView());
// FireTV: fix accidental kbd pop-ups
// more info: https://forum.xda-developers.com/fire-tv/general/guide-change-screen-keyboard-to-leankey-t3527675/page2
//updateInputViewShown();

View File

@@ -1,10 +1,8 @@
package com.liskovsoft.leankeyboard.settings.settings;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import androidx.leanback.app.GuidedStepSupportFragment;
import com.liskovsoft.leankeyboard.other.RestartServiceReceiver;
public class KbSettingsActivity extends FragmentActivity {
@Override
@@ -13,12 +11,4 @@ public class KbSettingsActivity extends FragmentActivity {
GuidedStepSupportFragment.addAsRoot(this, new KbSettingsFragment(), android.R.id.content);
}
@Override
protected void onStop() {
super.onStop();
Intent intent = new Intent(this, RestartServiceReceiver.class);
sendBroadcast(intent);
}
}

View File

@@ -17,6 +17,6 @@
<item>Thai|th</item>
<item>Turkish|tr</item>
<item>Ukrainian|uk</item>
<item>Spanish|es_us</item>
<!-- <item>Spanish|es_us</item>-->
</string-array>
</resources>