Пример #1
0
  /** Create all the preference widgets in the view */
  private void createView() {
    PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
    createRestoreDefaultPrefs(root);
    createTrackPrefs(root);
    createMutePrefs(root);
    createInstrumentPrefs(root);

    PreferenceCategory sheetTitle = new PreferenceCategory(this);
    sheetTitle.setTitle(R.string.sheet_prefs_title);
    root.addPreference(sheetTitle);

    createScrollPrefs(root);
    createShowPianoPrefs(root);
    createShowLyricsPrefs(root);
    if (options.tracks.length != 2) {
      createTwoStaffsPrefs(root);
    }
    createShowLetterPrefs(root);
    createTransposePrefs(root);
    createKeySignaturePrefs(root);
    createTimeSignaturePrefs(root);
    createCombineIntervalPrefs(root);
    createColorPrefs(root);
    createPlayMeasuresInLoopPrefs(root);
    setPreferenceScreen(root);
  }
Пример #2
0
 /** Create the "Select Tracks to Mute" checkboxes. */
 private void createMutePrefs(PreferenceScreen root) {
   PreferenceCategory muteTracksTitle = new PreferenceCategory(this);
   muteTracksTitle.setTitle(R.string.select_tracks_to_mute);
   root.addPreference(muteTracksTitle);
   muteTracks = new CheckBoxPreference[options.mute.length];
   for (int i = 0; i < options.mute.length; i++) {
     muteTracks[i] = new CheckBoxPreference(this);
     muteTracks[i].setTitle("Track " + i);
     muteTracks[i].setChecked(options.mute[i]);
     root.addPreference(muteTracks[i]);
   }
 }
Пример #3
0
 /** Create the "Select Tracks to Display" checkboxes. */
 private void createTrackPrefs(PreferenceScreen root) {
   PreferenceCategory selectTracksTitle = new PreferenceCategory(this);
   selectTracksTitle.setTitle(R.string.select_tracks_to_display);
   root.addPreference(selectTracksTitle);
   selectTracks = new CheckBoxPreference[options.tracks.length];
   for (int i = 0; i < options.tracks.length; i++) {
     selectTracks[i] = new CheckBoxPreference(this);
     selectTracks[i].setTitle("Track " + i);
     selectTracks[i].setChecked(options.tracks[i]);
     root.addPreference(selectTracks[i]);
   }
 }
Пример #4
0
 /**
  * Create the "Select Instruments For Each Track " lists. The list of possible instruments is in
  * MidiFile.java.
  */
 private void createInstrumentPrefs(PreferenceScreen root) {
   PreferenceCategory selectInstrTitle = new PreferenceCategory(this);
   selectInstrTitle.setTitle(R.string.select_instruments_per_track);
   root.addPreference(selectInstrTitle);
   selectInstruments = new ListPreference[options.tracks.length];
   for (int i = 0; i < options.instruments.length; i++) {
     selectInstruments[i] = new ListPreference(this);
     selectInstruments[i].setOnPreferenceChangeListener(this);
     selectInstruments[i].setEntries(MidiFile.Instruments);
     selectInstruments[i].setEntryValues(MidiFile.Instruments);
     selectInstruments[i].setTitle("Track " + i);
     selectInstruments[i].setValueIndex(options.instruments[i]);
     selectInstruments[i].setSummary(selectInstruments[i].getEntry());
     root.addPreference(selectInstruments[i]);
   }
   setAllToPiano = new Preference(this);
   setAllToPiano.setTitle(R.string.set_all_to_piano);
   setAllToPiano.setOnPreferenceClickListener(this);
   root.addPreference(setAllToPiano);
 }
Пример #5
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);
  }