/** Starts/stops the recording of the call when this button is pressed. */ @Override public void buttonPressed() { if (call != null) { // start recording if (isSelected()) { boolean startedRecording = false; try { startedRecording = startRecording(); } finally { if (!startedRecording && (recorder != null)) { try { recorder.stop(); } finally { recorder = null; } } setSelected(startedRecording); } } // stop recording else if (recorder != null) { try { recorder.stop(); } finally { recorder = null; setSelected(false); } } } }
@Override public void stop() { interceptor.stop(); super.stop(); }