[Android] Improve the action bar update condition
Nicolas Pomepuy
git at videolan.org
Thu Feb 16 10:33:58 UTC 2023
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Feb 14 11:28:15 2023 +0100| [fa0309167b6165d6145b589c7bcffb3e2f4af5fb] | committer: Duncan McNamara
Improve the action bar update condition
> https://code.videolan.org/videolan/vlc-android/commit/fa0309167b6165d6145b589c7bcffb3e2f4af5fb
---
application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt | 4 +---
application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt | 3 +--
.../vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt | 1 -
3 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
index e5b41dcc5f..c0ae724283 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
@@ -40,8 +40,6 @@ abstract class BaseFragment : Fragment(), ActionMode.Callback {
false
}
open val hasTabs = false
- open val isChild = false
-
private var refreshJob : Job? = null
set(value) {
field?.cancel()
@@ -112,7 +110,7 @@ abstract class BaseFragment : Fragment(), ActionMode.Callback {
}
private fun updateActionBar() {
- if (isChild) return
+ if (parentFragment != null) return
val activity = activity as? AppCompatActivity ?: return
activity.supportActionBar?.let {
if (requireActivity() !is ContentActivity || (requireActivity() as ContentActivity).displayTitle) requireActivity().title = getTitle()
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
index c9d4682f2b..6e4ebfb08e 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/PlaylistFragment.kt
@@ -68,7 +68,6 @@ class PlaylistFragment : BaseAudioBrowser<PlaylistsViewModel>(), SwipeRefreshLay
private lateinit var playlists: RecyclerView
private lateinit var playlistAdapter: AudioBrowserAdapter
private lateinit var fastScroller: FastScroller
- override val isChild = true
override val isMainNavigationPoint = false
override fun onCreate(savedInstanceState: Bundle?) {
@@ -258,7 +257,7 @@ class PlaylistFragment : BaseAudioBrowser<PlaylistsViewModel>(), SwipeRefreshLay
private const val PLAYLIST_TYPE = "PLAYLIST_TYPE"
fun newInstance(type: Playlist.Type) = PlaylistFragment().apply {
arguments = Bundle().apply {
- putInt("PLAYLIST_TYPE", type.ordinal)
+ putInt(PLAYLIST_TYPE, type.ordinal)
}
}
}
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
index f8a3266ee9..853a39a67b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
@@ -83,7 +83,6 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
private lateinit var binding: VideoGridBinding
private var gridItemDecoration: RecyclerView.ItemDecoration? = null
private lateinit var settings: SharedPreferences
- override val isChild = true
//in case of fragment being hosted by other fragments, it's useful to prevent the
//FAB visibility to be locked hidden
override val isMainNavigationPoint = false
More information about the Android
mailing list