From 0b968d02cd6d66660c0bbb7b30763e8a43e1e6c8 Mon Sep 17 00:00:00 2001
From: susonthapa <33973551+susonthapa@users.noreply.github.com>
Date: Wed, 23 Nov 2022 10:09:26 +0545
Subject: [PATCH 1/5] added back button in the exo player
---
.../jellyfin/mobile/player/ui/PlayerFragment.kt | 9 ++++++---
.../main/res/layout/exo_player_control_view.xml | 17 +++++++----------
app/src/main/res/values/styles.xml | 5 +++++
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt b/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
index 36aeeb743..f182f18bc 100644
--- a/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
+++ b/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
@@ -16,8 +16,8 @@ import android.view.ViewGroup
import android.view.WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE
import android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
import android.widget.ImageButton
-import android.widget.TextView
import androidx.annotation.RequiresApi
+import androidx.appcompat.widget.Toolbar
import androidx.core.view.ViewCompat
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
@@ -57,7 +57,8 @@ class PlayerFragment : Fragment() {
private var _playerControlsBinding: ExoPlayerControlViewBinding? = null
private val playerControlsBinding: ExoPlayerControlViewBinding get() = _playerControlsBinding!!
private val playerControlsView: View get() = playerControlsBinding.root
- private val titleTextView: TextView get() = playerControlsBinding.trackTitle
+
+ private val toolbar: Toolbar get() = playerControlsBinding.toolbar
private val fullscreenSwitcher: ImageButton get() = playerControlsBinding.fullscreenSwitcher
private var playerMenus: PlayerMenus? = null
@@ -110,7 +111,7 @@ class PlayerFragment : Fragment() {
}
// Update title and player menus
- titleTextView.text = jellyfinMediaSource.name
+ toolbar.title = jellyfinMediaSource.name
playerMenus?.onQueueItemChanged(queueItem)
}
@@ -129,11 +130,13 @@ class PlayerFragment : Fragment() {
null -> Unit // success
}
}
+
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
_playerBinding = FragmentPlayerBinding.inflate(layoutInflater)
_playerControlsBinding = ExoPlayerControlViewBinding.bind(playerBinding.root.findViewById(R.id.player_controls))
+ toolbar.setNavigationOnClickListener { parentFragmentManager.popBackStack() }
return playerBinding.root
}
diff --git a/app/src/main/res/layout/exo_player_control_view.xml b/app/src/main/res/layout/exo_player_control_view.xml
index c5bee0620..4fafeb9bc 100644
--- a/app/src/main/res/layout/exo_player_control_view.xml
+++ b/app/src/main/res/layout/exo_player_control_view.xml
@@ -7,20 +7,17 @@
android:layout_height="match_parent"
android:background="@color/playback_controls_background">
-
+ app:navigationIcon="?attr/homeAsUpIndicator"
+ tools:title="Star Wars: A New Hope" />
+
+
+
From 1e1cd4e6989d924ecc16b7ea85605964f0464357 Mon Sep 17 00:00:00 2001
From: susonthapa <33973551+susonthapa@users.noreply.github.com>
Date: Wed, 23 Nov 2022 10:18:09 +0545
Subject: [PATCH 2/5] fixed the margin on the left of the title
---
app/src/main/res/layout/exo_player_control_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/res/layout/exo_player_control_view.xml b/app/src/main/res/layout/exo_player_control_view.xml
index 4fafeb9bc..30814d62b 100644
--- a/app/src/main/res/layout/exo_player_control_view.xml
+++ b/app/src/main/res/layout/exo_player_control_view.xml
@@ -12,7 +12,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.App.BackButton"
- app:contentInsetStart="0dp"
+ app:contentInsetStartWithNavigation="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
From d26ef9700825d42285592e54cd2f4f1e983e5cff Mon Sep 17 00:00:00 2001
From: Maxr1998
Date: Fri, 25 Nov 2022 22:56:09 +0100
Subject: [PATCH 3/5] Fix whitespace issues
---
.../main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt | 2 --
app/src/main/res/values/styles.xml | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt b/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
index f182f18bc..55b316e63 100644
--- a/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
+++ b/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
@@ -57,7 +57,6 @@ class PlayerFragment : Fragment() {
private var _playerControlsBinding: ExoPlayerControlViewBinding? = null
private val playerControlsBinding: ExoPlayerControlViewBinding get() = _playerControlsBinding!!
private val playerControlsView: View get() = playerControlsBinding.root
-
private val toolbar: Toolbar get() = playerControlsBinding.toolbar
private val fullscreenSwitcher: ImageButton get() = playerControlsBinding.fullscreenSwitcher
private var playerMenus: PlayerMenus? = null
@@ -130,7 +129,6 @@ class PlayerFragment : Fragment() {
null -> Unit // success
}
}
-
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 75dc571ba..60316d327 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -13,7 +13,7 @@
-
+
From 5f0068ecf0482c8dff30f07b2e4ac1ebef779c41 Mon Sep 17 00:00:00 2001
From: Maxr1998
Date: Fri, 25 Nov 2022 23:07:52 +0100
Subject: [PATCH 4/5] Use resource reference for color
---
app/src/main/res/values/styles.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 60316d327..a709fc34e 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -15,6 +15,6 @@
From 2bb9f262e467b97dae818d5be351c643ae0aa70a Mon Sep 17 00:00:00 2001
From: Maxr1998
Date: Fri, 25 Nov 2022 23:10:25 +0100
Subject: [PATCH 5/5] Move toolbar button handling to onViewCreated
---
.../main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt b/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
index 55b316e63..33c47b3de 100644
--- a/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
+++ b/app/src/main/java/org/jellyfin/mobile/player/ui/PlayerFragment.kt
@@ -134,7 +134,6 @@ class PlayerFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
_playerBinding = FragmentPlayerBinding.inflate(layoutInflater)
_playerControlsBinding = ExoPlayerControlViewBinding.bind(playerBinding.root.findViewById(R.id.player_controls))
- toolbar.setNavigationOnClickListener { parentFragmentManager.popBackStack() }
return playerBinding.root
}
@@ -159,6 +158,9 @@ class PlayerFragment : Fragment() {
insets
}
+ // Handle toolbar back button
+ toolbar.setNavigationOnClickListener { parentFragmentManager.popBackStack() }
+
// Create playback menus
playerMenus = PlayerMenus(this, playerBinding, playerControlsBinding)