1
0
Fork 0

fixed the command keys not working in invisible mode

This commit is contained in:
sspanak 2024-07-02 17:24:57 +03:00 committed by Dimo Karaivanov
parent 1ee0a4485f
commit 9cddbb5969
7 changed files with 28 additions and 9 deletions

View file

@ -83,6 +83,10 @@ abstract class BaseMainLayout {
void resetHeight() {}
abstract void showCommandPalette();
abstract void hideCommandPalette();
abstract boolean isCommandPaletteShown();
/**
* render
* Do all the necessary stuff to display the View.

View file

@ -77,6 +77,11 @@ class MainLayoutNumpad extends BaseMainLayout {
}
@Override void showCommandPalette() {}
@Override void hideCommandPalette() {}
@Override boolean isCommandPaletteShown() { return false; }
/**
* Uses the key height from the settings, but if it takes up too much of the screen, it will
* be adjusted so that the entire Main View would take up around 50% of the screen in landscape mode

View file

@ -37,6 +37,12 @@ class MainLayoutSmall extends MainLayoutTray {
}
}
@Override
void hideCommandPalette() {
super.hideCommandPalette();
view.findViewById(R.id.main_soft_keys).setVisibility(LinearLayout.VISIBLE);
}
@Override
protected void enableClickHandlers() {
super.enableClickHandlers();

View file

@ -4,7 +4,12 @@ import io.github.sspanak.tt9.R;
import io.github.sspanak.tt9.ime.TraditionalT9;
class MainLayoutStealth extends BaseMainLayout {
private boolean isCommandPaletteShown = false;
MainLayoutStealth(TraditionalT9 tt9) { super(tt9, R.layout.main_stealth); }
@Override void showCommandPalette() { isCommandPaletteShown = true; }
@Override void hideCommandPalette() { isCommandPaletteShown = false; }
@Override boolean isCommandPaletteShown() { return isCommandPaletteShown; }
@Override void render() {}
}

View file

@ -43,9 +43,6 @@ class MainLayoutTray extends BaseMainLayout {
void hideCommandPalette() {
view.findViewById(R.id.main_command_keys).setVisibility(LinearLayout.GONE);
if (this instanceof MainLayoutSmall) {
view.findViewById(R.id.main_soft_keys).setVisibility(LinearLayout.VISIBLE);
}
}
boolean isCommandPaletteShown() {

View file

@ -58,18 +58,18 @@ public class MainView {
}
public void showCommandPalette() {
if (main instanceof MainLayoutTray) {
((MainLayoutTray) main).showCommandPalette();
if (main != null) {
main.showCommandPalette();
}
}
public void hideCommandPalette() {
if (main instanceof MainLayoutTray) {
((MainLayoutTray) main).hideCommandPalette();
if (main != null) {
main.hideCommandPalette();
}
}
public boolean isCommandPaletteShown() {
return main != null && main instanceof MainLayoutTray && ((MainLayoutTray) main).isCommandPaletteShown();
return main != null && main.isCommandPaletteShown();
}
}

View file

@ -32,8 +32,10 @@ public class StatusBar {
public void setText(int stringResourceId) {
if (statusView != null) {
setText(statusView.getContext().getString(stringResourceId));
}
}
public void setText(String text) {