fullscreen button dyncamic image

This commit is contained in:
Bnyro 2022-06-24 15:16:14 +02:00
parent 108a1d90b0
commit fddb3897cb
6 changed files with 47 additions and 5 deletions

View File

@ -182,6 +182,7 @@ class PlayerFragment : Fragment() {
val mainMotionLayout = val mainMotionLayout =
mainActivity.findViewById<MotionLayout>(R.id.mainMotionLayout) mainActivity.findViewById<MotionLayout>(R.id.mainMotionLayout)
mainMotionLayout.progress = abs(progress) mainMotionLayout.progress = abs(progress)
exoPlayerView.hideController()
eId = endId eId = endId
sId = startId sId = startId
} }
@ -192,13 +193,11 @@ class PlayerFragment : Fragment() {
val mainMotionLayout = val mainMotionLayout =
mainActivity.findViewById<MotionLayout>(R.id.mainMotionLayout) mainActivity.findViewById<MotionLayout>(R.id.mainMotionLayout)
if (currentId == eId) { if (currentId == eId) {
exoPlayerView.hideController()
exoPlayerView.useController = false exoPlayerView.useController = false
mainMotionLayout.progress = 1.toFloat() mainMotionLayout.progress = 1F
} else if (currentId == sId) { } else if (currentId == sId) {
exoPlayerView.showController()
exoPlayerView.useController = true exoPlayerView.useController = true
mainMotionLayout.progress = 0.toFloat() mainMotionLayout.progress = 0F
} }
} }
@ -269,6 +268,7 @@ class PlayerFragment : Fragment() {
} }
view.findViewById<ConstraintLayout>(R.id.main_container).isClickable = true view.findViewById<ConstraintLayout>(R.id.main_container).isClickable = true
view.findViewById<LinearLayout>(R.id.linLayout).visibility = View.GONE view.findViewById<LinearLayout>(R.id.linLayout).visibility = View.GONE
fullScreenButton.setImageResource(R.drawable.ic_fullscreen_exit)
val mainActivity = activity as MainActivity val mainActivity = activity as MainActivity
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
isFullScreen = true isFullScreen = true
@ -279,6 +279,7 @@ class PlayerFragment : Fragment() {
} }
view.findViewById<ConstraintLayout>(R.id.main_container).isClickable = false view.findViewById<ConstraintLayout>(R.id.main_container).isClickable = false
view.findViewById<LinearLayout>(R.id.linLayout).visibility = View.VISIBLE view.findViewById<LinearLayout>(R.id.linLayout).visibility = View.VISIBLE
fullScreenButton.setImageResource(R.drawable.ic_fullscreen)
val mainActivity = activity as MainActivity val mainActivity = activity as MainActivity
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
isFullScreen = false isFullScreen = false

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="@android:color/white"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M7,14L5,14v5h5v-2L7,17v-3zM5,10h2L7,7h3L10,5L5,5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2L19,5h-5z" />
</vector>

View File

@ -0,0 +1,10 @@
<vector android:height="24dp"
android:tint="@android:color/white"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/white"
android:pathData="M5,16h3v3h2v-5L5,14v2zM8,8L5,8v2h5L10,5L8,5v3zM14,19h2v-3h3v-2h-5v5zM16,8L16,5h-2v5h5L19,8h-3z" />
</vector>

View File

@ -0,0 +1,10 @@
<vector android:height="24dp"
android:tint="@android:color/white"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/white"
android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z" />
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="@android:color/holo_green_dark"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z" />
</vector>

View File

@ -150,7 +150,8 @@
<ImageButton <ImageButton
android:id="@+id/fullscreen" android:id="@+id/fullscreen"
style="@style/ExoStyledControls.Button.Bottom.FullScreen" /> style="@style/ExoStyledControls.Button.Bottom.FullScreen"
android:src="@drawable/ic_fullscreen"/>
</LinearLayout> </LinearLayout>