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 {
|
||||
@Override
|
||||
protected boolean onBack() {
|
||||
if (super.onBack()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mainView.isCommandPaletteShown()) {
|
||||
mainView.hideCommandPalette();
|
||||
if (!voiceInputOps.isListening()) {
|
||||
resetStatus();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return super.onBack() || hideCommandPalette();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBackspace() {
|
||||
if (mainView.isCommandPaletteShown()) {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return super.onBackspace();
|
||||
return hideCommandPalette() || super.onBackspace();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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();
|
||||
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;
|
||||
}
|
||||
|
||||
if (!validateOnly) {
|
||||
if (validateOnly) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mainView.isCommandPaletteShown()) {
|
||||
hideCommandPalette();
|
||||
} else {
|
||||
showCommandPalette();
|
||||
forceShowWindow();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue