private void alertcallShowDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Assistenz rufen..."); alertTextview = new TextView(context); alertTextview.setPadding(40, 40, 40, 40); alertTextview.setTextSize(24f); builder.setView(alertTextview); builder.setPositiveButton("Jetzt sofort", null); builder.setNeutralButton("Abbrechen", null); alertDialog = builder.create(); alertDialog.show(); alertDialog.setCancelable(false); Button positive = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); positive.setTextSize(24f); positive.setTransformationMethod(null); positive.setOnClickListener(alertOnClickPositive); Button neutral = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL); neutral.setTextSize(24f); neutral.setTransformationMethod(null); neutral.setOnClickListener(alertOnClickNeutral); alertMessage = "Der Assistenzruf wird in %d Sekunden ausgelöst"; alertStatus = ALERTCALL_COUNTDOWN; alertCountdown = 20; if (handler == null) handler = new Handler(); handler.post(alertcallCountdown); }
public void addButton(ViewGroup layout, final String description, final CommandBuilder builder) { Button button = new Button(this); button.setGravity(Gravity.LEFT); button.setTransformationMethod(null); // or else button text is all upper case button.setText(description); button.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); button.setPadding(10, 5, 10, 2); layout.addView(button); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { builder.play(); if (description.startsWith("(11.1)")) { if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) { Toast.makeText( TestVoiceActivity.this, AbstractPrologCommandPlayer.btScoInit + "\nBT SCO init delay: " + ((OsmandApplication) getApplication()) .getSettings() .BT_SCO_DELAY .get() + " ms", Toast.LENGTH_LONG) .show(); } else { Toast.makeText( TestVoiceActivity.this, "Action only available for Phone Call Audio", Toast.LENGTH_LONG) .show(); } } if (description.startsWith("(11.2)")) { if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) { if (((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.get() == 1000) { ((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.set(1500); } else if (((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.get() == 1500) { ((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.set(2000); } else if (((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.get() == 2000) { ((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.set(2500); } else if (((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.get() == 2500) { ((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.set(1000); } Toast.makeText( TestVoiceActivity.this, "BT SCO init delay changed to " + ((OsmandApplication) getApplication()) .getSettings() .BT_SCO_DELAY .get() + " ms", Toast.LENGTH_LONG) .show(); } else { Toast.makeText( TestVoiceActivity.this, "Action only available for Phone Call Audio", Toast.LENGTH_LONG) .show(); } } if (description.startsWith("(11.3)")) { final String systemVoiceUsed = AbstractPrologCommandPlayer.getCurrentVersion() > 99 ? TTSCommandPlayerImpl.getTtsVoiceName() : "Recorded voice"; Toast.makeText( TestVoiceActivity.this, "System's language availability status and voice actually used:\n\n" + systemVoiceUsed, Toast.LENGTH_LONG) .show(); } } }); }