mirror of
https://github.com/yuliskov/LeanKeyboard.git
synced 2026-05-18 21:40:26 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e7db94a30 | ||
|
|
80b76e9d1e | ||
|
|
8c1c36cf0e |
@@ -47,9 +47,8 @@ __Standard installation via ADB__
|
|||||||
|
|
||||||
### Donation:
|
### Donation:
|
||||||
If you want to support my developments you are welcome to buy me a cup of coffee :)
|
If you want to support my developments you are welcome to buy me a cup of coffee :)
|
||||||
* BTC: 1JAT5VVWarVBkpVbNDn8UA8HXNdrukuBSx
|
* [__PrivatBank (Ukraine)__](https://privatbank.ua/ru/sendmoney?payment=5fcdddf53e3d491d63fcb050e6e2e05f2f2678c2)
|
||||||
* WMZ: Z375157140784
|
* __BTC__: 1JAT5VVWarVBkpVbNDn8UA8HXNdrukuBSx
|
||||||
* WMU: U449339012933
|
|
||||||
|
|
||||||
### Screens:
|
### Screens:
|
||||||

|

|
||||||
|
|||||||
@@ -8,8 +8,8 @@ android {
|
|||||||
applicationId "org.liskovsoft.leankeykeyboard.pro"
|
applicationId "org.liskovsoft.leankeykeyboard.pro"
|
||||||
minSdkVersion project.properties.minSdkVersion
|
minSdkVersion project.properties.minSdkVersion
|
||||||
targetSdkVersion project.properties.targetSdkVersion
|
targetSdkVersion project.properties.targetSdkVersion
|
||||||
versionCode 76
|
versionCode 77
|
||||||
versionName "4.3.26"
|
versionName "4.3.27"
|
||||||
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@@ -1132,7 +1132,7 @@ public class LeanbackKeyboardContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateAddonKeyboard() {
|
public void updateAddonKeyboard() {
|
||||||
mKeyboardManager = new KeyboardManager(mContext, mAbcKeyboard);
|
mKeyboardManager = new KeyboardManager(mContext);
|
||||||
switchToNextKeyboard();
|
switchToNextKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class KeyboardManager {
|
public class KeyboardManager {
|
||||||
private final Keyboard mEnglishKeyboard;
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final KeyboardStateManager mStateManager;
|
private final KeyboardStateManager mStateManager;
|
||||||
private List<? extends KeyboardBuilder> mKeyboardBuilders;
|
private List<? extends KeyboardBuilder> mKeyboardBuilders;
|
||||||
@@ -17,13 +16,8 @@ public class KeyboardManager {
|
|||||||
|
|
||||||
private int mKeyboardIndex = 0;
|
private int mKeyboardIndex = 0;
|
||||||
|
|
||||||
public KeyboardManager(Context ctx, int keyboardResId) {
|
public KeyboardManager(Context ctx) {
|
||||||
this(ctx, new Keyboard(ctx, keyboardResId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeyboardManager(Context ctx, Keyboard englishKeyboard) {
|
|
||||||
mContext = ctx;
|
mContext = ctx;
|
||||||
mEnglishKeyboard = englishKeyboard;
|
|
||||||
mStateManager = new KeyboardStateManager(mContext, this);
|
mStateManager = new KeyboardStateManager(mContext, this);
|
||||||
mStateManager.restore();
|
mStateManager.restore();
|
||||||
init();
|
init();
|
||||||
@@ -37,7 +31,6 @@ public class KeyboardManager {
|
|||||||
|
|
||||||
private List<Keyboard> buildAllKeyboards() {
|
private List<Keyboard> buildAllKeyboards() {
|
||||||
List<Keyboard> keyboards = new ArrayList<>();
|
List<Keyboard> keyboards = new ArrayList<>();
|
||||||
keyboards.add(mEnglishKeyboard);
|
|
||||||
if (!mKeyboardBuilders.isEmpty()) {
|
if (!mKeyboardBuilders.isEmpty()) {
|
||||||
for (KeyboardBuilder builder : mKeyboardBuilders) {
|
for (KeyboardBuilder builder : mKeyboardBuilders) {
|
||||||
keyboards.add(builder.createKeyboard());
|
keyboards.add(builder.createKeyboard());
|
||||||
|
|||||||
@@ -21,26 +21,37 @@ public class ResKeyboardFactory implements KeyboardFactory {
|
|||||||
@Override
|
@Override
|
||||||
public List<? extends KeyboardBuilder> getAllAvailableKeyboards(Context context) {
|
public List<? extends KeyboardBuilder> getAllAvailableKeyboards(Context context) {
|
||||||
List<KeyboardBuilder> result = new ArrayList<>();
|
List<KeyboardBuilder> result = new ArrayList<>();
|
||||||
|
|
||||||
List<KeyboardInfo> infos = ResKeyboardInfo.getAllKeyboardInfos(context);
|
List<KeyboardInfo> infos = ResKeyboardInfo.getAllKeyboardInfos(context);
|
||||||
final Resources resources = mContext.getResources();
|
|
||||||
|
|
||||||
for (final KeyboardInfo info : infos) {
|
for (final KeyboardInfo info : infos) {
|
||||||
if (!info.isEnabled()) {
|
if (!info.isEnabled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.add(new KeyboardBuilder() {
|
result.add(createKeyboard(info.getLangCode()));
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public Keyboard createKeyboard() {
|
|
||||||
return new Keyboard(mContext, resources.getIdentifier("qwerty_" + info.getLangCode(), "xml", mContext.getPackageName()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// at least one kbd should be enabled
|
||||||
|
if (result.isEmpty()) {
|
||||||
|
KeyboardInfo firstKbd = infos.get(0);
|
||||||
|
result.add(createKeyboard(firstKbd.getLangCode()));
|
||||||
|
firstKbd.setEnabled(true);
|
||||||
|
ResKeyboardInfo.updateAllKeyboardInfos(mContext, infos);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private KeyboardBuilder createKeyboard(final String langCode) {
|
||||||
|
return new KeyboardBuilder() {
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Keyboard createKeyboard() {
|
||||||
|
return new Keyboard(mContext, mContext.getResources().getIdentifier("qwerty_" + langCode, "xml", mContext.getPackageName()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needUpdate() {
|
public boolean needUpdate() {
|
||||||
return ResKeyboardInfo.needUpdate();
|
return ResKeyboardInfo.needUpdate();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string-array name="additional_languages">
|
<string-array name="additional_languages">
|
||||||
<item>Swedish|sv</item>
|
<item>English|us</item>
|
||||||
<item>Arabic|ar</item>
|
<item>Arabic|ar</item>
|
||||||
<item>Bulgarian|bg</item>
|
<item>Bulgarian|bg</item>
|
||||||
<item>Dutch|nl</item>
|
<item>Dutch|nl</item>
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
<item>Italian|it</item>
|
<item>Italian|it</item>
|
||||||
<item>Persian|fa</item>
|
<item>Persian|fa</item>
|
||||||
<item>Russian|ru</item>
|
<item>Russian|ru</item>
|
||||||
|
<item>Swedish|sv</item>
|
||||||
<item>Thai|th</item>
|
<item>Thai|th</item>
|
||||||
<item>Turkish|tr</item>
|
<item>Turkish|tr</item>
|
||||||
<item>Ukrainian|uk</item>
|
<item>Ukrainian|uk</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user