private void runLanguageFilterDialog() {
    final NetworkLibrary library = NetworkLibrary.Instance();

    final List<String> allLanguageCodes = library.languageCodes();
    Collections.sort(allLanguageCodes, new ZLLanguageUtil.CodeComparator());
    final Collection<String> activeLanguageCodes = library.activeLanguageCodes();
    final CharSequence[] languageNames = new CharSequence[allLanguageCodes.size()];
    final boolean[] checked = new boolean[allLanguageCodes.size()];

    for (int i = 0; i < allLanguageCodes.size(); ++i) {
      final String code = allLanguageCodes.get(i);
      languageNames[i] = ZLLanguageUtil.languageName(code);
      checked[i] = activeLanguageCodes.contains(code);
    }

    final DialogInterface.OnMultiChoiceClickListener listener =
        new DialogInterface.OnMultiChoiceClickListener() {
          public void onClick(DialogInterface dialog, int which, boolean isChecked) {
            checked[which] = isChecked;
          }
        };
    final ZLResource dialogResource = ZLResource.resource("dialog");
    final AlertDialog dialog =
        new AlertDialog.Builder(this)
            .setMultiChoiceItems(languageNames, checked, listener)
            .setTitle(
                dialogResource.getResource("languageFilterDialog").getResource("title").getValue())
            .setPositiveButton(
                dialogResource.getResource("button").getResource("ok").getValue(),
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                    final TreeSet<String> newActiveCodes =
                        new TreeSet<String>(new ZLLanguageUtil.CodeComparator());
                    for (int i = 0; i < checked.length; ++i) {
                      if (checked[i]) {
                        newActiveCodes.add(allLanguageCodes.get(i));
                      }
                    }
                    library.setActiveLanguageCodes(newActiveCodes);
                    library.synchronize();
                    NetworkView.Instance().fireModelChanged();
                  }
                })
            .create();
    dialog.show();
  }
    /**
     * Set multiple selected dates. This will throw an {@link IllegalArgumentException} if you pass
     * in multiple dates and haven't already called {@link #inMode(SelectionMode)}.
     */
    public FluentInitializer withSelectedDates(Collection<Date> selectedDates) {
      if (selectionMode == SelectionMode.SINGLE && selectedDates.size() > 1) {
        throw new IllegalArgumentException("SINGLE mode can't be used with multiple selectedDates");
      }
      if (selectedDates != null) {
        for (Date date : selectedDates) {
          selectDate(date);
        }
      }
      scrollToSelectedDates();

      validateAndUpdate();
      return this;
    }