public void speak(String string, Runnable onDone) { Log.d( TAG, "speak:" + string + ",onDone=" + onDone + ",this.onDone=" + this.onDone + ",this=" + this); if (onDone == null) { throw new IllegalArgumentException(); } synchronized (utteranceProgressListener) { if (this.onDone != null) { throw new IllegalStateException(); } if (speechCanceled) { skipButton.post(onDone); return; } this.onDone = onDone; speechStarted = false; } skipButton.post(showSkipButton); HashMap<String, String> params = new HashMap<String, String>(); params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, string); if (textToSpeech.speak(string, TextToSpeech.QUEUE_ADD, params) != TextToSpeech.SUCCESS) { synchronized (utteranceProgressListener) { skipButton.post(hideSkipButton); if (this.onDone != null) { skipButton.post(this.onDone); this.onDone = null; } } } }
@Override public void onError(String utteranceId) { skipButton.post(hideSkipButton); synchronized (this) { if (onDone != null) { skipButton.post(onDone); onDone = null; } } }
/** * Set UI button state. Function is thread safe. * * @param isEnabled - new state for button */ private void setButtonSendEnabledT(final boolean isEnabled) { mButton1.post( new Runnable() { public void run() { mButton1.setEnabled(isEnabled); } }); }
public void setButtonWidth() { final int offset = getWidth() / 3; Global.logd(TAG + " offset " + offset); mBtnLockLeftMenu.post( new Runnable() { @Override public void run() { mBtnLockLeftMenu.setWidth(offset); Log.i("Dhara", "mBtnLockLeftMenu " + mBtnLockLeftMenu.getWidth()); } }); mBtnWaiterChangeLeftMenu.post( new Runnable() { @Override public void run() { mBtnWaiterChangeLeftMenu.setWidth(offset); Log.i("Dhara", "mBtnChangeWaiterLeftMenu " + mBtnWaiterChangeLeftMenu.getWidth()); } }); }
@Override public void chargementTermine( URL u, ArrayList<MarkerOptions> markers, HashMap<Integer, String> markersQueryResources, ArrayList<String> types) { this.markersOptions = markers; this.markersQueryResources = markersQueryResources; this.types = types; sportsPoiVisibility.post( new Runnable() { @Override public void run() { addMarkersToMap(); markerSearchResultsList.setAdapter( new MarkerSearchListAdapter( Carte.this, R.layout.marker_search_item, markersOptions)); markerSearchResultsList.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { markerSearchResultsList.setVisibility(View.GONE); Marker marker = Carte.this.markers.get(suggestions.get(position)); map.animateCamera(CameraUpdateFactory.newLatLngZoom(marker.getPosition(), 14)); marker.showInfoWindow(); } }); MyInfoWindowAdapterListener adapterListener = new MyInfoWindowAdapterListener(Carte.this); map.setInfoWindowAdapter(adapterListener); map.setOnInfoWindowClickListener(adapterListener); invalidateOptionsMenu(); } }); }