mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 12:35:33 -04:00
universal7885: FMRadio: Restore output selection too
This commit is contained in:
parent
e682783f6b
commit
201c4fa92a
1 changed files with 24 additions and 17 deletions
|
|
@ -119,6 +119,7 @@ class MainFragment :
|
||||||
mSeekBar.min = 1
|
mSeekBar.min = 1
|
||||||
mSeekBar.max = 15
|
mSeekBar.max = 15
|
||||||
mSeekBar.progress = mVolume
|
mSeekBar.progress = mVolume
|
||||||
|
updateOutputStatus(false)
|
||||||
if (!mFreqSearchDone) {
|
if (!mFreqSearchDone) {
|
||||||
val mRestoreFreq = mSharedPref.getInt("freq", mFMInterface.mDevCtl.getValue(GetType.GET_TYPE_FM_LOWER_LIMIT))
|
val mRestoreFreq = mSharedPref.getInt("freq", mFMInterface.mDevCtl.getValue(GetType.GET_TYPE_FM_LOWER_LIMIT))
|
||||||
mFMInterface.mDefaultCtl.setValue(SetType.SET_TYPE_FM_FREQ, mRestoreFreq)
|
mFMInterface.mDefaultCtl.setValue(SetType.SET_TYPE_FM_FREQ, mRestoreFreq)
|
||||||
|
|
@ -206,27 +207,33 @@ class MainFragment :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateOutputStatus(mInverted : Boolean) {
|
||||||
|
var mCurrent = mSharedPref.getBoolean("speaker", false)
|
||||||
|
if (mInverted) mCurrent = !mCurrent
|
||||||
|
if (mCurrent) {
|
||||||
|
mOutputSwitch.setImageIcon(
|
||||||
|
Icon.createWithResource(
|
||||||
|
requireContext(),
|
||||||
|
R.drawable.ic_volume_up
|
||||||
|
)
|
||||||
|
)
|
||||||
|
mFMInterface.mDevCtl.setValue(SetType.SET_TYPE_FM_SPEAKER_ROUTE, 1)
|
||||||
|
} else {
|
||||||
|
mOutputSwitch.setImageIcon(
|
||||||
|
Icon.createWithResource(
|
||||||
|
requireContext(),
|
||||||
|
R.drawable.ic_headphones
|
||||||
|
)
|
||||||
|
)
|
||||||
|
mFMInterface.mDevCtl.setValue(SetType.SET_TYPE_FM_SPEAKER_ROUTE, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onClick(v: View) {
|
override fun onClick(v: View) {
|
||||||
when (v.id) {
|
when (v.id) {
|
||||||
mOutputSwitch.id -> {
|
mOutputSwitch.id -> {
|
||||||
val mCurrent = mSharedPref.getBoolean("speaker", false)
|
val mCurrent = mSharedPref.getBoolean("speaker", false)
|
||||||
if (!mCurrent) {
|
updateOutputStatus(true)
|
||||||
mOutputSwitch.setImageIcon(
|
|
||||||
Icon.createWithResource(
|
|
||||||
requireContext(),
|
|
||||||
R.drawable.ic_volume_up
|
|
||||||
)
|
|
||||||
)
|
|
||||||
mFMInterface.mDevCtl.setValue(SetType.SET_TYPE_FM_SPEAKER_ROUTE, 1)
|
|
||||||
} else {
|
|
||||||
mOutputSwitch.setImageIcon(
|
|
||||||
Icon.createWithResource(
|
|
||||||
requireContext(),
|
|
||||||
R.drawable.ic_headphones
|
|
||||||
)
|
|
||||||
)
|
|
||||||
mFMInterface.mDevCtl.setValue(SetType.SET_TYPE_FM_SPEAKER_ROUTE, 0)
|
|
||||||
}
|
|
||||||
mSharedPref.edit().putBoolean("speaker", !mCurrent).apply()
|
mSharedPref.edit().putBoolean("speaker", !mCurrent).apply()
|
||||||
}
|
}
|
||||||
mVolumeUp.id -> {
|
mVolumeUp.id -> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue