diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-03-20 19:54:39 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-03-20 19:54:39 -0700 |
commit | 9736e06e4a3edef265241500a6ce31444327edf0 (patch) | |
tree | 0e94c5db186244287c0945a53098f98a94dc46aa /src/github | |
parent | 2bddf1ed5bdd8dd611c768c6598b49893d9ca481 (diff) | |
download | dsub-9736e06e4a3edef265241500a6ce31444327edf0.tar.gz dsub-9736e06e4a3edef265241500a6ce31444327edf0.tar.bz2 dsub-9736e06e4a3edef265241500a6ce31444327edf0.zip |
Add a couple of try/catch blocks to progress bars
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/EqualizerFragment.java | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/github/daneren2005/dsub/fragments/EqualizerFragment.java b/src/github/daneren2005/dsub/fragments/EqualizerFragment.java index 8cc245bd..d957b745 100644 --- a/src/github/daneren2005/dsub/fragments/EqualizerFragment.java +++ b/src/github/daneren2005/dsub/fragments/EqualizerFragment.java @@ -312,17 +312,21 @@ public class EqualizerFragment extends SubsonicFragment { bassBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- bassTextView.setText(context.getResources().getString(R.string.equalizer_bass_size, progress));
- if(fromUser) {
- if(progress > 0) {
- if(!bass.getEnabled()) {
- bass.setEnabled(true);
+ try {
+ bassTextView.setText(context.getResources().getString(R.string.equalizer_bass_size, progress));
+ if (fromUser) {
+ if (progress > 0) {
+ if (!bass.getEnabled()) {
+ bass.setEnabled(true);
+ }
+ bass.setStrength((short) progress);
+ } else if (progress == 0 && bass.getEnabled()) {
+ bass.setStrength((short) progress);
+ bass.setEnabled(false);
}
- bass.setStrength((short) progress);
- } else if(progress == 0 && bass.getEnabled()) {
- bass.setStrength((short) progress);
- bass.setEnabled(false);
}
+ } catch(Exception e) {
+ Log.w(TAG, "Error on changing bass: ", e);
}
}
@@ -357,17 +361,21 @@ public class EqualizerFragment extends SubsonicFragment { loudnessBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- loudnessTextView.setText(context.getResources().getString(R.string.equalizer_db_size, progress));
- if(fromUser) {
- if(progress > 0) {
- if(!loudnessEnhancer.isEnabled()) {
- loudnessEnhancer.enable();
+ try {
+ loudnessTextView.setText(context.getResources().getString(R.string.equalizer_db_size, progress));
+ if(fromUser) {
+ if(progress > 0) {
+ if(!loudnessEnhancer.isEnabled()) {
+ loudnessEnhancer.enable();
+ }
+ loudnessEnhancer.setGain(progress * 100);
+ } else if(progress == 0 && loudnessEnhancer.isEnabled()) {
+ loudnessEnhancer.setGain(progress * 100);
+ loudnessEnhancer.disable();
}
- loudnessEnhancer.setGain(progress * 100);
- } else if(progress == 0 && loudnessEnhancer.isEnabled()) {
- loudnessEnhancer.setGain(progress * 100);
- loudnessEnhancer.disable();
}
+ } catch(Exception e) {
+ Log.w(TAG, "Error on changing loudness: ", e);
}
}
|