示例#1
0
 /** Create the "Combine to Two Staffs" preference. */
 private void createTwoStaffsPrefs(PreferenceScreen root) {
   twoStaffs = new CheckBoxPreference(this);
   if (options.tracks.length == 1) {
     twoStaffs.setTitle(R.string.split_to_two_staffs);
     twoStaffs.setSummary(R.string.split_to_two_staffs_summary);
   } else {
     twoStaffs.setTitle(R.string.combine_to_two_staffs);
     twoStaffs.setSummary(R.string.combine_to_two_staffs_summary);
   }
   twoStaffs.setChecked(options.twoStaffs);
   root.addPreference(twoStaffs);
 }
示例#2
0
  /**
   * Create the "Play Measures in a Loop" preference.
   *
   * <p>Note that we display the measure numbers starting at 1, but the actual
   * playMeasuresInLoopStart field starts at 0.
   */
  private void createPlayMeasuresInLoopPrefs(PreferenceScreen root) {
    String[] values = new String[options.lastMeasure + 1];
    for (int measure = 0; measure < values.length; measure++) {
      values[measure] = "" + (measure + 1);
    }

    PreferenceCategory playLoopTitle = new PreferenceCategory(this);
    playLoopTitle.setTitle(R.string.play_measures_in_loop_title);
    root.addPreference(playLoopTitle);

    showMeasures = new CheckBoxPreference(this);
    showMeasures.setTitle(R.string.show_measures);
    showMeasures.setChecked(options.showMeasures);
    root.addPreference(showMeasures);

    playMeasuresInLoop = new CheckBoxPreference(this);
    playMeasuresInLoop.setTitle(R.string.play_measures_in_loop);
    playMeasuresInLoop.setChecked(options.playMeasuresInLoop);
    root.addPreference(playMeasuresInLoop);

    loopStart = new ListPreference(this);
    loopStart.setOnPreferenceChangeListener(this);
    loopStart.setTitle(R.string.play_measures_in_loop_start);
    loopStart.setEntries(values);
    loopStart.setEntryValues(values);
    loopStart.setValueIndex(options.playMeasuresInLoopStart);
    loopStart.setSummary(loopStart.getEntry());
    root.addPreference(loopStart);

    loopEnd = new ListPreference(this);
    loopEnd.setOnPreferenceChangeListener(this);
    loopEnd.setTitle(R.string.play_measures_in_loop_end);
    loopEnd.setEntries(values);
    loopEnd.setEntryValues(values);
    loopEnd.setValueIndex(options.playMeasuresInLoopEnd);
    loopEnd.setSummary(loopEnd.getEntry());
    root.addPreference(loopEnd);
  }
示例#3
0
  /** Update the MidiOptions based on the preferences selected. */
  private void updateOptions() {
    for (int i = 0; i < options.tracks.length; i++) {
      options.tracks[i] = selectTracks[i].isChecked();
    }
    for (int i = 0; i < options.mute.length; i++) {
      options.mute[i] = muteTracks[i].isChecked();
    }
    for (int i = 0; i < options.tracks.length; i++) {
      ListPreference entry = selectInstruments[i];
      options.instruments[i] = entry.findIndexOfValue(entry.getValue());
    }
    options.scrollVert = scrollVertically.isChecked();
    options.showPiano = showPiano.isChecked();
    options.showLyrics = showLyrics.isChecked();
    if (twoStaffs != null) options.twoStaffs = twoStaffs.isChecked();
    else options.twoStaffs = false;

    options.showNoteLetters = Integer.parseInt(showNoteLetters.getValue());
    options.transpose = Integer.parseInt(transpose.getValue());
    options.key = Integer.parseInt(key.getValue());
    if (time.getValue().equals("Default")) {
      options.time = null;
    } else if (time.getValue().equals("3/4")) {
      options.time =
          new TimeSignature(3, 4, options.defaultTime.getQuarter(), options.defaultTime.getTempo());
    } else if (time.getValue().equals("4/4")) {
      options.time =
          new TimeSignature(4, 4, options.defaultTime.getQuarter(), options.defaultTime.getTempo());
    }
    options.combineInterval = Integer.parseInt(combineInterval.getValue());
    options.shade1Color = shade1Color.getColor();
    options.shade2Color = shade2Color.getColor();
    options.showMeasures = showMeasures.isChecked();
    options.playMeasuresInLoop = playMeasuresInLoop.isChecked();
    options.playMeasuresInLoopStart = Integer.parseInt(loopStart.getValue()) - 1;
    options.playMeasuresInLoopEnd = Integer.parseInt(loopEnd.getValue()) - 1;
  }
示例#4
0
 /** Create the "Show Lyrics" preference */
 private void createShowLyricsPrefs(PreferenceScreen root) {
   showLyrics = new CheckBoxPreference(this);
   showLyrics.setTitle(R.string.show_lyrics);
   showLyrics.setChecked(options.showLyrics);
   root.addPreference(showLyrics);
 }
示例#5
0
 /** Create the "Show Piano" preference */
 private void createShowPianoPrefs(PreferenceScreen root) {
   showPiano = new CheckBoxPreference(this);
   showPiano.setTitle(R.string.show_piano);
   showPiano.setChecked(options.showPiano);
   root.addPreference(showPiano);
 }
示例#6
0
 /** Create the "Scroll Vertically" preference */
 private void createScrollPrefs(PreferenceScreen root) {
   scrollVertically = new CheckBoxPreference(this);
   scrollVertically.setTitle(R.string.scroll_vertically);
   scrollVertically.setChecked(options.scrollVert);
   root.addPreference(scrollVertically);
 }