Add Giant PTT: a full-screen talk button on Android and a resizable window on desktop
Holding it forces transmission in any input mode, past the voice-activation gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -91,6 +91,7 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
|
||||
/** Mirrors the active server's own client state next to the clock; set once the window is up. */
|
||||
private volatile TrayController tray;
|
||||
private GiantPttWindow giantPtt;
|
||||
private final DesktopNotifier notifier;
|
||||
|
||||
private MainToolbar toolbar;
|
||||
@@ -292,6 +293,11 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
if (selected != null) selected.avatar().delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGiantPtt() {
|
||||
showGiantPtt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowIdentities() {
|
||||
showIdentities();
|
||||
@@ -554,7 +560,9 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
|
||||
/** The local client on {@code tab} started or stopped talking, muted itself, … */
|
||||
void selfStateChanged(ServerTab tab) {
|
||||
if (tabs.contains(tab)) updateTray();
|
||||
if (!tabs.contains(tab)) return;
|
||||
updateTray();
|
||||
if (giantPtt != null) giantPtt.refresh();
|
||||
}
|
||||
|
||||
void tabConnected(ServerTab tab) {
|
||||
@@ -624,6 +632,18 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
sessions.setPushToTalk(talking);
|
||||
}
|
||||
|
||||
private void showGiantPtt() {
|
||||
if (giantPtt == null || !giantPtt.isDisplayable()) {
|
||||
giantPtt = new GiantPttWindow(this, sessions::setForceTransmit, () -> {
|
||||
ServerSession owner = sessions.microphoneOwner();
|
||||
SelfState state = owner == null ? null : owner.selfState();
|
||||
return state == SelfState.TALKING || state == SelfState.COMMANDER_TALKING;
|
||||
});
|
||||
}
|
||||
giantPtt.setVisible(true);
|
||||
giantPtt.toFront();
|
||||
}
|
||||
|
||||
void moveMicrophoneToSelectedTab() {
|
||||
if (selected != null && selected.session().isConnected()) sessions.giveMicrophoneTo(selected.session());
|
||||
updateToolbar();
|
||||
|
||||
Reference in New Issue
Block a user