List of usage examples for android.media ToneGenerator TONE_PROP_ACK
int TONE_PROP_ACK
To view the source code for android.media ToneGenerator TONE_PROP_ACK.
Click Source Link
From source file:com.commonsware.android.andshooter.ScreenshotService.java
void processImage(final byte[] png) { new Thread() { @Override// ww w . j av a 2s. c om public void run() { File output = new File(getExternalFilesDir(null), "screenshot.png"); try { FileOutputStream fos = new FileOutputStream(output); fos.write(png); fos.flush(); fos.getFD().sync(); fos.close(); MediaScannerConnection.scanFile(ScreenshotService.this, new String[] { output.getAbsolutePath() }, new String[] { "image/png" }, null); } catch (Exception e) { Log.e(getClass().getSimpleName(), "Exception writing out screenshot", e); } } }.start(); beeper.startTone(ToneGenerator.TONE_PROP_ACK); stopCapture(); }
From source file:com.github.wakhub.monodict.activity.FlashcardActivity.java
private boolean autoPlayLoop() { Cursor cursor = listAdapter.getCursor(); Card card = null;//w ww . j a v a2 s.c o m switch (autoPlayProgress) { case START: speechHelper.init(); showAutoPlayAlertDialog(); speechHelper.setOnUtteranceListener(this); cursor.moveToFirst(); autoPlayProgress = AutoPlayProgress.WAIT_FOR_DISPLAY; try { card = new Card(cursor); } catch (CursorIndexOutOfBoundsException e) { activityHelper.showError(e); return false; } setAutoPlayCard(card); toneGenerator.startTone(ToneGenerator.TONE_PROP_ACK); activityHelper.sleep(2000); break; case WAIT_FOR_DISPLAY: autoPlayProgress = AutoPlayProgress.DISPLAY; activityHelper.sleep(500); speechHelper.speech(new Card(cursor).getDisplay()); break; case WAIT_FOR_TRANSLATE: autoPlayProgress = AutoPlayProgress.TRANSLATE; String languageForTranslate = preferences.ttsLanguageForTranslate().get(); Locale localeForTranslate = new Locale(languageForTranslate.substring(0, 2)); activityHelper.sleep(500); try { card = new Card(cursor); } catch (CursorIndexOutOfBoundsException e) { activityHelper.showError(e); return false; } speechHelper.speech(card.getTranslate().substring(0, Math.min(card.getTranslate().length(), 100)), localeForTranslate, null); break; case WAIT_FOR_NEXT: cursor.moveToNext(); setAutoPlayCard(new Card(cursor)); autoPlayProgress = AutoPlayProgress.WAIT_FOR_DISPLAY; activityHelper.sleep(500); toneGenerator.startTone(ToneGenerator.TONE_PROP_BEEP); activityHelper.sleep(1000); break; case WAIT_FOR_STOP: stopAutoPlay(); return false; } return true; }
From source file:com.github.wakhub.monodict.activity.FlashcardActivity.java
private void stopAutoPlay() { Log.d(TAG, "stopAutoPlay"); if (autoPlayProgress == AutoPlayProgress.STOP) { return;//from w w w . j a v a 2 s . c o m } autoPlayProgress = AutoPlayProgress.STOP; speechHelper.finish(); speechHelper.setOnUtteranceListener(null); toneGenerator.startTone(ToneGenerator.TONE_PROP_ACK); if (autoPlayDialog != null) { autoPlayDialog.dismiss(); autoPlayDialog = null; } }