Esempio n. 1
0
  public void showDialogInitializingCommandPlayer(
      final Activity uiContext, boolean warningNoneProvider, Runnable run) {
    String voiceProvider = osmandSettings.VOICE_PROVIDER.get();
    if (voiceProvider == null || OsmandSettings.VOICE_PROVIDER_NOT_USE.equals(voiceProvider)) {
      if (warningNoneProvider && voiceProvider == null) {
        Builder builder = new AlertDialog.Builder(uiContext);
        builder.setCancelable(true);
        builder.setNegativeButton(R.string.default_buttons_cancel, null);
        builder.setPositiveButton(
            R.string.default_buttons_ok,
            new DialogInterface.OnClickListener() {

              @Override
              public void onClick(DialogInterface dialog, int which) {
                Intent intent = new Intent(uiContext, SettingsActivity.class);
                intent.putExtra(
                    SettingsActivity.INTENT_KEY_SETTINGS_SCREEN,
                    SettingsActivity.SCREEN_NAVIGATION_SETTINGS);
                uiContext.startActivity(intent);
              }
            });
        builder.setTitle(R.string.voice_is_not_available_title);
        builder.setMessage(R.string.voice_is_not_available_msg);
        builder.show();
      }

    } else {
      if (player == null || !Algorithms.objectEquals(voiceProvider, player.getCurrentVoice())) {
        initVoiceDataInDifferentThread(uiContext, voiceProvider, run);
      }
    }
  }
Esempio n. 2
0
  public void showDialogInitializingCommandPlayer(
      final Activity uiContext, boolean warningNoneProvider, Runnable run, boolean showDialog) {
    String voiceProvider = osmandSettings.VOICE_PROVIDER.get();
    if (voiceProvider == null || OsmandSettings.VOICE_PROVIDER_NOT_USE.equals(voiceProvider)) {
      if (warningNoneProvider && voiceProvider == null) {
        Builder builder = new AccessibleAlertBuilder(uiContext);
        LinearLayout ll = new LinearLayout(uiContext);
        ll.setOrientation(LinearLayout.VERTICAL);
        final TextView tv = new TextView(uiContext);
        tv.setPadding(7, 3, 7, 0);
        tv.setText(R.string.voice_is_not_available_msg);
        tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19);
        ll.addView(tv);

        final CheckBox cb = new CheckBox(uiContext);
        cb.setText(R.string.shared_string_remember_my_choice);
        LinearLayout.LayoutParams lp =
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        lp.setMargins(7, 10, 7, 0);
        cb.setLayoutParams(lp);
        ll.addView(cb);

        builder.setCancelable(true);
        builder.setNegativeButton(
            R.string.shared_string_cancel,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                if (cb.isChecked()) {
                  osmandSettings.VOICE_PROVIDER.set(OsmandSettings.VOICE_PROVIDER_NOT_USE);
                }
              }
            });
        builder.setPositiveButton(
            R.string.shared_string_ok,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                Intent intent = new Intent(uiContext, SettingsActivity.class);
                intent.putExtra(
                    SettingsActivity.INTENT_KEY_SETTINGS_SCREEN,
                    SettingsActivity.SCREEN_GENERAL_SETTINGS);
                uiContext.startActivity(intent);
              }
            });

        builder.setTitle(R.string.voice_is_not_available_title);
        builder.setView(ll);
        // builder.setMessage(R.string.voice_is_not_available_msg);
        builder.show();
      }

    } else {
      if (player == null || !Algorithms.objectEquals(voiceProvider, player.getCurrentVoice())) {
        appInitializer.initVoiceDataInDifferentThread(uiContext, voiceProvider, run, showDialog);
      }
    }
  }
Esempio n. 3
0
 private Term street(
     CommandPlayer p, String name, String ref, String destName, String currentName) {
   if (p.supportsStructuredStreetNames()) {
     Struct next =
         new Struct(new Term[] {getTermString(ref), getTermString(name), getTermString(destName)});
     Term current = new Struct("");
     if (currentName.length() > 0) {
       current =
           new Struct(
               new Term[] {getTermString(""), getTermString(currentName), getTermString("")});
     }
     Struct voice = new Struct("voice", next, current);
     return voice;
   }
   return new Struct(name);
 }
Esempio n. 4
0
 private CommandBuilder builder(CommandPlayer p) {
   return p.newCommandBuilder();
 }
Esempio n. 5
0
 protected CommandBuilder getNewCommandPlayerToPlay() {
   if (player == null || mute) {
     return null;
   }
   return player.newCommandBuilder();
 }
Esempio n. 6
0
 public void onApplicationTerminate(ClientContext ctx) {
   if (player != null) {
     player.clear();
   }
 }