fixed the special character order being unexpectedly reset sometimes
This commit is contained in:
parent
1a03c55e0d
commit
3e4f3d5d53
3 changed files with 9 additions and 23 deletions
|
|
@ -68,7 +68,7 @@ public abstract class TypingHandler extends KeyPadHandler {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.setDefaultCharOrder(mLanguage, true);
|
settings.setDefaultCharOrder(mLanguage, false);
|
||||||
resetKeyRepeat();
|
resetKeyRepeat();
|
||||||
mInputMode = determineInputMode();
|
mInputMode = determineInputMode();
|
||||||
determineTextCase();
|
determineTextCase();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
||||||
abstract class AbstractPreferenceCharList extends TextInputPreference {
|
abstract class AbstractPreferenceCharList extends TextInputPreference {
|
||||||
@NonNull protected String currentChars = "";
|
@NonNull protected String currentChars = "";
|
||||||
protected Language language;
|
protected Language language;
|
||||||
private Runnable onRender;
|
private boolean isInitialized = false;
|
||||||
protected static SettingsStore settings;
|
protected static SettingsStore settings;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -28,8 +28,9 @@ abstract class AbstractPreferenceCharList extends TextInputPreference {
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull PreferenceViewHolder holder) {
|
public void onBindViewHolder(@NonNull PreferenceViewHolder holder) {
|
||||||
super.onBindViewHolder(holder);
|
super.onBindViewHolder(holder);
|
||||||
if (holder.itemView.findViewById(R.id.input_text_input_field) != null && onRender != null) {
|
if (!isInitialized && holder.itemView.findViewById(R.id.input_text_input_field) != null) {
|
||||||
onRender.run();
|
isInitialized = true;
|
||||||
|
onLanguageChange(language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,6 +57,9 @@ abstract class AbstractPreferenceCharList extends TextInputPreference {
|
||||||
|
|
||||||
void onLanguageChange(Language language) {
|
void onLanguageChange(Language language) {
|
||||||
this.language = language;
|
this.language = language;
|
||||||
|
if (!isInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String all = getChars();
|
String all = getChars();
|
||||||
char[] mandatory = getMandatoryChars();
|
char[] mandatory = getMandatoryChars();
|
||||||
|
|
@ -83,11 +87,6 @@ abstract class AbstractPreferenceCharList extends TextInputPreference {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setOnRender(Runnable onRender) {
|
|
||||||
this.onRender = onRender;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected String validateForbiddenChars() {
|
protected String validateForbiddenChars() {
|
||||||
StringBuilder forbiddenCharList = new StringBuilder();
|
StringBuilder forbiddenCharList = new StringBuilder();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class PunctuationScreen extends BaseScreenFragment {
|
||||||
initLanguageList();
|
initLanguageList();
|
||||||
initResetDefaults();
|
initResetDefaults();
|
||||||
initSaveButton();
|
initSaveButton();
|
||||||
loadCharLists();
|
onLanguageChanged(languageList.getValue());
|
||||||
resetFontSize(false);
|
resetFontSize(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,17 +115,4 @@ public class PunctuationScreen extends BaseScreenFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadCharLists() {
|
|
||||||
for (AbstractPreferenceCharList list : charLists) {
|
|
||||||
if (list == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
list.setOnRender(() -> {
|
|
||||||
list.setOnRender(null);
|
|
||||||
onLanguageChanged(languageList.getValue());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue