diff --git a/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt b/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt index 5eb9591..b0934ff 100644 --- a/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt +++ b/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt @@ -26,6 +26,7 @@ import org.libre.agosto.p2play.adapters.CommentariesAdapter import org.libre.agosto.p2play.ajax.Actions import org.libre.agosto.p2play.ajax.Comments import org.libre.agosto.p2play.ajax.Videos +import org.libre.agosto.p2play.helpers.setFullscreen import org.libre.agosto.p2play.models.CommentaryModel import org.libre.agosto.p2play.models.VideoModel @@ -388,12 +389,7 @@ class ReproductorActivity : AppCompatActivity() { this@ReproductorActivity.fullScreen.addView(paramView, FrameLayout.LayoutParams(match_parent, match_parent)) - - val attrs = this@ReproductorActivity.window.attributes - attrs.flags = attrs.flags or WindowManager.LayoutParams.FLAG_FULLSCREEN - attrs.flags = attrs.flags or WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON - window.attributes = attrs - this@ReproductorActivity.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE + setFullscreen(this@ReproductorActivity.window) this@ReproductorActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE } diff --git a/app/src/main/java/org/libre/agosto/p2play/helpers/setFullscreen.kt b/app/src/main/java/org/libre/agosto/p2play/helpers/setFullscreen.kt new file mode 100644 index 0000000..1b3922c --- /dev/null +++ b/app/src/main/java/org/libre/agosto/p2play/helpers/setFullscreen.kt @@ -0,0 +1,13 @@ +package org.libre.agosto.p2play.helpers + +import android.view.View +import android.view.Window +import android.view.WindowManager + +fun setFullscreen (window: Window) { + val attrs = window.attributes + attrs.flags = attrs.flags or WindowManager.LayoutParams.FLAG_FULLSCREEN + attrs.flags = attrs.flags or WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON + window.attributes = attrs + window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION +} \ No newline at end of file