Commit 881bf973 authored by David Papazian's avatar David Papazian Committed by Geoffrey Métais

Enabled custom equalizer set

Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
parent 17e00cf2
......@@ -7,24 +7,55 @@
android:padding="@dimen/default_margin" >
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:layout_height="wrap_content">
<android.support.v7.widget.SwitchCompat
android:id="@+id/equalizer_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
android:layout_gravity="center_vertical"/>
<Spinner
android:id="@+id/equalizer_presets"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"/>
<LinearLayout
android:id="@+id/buttons"
android:orientation="horizontal"
android:layout_width="50dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical">
<ImageView
android:visibility="invisible"
android:id="@+id/equalizer_save"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="?attr/ic_save"
android:layout_gravity="center_vertical"/>
<ImageView
android:visibility="invisible"
android:id="@+id/equalizer_revert"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="?attr/ic_previous"
android:layout_gravity="center_vertical"/>
<ImageView
android:visibility="gone"
android:id="@+id/equalizer_delete"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="?attr/ic_trash_small_normal"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<SeekBar
android:id="@+id/equalizer_preamp"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
......@@ -33,6 +64,7 @@
android:progressDrawable="@drawable/po_seekbar"
android:thumb="@drawable/seekbar_thumb"
android:splitTrack="false"/>
</LinearLayout>
<HorizontalScrollView
......
......@@ -8,20 +8,52 @@
android:padding="@dimen/default_margin" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.SwitchCompat
android:id="@+id/equalizer_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
android:layout_gravity="center_vertical"/>
<Spinner
android:id="@+id/equalizer_presets"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"/>
<LinearLayout
android:id="@+id/buttons"
android:orientation="horizontal"
android:layout_width="50dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical">
<ImageView
android:visibility="invisible"
android:id="@+id/equalizer_save"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="?attr/ic_save"
android:layout_gravity="center_vertical"/>
<ImageView
android:visibility="invisible"
android:id="@+id/equalizer_revert"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="?attr/ic_previous"
android:layout_gravity="center_vertical"/>
<ImageView
android:visibility="gone"
android:id="@+id/equalizer_delete"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="?attr/ic_trash_small_normal"
android:layout_gravity="center_vertical"/>
</LinearLayout>
</LinearLayout>
<SeekBar
......
......@@ -540,4 +540,16 @@
<string name="no">No</string>
<string name="loading_medialibrary">Loading Medialibrary...</string>
<string name="yes">yes</string>
<string name="custom_set_save_title">Unsaved changes</string>
<string name="custom_set_save_warning">Warning: unsaved changes</string>
<string name="existing_custom_set_save_message">Save equalizer-set as...</string>
<string name="new_custom_set_save_message">Save new equalizer-set as...</string>
<string name="save">Save</string>
<string name="do_not_save">Do not save</string>
<string name="custom_set_deleted_message">Custom equalizer-set \"%1$s\" deleted.</string>
<string name="custom_set_wrong_input">Invalid name.</string>
<string name="custom_set_already_exist">Equalizer-set with this name already exists</string>
<string name="custom_set_restored">Custom equalizer-set restored.</string>
<string name="unsaved_set_deleted_message">Unsaved equalizer-set deleted.</string>
</resources>
......@@ -244,7 +244,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
hideNotification();
mSettings = PreferenceManager.getDefaultSharedPreferences(this);
mMediaPlayer = newMediaPlayer();
mMediaPlayer.setEqualizer(VLCOptions.getEqualizer(this));
mMediaPlayer.setEqualizer(VLCOptions.getEqualizerSetFromSettings(this));
if (!VLCInstance.testCompatibleCPU(this)) {
stopSelf();
......@@ -1985,7 +1985,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
media.release();
if (mw .getType() != MediaWrapper.TYPE_VIDEO || isVideoPlaying || mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO)) {
mMediaPlayer.setEqualizer(VLCOptions.getEqualizer(this));
mMediaPlayer.setEqualizer(VLCOptions.getEqualizerSetFromSettings(this));
mMediaPlayer.setVideoTitleDisplay(MediaPlayer.Position.Disable, 0);
changeAudioFocus(true);
mMediaPlayer.setEventListener(mMediaPlayerListener);
......
......@@ -20,41 +20,73 @@
package org.videolan.vlc.gui.audio;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatDialogFragment;
import android.support.v7.widget.SwitchCompat;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.Spinner;
import android.widget.Toast;
import org.videolan.libvlc.MediaPlayer;
import org.videolan.vlc.PlaybackService;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.PlaybackServiceFragment;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.gui.view.EqualizerBar;
import org.videolan.vlc.interfaces.OnEqualizerBarChangeListener;
import org.videolan.vlc.util.VLCOptions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class EqualizerFragment extends AppCompatDialogFragment implements PlaybackService.Client.Callback {
private PlaybackService mService;
public final static String TAG = "VLC/EqualizerFragment";
private SwitchCompat button;
private Spinner equalizer_presets;
private ImageView save;
private ImageView delete;
private ImageView revert;
private Spinner equalizer_sets;
private SeekBar preamp;
private LinearLayout bands_layout;
private MediaPlayer.Equalizer mEqualizer = null;
private static final int BAND_COUNT = MediaPlayer.Equalizer.getBandCount();
private int customCount = 0;
private int presetCount = 0;
private List<String> allSets = new ArrayList<>();
private ArrayAdapter<String> adapter;
private Context context;
private View dialogView;
private int previousPos = 0;
private boolean saved = true;
private final static int TYPE_PRESET = 0;
private final static int TYPE_CUSTOM = 1;
private final static int TYPE_NEW = 2;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
......@@ -78,10 +110,14 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
}
private void saveViewChildren(View v) {
dialogView = v;
button = v.findViewById(R.id.equalizer_button);
equalizer_presets = v.findViewById(R.id.equalizer_presets);
equalizer_sets = v.findViewById(R.id.equalizer_presets);
preamp = v.findViewById(R.id.equalizer_preamp);
bands_layout = v.findViewById(R.id.equalizer_bands);
save = v.findViewById(R.id.equalizer_save);
delete = v.findViewById(R.id.equalizer_delete);
revert = v.findViewById(R.id.equalizer_revert);
}
@Override
......@@ -95,17 +131,27 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
}
private void fillViews() {
final Context context = getActivity();
context = getActivity();
if (context == null)
return;
final String[] presets = getEqualizerPresets();
allSets.clear();
allSets = new ArrayList<>();
allSets.addAll(Arrays.asList(getEqualizerPresets()));
presetCount = allSets.size();
for (Map.Entry<String, ?> entry : PreferenceManager.getDefaultSharedPreferences(context).getAll().entrySet()) {
if (entry.getKey().startsWith("custom_equalizer_")) {
allSets.add(entry.getKey().replace("custom_equalizer_", "").replace("_", " "));
customCount++;
}
}
allSets.add("new");
mEqualizer = VLCOptions.getEqualizer(context);
mEqualizer = VLCOptions.getEqualizerSetFromSettings(context);
final boolean isEnabled = mEqualizer != null;
if (mEqualizer == null)
mEqualizer = MediaPlayer.Equalizer.create();
mEqualizer = MediaPlayer.Equalizer.createFromPreset(0);
// on/off
button.setChecked(isEnabled);
......@@ -113,20 +159,43 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mService != null)
mService.setEqualizer(isChecked ? mEqualizer : null);
if (isChecked)
updateEqualizer(allSets.indexOf(VLCOptions.getEqualizerNameFromSettings(context)));
else
mService.setEqualizer(null);
}
});
save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
createSaveCustomSetDialog(equalizer_sets.getSelectedItemPosition(), true, false);
}
});
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
createDeleteCustomSetSnacker();
}
});
revert.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
revertCustomSetChanges();
}
});
// presets
equalizer_presets.setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, presets));
adapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_dropdown_item, allSets);
equalizer_sets.setAdapter(adapter);
// Set the default selection asynchronously to prevent a layout initialization bug.
final int equalizer_preset_pref = VLCOptions.getEqualizerPreset(context);
equalizer_presets.post(new Runnable() {
final int pos = allSets.indexOf(VLCOptions.getEqualizerNameFromSettings(context));
equalizer_sets.post(new Runnable() {
@Override
public void run() {
equalizer_presets.setSelection(equalizer_preset_pref, false);
equalizer_presets.setOnItemSelectedListener(mPresetListener);
equalizer_sets.setOnItemSelectedListener(mSetListener);
equalizer_sets.setOnTouchListener(spinnerOpenListener);
equalizer_sets.setSelection(pos);
}
});
......@@ -139,7 +208,7 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
for (int i = 0; i < BAND_COUNT; i++) {
float band = MediaPlayer.Equalizer.getBandFrequency(i);
EqualizerBar bar = new EqualizerBar(getActivity(), band);
EqualizerBar bar = new EqualizerBar(context, band);
bar.setValue(mEqualizer.getAmp(i));
bar.setListener(new BandListener(i));
......@@ -155,14 +224,24 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
public void onPause() {
super.onPause();
button.setOnCheckedChangeListener(null);
equalizer_presets.setOnItemSelectedListener(null);
equalizer_sets.setOnItemSelectedListener(null);
preamp.setOnSeekBarChangeListener(null);
bands_layout.removeAllViews();
if (button.isChecked())
VLCOptions.setEqualizer(getActivity(), mEqualizer, equalizer_presets.getSelectedItemPosition());
else
VLCOptions.setEqualizer(getActivity(), null, 0);
if (button.isChecked()) {
int pos = equalizer_sets.getSelectedItemPosition();
if (saved) {
VLCOptions.saveEqualizerInSettings(context, mEqualizer, allSets.get(pos));
} else {
if (getEqualizerType(pos) == TYPE_NEW)
VLCOptions.saveEqualizerInSettings(context, MediaPlayer.Equalizer.createFromPreset(0), allSets.get(0));
else
VLCOptions.saveEqualizerInSettings(context, VLCOptions.getCustomSet(context, allSets.get(pos)), allSets.get(pos));
createSaveCustomSetDialog(equalizer_sets.getSelectedItemPosition(), false, true);
}
} else {
VLCOptions.saveEqualizerInSettings(context, null, null);
}
}
@Override
......@@ -171,20 +250,20 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
fillViews();
}
private final OnItemSelectedListener mPresetListener = new OnItemSelectedListener() {
private final OnItemSelectedListener mSetListener = new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
if (mService == null)
return;
mEqualizer = MediaPlayer.Equalizer.createFromPreset(pos);
//save set if changes made (needs old currentPosition)
if (!saved && getEqualizerType(pos) != TYPE_NEW)
createSaveCustomSetDialog(previousPos, false, false);
preamp.setProgress((int) mEqualizer.getPreAmp() + 20);
for (int i = 0; i < BAND_COUNT; ++i) {
EqualizerBar bar = (EqualizerBar) bands_layout.getChildAt(i);
if (bar != null)
bar.setValue(mEqualizer.getAmp(i));
}
saved = getEqualizerType(pos) != TYPE_NEW;
updateEqualizer(pos);
updateButtonVisibility(pos);
}
@Override
......@@ -207,6 +286,16 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
return;
mEqualizer.setPreAmp(progress - 20);
int pos = equalizer_sets.getSelectedItemPosition();
if (getEqualizerType(pos) == TYPE_PRESET) {
previousPos = equalizer_sets.getSelectedItemPosition();
equalizer_sets.setSelection(presetCount + customCount);
} else if (getEqualizerType(pos) == TYPE_CUSTOM) {
saved = false;
setButtonVisibility(true, true, false);
}
if (button.isChecked())
mService.setEqualizer(mEqualizer);
}
......@@ -220,13 +309,34 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
}
@Override
public void onProgressChanged(float value) {
public void onProgressChanged(float value, boolean fromUser) {
if (!fromUser)
return;
mEqualizer.setAmp(index, value);
int pos = equalizer_sets.getSelectedItemPosition();
if (getEqualizerType(pos) == TYPE_PRESET) {
previousPos = equalizer_sets.getSelectedItemPosition();
equalizer_sets.setSelection(presetCount + customCount);
} else if (getEqualizerType(pos) == TYPE_CUSTOM) {
saved = false;
setButtonVisibility(true, true, false);
}
if (button.isChecked() && mService != null)
mService.setEqualizer(mEqualizer);
}
}
private final View.OnTouchListener spinnerOpenListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN && !saved)
previousPos = equalizer_sets.getSelectedItemPosition();
return false;
}
};
private static String[] getEqualizerPresets() {
final int count = MediaPlayer.Equalizer.getPresetCount();
if (count <= 0)
......@@ -237,4 +347,207 @@ public class EqualizerFragment extends AppCompatDialogFragment implements Playba
}
return presets;
}
public void createSaveCustomSetDialog(final int positionToSave, final boolean fromUser, final boolean onPause) {
final String oldName = allSets.get(positionToSave);
final MediaPlayer.Equalizer temporarySet = MediaPlayer.Equalizer.create();
temporarySet.setPreAmp(mEqualizer.getPreAmp());
for (int i=0; i< MediaPlayer.Equalizer.getBandCount(); i++)
temporarySet.setAmp(i, mEqualizer.getAmp(i));
final EditText input = new EditText(context);
input.setText(oldName);
input.setSelectAllOnFocus(true);
final AlertDialog saveEqualizer = new AlertDialog.Builder(context)
.setTitle(getResources().getString(fromUser
? R.string.custom_set_save_title
: R.string.custom_set_save_warning))
.setMessage(getResources().getString((getEqualizerType(positionToSave) == TYPE_CUSTOM)
? R.string.existing_custom_set_save_message
: R.string.new_custom_set_save_message))
.setView(input)
.setPositiveButton(R.string.save, null)
.setNegativeButton(R.string.do_not_save, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
onCancel(dialogInterface);
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
if (onPause) {
VLCOptions.saveEqualizerInSettings(context, MediaPlayer.Equalizer.createFromPreset(0), allSets.get(0));
if (getEqualizerType(positionToSave) == TYPE_PRESET || getEqualizerType(positionToSave) == TYPE_CUSTOM)
updateEqualizer(positionToSave);
else
updateEqualizer(previousPos);
} else {
if (fromUser)
saved = true;
else
updateEqualizer(equalizer_sets.getSelectedItemPosition());
}
}
})
.create();
saveEqualizer.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
//HACK to prevent closure
saveEqualizer.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String newName = input.getText().toString();
if (newName.contains("_") || TextUtils.equals(newName,"new")) {
Toast.makeText(VLCApplication.getAppContext(), VLCApplication.getAppContext().getResources().getString(R.string.custom_set_wrong_input), Toast.LENGTH_SHORT).show();
} else if (allSets.contains(newName) && !TextUtils.equals(newName,oldName)) {
Toast.makeText(VLCApplication.getAppContext(), VLCApplication.getAppContext().getResources().getString(R.string.custom_set_already_exist), Toast.LENGTH_SHORT).show();
} else {
saved = true;
VLCOptions.saveCustomSet(context, temporarySet, newName);
if (onPause) {
VLCOptions.saveEqualizerInSettings(context, temporarySet, newName);
} else {
setButtonVisibility(false, false, fromUser);
if (!TextUtils.equals(newName,oldName)) {
allSets.add(presetCount + customCount, newName);
customCount++;
}
if (fromUser) {
adapter.notifyDataSetChanged();
equalizer_sets.setSelection(allSets.indexOf(newName));
} else {
updateEqualizer(equalizer_sets.getSelectedItemPosition());
}
}
saveEqualizer.dismiss();
}
}
});
}
});
saveEqualizer.show();
}
public void createDeleteCustomSetSnacker() {
final int oldPos = equalizer_sets.getSelectedItemPosition();
final String oldName = allSets.get(oldPos);
if (getEqualizerType(oldPos) == TYPE_CUSTOM) {
final MediaPlayer.Equalizer savedEqualizerSet = VLCOptions.getCustomSet(context, oldName);
Runnable cancelAction = new Runnable() {
@Override
public void run() {
VLCOptions.saveCustomSet(context, savedEqualizerSet, oldName);
mEqualizer = savedEqualizerSet;
allSets.add(oldPos, oldName);
customCount++;
equalizer_sets.setSelection(oldPos);
}
};
VLCOptions.deleteCustomSet(context, oldName);
allSets.remove(oldName);
customCount--;
saved = true;
equalizer_sets.setSelection(0);
String message = context.getString(R.string.custom_set_deleted_message, oldName);
UiTools.snackerWithCancel(dialogView, message, null, cancelAction);
}
}
public void revertCustomSetChanges() {
final int pos = equalizer_sets.getSelectedItemPosition();
if (getEqualizerType(pos) == TYPE_CUSTOM) {
final MediaPlayer.Equalizer temporarySet = MediaPlayer.Equalizer.create();
temporarySet.setPreAmp(mEqualizer.getPreAmp());
for (int i=0; i< MediaPlayer.Equalizer.getBandCount(); i++)
temporarySet.setAmp(i, mEqualizer.getAmp(i));
Runnable cancelAction = new Runnable() {
@Override
public void run() {
mEqualizer = temporarySet;
saved = false;
setButtonVisibility(true, true, false);
updateEqualizer(-1);
}
};
saved = true;
updateEqualizer(pos);
setButtonVisibility(false, false, true);
String message = context.getString(R.string.custom_set_restored);
UiTools.snackerWithCancel(dialogView, message, null, cancelAction);
} else if (getEqualizerType(pos) == TYPE_NEW) {
final MediaPlayer.Equalizer temporarySet = MediaPlayer.Equalizer.create();
temporarySet.setPreAmp(mEqualizer.getPreAmp());
for (int i=0; i< MediaPlayer.Equalizer.getBandCount(); i++)
temporarySet.setAmp(i, mEqualizer.getAmp(i));
Runnable cancelAction = new Runnable() {
@Override
public void run() {
mEqualizer = temporarySet;
equalizer_sets.setSelection(presetCount + customCount);
}
};
saved = true;
equalizer_sets.setSelection(previousPos);
String message = context.getString(R.string.unsaved_set_deleted_message);
UiTools.snackerWithCancel(dialogView, message, null, cancelAction);
}
}
private void updateEqualizer(int pos) {
if (getEqualizerType(pos) == TYPE_PRESET)
mEqualizer = MediaPlayer.Equalizer.createFromPreset(pos);
else if (getEqualizerType(pos) == TYPE_CUSTOM)
mEqualizer = VLCOptions.getCustomSet(context, allSets.get(pos));
preamp.setProgress((int) mEqualizer.getPreAmp() + 20);
for (int i = 0; i < BAND_COUNT; ++i) {
EqualizerBar bar = (EqualizerBar) bands_layout.getChildAt(i);
if (bar != null)
bar.setValue(mEqualizer.getAmp(i));
}
if (button.isChecked())
mService.setEqualizer(mEqualizer);
}
private void updateButtonVisibility (int pos) {
if (getEqualizerType(pos) == TYPE_PRESET) {
setButtonVisibility(false, false, false);
} else if (getEqualizerType(pos) == TYPE_CUSTOM) {
setButtonVisibility(false, false, true);
} else {
setButtonVisibility(true, true, false);
}
}
private void setButtonVisibility(boolean s, boolean r, boolean d) {
save.setVisibility(s ? View.VISIBLE : View.GONE);
revert.setVisibility(r ? View.VISIBLE : View.GONE);
delete.setVisibility(d ? View.VISIBLE : View.GONE);
}
private int getEqualizerType(int position) {
if (position < 0)
return -1;
if (position < presetCount)
return TYPE_PRESET;
if (position < presetCount + customCount)
return TYPE_CUSTOM;
return TYPE_NEW;
}
}
\ No newline at end of file
......@@ -86,8 +86,12 @@ public class EqualizerBar extends LinearLayout {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
float value = (progress - RANGE) / (float) PRECISION;
mValue.setText(value + " dB");
if (listener != null)
listener.onProgressChanged(value);
if (listener != null) {
// HACK: VerticalSeekBar programmatically calls onProgress
// fromUser will always be false