Fix sound overlapping and keystore path in pipeline
All checks were successful
Build Android APK / build (push) Successful in 2m54s

This commit is contained in:
2026-04-17 13:46:20 +02:00
parent 683287bfbb
commit de1bd7c1b8
2 changed files with 23 additions and 11 deletions

View File

@@ -23,9 +23,9 @@ jobs:
- name: Setup Keystore
run: |
echo "${{ secrets.ANDROIDKEYSTOREBASE64 }}" | base64 -d > helldivers.keystore
echo "${{ secrets.ANDROIDKEYSTOREBASE64 }}" | base64 -d > app/helldivers.keystore
env:
ANDROIDKEYSTOREPATH: helldivers.keystore
ANDROIDKEYSTOREPATH: app/helldivers.keystore
ANDROIDKEYSTOREPASS: ${{ secrets.ANDROIDKEYSTOREPASS }}
ANDROIDKEYALIAS: ${{ secrets.ANDROIDKEYALIAS }}
ANDROIDKEYPASS: ${{ secrets.ANDROIDKEYPASS }}

View File

@@ -17,38 +17,44 @@ public class SoundManager {
private ToneGenerator toneGenerator;
private Handler handler;
private boolean enabled = true;
private boolean isPlaying = false;
private Runnable stopToneRunnable;
public SoundManager(Context context) {
// ToneGenerator.STREAM_MUSIC para compatibilidad API 18+
toneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, VOLUME);
handler = new Handler(Looper.getMainLooper());
stopToneRunnable = () -> isPlaying = false;
}
/**
* Sonido de click de boton - tono corto y agudo
*/
public void playButtonClick() {
if (!enabled || toneGenerator == null) return;
// Tono DTMF 6 - sonido tipo boton tactil
if (!enabled || toneGenerator == null || isPlaying) return;
isPlaying = true;
toneGenerator.startTone(ToneGenerator.TONE_DTMF_6, 80);
handler.postDelayed(stopToneRunnable, 80);
}
/**
* Sonido de exito - secuencia ascendente
*/
public void playSuccess() {
if (!enabled || toneGenerator == null) return;
// Tono de confirmacion propositivo
if (!enabled || toneGenerator == null || isPlaying) return;
isPlaying = true;
toneGenerator.startTone(ToneGenerator.TONE_PROP_ACK, 150);
handler.postDelayed(stopToneRunnable, 150);
}
/**
* Sonido de fallo - tono bajo grave
*/
public void playFailure() {
if (!enabled || toneGenerator == null) return;
// Tono de error
if (!enabled || toneGenerator == null || isPlaying) return;
isPlaying = true;
toneGenerator.startTone(ToneGenerator.TONE_PROP_NACK, 200);
handler.postDelayed(stopToneRunnable, 200);
}
/**
@@ -56,7 +62,8 @@ public class SoundManager {
* Usa diferentes tonos DTMF para cada direccion
*/
public void playTone(int direction) {
if (!enabled || toneGenerator == null) return;
if (!enabled || toneGenerator == null || isPlaying) return;
isPlaying = true;
int tone;
switch (direction) {
@@ -76,22 +83,27 @@ public class SoundManager {
tone = ToneGenerator.TONE_DTMF_0;
}
toneGenerator.startTone(tone, 100);
handler.postDelayed(stopToneRunnable, 100);
}
/**
* Tono de inicio de secuencia
*/
public void playSequenceStart() {
if (!enabled || toneGenerator == null) return;
if (!enabled || toneGenerator == null || isPlaying) return;
isPlaying = true;
toneGenerator.startTone(ToneGenerator.TONE_SUP_DIAL, 100);
handler.postDelayed(stopToneRunnable, 100);
}
/**
* Tono de alerta/peligro
*/
public void playAlert() {
if (!enabled || toneGenerator == null) return;
if (!enabled || toneGenerator == null || isPlaying) return;
isPlaying = true;
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 150);
handler.postDelayed(stopToneRunnable, 150);
}
public void setEnabled(boolean enabled) {