1
0
Fork 0

new dev bug: fixed the text editing palette closing when backspace is pressed

This commit is contained in:
sspanak 2025-05-26 13:11:09 +03:00 committed by Dimo Karaivanov
parent 547b18a56f
commit f4395ad6fb
7 changed files with 36 additions and 53 deletions

View file

@ -234,7 +234,9 @@ public abstract class HotkeyHandler extends CommandHandler {
mInputMode.onAcceptSuggestion(suggestionOps.acceptIncomplete()); mInputMode.onAcceptSuggestion(suggestionOps.acceptIncomplete());
resetKeyRepeat(); resetKeyRepeat();
mainView.render(); if (settings.isMainLayoutNumpad()) {
mainView.renderKeys();
}
return true; return true;
} }
@ -271,7 +273,9 @@ public abstract class HotkeyHandler extends CommandHandler {
.loadSuggestions(filter); .loadSuggestions(filter);
} }
mainView.render(); if (settings.isMainLayoutNumpad()) {
mainView.renderKeys();
}
return true; return true;
} }
@ -289,7 +293,7 @@ public abstract class HotkeyHandler extends CommandHandler {
backward = isLanguageRTL != backward; backward = isLanguageRTL != backward;
scrollSuggestions(backward); scrollSuggestions(backward);
if (settings.isMainLayoutNumpad()) { if (settings.isMainLayoutNumpad()) {
mainView.render(); mainView.renderKeys();
} }
return true; return true;

View file

@ -119,7 +119,7 @@ public abstract class TypingHandler extends KeyPadHandler {
if (appHacks.onBackspace(settings, mInputMode)) { if (appHacks.onBackspace(settings, mInputMode)) {
mInputMode.reset(); mInputMode.reset();
if (settings.isMainLayoutNumpad()) { if (settings.isMainLayoutNumpad()) {
mainView.render(); mainView.renderKeys();
} }
return false; return false;
} }
@ -154,7 +154,7 @@ public abstract class TypingHandler extends KeyPadHandler {
} }
if (settings.isMainLayoutNumpad()) { if (settings.isMainLayoutNumpad()) {
mainView.render(); mainView.renderKeys();
} }
return true; return true;
@ -189,7 +189,7 @@ public abstract class TypingHandler extends KeyPadHandler {
mInputMode.onAcceptSuggestion(lastWord); mInputMode.onAcceptSuggestion(lastWord);
autoCorrectSpace(lastWord, false, key); autoCorrectSpace(lastWord, false, key);
if (settings.isMainLayoutNumpad()) { if (settings.isMainLayoutNumpad()) {
mainView.render(); mainView.renderKeys();
} }
} }
@ -237,7 +237,7 @@ public abstract class TypingHandler extends KeyPadHandler {
forceShowWindow(); forceShowWindow();
if (settings.isMainLayoutNumpad()) { if (settings.isMainLayoutNumpad()) {
mainView.render(); mainView.renderKeys();
} }
return true; return true;
@ -379,7 +379,7 @@ public abstract class TypingHandler extends KeyPadHandler {
autoCorrectSpace(word, false, mInputMode.getSequence().isEmpty() ? -1 : mInputMode.getSequence().charAt(0) - '0'); autoCorrectSpace(word, false, mInputMode.getSequence().isEmpty() ? -1 : mInputMode.getSequence().charAt(0) - '0');
mInputMode.determineNextWordTextCase(); mInputMode.determineNextWordTextCase();
if (settings.isMainLayoutNumpad()) { if (settings.isMainLayoutNumpad()) {
mainView.render(); mainView.renderKeys();
} }
} }
@ -394,7 +394,7 @@ public abstract class TypingHandler extends KeyPadHandler {
autoCorrectSpace(word, true, fromKey); autoCorrectSpace(word, true, fromKey);
resetKeyRepeat(); resetKeyRepeat();
if (settings.isMainLayoutNumpad()) { if (settings.isMainLayoutNumpad()) {
mainView.render(); mainView.renderKeys();
} }
} }
} }

View file

