public void heliPass(View v) { g.setFlagStopSong(true); stopM(); String aPath = "/sdcard/media/audio/raw/helicopterPass.wav"; play(aPath); long time = g.getTimerCountdown() / 1000; new CountDownTimer(time, 100) { @Override public void onTick(long millisUntilFinished) { long timer = g.getTimerCountdown() / 1000; int x = 0; if (millisUntilFinished < g.getTimerCountdown() / 1000) { x = 90; } else { x = 270; } int r = (int) Math.abs((timer / 2 - millisUntilFinished) * 100 / timer / 2); String message = " custHelitwo" + String.valueOf(x) + "%" + String.valueOf(r); ; sendData(message); } public void onFinish() {} }.start(); }
public void batSound(View v) { g.setFlagStopSong(true); stopM(); String aPath = "/sdcard/media/audio/raw/bats.wav"; play(aPath); long time = g.getTimerCountdown() / 1000; new CountDownTimer(time, 100) { @Override public void onTick(long millisUntilFinished) { int x = (int) (millisUntilFinished); String message = " " + String.valueOf(10); sendData(message); } public void onFinish() {} }.start(); }
public void heliMilitary(View v) { g.setFlagStopSong(true); stopM(); String aPath = "/sdcard/media/audio/raw/helicopterMilitary.wav"; play(aPath); long time = g.getTimerCountdown() / 1000; new CountDownTimer(time, 100) { @Override public void onTick(long millisUntilFinished) { int x = (int) (millisUntilFinished); String message = " custHelione " + String.valueOf(x); sendData(message); } public void onFinish() { // mConnectedThread.stopSend(); } }.start(); }
public void playThunder(View v) { g.setFlagStopSong(true); stopM(); String aPath = "/sdcard/media/audio/raw/thunder1.wav"; play(aPath); long time = g.getTimerCountdown() / 1000; new CountDownTimer(time, 100) { @Override public void onTick(long millisUntilFinished) { int x = (int) (((float) millisUntilFinished * 1000 / (float) g.getTimerCountdown()) * 360); String message = " custThunder" + String.valueOf(x); Log.d("sendingAuto", message + " " + String.valueOf(millisUntilFinished / 1000)); sendData(message); } public void onFinish() { // mConnectedThread.stopSend(); Log.d("sendingAuto", "Done"); } }.start(); }