the Command Palette key both opens and closes the Command Palette; Backspace also closes the Command Palette
This commit is contained in:
parent
c628217ea9
commit
1aac6e452e
2 changed files with 26 additions and 21 deletions
|
|
@ -11,36 +11,19 @@ import io.github.sspanak.tt9.ui.dialogs.AddWordDialog;
|
||||||
abstract public class CommandHandler extends VoiceHandler {
|
abstract public class CommandHandler extends VoiceHandler {
|
||||||
@Override
|
@Override
|
||||||
protected boolean onBack() {
|
protected boolean onBack() {
|
||||||
if (super.onBack()) {
|
return super.onBack() || hideCommandPalette();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mainView.isCommandPaletteShown()) {
|
|
||||||
mainView.hideCommandPalette();
|
|
||||||
if (!voiceInputOps.isListening()) {
|
|
||||||
resetStatus();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBackspace() {
|
public boolean onBackspace() {
|
||||||
if (mainView.isCommandPaletteShown()) {
|
return hideCommandPalette() || super.onBackspace();
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onBackspace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onHotkey(int keyCode, boolean repeat, boolean validateOnly) {
|
public boolean onHotkey(int keyCode, boolean repeat, boolean validateOnly) {
|
||||||
return mainView.isCommandPaletteShown();
|
return mainView.isCommandPaletteShown() && keyCode != settings.getKeyCommandPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -204,4 +187,20 @@ abstract public class CommandHandler extends VoiceHandler {
|
||||||
mainView.showCommandPalette();
|
mainView.showCommandPalette();
|
||||||
resetStatus();
|
resetStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean hideCommandPalette() {
|
||||||
|
if (!mainView.isCommandPaletteShown()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mainView.hideCommandPalette();
|
||||||
|
if (voiceInputOps.isListening()) {
|
||||||
|
stopVoiceInput();
|
||||||
|
} else {
|
||||||
|
resetStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,13 @@ public abstract class HotkeyHandler extends CommandHandler {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validateOnly) {
|
if (validateOnly) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainView.isCommandPaletteShown()) {
|
||||||
|
hideCommandPalette();
|
||||||
|
} else {
|
||||||
showCommandPalette();
|
showCommandPalette();
|
||||||
forceShowWindow();
|
forceShowWindow();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue