mirror of
https://github.com/yuliskov/LeanKeyboard.git
synced 2026-04-20 06:56:53 -04:00
rtl info
This commit is contained in:
@@ -7,4 +7,5 @@ public interface KeyboardBuilder {
|
||||
Keyboard createAbcKeyboard();
|
||||
Keyboard createSymKeyboard();
|
||||
Keyboard createNumKeyboard();
|
||||
boolean isRtl();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ public class KeyboardManager {
|
||||
public Keyboard abcKeyboard;
|
||||
public Keyboard symKeyboard;
|
||||
public Keyboard numKeyboard;
|
||||
public boolean isRtl;
|
||||
}
|
||||
|
||||
public KeyboardManager(Context ctx) {
|
||||
@@ -41,6 +42,7 @@ public class KeyboardManager {
|
||||
data.abcKeyboard = builder.createAbcKeyboard();
|
||||
data.symKeyboard = builder.createSymKeyboard();
|
||||
data.numKeyboard = builder.createNumKeyboard();
|
||||
data.isRtl = builder.isRtl();
|
||||
|
||||
keyboards.add(data);
|
||||
}
|
||||
|
||||
@@ -92,4 +92,9 @@ public class ApkKeyboardAddOnAndBuilder extends AddOnImpl implements KeyboardBui
|
||||
public Keyboard createNumKeyboard() {
|
||||
return new Keyboard(getPackageContext(), R.xml.number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRtl() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,10 +73,12 @@ public class ResKeyboardFactory implements KeyboardFactory {
|
||||
*/
|
||||
private KeyboardBuilder createKeyboard(final KeyboardInfo info) {
|
||||
return new KeyboardBuilder() {
|
||||
private final String langCode = info.getLangCode();
|
||||
|
||||
@Override
|
||||
public Keyboard createAbcKeyboard() {
|
||||
String prefix = info.isAzerty() ? "azerty_" : "qwerty_";
|
||||
int kbResId = mContext.getResources().getIdentifier(prefix + info.getLangCode(), "xml", mContext.getPackageName());
|
||||
int kbResId = mContext.getResources().getIdentifier(prefix + langCode, "xml", mContext.getPackageName());
|
||||
Keyboard keyboard = new Keyboard(mContext, kbResId);
|
||||
Log.d(TAG, "Creating keyboard... " + info.getLangName());
|
||||
return localizeKeys(keyboard, info);
|
||||
@@ -92,6 +94,11 @@ public class ResKeyboardFactory implements KeyboardFactory {
|
||||
public Keyboard createNumKeyboard() {
|
||||
return new Keyboard(mContext, R.xml.number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRtl() {
|
||||
return langCode.contains("he") || langCode.contains("ar");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.view.View;
|
||||
import android.view.inputmethod.CompletionInfo;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import com.liskovsoft.leankeyboard.addons.keyboards.KeyboardManager.KeyboardData;
|
||||
import com.liskovsoft.leankeyboard.ime.LeanbackKeyboardController.InputListener;
|
||||
import com.liskovsoft.leankeyboard.utils.LeanKeyPreferences;
|
||||
|
||||
|
||||
@@ -299,9 +299,6 @@ public class LeanbackKeyboardContainer {
|
||||
}
|
||||
|
||||
public void initKeyboards() {
|
||||
//mAbcKeyboard = new Keyboard(mContext, R.xml.qwerty_en_us);
|
||||
//mSymKeyboard = new Keyboard(mContext, R.xml.sym_en_us);
|
||||
//mNumKeyboard = new Keyboard(mContext, R.xml.number);
|
||||
updateAddonKeyboard();
|
||||
}
|
||||
|
||||
@@ -1536,4 +1533,8 @@ public class LeanbackKeyboardContainer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRtl() {
|
||||
return mKeyboardManager.get().isRtl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.liskovsoft.leankeyboard.addons.keyboards.KeyboardManager.KeyboardData;
|
||||
import com.liskovsoft.leankeyboard.ime.LeanbackKeyboardContainer.KeyFocus;
|
||||
import com.liskovsoft.leankeyboard.ime.pano.util.TouchNavSpaceTracker;
|
||||
import com.liskovsoft.leankeykeyboard.R;
|
||||
@@ -951,4 +952,8 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
|
||||
return handleKeyUpEvent(keyCode, event.getEventTime());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRtl() {
|
||||
return mContainer.isRtl();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user