[Android] Streams: Fix audio tabs showing
Geoffrey Métais
git at videolan.org
Fri Nov 22 08:52:00 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey at videolan.org> | Fri Nov 22 08:51:59 2019 +0100| [38c69b8013fa1ca856b2cc82cd7870ffb00afeee] | committer: Nicolas Pomepuy
Streams: Fix audio tabs showing
Fix #1088
> https://code.videolan.org/videolan/vlc-android/commit/38c69b8013fa1ca856b2cc82cd7870ffb00afeee
---
.../videolan/vlc/gui/network/MRLPanelFragment.kt | 25 ++++++++--------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
index e52e25d02..75743a210 100644
--- a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
@@ -50,6 +50,7 @@ import org.videolan.tools.copy
import org.videolan.tools.coroutineScope
import org.videolan.vlc.R
import org.videolan.vlc.databinding.MrlPanelBinding
+import org.videolan.vlc.gui.ContentActivity
import org.videolan.vlc.gui.MainActivity
import org.videolan.vlc.gui.dialogs.CtxActionReceiver
import org.videolan.vlc.gui.dialogs.SavePlaylistDialog
@@ -111,33 +112,26 @@ class MRLPanelFragment : Fragment(), View.OnKeyListener, TextView.OnEditorAction
binding.play.setOnClickListener(this)
- // dialog?.setTitle(R.string.open_mrl_dialog_title)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- viewModel.dataset.observe(this, Observer { adapter.setList(it as List<AbstractMediaWrapper>) })
- viewModel.loading.observe(this, Observer {
- (activity as? MainActivity)?.refreshing = it
- })
+ viewModel.dataset.observe(requireActivity(), Observer { adapter.setList(it as List<AbstractMediaWrapper>) })
+ viewModel.loading.observe(requireActivity(), Observer { (activity as? MainActivity)?.refreshing = it })
}
override fun onStart() {
super.onStart()
viewModel.refresh()
- val activity = activity as AppCompatActivity? ?: return
- if (activity.supportActionBar != null) {
- activity.supportActionBar!!.setTitle(R.string.open_mrl)
- }
+ (activity as? ContentActivity)?.setTabLayoutVisibility(false)
+ (activity as? AppCompatActivity)?.supportActionBar?.setTitle(R.string.open_mrl)
}
- override fun onKey(v: View, keyCode: Int, event: KeyEvent): Boolean {
- return (keyCode == EditorInfo.IME_ACTION_DONE ||
- keyCode == EditorInfo.IME_ACTION_GO ||
- event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER) && processUri()
- }
+ override fun onKey(v: View, keyCode: Int, event: KeyEvent) = (keyCode == EditorInfo.IME_ACTION_DONE ||
+ keyCode == EditorInfo.IME_ACTION_GO ||
+ event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER) && processUri()
private fun processUri(): Boolean {
if (!TextUtils.isEmpty(viewModel.observableSearchText.get())) {
@@ -201,8 +195,7 @@ class MRLPanelFragment : Fragment(), View.OnKeyListener, TextView.OnEditorAction
.show()
}
-
override fun refresh() {
- refresh()
+ viewModel.refresh()
}
}
More information about the Android
mailing list