public void setSavedPreset() { final int sbOne, sbTwo, sbThree, sbFour, sbFive, skOne, skTwo; if ("Custom".equals(presetsSpinner.getSelectedItem())) { sbOne = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_ONE, 0); sbTwo = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_TWO, 0); sbThree = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_THREE, 0); sbFour = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_FOUR, 0); sbFive = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_FIVE, 0); skOne = prefs.getInt(EQUALIZER_SEEKBAR_CUSTOM_ONE, 0); skTwo = prefs.getInt(EQUALIZER_SEEKBAR_CUSTOM_TWO, 0); } else { sbOne = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_ONE, 0); sbTwo = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_TWO, 0); sbThree = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_THREE, 0); sbFour = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_FOUR, 0); sbFive = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_FIVE, 0); skOne = prefs.getInt(EQUALIZER_SEEKBAR_ONE, 0); skTwo = prefs.getInt(EQUALIZER_SEEKBAR_TWO, 0); } sb1.setProgressAndThumb(sbOne); sb2.setProgressAndThumb(sbTwo); sb3.setProgressAndThumb(sbThree); sb4.setProgressAndThumb(sbFour); sb5.setProgressAndThumb(sbFive); Utils.changeAtBand(equalizer, band1, sbOne - 15); Utils.changeAtBand(equalizer, band2, sbTwo - 15); Utils.changeAtBand(equalizer, band2, sbThree - 15); Utils.changeAtBand(equalizer, band3, sbFour - 15); Utils.changeAtBand(equalizer, band4, sbFive - 15); presetsSpinner.setSelection(0); Toast.makeText(getApplicationContext(), R.string.user, Toast.LENGTH_SHORT).show(); sk1.setProgress(skOne); sk2.setProgress(skTwo); dbChangePg(sbOne, sbTwo, sbThree, sbFour, sbFive, 0, skOne, skTwo); }
public void setEqualizerPreset(Short preset, int p1, int p2, int p3, int p4, int p5) { try { equalizer.usePreset(preset); } catch (Throwable e) { e.printStackTrace(); } sb1.setProgressAndThumb(15 + p1); sb2.setProgressAndThumb(15 + p2); sb3.setProgressAndThumb(15 + p3); sb4.setProgressAndThumb(15 + p4); sb5.setProgressAndThumb(15 + p5); }