[Android] Streams: Fix audio tabs showing
Geoffrey Métais
git at videolan.org
Fri Nov 22 09:03:38 CET 2019
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey at videolan.org> | Fri Nov 22 08:51:59 2019 +0100| [490951638d36cda1aa8490c42c856490f84176b7] | committer: Nicolas Pomepuy
Streams: Fix audio tabs showing
Fix #1088
(cherry picked from commit 38c69b8013fa1ca856b2cc82cd7870ffb00afeee)
> https://code.videolan.org/videolan/vlc-android/commit/490951638d36cda1aa8490c42c856490f84176b7
---
.../videolan/vlc/gui/network/MRLPanelFragment.kt | 26 ++++++++--------------
1 file changed, 9 insertions(+), 17 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 771ce5f83..042690c47 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,25 @@ 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 +194,7 @@ class MRLPanelFragment : Fragment(), View.OnKeyListener, TextView.OnEditorAction
.show()
}
-
override fun refresh() {
- refresh()
+ viewModel.refresh()
}
}
More information about the Android
mailing list