Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grayjay
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoStreaming
Grayjay
Commits
3d617187
Verified
Commit
3d617187
authored
1 month ago
by
Kai DeLorenzo
Browse files
Options
Downloads
Patches
Plain Diff
update rotation lock approach
Changelog: changed
parent
d040b93c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!83
Fix Rotation Lock Activity Resume Issue
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt
+34
-2
34 additions, 2 deletions
...mplayer/fragment/mainactivity/main/VideoDetailFragment.kt
with
34 additions
and
2 deletions
app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt
+
34
−
2
View file @
3d617187
...
...
@@ -11,12 +11,14 @@ import android.os.Handler
import
android.os.Looper
import
android.view.LayoutInflater
import
android.view.OrientationEventListener
import
android.view.Surface
import
android.view.View
import
android.view.ViewGroup
import
android.view.WindowInsets
import
android.view.WindowInsetsController
import
android.view.WindowManager
import
androidx.constraintlayout.motion.widget.MotionLayout
import
androidx.core.view.ViewCompat.getDisplay
import
androidx.core.view.WindowCompat
import
androidx.media3.common.util.UnstableApi
import
com.futo.platformplayer.R
...
...
@@ -37,7 +39,7 @@ import kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
import
kotlin.math.min
//region Fragment
@UnstableApi
...
...
@@ -205,7 +207,37 @@ class VideoDetailFragment() : MainFragment() {
}
else
if
(
rotationLock
)
{
_portraitOrientationListener
?.
disableListener
()
_landscapeOrientationListener
?.
disableListener
()
a
.
requestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_LOCKED
val
display
=
getDisplay
(
_viewDetail
!!
)
val
rotation
=
display
!!
.
rotation
val
orientation
=
resources
.
configuration
.
orientation
a
.
requestedOrientation
=
when
(
orientation
)
{
Configuration
.
ORIENTATION_PORTRAIT
->
{
if
(
rotation
==
Surface
.
ROTATION_0
||
rotation
==
Surface
.
ROTATION_180
)
{
if
(
rotation
==
Surface
.
ROTATION_0
)
{
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
}
else
{
ActivityInfo
.
SCREEN_ORIENTATION_REVERSE_PORTRAIT
}
}
else
{
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
}
}
Configuration
.
ORIENTATION_LANDSCAPE
->
{
if
(
rotation
==
Surface
.
ROTATION_90
||
rotation
==
Surface
.
ROTATION_270
)
{
if
(
rotation
==
Surface
.
ROTATION_90
)
{
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
}
else
{
ActivityInfo
.
SCREEN_ORIENTATION_REVERSE_LANDSCAPE
}
}
else
{
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
}
}
else
->
ActivityInfo
.
SCREEN_ORIENTATION_UNSPECIFIED
}
}
else
{
_portraitOrientationListener
?.
disableListener
()
_landscapeOrientationListener
?.
disableListener
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment