public void savePreset() { final int sbOne = sb1.getProgress(); final int sbTwo = sb2.getProgress(); final int sbThree = sb3.getProgress(); final int sbFour = sb4.getProgress(); final int sbFive = sb5.getProgress(); final int skOne = sk1.getProgress(); final int skTwo = sk2.getProgress(); final String preset = presetsSpinner.getSelectedItem().toString().trim(); Editor editor = prefs.edit(); editor.putBoolean(EQUALIZER_SAVE, true); editor.putString(EQUALIZER_PRESET, preset); if ("Custom".equals(preset)) { editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_ONE, sbOne); editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_TWO, sbTwo); editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_THREE, sbThree); editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_FOUR, sbFour); editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_FIVE, sbFive); editor.putInt(EQUALIZER_SEEKBAR_CUSTOM_ONE, skOne); editor.putInt(EQUALIZER_SEEKBAR_CUSTOM_TWO, skTwo); } else { editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_ONE, sbOne); editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_TWO, sbTwo); editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_THREE, sbThree); editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_FOUR, sbFour); editor.putInt(EQUALIZER_VERTICAL_SEEKBAR_FIVE, sbFive); editor.putInt(EQUALIZER_SEEKBAR_ONE, skOne); editor.putInt(EQUALIZER_SEEKBAR_TWO, skTwo); } editor.apply(); }
@Override public void onStopTrackingTouch(SeekBar seekBar) { if (presetsSpinner.getSelectedItem().equals("Custom")) { savePreset(); dbChangePg( sb1.getProgress(), sb2.getProgress(), sb3.getProgress(), sb4.getProgress(), sb5.getProgress(), presetsSpinner.getSelectedItemPosition(), sk1pgs, sk2pgs); } }