mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 11:55:31 -04:00
universal7885: FMRadio: Fix crash and freq mismatch
- For ChannelListFragment, check if the fragment is added to an Activity and run requireactivity() - For MainFragment, re-fetch the freq every time that fragment is drawn
This commit is contained in:
parent
51e39482e0
commit
13e6667cfd
2 changed files with 10 additions and 5 deletions
|
|
@ -62,12 +62,14 @@ class ChannelListFragment :
|
|||
object : IWaitUntil {
|
||||
override fun cond(): Boolean = mNativeIF.mDefaultCtl.getValue(GetType.GET_TYPE_FM_MUTEX_LOCKED) == 0
|
||||
override fun todo() {
|
||||
(requireActivity() as MainActivity).getMySupportFragmentManager().apply {
|
||||
beginTransaction().remove(this@ChannelListFragment).commit()
|
||||
executePendingTransactions()
|
||||
beginTransaction().add(R.id.container_view, this@ChannelListFragment).commit()
|
||||
if (isAdded()) {
|
||||
(requireActivity() as MainActivity).getMySupportFragmentManager().apply {
|
||||
beginTransaction().remove(this@ChannelListFragment).commit()
|
||||
executePendingTransactions()
|
||||
beginTransaction().add(R.id.container_view, this@ChannelListFragment).commit()
|
||||
}
|
||||
requireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE)
|
||||
}
|
||||
requireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -142,6 +142,9 @@ class MainFragment :
|
|||
}
|
||||
)
|
||||
mFreqSearchDone = true
|
||||
} else {
|
||||
val mNewFreq = mFMInterface.mDefaultCtl.getValue(GetType.GET_TYPE_FM_FREQ)
|
||||
mFMFreq.text = mCleanFormat.format(mNewFreq.toFloat() / 1000)
|
||||
}
|
||||
// Update track list and fav button
|
||||
return mRootView
|
||||
|
|
|
|||
Loading…
Reference in a new issue