@ -309,4 +309,13 @@ abstract class BaseMainLayout {
* Do all the necessary stuff to display the View. * Do all the necessary stuff to display the View.
*/ */
abstract void render(); abstract void render();
/**
* Run render only on the keys, for example, to refresh their state.
*/
void renderKeys() {
for (SoftKey key : getKeys()) {
key.render();
}
}
} }

View file

@ -50,25 +50,7 @@ class MainLayoutNumpad extends BaseMainLayout {
view.findViewById(R.id.numpad_column_102).setVisibility(LinearLayout.VISIBLE); view.findViewById(R.id.numpad_column_102).setVisibility(LinearLayout.VISIBLE);
view.findViewById(R.id.numpad_column_103).setVisibility(LinearLayout.VISIBLE); view.findViewById(R.id.numpad_column_103).setVisibility(LinearLayout.VISIBLE);
for (SoftKey key : getKeys()) { renderKeys();
int keyId = key.getId();
if (
keyId == R.id.soft_key_add_word
|| keyId == R.id.soft_key_filter
|| keyId == R.id.soft_key_shift
|| keyId == R.id.soft_key_rf3
|| keyId == R.id.soft_key_lf4
|| keyId == R.id.soft_key_0
|| keyId == R.id.soft_key_100
|| keyId == R.id.soft_key_punctuation_101
|| keyId == R.id.soft_key_punctuation_102
|| keyId == R.id.soft_key_punctuation_201
|| keyId == R.id.soft_key_punctuation_202
) {
key.render();
}
}
} }
@Override @Override
@ -83,25 +65,7 @@ class MainLayoutNumpad extends BaseMainLayout {
view.findViewById(R.id.numpad_column_102).setVisibility(LinearLayout.GONE); view.findViewById(R.id.numpad_column_102).setVisibility(LinearLayout.GONE);
view.findViewById(R.id.numpad_column_103).setVisibility(LinearLayout.GONE); view.findViewById(R.id.numpad_column_103).setVisibility(LinearLayout.GONE);
for (SoftKey key : getKeys()) { renderKeys();
int keyId = key.getId();
if (
keyId == R.id.soft_key_add_word
|| keyId == R.id.soft_key_filter
|| keyId == R.id.soft_key_shift
|| keyId == R.id.soft_key_rf3
|| keyId == R.id.soft_key_lf4
|| keyId == R.id.soft_key_0
|| keyId == R.id.soft_key_100
|| keyId == R.id.soft_key_punctuation_101
|| keyId == R.id.soft_key_punctuation_102
|| keyId == R.id.soft_key_punctuation_201
|| keyId == R.id.soft_key_punctuation_202
) {
key.render();
}
}
} }
@Override @Override
@ -387,8 +351,6 @@ class MainLayoutNumpad extends BaseMainLayout {
keyHeights[0] keyHeights[0]
); );
for (SoftKey key : getKeys()) { renderKeys();
key.render();
}
} }
} }

View file

@ -24,4 +24,5 @@ class MainLayoutStealth extends BaseMainLayout {
@Override boolean isTextEditingPaletteShown() { return isTextEditingPaletteShown; } @Override boolean isTextEditingPaletteShown() { return isTextEditingPaletteShown; }
@Override void setWidth(int w, int g) {} @Override void setWidth(int w, int g) {}
@Override void render() {} @Override void render() {}
@Override void renderKeys() {}
} }

View file

@ -90,8 +90,6 @@ class MainLayoutTray extends BaseMainLayout {
setWidth(tt9.getSettings().getWidthPercent(), tt9.getSettings().getAlignment()); setWidth(tt9.getSettings().getWidthPercent(), tt9.getSettings().getAlignment());
setBackgroundBlending(); setBackgroundBlending();
enableClickHandlers(); enableClickHandlers();
for (SoftKey key : getKeys()) { renderKeys();
key.render();
}
} }
} }

View file

@ -78,6 +78,15 @@ public class MainView {
main.render(); main.render();
} }
public void renderKeys() {
if (main == null) {
Logger.e(LOG_TAG, "Cannot render keys for a null MainView.");
return;
}
main.renderKeys();
}
public void showCommandPalette() { public void showCommandPalette() {
if (main != null) { if (main != null) {
main.showCommandPalette(); main.showCommandPalette();