WIP equalizer
This commit is contained in:
parent
98f1d23ebe
commit
886112d7df
27 changed files with 1498 additions and 408 deletions
|
@ -194,4 +194,6 @@ dependencies {
|
|||
kapt "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
|
||||
implementation 'com.github.ologe:scroll-helper:1.1.5'
|
||||
implementation 'com.diogobernardino:williamchart:2.2'
|
||||
implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.0'
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
<activity android:name=".activities.ShareInstagramStory" />
|
||||
<activity android:name=".activities.DriveModeActivity" />
|
||||
<activity android:name=".activities.EqualizerActivity" />
|
||||
<activity android:name=".activities.TestActivity" />
|
||||
<activity
|
||||
android:name=".activities.SearchActivity"
|
||||
android:windowSoftInputMode="stateVisible" />
|
||||
|
@ -228,8 +229,9 @@
|
|||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget_card_info" />
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".AudioEffectsReceiver"
|
||||
android:name=".equalizer.AudioEffectsReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
|
|
|
@ -22,6 +22,7 @@ import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
|
|||
import code.name.monkey.retromusic.dagger.DaggerMusicComponent
|
||||
import code.name.monkey.retromusic.dagger.MusicComponent
|
||||
import code.name.monkey.retromusic.dagger.module.AppModule
|
||||
import code.name.monkey.retromusic.equalizer.AudioEffects
|
||||
import com.anjlab.android.iab.v3.BillingProcessor
|
||||
import com.anjlab.android.iab.v3.TransactionDetails
|
||||
|
||||
|
@ -63,6 +64,8 @@ class App : MultiDexApplication() {
|
|||
|
||||
override fun onBillingInitialized() {}
|
||||
})
|
||||
|
||||
AudioEffects.init(this)
|
||||
}
|
||||
|
||||
private fun initDagger(app: App): MusicComponent =
|
||||
|
|
|
@ -1,123 +1,177 @@
|
|||
package code.name.monkey.retromusic.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.transition.TransitionManager
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.AdapterView
|
||||
import android.widget.AdapterView.OnItemSelectedListener
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.SeekBar
|
||||
import android.widget.TextView
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.appthemehelper.util.*
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
||||
import code.name.monkey.retromusic.equalizer.FreqLevelItem
|
||||
import code.name.monkey.retromusic.equalizer.MainContract
|
||||
import code.name.monkey.retromusic.equalizer.MainPresenter
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.model.Band
|
||||
import code.name.monkey.retromusic.equalizer.AudioEffects
|
||||
import code.name.monkey.retromusic.helper.EqualizerHelper
|
||||
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import kotlinx.android.synthetic.main.activity_equalizer.*
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
*/
|
||||
|
||||
class EqualizerActivity : AbsMusicServiceActivity(), MainContract.View {
|
||||
class EqualizerActivity : AbsMusicServiceActivity(), AdapterView.OnItemSelectedListener {
|
||||
|
||||
private lateinit var mainPresenter: MainPresenter
|
||||
private val seekBarChangeListener = object : SeekBar.OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
if (seekBar === bassBoostStrength) {
|
||||
bassBoost.isEnabled = progress > 0
|
||||
EqualizerHelper.instance!!.bassBoostStrength = progress
|
||||
EqualizerHelper.instance!!.isBassBoostEnabled = progress > 0
|
||||
} else if (seekBar === virtualizerStrength) {
|
||||
virtualizer.isEnabled = progress > 0
|
||||
EqualizerHelper.instance!!.isVirtualizerEnabled = progress > 0
|
||||
EqualizerHelper.instance!!.virtualizerStrength = progress
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {
|
||||
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var presetsNamesAdapter: ArrayAdapter<String>
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_equalizer)
|
||||
|
||||
setStatusbarColorAuto()
|
||||
setNavigationbarColorAuto()
|
||||
setTaskDescriptionColorAuto()
|
||||
setLightNavigationBar(true)
|
||||
|
||||
setupToolbar()
|
||||
|
||||
equalizerSwitch.isChecked = AudioEffects.areAudioEffectsEnabled()
|
||||
val widgetColor = MaterialValueHelper.getPrimaryTextColor(
|
||||
this,
|
||||
ColorUtil.isColorLight(ThemeStore.accentColor(this))
|
||||
)
|
||||
equalizerSwitch.setTextColor(widgetColor)
|
||||
TintHelper.setTintAuto(equalizerSwitch, ThemeStore.accentColor(this), false)
|
||||
equalizerSwitch.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
when (buttonView.id) {
|
||||
R.id.equalizerSwitch -> {
|
||||
AudioEffects.setAudioEffectsEnabled(isChecked)
|
||||
TransitionManager.beginDelayedTransition(content)
|
||||
content.visibility = if (isChecked) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
presetsNamesAdapter =
|
||||
ArrayAdapter(this, R.layout.dropdown_item, AudioEffects.getEqualizerPresets(this))
|
||||
presets.adapter = presetsNamesAdapter
|
||||
presets.onItemSelectedListener = this
|
||||
presets.setSelection(AudioEffects.getCurrentPreset())
|
||||
|
||||
bassBoostStrength.progress = AudioEffects.getBassBoostStrength().toInt()
|
||||
ViewUtil.setProgressDrawable(bassBoostStrength, ThemeStore.accentColor(this), true)
|
||||
bassBoostStrength.setOnSeekBarChangeListener(seekBarChangeListener)
|
||||
|
||||
virtualizerStrength.progress = AudioEffects.getVirtualizerStrength().toInt()
|
||||
ViewUtil.setProgressDrawable(virtualizerStrength, ThemeStore.accentColor(this), true)
|
||||
virtualizerStrength.setOnSeekBarChangeListener(seekBarChangeListener)
|
||||
|
||||
setupUI()
|
||||
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == android.R.id.home) {
|
||||
onBackPressed()
|
||||
return true
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
private fun setupToolbar() {
|
||||
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||
toolbar.setBackgroundColor(toolbarColor)
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
equalizerToggle.setOnCheckedChangeListener { _, isChecked ->
|
||||
mainPresenter.effectOnOff(isChecked)
|
||||
}
|
||||
|
||||
mainPresenter = MainPresenter(this)
|
||||
mainPresenter.initEqualizer()
|
||||
|
||||
val accentColor = ThemeStore.accentColor(this)
|
||||
val textColor = MaterialValueHelper.getPrimaryTextColor(
|
||||
this,
|
||||
ColorUtil.isColorLight(accentColor)
|
||||
)
|
||||
equalizerToggle.setBackgroundColor(accentColor)
|
||||
equalizerToggle.setTextColor(textColor)
|
||||
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
mainPresenter.detachView()
|
||||
}
|
||||
|
||||
override fun showEmptyView() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun showBandInfo(bands: Array<Band?>) {
|
||||
bandList.removeAllViews()
|
||||
for (i in bands.indices) {
|
||||
val band = bands[i]
|
||||
val freqLevelItem = FreqLevelItem(this, null, 0)
|
||||
freqLevelItem.setLevelInfo(band)
|
||||
freqLevelItem.id = i
|
||||
bandList.addView(freqLevelItem, i)
|
||||
}
|
||||
}
|
||||
private fun setupUI() {
|
||||
frequencyBands.removeAllViews()
|
||||
// get number of supported bands
|
||||
|
||||
override fun showPresetList(presetNames: Array<String?>?) {
|
||||
val spinnerAdapter: ArrayAdapter<*> = ArrayAdapter<Any?>(
|
||||
this,
|
||||
R.layout.dropdown_item,
|
||||
presetNames!!
|
||||
)
|
||||
spinnerAdapter.setDropDownViewResource(R.layout.dropdown_item)
|
||||
preset.adapter = spinnerAdapter
|
||||
preset.onItemSelectedListener = object : OnItemSelectedListener {
|
||||
override fun onItemSelected(
|
||||
parent: AdapterView<*>?,
|
||||
view: View?,
|
||||
position: Int,
|
||||
id: Long
|
||||
try {
|
||||
val bands: Short = AudioEffects.getNumberOfBands()
|
||||
val range: ShortArray = AudioEffects.getBandLevelRange()
|
||||
|
||||
// for each of the supported bands, we will set up a slider from -10dB to 10dB boost/attenuation,
|
||||
// as well as text labels to assist the user
|
||||
for (band in 0 until bands) {
|
||||
|
||||
val view = LayoutInflater.from(this)
|
||||
.inflate(R.layout.retro_seekbar, frequencyBands, false)
|
||||
val freqTextView = view.findViewById<TextView>(R.id.hurtz)
|
||||
freqTextView.text =
|
||||
String.format("%d Hz", EqualizerHelper.instance!!.getCenterFreq(band) / 1000)
|
||||
|
||||
val bar = view.findViewById<SeekBar>(R.id.seekbar)
|
||||
ViewUtil.setProgressDrawable(bar, ThemeStore.accentColor(this), true)
|
||||
val seekBarMax = range[1] - range[0]
|
||||
bar.max = seekBarMax
|
||||
println("AudioEffect ${AudioEffects.getBandLevel(band.toShort())}")
|
||||
bar.progress = EqualizerHelper.instance!!.getBandLevel(band)
|
||||
|
||||
bar.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
||||
override fun onProgressChanged(
|
||||
seekBar: SeekBar,
|
||||
progress: Int,
|
||||
fromUser: Boolean
|
||||
) {
|
||||
Log.d("eq", "onItemSelected position $position, id $id")
|
||||
mainPresenter.changePreset(position.toShort())
|
||||
if (fromUser) {
|
||||
//val level: Short = (progress + AudioEffects.getBandLevelRange(0)).toShort()
|
||||
//AudioEffects.setBandLevel(band.toShort(), level)
|
||||
EqualizerHelper.instance!!.setBandLevel(
|
||||
band, progress + EqualizerHelper.instance!!.bandLevelLow
|
||||
)
|
||||
println("AudioEffect: ${progress + EqualizerHelper.instance!!.bandLevelLow}")
|
||||
presets.setSelection(0)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
frequencyBands.addView(view)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||
Log.d("eq", "onNothingSelected")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun showBandLevel(levels: ShortArray) {
|
||||
val count = bandList.childCount
|
||||
for (i in 0 until count) {
|
||||
val item: View = bandList.getChildAt(i)
|
||||
if (item is FreqLevelItem) {
|
||||
val freqLevelItem = item as FreqLevelItem
|
||||
freqLevelItem.setBandLevel(levels[i])
|
||||
}
|
||||
}
|
||||
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
||||
println("AudioEffect: $position")
|
||||
AudioEffects.usePreset((position).toShort())
|
||||
//EqualizerHelper.instance!!.equalizer.usePreset((position - 1).toShort())
|
||||
setupUI()
|
||||
}
|
||||
|
||||
override fun onServiceConnected() {
|
||||
super.onServiceConnected()
|
||||
mainPresenter.changeAudioSession(MusicPlayerRemote.audioSessionId)
|
||||
}
|
||||
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||
|
||||
override fun onPlayingMetaChanged() {
|
||||
super.onPlayingMetaChanged()
|
||||
mainPresenter.changeAudioSession(MusicPlayerRemote.audioSessionId)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package code.name.monkey.retromusic.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
||||
import code.name.monkey.retromusic.fragments.EqualizerFragment
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote.audioSessionId
|
||||
import kotlinx.android.synthetic.main.activity_about.*
|
||||
|
||||
class TestActivity : AbsMusicServiceActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.test)
|
||||
setStatusbarColorAuto()
|
||||
setNavigationbarColorAuto()
|
||||
setLightNavigationBar(true)
|
||||
|
||||
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||
toolbar.setBackgroundColor(toolbarColor)
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
val equalizerFragment = EqualizerFragment.newInstance(audioSessionId)
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.contentFrame, equalizerFragment)
|
||||
.commit()
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == android.R.id.home) {
|
||||
onBackPressed()
|
||||
return true
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,203 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
|
||||
/**
|
||||
* Created by Harjot on 23-May-16.
|
||||
*/
|
||||
public class AnalogController extends View {
|
||||
|
||||
public Paint circlePaint2;
|
||||
public Paint linePaint;
|
||||
float midx, midy;
|
||||
Paint textPaint;
|
||||
Paint circlePaint;
|
||||
String angle;
|
||||
float currdeg, deg = 3, downdeg;
|
||||
|
||||
int progressColor, lineColor;
|
||||
|
||||
onProgressChangedListener mListener;
|
||||
|
||||
String label;
|
||||
|
||||
public AnalogController(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public AnalogController(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public AnalogController(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
public void setOnProgressChangedListener(onProgressChangedListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
void init() {
|
||||
textPaint = new Paint();
|
||||
textPaint.setColor(ATHUtil.INSTANCE.resolveColor(getContext(), android.R.attr.textColorSecondary));
|
||||
textPaint.setStyle(Paint.Style.FILL);
|
||||
textPaint.setTextSize(33);
|
||||
textPaint.setFakeBoldText(true);
|
||||
textPaint.setTextAlign(Paint.Align.CENTER);
|
||||
circlePaint = new Paint();
|
||||
circlePaint.setColor(Color.BLUE);
|
||||
circlePaint.setStyle(Paint.Style.FILL);
|
||||
circlePaint2 = new Paint();
|
||||
circlePaint2.setColor(Color.RED);
|
||||
circlePaint2.setStyle(Paint.Style.FILL);
|
||||
linePaint = new Paint();
|
||||
linePaint.setColor(ThemeStore.Companion.accentColor(getContext()));
|
||||
linePaint.setStrokeWidth(16);
|
||||
angle = "0.0";
|
||||
label = "Label";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
midx = canvas.getWidth() / 2;
|
||||
midy = canvas.getHeight() / 2;
|
||||
|
||||
int ang = 0;
|
||||
float x = 0, y = 0;
|
||||
int radius = (int) (Math.min(midx, midy) * ((float) 14.5 / 16));
|
||||
float deg2 = Math.max(3, deg);
|
||||
float deg3 = Math.min(deg, 21);
|
||||
for (int i = (int) (deg2); i < 22; i++) {
|
||||
float tmp = (float) i / 24;
|
||||
x = midx + (float) (radius * Math.sin(2 * Math.PI * (1.0 - tmp)));
|
||||
y = midy + (float) (radius * Math.cos(2 * Math.PI * (1.0 - tmp)));
|
||||
circlePaint.setColor(Color.parseColor("#777777"));
|
||||
canvas.drawCircle(x, y, ((float) radius / 15), circlePaint);
|
||||
}
|
||||
for (int i = 3; i <= deg3; i++) {
|
||||
float tmp = (float) i / 24;
|
||||
x = midx + (float) (radius * Math.sin(2 * Math.PI * (1.0 - tmp)));
|
||||
y = midy + (float) (radius * Math.cos(2 * Math.PI * (1.0 - tmp)));
|
||||
canvas.drawCircle(x, y, ((float) radius / 15), circlePaint2);
|
||||
}
|
||||
|
||||
float tmp2 = deg / 24;
|
||||
float x1 = midx + (float) (radius * ((float) 2 / 5) * Math.sin(2 * Math.PI * (1.0 - tmp2)));
|
||||
float y1 = midy + (float) (radius * ((float) 2 / 5) * Math.cos(2 * Math.PI * (1.0 - tmp2)));
|
||||
float x2 = midx + (float) (radius * ((float) 3 / 5) * Math.sin(2 * Math.PI * (1.0 - tmp2)));
|
||||
float y2 = midy + (float) (radius * ((float) 3 / 5) * Math.cos(2 * Math.PI * (1.0 - tmp2)));
|
||||
|
||||
circlePaint.setColor(Color.parseColor("#888888"));
|
||||
canvas.drawCircle(midx, midy, radius * ((float) 13 / 15), circlePaint);
|
||||
circlePaint.setColor(Color.parseColor("#999999"));
|
||||
canvas.drawCircle(midx, midy, radius * ((float) 11 / 15), circlePaint);
|
||||
canvas.drawText(label, midx, midy + (float) (radius * 1.1), textPaint);
|
||||
canvas.drawLine(x1, y1, x2, y2, linePaint);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent e) {
|
||||
|
||||
mListener.onProgressChanged((int) (deg - 2));
|
||||
|
||||
if (e.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
float dx = e.getX() - midx;
|
||||
float dy = e.getY() - midy;
|
||||
downdeg = (float) ((Math.atan2(dy, dx) * 180) / Math.PI);
|
||||
downdeg -= 90;
|
||||
if (downdeg < 0) {
|
||||
downdeg += 360;
|
||||
}
|
||||
downdeg = (float) Math.floor(downdeg / 15);
|
||||
return true;
|
||||
}
|
||||
if (e.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
float dx = e.getX() - midx;
|
||||
float dy = e.getY() - midy;
|
||||
currdeg = (float) ((Math.atan2(dy, dx) * 180) / Math.PI);
|
||||
currdeg -= 90;
|
||||
if (currdeg < 0) {
|
||||
currdeg += 360;
|
||||
}
|
||||
currdeg = (float) Math.floor(currdeg / 15);
|
||||
|
||||
if (currdeg == 0 && downdeg == 23) {
|
||||
deg++;
|
||||
if (deg > 21) {
|
||||
deg = 21;
|
||||
}
|
||||
downdeg = currdeg;
|
||||
} else if (currdeg == 23 && downdeg == 0) {
|
||||
deg--;
|
||||
if (deg < 3) {
|
||||
deg = 3;
|
||||
}
|
||||
downdeg = currdeg;
|
||||
} else {
|
||||
deg += (currdeg - downdeg);
|
||||
if (deg > 21) {
|
||||
deg = 21;
|
||||
}
|
||||
if (deg < 3) {
|
||||
deg = 3;
|
||||
}
|
||||
downdeg = currdeg;
|
||||
}
|
||||
|
||||
angle = String.valueOf(deg);
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
return e.getAction() == MotionEvent.ACTION_UP || super.onTouchEvent(e);
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return (int) (deg - 2);
|
||||
}
|
||||
|
||||
public void setProgress(int param) {
|
||||
deg = param + 2;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String txt) {
|
||||
label = txt;
|
||||
}
|
||||
|
||||
public int getLineColor() {
|
||||
return lineColor;
|
||||
}
|
||||
|
||||
public void setLineColor(int lineColor) {
|
||||
this.lineColor = lineColor;
|
||||
}
|
||||
|
||||
public int getProgressColor() {
|
||||
return progressColor;
|
||||
}
|
||||
|
||||
public void setProgressColor(int progressColor) {
|
||||
this.progressColor = progressColor;
|
||||
}
|
||||
|
||||
public interface onProgressChangedListener {
|
||||
void onProgressChanged(int progress);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.media.audiofx.BassBoost;
|
||||
import android.media.audiofx.Equalizer;
|
||||
import android.media.audiofx.Virtualizer;
|
||||
import android.util.Log;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
@ -14,20 +15,23 @@ public class AudioEffects {
|
|||
|
||||
public static final short BASSBOOST_MAX_STRENGTH = 1000;
|
||||
private static final String PREF_EQ_ENABLED = "enabled";
|
||||
private static final String PREF_VIRTUALIZER_ENABLED = "pref_virtualizer_enabled";
|
||||
private static final String PREF_BAND_LEVEL = "level";
|
||||
private static final String PREF_PRESET = "preset";
|
||||
private static final String PREF_BASSBOOST = "bassboost";
|
||||
private static final String PREF_VIRTUALIZER = "pref_virtualizer";
|
||||
private static final String AUDIO_EFFECTS_PREFS = "audioeffects";
|
||||
|
||||
private static final BassBoostValues sBassBoostValues = new BassBoostValues();
|
||||
private static final VirtualizerValues sVirtualizerValues = new VirtualizerValues();
|
||||
private static final EqualizerValues sEqualizerValues = new EqualizerValues();
|
||||
private static BassBoost sBassBoost;
|
||||
private static Equalizer sEqualizer;
|
||||
private static Virtualizer sVirtualizer;
|
||||
private static boolean sCustomPreset;
|
||||
|
||||
public static void init(Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(AUDIO_EFFECTS_PREFS, Context.MODE_PRIVATE);
|
||||
|
||||
initBassBoostValues(prefs);
|
||||
initEqualizerValues(prefs);
|
||||
}
|
||||
|
@ -50,11 +54,18 @@ public class AudioEffects {
|
|||
sEqualizer.release();
|
||||
sEqualizer = null;
|
||||
}
|
||||
if (sVirtualizer != null) {
|
||||
sVirtualizer.release();
|
||||
sVirtualizer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void initBassBoostValues(SharedPreferences prefs) {
|
||||
sBassBoostValues.enabled = prefs.getBoolean(PREF_EQ_ENABLED, false);
|
||||
sBassBoostValues.strength = (short) prefs.getInt(PREF_BASSBOOST, 0);
|
||||
|
||||
sVirtualizerValues.enabled = prefs.getBoolean(PREF_VIRTUALIZER_ENABLED, false);
|
||||
sVirtualizerValues.strength = (short) prefs.getInt(PREF_VIRTUALIZER, 0);
|
||||
}
|
||||
|
||||
private static void initBassBoost(int audioSessionId) {
|
||||
|
@ -72,27 +83,46 @@ public class AudioEffects {
|
|||
}
|
||||
}
|
||||
|
||||
private static void initVirtualizerBoost(int audioSessionId) {
|
||||
if (sVirtualizer != null) {
|
||||
sVirtualizer.release();
|
||||
sVirtualizer = null;
|
||||
}
|
||||
sVirtualizer = new Virtualizer(0, audioSessionId);
|
||||
sVirtualizer.setEnabled(sVirtualizerValues.enabled);
|
||||
|
||||
short strength = sVirtualizerValues.strength;
|
||||
|
||||
if (strength >= 0 && strength <= BASSBOOST_MAX_STRENGTH) {
|
||||
sVirtualizer.setStrength(strength);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initEqualizerValues(SharedPreferences prefs) {
|
||||
|
||||
|
||||
sEqualizerValues.enabled = prefs.getBoolean(PREF_EQ_ENABLED, false);
|
||||
|
||||
sEqualizerValues.preset = (short) prefs.getInt(PREF_PRESET, -1);
|
||||
|
||||
if (sEqualizerValues.preset == -1) {
|
||||
sCustomPreset = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void initEqualizer(SharedPreferences prefs, int audioSessionId) {
|
||||
|
||||
if (sEqualizer != null) {
|
||||
sEqualizer.release();
|
||||
sEqualizer = null;
|
||||
}
|
||||
if (sVirtualizer != null) {
|
||||
sVirtualizer.release();
|
||||
sVirtualizer = null;
|
||||
}
|
||||
sEqualizer = new Equalizer(0, audioSessionId);
|
||||
sEqualizer.setEnabled(sEqualizerValues.enabled);
|
||||
|
||||
sVirtualizer = new Virtualizer(0, audioSessionId);
|
||||
sVirtualizer.setEnabled(sEqualizerValues.enabled);
|
||||
|
||||
if (!sCustomPreset) {
|
||||
usePreset(sEqualizerValues.preset);
|
||||
|
||||
|
@ -119,7 +149,6 @@ public class AudioEffects {
|
|||
|
||||
sEqualizerValues.levelsSet = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static short getBassBoostStrength() {
|
||||
|
@ -131,7 +160,17 @@ public class AudioEffects {
|
|||
if (sBassBoost != null) {
|
||||
sBassBoost.setStrength(strength);
|
||||
}
|
||||
}
|
||||
|
||||
public static short getVirtualizerStrength() {
|
||||
return sVirtualizer.getRoundedStrength();
|
||||
}
|
||||
|
||||
public static void setVirtualizerStrength(short strength) {
|
||||
sVirtualizerValues.strength = strength;
|
||||
if (sVirtualizer != null) {
|
||||
sVirtualizer.setStrength(strength);
|
||||
}
|
||||
}
|
||||
|
||||
public static short[] getBandLevelRange() {
|
||||
|
@ -142,14 +181,32 @@ public class AudioEffects {
|
|||
}
|
||||
|
||||
public static short getBandLevel(short band) {
|
||||
if (sEqualizer == null) {
|
||||
/*if (sEqualizer == null) {
|
||||
if (sEqualizerValues.levelsSet && sEqualizerValues.bandLevels.length > band) {
|
||||
return sEqualizerValues.bandLevels[band];
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (sEqualizer != null) {
|
||||
Log.d("audiofx", "eeeD");
|
||||
return sEqualizer.getBandLevel(band);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static short getBandLevelRange(int i) {
|
||||
if (sEqualizer != null) {
|
||||
Log.i("AudioEffect", "getBandLevelRange: " + sEqualizer.getBandLevelRange()[i]);
|
||||
return sEqualizer.getBandLevelRange()[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getBandLevelOfPreset(short i) {
|
||||
if (sEqualizer != null) {
|
||||
return (int) sEqualizer.getBandLevel(i) - getBandLevelRange(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean areAudioEffectsEnabled() {
|
||||
if (sEqualizer == null) {
|
||||
|
@ -256,11 +313,24 @@ public class AudioEffects {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
|
||||
public static String getPresetAtIndex(short i) {
|
||||
if (sEqualizer != null) {
|
||||
return sEqualizer.getPresetName(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class BassBoostValues {
|
||||
public boolean enabled;
|
||||
public short strength;
|
||||
}
|
||||
|
||||
private static class VirtualizerValues {
|
||||
public boolean enabled;
|
||||
public short strength;
|
||||
}
|
||||
|
||||
private static class EqualizerValues {
|
||||
public boolean enabled;
|
||||
public short preset;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import code.name.monkey.retromusic.mvp.BaseView;
|
||||
|
||||
public class BasePresenter<T extends BaseView> {
|
||||
protected T mView;
|
||||
|
||||
final public void attachView(T view){
|
||||
mView = view;
|
||||
}
|
||||
|
||||
final public void detachView(){
|
||||
mView = null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Harjot on 09-Dec-16.
|
||||
*/
|
||||
|
||||
public class EqualizerModel implements Serializable {
|
||||
private boolean isEqualizerEnabled;
|
||||
private int[] seekbarpos = new int[5];
|
||||
private int presetPos;
|
||||
private short reverbPreset;
|
||||
private short bassStrength;
|
||||
private short virtualizerStrength;
|
||||
|
||||
public EqualizerModel() {
|
||||
isEqualizerEnabled = true;
|
||||
reverbPreset = -1;
|
||||
bassStrength = -1;
|
||||
}
|
||||
|
||||
public boolean isEqualizerEnabled() {
|
||||
return isEqualizerEnabled;
|
||||
}
|
||||
|
||||
public void setEqualizerEnabled(boolean equalizerEnabled) {
|
||||
isEqualizerEnabled = equalizerEnabled;
|
||||
}
|
||||
|
||||
public int[] getSeekbarpos() {
|
||||
return seekbarpos;
|
||||
}
|
||||
|
||||
public void setSeekbarpos(int[] seekbarpos) {
|
||||
this.seekbarpos = seekbarpos;
|
||||
}
|
||||
|
||||
public int getPresetPos() {
|
||||
return presetPos;
|
||||
}
|
||||
|
||||
public void setPresetPos(int presetPos) {
|
||||
this.presetPos = presetPos;
|
||||
}
|
||||
|
||||
public short getReverbPreset() {
|
||||
return reverbPreset;
|
||||
}
|
||||
|
||||
public void setReverbPreset(short reverbPreset) {
|
||||
this.reverbPreset = reverbPreset;
|
||||
}
|
||||
|
||||
public short getBassStrength() {
|
||||
return bassStrength;
|
||||
}
|
||||
|
||||
public void setBassStrength(short bassStrength) {
|
||||
this.bassStrength = bassStrength;
|
||||
}
|
||||
|
||||
public short getVirtualizerStrength() {
|
||||
return virtualizerStrength;
|
||||
}
|
||||
|
||||
public void setVirtualizerStrength(short virtualizerStrength) {
|
||||
this.virtualizerStrength = virtualizerStrength;
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package code.name.monkey.retromusic.equalizer
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.SeekBar
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
import android.widget.TextView
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.model.Band
|
||||
|
||||
/**
|
||||
* Created by 1100416 on 2018. 1. 11..
|
||||
*/
|
||||
class FreqLevelItem @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||
private var band: Band? = null
|
||||
private var mSeekBar: SeekBar? = null
|
||||
private var mCenterFreq: TextView? = null
|
||||
private var mLevel: TextView? = null
|
||||
|
||||
interface OnBandLevelChangeListener {
|
||||
fun onBandLevelChange(band: View?, level: Short)
|
||||
fun onBandLevelChangeStop()
|
||||
}
|
||||
|
||||
var mBandLevelChangeListener: OnBandLevelChangeListener? = null
|
||||
private fun initView() {
|
||||
val rootView =
|
||||
LayoutInflater.from(context).inflate(R.layout.freq_level_item, this, false)
|
||||
mCenterFreq = rootView.findViewById(R.id.centerFreq)
|
||||
|
||||
mLevel = rootView.findViewById(R.id.currentLevel)
|
||||
mSeekBar = rootView.findViewById(R.id.seekBar)
|
||||
mSeekBar?.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(
|
||||
seekBar: SeekBar,
|
||||
i: Int,
|
||||
b: Boolean
|
||||
) {
|
||||
if (band != null) {
|
||||
mLevel?.text = "${i + band!!.rangeMin}"
|
||||
} else {
|
||||
mLevel?.text = "$i"
|
||||
}
|
||||
if (mBandLevelChangeListener != null) {
|
||||
mBandLevelChangeListener!!.onBandLevelChange(
|
||||
this@FreqLevelItem,
|
||||
(i + band!!.rangeMin).toShort()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {}
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||
if (mBandLevelChangeListener != null) {
|
||||
mBandLevelChangeListener!!.onBandLevelChangeStop()
|
||||
}
|
||||
}
|
||||
})
|
||||
addView(rootView)
|
||||
}
|
||||
|
||||
fun setLevelInfo(band: Band?) {
|
||||
this.band = band
|
||||
mCenterFreq!!.text = displayNameOfHz(band!!.centerFreq)
|
||||
|
||||
mSeekBar!!.max = band.rangeMax - band.rangeMin
|
||||
mSeekBar!!.progress = band.level - band.rangeMin
|
||||
}
|
||||
|
||||
private fun displayNameOfHz(freq: Int): String {
|
||||
var display = freq.toString() + "mHz"
|
||||
when {
|
||||
1000 * 1000 * 1000 < freq -> {
|
||||
display = String.format("%.1f", freq / 1000 / 1000f) + "MHz"
|
||||
}
|
||||
1000 * 1000 < freq -> {
|
||||
display = String.format("%.1f", freq / 1000 / 1000f) + "KHz"
|
||||
}
|
||||
1000 < freq -> {
|
||||
display = String.format("%d", freq / 1000) + "Hz"
|
||||
}
|
||||
}
|
||||
return display
|
||||
}
|
||||
|
||||
fun setBandLevel(level: Short) {
|
||||
band!!.level = level
|
||||
setLevelInfo(band)
|
||||
}
|
||||
|
||||
fun setBandLevelChangeListener(listener: OnBandLevelChangeListener?) {
|
||||
mBandLevelChangeListener = listener
|
||||
}
|
||||
|
||||
init {
|
||||
initView()
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import code.name.monkey.retromusic.model.Band;
|
||||
import code.name.monkey.retromusic.mvp.BaseView;
|
||||
|
||||
public interface MainContract {
|
||||
interface View extends BaseView {
|
||||
void showBandInfo(Band[] bands);
|
||||
|
||||
void showPresetList(String[] presetNames);
|
||||
|
||||
void showBandLevel(short[] levels);
|
||||
}
|
||||
|
||||
abstract class Presenter extends BasePresenter<View> {
|
||||
abstract void initEqualizer();
|
||||
|
||||
abstract void changePreset(short presetId);
|
||||
|
||||
abstract void changeAudioSession(int audioSession);
|
||||
|
||||
abstract public void effectOnOff(boolean effectOn);
|
||||
}
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import android.media.audiofx.Equalizer;
|
||||
import android.util.Log;
|
||||
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.model.Band;
|
||||
|
||||
|
||||
/**
|
||||
* Created by 1100416 on 2018. 1. 15..
|
||||
*/
|
||||
|
||||
public class MainPresenter extends MainContract.Presenter {
|
||||
private Equalizer mEqualizer;
|
||||
private int mAudioSession = -1;
|
||||
private boolean mEffectEnabled = false;
|
||||
|
||||
private short mPreset = 0;
|
||||
|
||||
|
||||
public MainPresenter(MainContract.View view) {
|
||||
attachView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initEqualizer() {
|
||||
initEqualizer(MusicPlayerRemote.INSTANCE.getAudioSessionId());
|
||||
mAudioSession = 0;
|
||||
displayEQStatus(mEqualizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changePreset(short presetId) {
|
||||
mEqualizer.usePreset(presetId);
|
||||
updateBandLevel(mEqualizer);
|
||||
mPreset = presetId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeAudioSession(int audioSession) {
|
||||
initEqualizer(audioSession);
|
||||
mAudioSession = audioSession;
|
||||
enableEqualisingEffect(mEffectEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void effectOnOff(boolean effectOn) {
|
||||
mEffectEnabled = effectOn;
|
||||
enableEqualisingEffect(mEffectEnabled);
|
||||
}
|
||||
|
||||
|
||||
private void initEqualizer(int audioSession) {
|
||||
if (mAudioSession != audioSession) {
|
||||
try {
|
||||
mEqualizer = new Equalizer(0, audioSession);
|
||||
mEqualizer.usePreset(mPreset);
|
||||
mEqualizer.setParameterListener(mEqualizerParameterChangeListener);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void enableEqualisingEffect(boolean enable) {
|
||||
if (mEqualizer != null) {
|
||||
mEqualizer.setEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
private void displayEQStatus(Equalizer equalizer) {
|
||||
if (mView != null && equalizer != null) {
|
||||
int numOfPresets = equalizer.getNumberOfPresets();
|
||||
String[] presetNames = new String[numOfPresets];
|
||||
|
||||
for (short p = 0; p < numOfPresets; p++) {
|
||||
presetNames[p] = equalizer.getPresetName(p);
|
||||
}
|
||||
((MainContract.View) mView).showPresetList(presetNames);
|
||||
|
||||
int numOfBands = mEqualizer.getNumberOfBands();
|
||||
Band[] bands = new Band[numOfBands];
|
||||
for (short i = 0; i < numOfBands; i++) {
|
||||
int centerFreq = mEqualizer.getCenterFreq(i);
|
||||
short bandLevel = mEqualizer.getBandLevel(i);
|
||||
int freqRange[] = mEqualizer.getBandFreqRange(i);
|
||||
short[] bandLevelRange = mEqualizer.getBandLevelRange();
|
||||
|
||||
Band band = new Band(centerFreq, bandLevel, freqRange, bandLevelRange[0], bandLevelRange[bandLevelRange.length - 1]);
|
||||
bands[i] = band;
|
||||
}
|
||||
((MainContract.View) mView).showBandInfo(bands);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBandLevel(Equalizer equalizer) {
|
||||
if (equalizer != null) {
|
||||
int numOfBands = equalizer.getNumberOfBands();
|
||||
short[] bandLevels = new short[numOfBands];
|
||||
for (short i = 0; i < numOfBands; i++) {
|
||||
bandLevels[i] = equalizer.getBandLevel(i);
|
||||
}
|
||||
|
||||
if (mView != null) {
|
||||
((MainContract.View) mView).showBandLevel(bandLevels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Equalizer.OnParameterChangeListener mEqualizerParameterChangeListener = (equalizer, i, i1, i2, i3) -> {
|
||||
Log.d("eq", "onParameterChange : i " + i + ", i1 " + i1 + ", i2 " + i2 + ", i3 " + i3);
|
||||
updateBandLevel(equalizer);
|
||||
};
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
public class Settings {
|
||||
public static boolean isEqualizerEnabled = true;
|
||||
public static boolean isEqualizerReloaded = true;
|
||||
public static int[] seekbarpos = new int[6];
|
||||
public static int presetPos;
|
||||
public static short reverbPreset = -1, bassStrength = -1, virtualizerStrength = -1;
|
||||
public static EqualizerModel equalizerModel;
|
||||
public static double ratio = 1.0;
|
||||
public static boolean isEditing = false;
|
||||
}
|
|
@ -0,0 +1,399 @@
|
|||
package code.name.monkey.retromusic.fragments;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.media.audiofx.BassBoost;
|
||||
import android.media.audiofx.Equalizer;
|
||||
import android.media.audiofx.PresetReverb;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import code.name.monkey.appthemehelper.util.TintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.equalizer.EqualizerModel;
|
||||
import code.name.monkey.retromusic.equalizer.Settings;
|
||||
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener;
|
||||
import code.name.monkey.retromusic.util.ViewUtil;
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
*/
|
||||
public class EqualizerFragment extends Fragment {
|
||||
|
||||
private static final String ARG_AUDIO_SESSIOIN_ID = "audio_session_id";
|
||||
|
||||
private Equalizer mEqualizer;
|
||||
private BassBoost bassBoost;
|
||||
private PresetReverb presetReverb;
|
||||
|
||||
private int y = 0;
|
||||
private SeekBar[] seekBarFinal = new SeekBar[5];
|
||||
private Spinner presetSpinner;
|
||||
private int audioSesionId;
|
||||
|
||||
public EqualizerFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static EqualizerFragment newInstance(int audioSessionId) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_AUDIO_SESSIOIN_ID, audioSessionId);
|
||||
|
||||
EqualizerFragment fragment = new EqualizerFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Settings.isEditing = true;
|
||||
|
||||
if (getArguments() != null && getArguments().containsKey(ARG_AUDIO_SESSIOIN_ID)) {
|
||||
audioSesionId = getArguments().getInt(ARG_AUDIO_SESSIOIN_ID);
|
||||
}
|
||||
|
||||
if (Settings.equalizerModel == null) {
|
||||
Settings.equalizerModel = new EqualizerModel();
|
||||
Settings.equalizerModel.setReverbPreset(PresetReverb.PRESET_NONE);
|
||||
Settings.equalizerModel.setBassStrength((short) (1000 / 19));
|
||||
}
|
||||
|
||||
mEqualizer = new Equalizer(0, audioSesionId);
|
||||
|
||||
bassBoost = new BassBoost(0, audioSesionId);
|
||||
bassBoost.setEnabled(Settings.isEqualizerEnabled);
|
||||
BassBoost.Settings bassBoostSettingTemp = bassBoost.getProperties();
|
||||
BassBoost.Settings bassBoostSetting = new BassBoost.Settings(bassBoostSettingTemp.toString());
|
||||
bassBoostSetting.strength = Settings.equalizerModel.getBassStrength();
|
||||
bassBoost.setProperties(bassBoostSetting);
|
||||
|
||||
presetReverb = new PresetReverb(0, audioSesionId);
|
||||
presetReverb.setPreset(Settings.equalizerModel.getReverbPreset());
|
||||
presetReverb.setEnabled(Settings.isEqualizerEnabled);
|
||||
|
||||
mEqualizer.setEnabled(Settings.isEqualizerEnabled);
|
||||
|
||||
if (Settings.presetPos == 0) {
|
||||
for (short bandIdx = 0; bandIdx < mEqualizer.getNumberOfBands(); bandIdx++) {
|
||||
mEqualizer.setBandLevel(bandIdx, (short) Settings.seekbarpos[bandIdx]);
|
||||
}
|
||||
} else {
|
||||
mEqualizer.usePreset((short) Settings.presetPos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_equalizer, container, false);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
SwitchCompat equalizerSwitch = view.findViewById(R.id.equalizer_switch);
|
||||
equalizerSwitch.setChecked(Settings.isEqualizerEnabled);
|
||||
TintHelper.setTint(equalizerSwitch, ThemeStore.Companion.accentColor(requireContext()), ATHUtil.INSTANCE.isWindowBackgroundDark(requireContext()));
|
||||
equalizerSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mEqualizer.setEnabled(isChecked);
|
||||
bassBoost.setEnabled(isChecked);
|
||||
presetReverb.setEnabled(isChecked);
|
||||
Settings.isEqualizerEnabled = isChecked;
|
||||
Settings.equalizerModel.setEqualizerEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
presetSpinner = view.findViewById(R.id.equalizer_preset_spinner);
|
||||
|
||||
FrameLayout equalizerBlocker = view.findViewById(R.id.equalizerBlocker);
|
||||
|
||||
SeekBar bassController = view.findViewById(R.id.bassController);
|
||||
SeekBar reverbController = view.findViewById(R.id.reverbController);
|
||||
|
||||
if (!Settings.isEqualizerReloaded) {
|
||||
int x = 0;
|
||||
if (bassBoost != null) {
|
||||
try {
|
||||
x = ((bassBoost.getRoundedStrength() * 19) / 1000);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (presetReverb != null) {
|
||||
try {
|
||||
y = (presetReverb.getPreset() * 19) / 6;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (x == 0) {
|
||||
bassController.setProgress(1);
|
||||
} else {
|
||||
bassController.setProgress(x);
|
||||
}
|
||||
|
||||
if (y == 0) {
|
||||
reverbController.setProgress(1);
|
||||
} else {
|
||||
reverbController.setProgress(y);
|
||||
}
|
||||
} else {
|
||||
int x = ((Settings.bassStrength * 19) / 1000);
|
||||
y = (Settings.reverbPreset * 19) / 6;
|
||||
if (x == 0) {
|
||||
bassController.setProgress(1);
|
||||
} else {
|
||||
bassController.setProgress(x);
|
||||
}
|
||||
|
||||
if (y == 0) {
|
||||
reverbController.setProgress(1);
|
||||
} else {
|
||||
reverbController.setProgress(y);
|
||||
}
|
||||
}
|
||||
TintHelper.setTint(bassController, ThemeStore.Companion.accentColor(requireContext()), ATHUtil.INSTANCE.isWindowBackgroundDark(requireContext()));
|
||||
bassController.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(@NotNull SeekBar seekBar, int progress, boolean fromUser) {
|
||||
super.onProgressChanged(seekBar, progress, fromUser);
|
||||
Settings.bassStrength = (short) (((float) 1000 / 19) * (progress));
|
||||
try {
|
||||
bassBoost.setStrength(Settings.bassStrength);
|
||||
Settings.equalizerModel.setBassStrength(Settings.bassStrength);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TintHelper.setTint(reverbController, ThemeStore.Companion.accentColor(requireContext()), ATHUtil.INSTANCE.isWindowBackgroundDark(requireContext()));
|
||||
reverbController.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(@NotNull SeekBar seekBar, int progress, boolean fromUser) {
|
||||
super.onProgressChanged(seekBar, progress, fromUser);
|
||||
Settings.reverbPreset = (short) ((progress * 6) / 19);
|
||||
Settings.equalizerModel.setReverbPreset(Settings.reverbPreset);
|
||||
try {
|
||||
presetReverb.setPreset(Settings.reverbPreset);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
y = progress;
|
||||
}
|
||||
});
|
||||
|
||||
TextView equalizerHeading = new TextView(getContext());
|
||||
equalizerHeading.setText(R.string.equalizer);
|
||||
equalizerHeading.setTextSize(20);
|
||||
equalizerHeading.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
|
||||
short numberOfFrequencyBands = 5;
|
||||
|
||||
|
||||
final short lowerEqualizerBandLevel = mEqualizer.getBandLevelRange()[0];
|
||||
final short upperEqualizerBandLevel = mEqualizer.getBandLevelRange()[1];
|
||||
|
||||
for (short i = 0; i < numberOfFrequencyBands; i++) {
|
||||
final short equalizerBandIndex = i;
|
||||
final TextView frequencyHeaderTextView = new TextView(getContext());
|
||||
frequencyHeaderTextView.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
frequencyHeaderTextView.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
frequencyHeaderTextView.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
frequencyHeaderTextView.setText((mEqualizer.getCenterFreq(equalizerBandIndex) / 1000) + "Hz");
|
||||
|
||||
LinearLayout seekBarRowLayout = new LinearLayout(getContext());
|
||||
seekBarRowLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
TextView lowerEqualizerBandLevelTextView = new TextView(getContext());
|
||||
lowerEqualizerBandLevelTextView.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
));
|
||||
lowerEqualizerBandLevelTextView.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
lowerEqualizerBandLevelTextView.setText((lowerEqualizerBandLevel / 100) + "dB");
|
||||
|
||||
TextView upperEqualizerBandLevelTextView = new TextView(getContext());
|
||||
lowerEqualizerBandLevelTextView.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
upperEqualizerBandLevelTextView.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
upperEqualizerBandLevelTextView.setText((upperEqualizerBandLevel / 100) + "dB");
|
||||
|
||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
layoutParams.weight = 1;
|
||||
|
||||
SeekBar seekBar = new SeekBar(getContext());
|
||||
TextView textView = new TextView(getContext());
|
||||
switch (i) {
|
||||
case 0:
|
||||
seekBar = view.findViewById(R.id.seekBar1);
|
||||
textView = view.findViewById(R.id.textView1);
|
||||
break;
|
||||
case 1:
|
||||
seekBar = view.findViewById(R.id.seekBar2);
|
||||
textView = view.findViewById(R.id.textView2);
|
||||
break;
|
||||
case 2:
|
||||
seekBar = view.findViewById(R.id.seekBar3);
|
||||
textView = view.findViewById(R.id.textView3);
|
||||
break;
|
||||
case 3:
|
||||
seekBar = view.findViewById(R.id.seekBar4);
|
||||
textView = view.findViewById(R.id.textView4);
|
||||
break;
|
||||
case 4:
|
||||
seekBar = view.findViewById(R.id.seekBar5);
|
||||
textView = view.findViewById(R.id.textView5);
|
||||
break;
|
||||
}
|
||||
seekBarFinal[i] = seekBar;
|
||||
ViewUtil.INSTANCE.setProgressDrawable(seekBar, ThemeStore.Companion.accentColor(requireContext()), true);
|
||||
seekBar.setId(i);
|
||||
seekBar.setMax(upperEqualizerBandLevel - lowerEqualizerBandLevel);
|
||||
|
||||
textView.setText(frequencyHeaderTextView.getText());
|
||||
|
||||
if (Settings.isEqualizerReloaded) {
|
||||
|
||||
seekBar.setProgress(Settings.seekbarpos[i] - lowerEqualizerBandLevel);
|
||||
} else {
|
||||
|
||||
seekBar.setProgress(mEqualizer.getBandLevel(equalizerBandIndex) - lowerEqualizerBandLevel);
|
||||
Settings.seekbarpos[i] = mEqualizer.getBandLevel(equalizerBandIndex);
|
||||
Settings.isEqualizerReloaded = true;
|
||||
}
|
||||
|
||||
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
mEqualizer.setBandLevel(equalizerBandIndex, (short) (progress + lowerEqualizerBandLevel));
|
||||
|
||||
Settings.seekbarpos[seekBar.getId()] = (progress + lowerEqualizerBandLevel);
|
||||
Settings.equalizerModel.getSeekbarpos()[seekBar.getId()] = (progress + lowerEqualizerBandLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
presetSpinner.setSelection(0);
|
||||
Settings.presetPos = 0;
|
||||
Settings.equalizerModel.setPresetPos(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
equalizeSound();
|
||||
|
||||
}
|
||||
|
||||
void equalizeSound() {
|
||||
ArrayList<String> equalizerPresetNames = new ArrayList<>();
|
||||
ArrayAdapter<String> equalizerPresetSpinnerAdapter = new ArrayAdapter<>(requireContext(),
|
||||
R.layout.dropdown_item,
|
||||
equalizerPresetNames);
|
||||
equalizerPresetSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
equalizerPresetNames.add("Custom");
|
||||
|
||||
for (short i = 0; i < mEqualizer.getNumberOfPresets(); i++) {
|
||||
equalizerPresetNames.add(mEqualizer.getPresetName(i));
|
||||
}
|
||||
|
||||
presetSpinner.setAdapter(equalizerPresetSpinnerAdapter);
|
||||
if (Settings.isEqualizerReloaded && Settings.presetPos != 0) {
|
||||
presetSpinner.setSelection(Settings.presetPos);
|
||||
}
|
||||
|
||||
presetSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
try {
|
||||
if (position != 0) {
|
||||
mEqualizer.usePreset((short) (position - 1));
|
||||
Settings.presetPos = position;
|
||||
short numberOfFreqBands = 5;
|
||||
|
||||
final short lowerEqualizerBandLevel = mEqualizer.getBandLevelRange()[0];
|
||||
|
||||
for (short i = 0; i < numberOfFreqBands; i++) {
|
||||
seekBarFinal[i].setProgress(mEqualizer.getBandLevel(i) - lowerEqualizerBandLevel);
|
||||
|
||||
Settings.seekbarpos[i] = mEqualizer.getBandLevel(i);
|
||||
Settings.equalizerModel.getSeekbarpos()[i] = mEqualizer.getBandLevel(i);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(requireContext(), "Error while updating Equalizer", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Settings.equalizerModel.setPresetPos(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mEqualizer != null) {
|
||||
mEqualizer.release();
|
||||
}
|
||||
|
||||
if (bassBoost != null) {
|
||||
bassBoost.release();
|
||||
}
|
||||
|
||||
if (presetReverb != null) {
|
||||
presetReverb.release();
|
||||
}
|
||||
|
||||
Settings.isEditing = false;
|
||||
}
|
||||
}
|
|
@ -68,6 +68,7 @@ import code.name.monkey.retromusic.appwidgets.AppWidgetCard;
|
|||
import code.name.monkey.retromusic.appwidgets.AppWidgetClassic;
|
||||
import code.name.monkey.retromusic.appwidgets.AppWidgetSmall;
|
||||
import code.name.monkey.retromusic.appwidgets.AppWidgetText;
|
||||
import code.name.monkey.retromusic.equalizer.AudioEffectsReceiver;
|
||||
import code.name.monkey.retromusic.glide.BlurTransformation;
|
||||
import code.name.monkey.retromusic.glide.SongGlideRequest;
|
||||
import code.name.monkey.retromusic.helper.ShuffleHelper;
|
||||
|
@ -392,6 +393,11 @@ public class MusicService extends Service implements
|
|||
|
||||
registerHeadsetEvents();
|
||||
registerBluetoothConnected();
|
||||
|
||||
Intent i = new Intent(this, AudioEffectsReceiver.class);
|
||||
i.setAction(AudioEffectsReceiver.ACTION_OPEN_AUDIO_EFFECT_SESSION);
|
||||
i.putExtra(AudioEffectsReceiver.EXTRA_AUDIO_SESSION_ID, getAudioSessionId());
|
||||
sendBroadcast(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -416,7 +422,9 @@ public class MusicService extends Service implements
|
|||
getContentResolver().unregisterContentObserver(mediaStoreObserver);
|
||||
PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
|
||||
wakeLock.release();
|
||||
|
||||
Intent i = new Intent(this, AudioEffectsReceiver.class);
|
||||
i.setAction(AudioEffectsReceiver.ACTION_CLOSE_AUDIO_EFFECT_SESSION);
|
||||
sendBroadcast(i);
|
||||
sendBroadcast(new Intent("code.name.monkey.retromusic.RETRO_MUSIC_SERVICE_DESTROYED"));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import code.name.monkey.retromusic.activities.AboutActivity;
|
|||
import code.name.monkey.retromusic.activities.AlbumDetailsActivity;
|
||||
import code.name.monkey.retromusic.activities.ArtistDetailActivity;
|
||||
import code.name.monkey.retromusic.activities.DriveModeActivity;
|
||||
import code.name.monkey.retromusic.activities.EqualizerActivity;
|
||||
import code.name.monkey.retromusic.activities.GenreDetailsActivity;
|
||||
import code.name.monkey.retromusic.activities.LicenseActivity;
|
||||
import code.name.monkey.retromusic.activities.LyricsActivity;
|
||||
|
@ -40,6 +39,7 @@ import code.name.monkey.retromusic.activities.PlayingQueueActivity;
|
|||
import code.name.monkey.retromusic.activities.PlaylistDetailActivity;
|
||||
import code.name.monkey.retromusic.activities.PurchaseActivity;
|
||||
import code.name.monkey.retromusic.activities.SearchActivity;
|
||||
import code.name.monkey.retromusic.activities.SettingsActivity;
|
||||
import code.name.monkey.retromusic.activities.SupportDevelopmentActivity;
|
||||
import code.name.monkey.retromusic.activities.UserInfoActivity;
|
||||
import code.name.monkey.retromusic.activities.WhatsNewActivity;
|
||||
|
@ -139,7 +139,7 @@ public class NavigationUtil {
|
|||
}
|
||||
|
||||
public static void goToSettings(@NonNull Activity activity) {
|
||||
ActivityCompat.startActivity(activity, new Intent(activity, EqualizerActivity.class), null);
|
||||
ActivityCompat.startActivity(activity, new Intent(activity, SettingsActivity.class), null);
|
||||
}
|
||||
|
||||
public static void goToSupportDevelopment(@NonNull Activity activity) {
|
||||
|
|
8
app/src/main/res/drawable/custom_equalizer_thumb.xml
Executable file
8
app/src/main/res/drawable/custom_equalizer_thumb.xml
Executable file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/custom_thumb_src" android:state_enabled="false" />
|
||||
<item android:drawable="@drawable/custom_thumb_src" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/custom_thumb_src" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/custom_thumb_src" />
|
||||
</selector>
|
11
app/src/main/res/drawable/custom_thumb_src.xml
Executable file
11
app/src/main/res/drawable/custom_thumb_src.xml
Executable file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<solid android:color="#FFFFFF" />
|
||||
<!--<solid android:color="#FFA036" />-->
|
||||
|
||||
<size
|
||||
android:width="16dp"
|
||||
android:height="16dp" />
|
||||
</shape>
|
BIN
app/src/main/res/drawable/graph_back_2.png
Executable file
BIN
app/src/main/res/drawable/graph_back_2.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<corners android:radius="35dp" />
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/md_white_1000" />
|
||||
android:width="1dp"
|
||||
android:color="?android:attr/textColorSecondary" />
|
||||
|
||||
</shape>
|
|
@ -1,66 +1,145 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:liftOnScroll="true">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_collapseMode="pin"
|
||||
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
|
||||
app:title="@string/action_about"
|
||||
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
|
||||
app:title="@string/equalizer">
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/equalizerSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:padding="16dp"
|
||||
android:textAppearance="@style/TextViewSubtitle2" />
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/equalizerToggle"
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/line_button"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="16dp"
|
||||
android:text="@string/select_preset"
|
||||
android:textAppearance="@style/TextViewSubtitle1" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/presets"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:spinnerMode="dialog" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/frequencyBands"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="16dp"
|
||||
android:background="?android:attr/dividerHorizontal" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/bassBoost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:padding="16dp"
|
||||
android:text="@string/bass_boost"
|
||||
android:textAppearance="@style/TextViewSubtitle1" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSeekBar
|
||||
android:id="@+id/bassBoostStrength"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:max="1000"
|
||||
android:maxHeight="3dp"
|
||||
android:padding="16dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:splitTrack="false"
|
||||
tools:progress="20" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/virtualizer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:padding="16dp"
|
||||
android:text="@string/virtualizer"
|
||||
android:textAppearance="@style/TextViewSubtitle1" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSeekBar
|
||||
android:id="@+id/virtualizerStrength"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:max="1000"
|
||||
android:maxHeight="3dp"
|
||||
android:padding="16dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:splitTrack="false"
|
||||
tools:progress="20" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="On"
|
||||
tools:checked="true"
|
||||
android:textAppearance="@style/TextViewSubtitle1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/preset"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:spinnerMode="dialog"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/equalizerToggle" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/bandListContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/preset">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bandList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
android:text="*Warning: It's alpha version. We don't recommend to use Equalizer, We believe without using Equalizer songs has better sound quality." />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -5,6 +5,5 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textAppearance="@style/TextViewBody1"
|
||||
tools:text="@tools:sample/full_names" />
|
|
@ -2,7 +2,8 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/frequency"
|
||||
|
@ -14,14 +15,14 @@
|
|||
android:maxLines="1" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/seek_bar"
|
||||
android:id="@+id/seekBar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/level"
|
||||
android:id="@+id/dbLevel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
|
318
app/src/main/res/layout/fragment_equalizer.xml
Normal file
318
app/src/main/res/layout/fragment_equalizer.xml
Normal file
|
@ -0,0 +1,318 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/equalizer_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/equalizer_preset_spinner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@drawable/line_button"
|
||||
android:spinnerMode="dialog"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/equalizer_switch" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/equalizerContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintDimensionRatio="4:3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/equalizer_preset_spinner">
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper
|
||||
android:id="@+id/seekBar1Wrap"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/textView1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/seekBar2Wrap"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBar
|
||||
android:id="@+id/seekBar1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:thumb="@drawable/switch_thumb_material"
|
||||
app:seekBarRotation="CW270"
|
||||
tools:progress="100" />
|
||||
</com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/seekBar1Wrap"
|
||||
app:layout_constraintStart_toStartOf="@id/seekBar1Wrap"
|
||||
app:layout_constraintTop_toBottomOf="@id/seekBar1Wrap"
|
||||
tools:text="10000 Hz" />
|
||||
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper
|
||||
android:id="@+id/seekBar2Wrap"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/textView2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/seekBar3Wrap"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/seekBar1Wrap"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBar
|
||||
android:id="@+id/seekBar2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:thumb="@drawable/switch_thumb_material"
|
||||
app:seekBarRotation="CW270"
|
||||
tools:progress="100" />
|
||||
</com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/seekBar2Wrap"
|
||||
app:layout_constraintStart_toStartOf="@id/seekBar2Wrap"
|
||||
app:layout_constraintTop_toBottomOf="@id/seekBar2Wrap"
|
||||
tools:text="10000 Hz" />
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper
|
||||
android:id="@+id/seekBar3Wrap"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="8"
|
||||
app:layout_constraintBottom_toTopOf="@id/textView3"
|
||||
app:layout_constraintEnd_toStartOf="@+id/seekBar4Wrap"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/seekBar2Wrap"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:layout_editor_absoluteY="3dp">
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBar
|
||||
android:id="@+id/seekBar3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:thumb="@drawable/switch_thumb_material"
|
||||
app:seekBarRotation="CW270" />
|
||||
</com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/seekBar3Wrap"
|
||||
app:layout_constraintStart_toStartOf="@id/seekBar3Wrap"
|
||||
app:layout_constraintTop_toBottomOf="@id/seekBar3Wrap"
|
||||
tools:text="10000 Hz" />
|
||||
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper
|
||||
android:id="@+id/seekBar4Wrap"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/textView4"
|
||||
app:layout_constraintEnd_toStartOf="@+id/seekBar5Wrap"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/seekBar3Wrap"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:layout_editor_absoluteY="3dp">
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBar
|
||||
android:id="@+id/seekBar4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:thumb="@drawable/switch_thumb_material"
|
||||
app:seekBarRotation="CW270" />
|
||||
</com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/seekBar4Wrap"
|
||||
app:layout_constraintStart_toStartOf="@id/seekBar4Wrap"
|
||||
app:layout_constraintTop_toBottomOf="@id/seekBar4Wrap"
|
||||
tools:text="10000 Hz" />
|
||||
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper
|
||||
android:id="@+id/seekBar5Wrap"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/textView5"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/seekBar4Wrap"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:layout_editor_absoluteY="3dp">
|
||||
|
||||
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBar
|
||||
android:id="@+id/seekBar5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:thumb="@drawable/switch_thumb_material"
|
||||
app:seekBarRotation="CW270" />
|
||||
</com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/seekBar5Wrap"
|
||||
app:layout_constraintStart_toStartOf="@id/seekBar5Wrap"
|
||||
app:layout_constraintTop_toBottomOf="@id/seekBar5Wrap"
|
||||
tools:text="10000 Hz" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/equalizerContainer" />
|
||||
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/bassBoostText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="@string/bass_boost"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/divider"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSeekBar
|
||||
android:id="@+id/bassController"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:thumb="@drawable/switch_thumb_material"
|
||||
app:layout_constraintBottom_toBottomOf="@id/bassBoostText"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/bassBoostText"
|
||||
app:layout_constraintTop_toTopOf="@id/bassBoostText" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/controllerText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="@string/virtualizer"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/bassBoostText"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSeekBar
|
||||
android:id="@+id/reverbController"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:thumb="@drawable/switch_thumb_material"
|
||||
app:layout_constraintBottom_toBottomOf="@id/controllerText"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/controllerText"
|
||||
app:layout_constraintTop_toTopOf="@id/controllerText" />
|
||||
|
||||
<!--<code.name.monkey.retromusic.equalizer.AnalogController
|
||||
android:id="@+id/controllerBass"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/controller3D"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/equalizer_preset_spinner" />
|
||||
|
||||
|
||||
<code.name.monkey.retromusic.equalizer.AnalogController
|
||||
android:id="@+id/controller3D"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/controllerBass"
|
||||
app:layout_constraintTop_toBottomOf="@id/equalizer_preset_spinner" />-->
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/equalizerBlocker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.7"
|
||||
android:background="@android:color/transparent"
|
||||
android:clickable="true"
|
||||
android:visibility="invisible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
42
app/src/main/res/layout/retro_seekbar.xml
Normal file
42
app/src/main/res/layout/retro_seekbar.xml
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/hurtz"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="0dp"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintEnd_toStartOf="@id/guideline"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="10000 Hz" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSeekBar
|
||||
android:id="@+id/seekbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="3dp"
|
||||
android:progressDrawable="@drawable/color_progress_seek"
|
||||
android:splitTrack="false"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/guideline"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:progress="20" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_begin="72dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
28
app/src/main/res/layout/test.xml
Normal file
28
app/src/main/res/layout/test.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:liftOnScroll="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:layout_collapseMode="pin"
|
||||
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
|
||||
app:title="@string/equalizer"
|
||||
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/contentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -845,5 +845,6 @@
|
|||
<string name="pref_title_expand_now_playing_panel">Show now playing screen</string>
|
||||
<string name="pref_summary_expand_now_playing_panel">Clicking on the notification will show now playing screen instead of the home screen</string>
|
||||
<string name="custom">Custom</string>
|
||||
<string name="select_preset">Select preset</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue