fixed suggestion Next Suggestion and Previous Suggestion keys scrolling the wrong way for RTL languages
This commit is contained in:
parent
bd3fcc1566
commit
68cd3995d0
3 changed files with 8 additions and 6 deletions
|
|
@ -54,6 +54,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
|||
// language
|
||||
protected ArrayList<Integer> mEnabledLanguages;
|
||||
protected Language mLanguage;
|
||||
protected Language systemLanguage;
|
||||
|
||||
// soft key view
|
||||
private MainView mainView = null;
|
||||
|
|
@ -226,6 +227,8 @@ public class TraditionalT9 extends KeyPadHandler {
|
|||
}
|
||||
|
||||
normalizationHandler.removeCallbacksAndMessages(null);
|
||||
systemLanguage = LanguageCollection.getDefault(this);
|
||||
|
||||
initUi();
|
||||
updateInputViewShown();
|
||||
}
|
||||
|
|
@ -462,6 +465,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
|||
}
|
||||
|
||||
cancelAutoAccept();
|
||||
backward = systemLanguage.isRTL() != backward;
|
||||
suggestionBar.scrollToSuggestion(backward ? -1 : 1);
|
||||
mInputMode.setWordStem(suggestionBar.getCurrentSuggestion(), true);
|
||||
setComposingTextWithHighlightedStem(suggestionBar.getCurrentSuggestion());
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package io.github.sspanak.tt9.languages;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -45,7 +46,7 @@ public class LanguageCollection {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static Language getDefault(Context context) {
|
||||
@NonNull public static Language getDefault(Context context) {
|
||||
Language language = getByLocale(context, SystemSettings.getLocale());
|
||||
language = language == null ? getByLocale(context, "en") : language;
|
||||
return language == null ? new NullLanguage(context) : language;
|
||||
|
|
|
|||
|
|
@ -142,14 +142,11 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
|||
int keyId = getId();
|
||||
boolean multiplePress = lastPressedKey == keyId;
|
||||
|
||||
Language language = getCurrentLanguage();
|
||||
boolean isRTL = language != null && language.isRTL();
|
||||
|
||||
if (keyId == R.id.soft_key_add_word) return tt9.onKeyAddWord(false);
|
||||
if (keyId == R.id.soft_key_filter_suggestions) return tt9.onKeyFilterSuggestions(false, multiplePress);
|
||||
if (keyId == R.id.soft_key_clear_filter) return tt9.onKeyFilterClear(false);
|
||||
if (keyId == R.id.soft_key_left_arrow) return tt9.onKeyScrollSuggestion(false, !isRTL);
|
||||
if (keyId == R.id.soft_key_right_arrow) return tt9.onKeyScrollSuggestion(false, isRTL);
|
||||
if (keyId == R.id.soft_key_left_arrow) return tt9.onKeyScrollSuggestion(false, true);
|
||||
if (keyId == R.id.soft_key_right_arrow) return tt9.onKeyScrollSuggestion(false, false);
|
||||
if (keyId == R.id.soft_key_language) return tt9.onKeyNextLanguage(false);
|
||||
if (keyId == R.id.soft_key_ok) return tt9.onOK();
|
||||
if (keyId == R.id.soft_key_settings) return tt9.onKeyShowSettings(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue