Full screen bugs fixed

This commit is contained in:
ivan agosto 2019-02-17 14:29:33 -06:00
parent a6f3a4b6b4
commit 2abdcb8375
4 changed files with 58 additions and 10 deletions

View File

@ -28,6 +28,7 @@
<activity
android:name=".ReproductorActivity"
android:hardwareAccelerated="true"
android:theme="@style/P2playTheme.noBar"
android:configChanges="orientation|screenSize"/>
<activity android:name=".LoginActivity" />
<activity android:name=".RegisterActivity" />

View File

@ -1,6 +1,8 @@
package org.libre.agosto.p2play
import android.annotation.SuppressLint
import android.app.Activity
import android.content.pm.ActivityInfo
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.AsyncTask
@ -12,6 +14,7 @@ import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.util.Log
import android.view.View
import android.view.WindowManager
import android.webkit.WebChromeClient
import android.widget.FrameLayout
import com.squareup.picasso.Picasso
@ -22,6 +25,10 @@ import org.libre.agosto.p2play.ajax.Comments
import org.libre.agosto.p2play.models.CommentaryModel
import org.libre.agosto.p2play.models.VideoModel
class ReproductorActivity : AppCompatActivity() {
lateinit var video:VideoModel
private val _actions: Actions = Actions()
@ -32,6 +39,7 @@ class ReproductorActivity : AppCompatActivity() {
private lateinit var viewAdapter: RecyclerView.Adapter<*>
private lateinit var viewManager: RecyclerView.LayoutManager
@SuppressLint("SetJavaScriptEnabled", "SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_reproductor)
@ -48,10 +56,10 @@ class ReproductorActivity : AppCompatActivity() {
try {
this.video = this.intent.extras.getSerializable("video") as VideoModel
tittleVideoTxt.text = this.video.name
viewsTxt.text = this.video.views.toString() + ' ' + getString(R.string.view_text)
viewsTxt.text = "${this.video.views} ${getString(R.string.view_text)}"
userTxt.text = this.video.username
descriptionVideoTxt.text = this.video.description.toString()
hostTxt.text = this.video.userHost.toString()
descriptionVideoTxt.text = this.video.description
hostTxt.text = this.video.userHost
// Check if user had profile image
if(this.video.userImageUrl!="")
@ -63,7 +71,6 @@ class ReproductorActivity : AppCompatActivity() {
}
catch (err:Exception){
err.printStackTrace()
Log.d("Error", err?.message)
}
viewManager = LinearLayoutManager(this)
@ -250,12 +257,22 @@ class ReproductorActivity : AppCompatActivity() {
override fun onHideCustomView() {
try {
(this@ReproductorActivity.window.decorView as FrameLayout).removeView(this.mCustomView)
this@ReproductorActivity.nonFullScreen.visibility = View.VISIBLE
this@ReproductorActivity.fullScreen.visibility = View.GONE
this@ReproductorActivity.fullScreen.removeView(this.mCustomView)
this.mCustomView = null
this@ReproductorActivity.window.decorView.systemUiVisibility = this.mOriginalSystemUiVisibility
this@ReproductorActivity.requestedOrientation = this.mOriginalOrientation
this.mCustomViewCallback?.onCustomViewHidden()
this.mCustomViewCallback!!.onCustomViewHidden()
this.mCustomViewCallback = null
this@ReproductorActivity.requestedOrientation = this.mOriginalOrientation
// this@ReproductorActivity.window.decorView.systemUiVisibility = this.mOriginalSystemUiVisibility
val attrs = this@ReproductorActivity.window.attributes
attrs.flags = attrs.flags and WindowManager.LayoutParams.FLAG_FULLSCREEN.inv()
attrs.flags = attrs.flags and WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON.inv()
window.attributes = attrs
this@ReproductorActivity.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE
}
catch (err: Exception){
err.printStackTrace()
@ -272,8 +289,21 @@ class ReproductorActivity : AppCompatActivity() {
this.mOriginalSystemUiVisibility = this@ReproductorActivity.window.decorView.systemUiVisibility
this.mOriginalOrientation = this@ReproductorActivity.requestedOrientation
this.mCustomViewCallback = paramCustomViewCallback
(this@ReproductorActivity.window.decorView as FrameLayout).addView(this.mCustomView, FrameLayout.LayoutParams(-1, -1))
this@ReproductorActivity.window.decorView.systemUiVisibility = 3846
val match_parent = WindowManager.LayoutParams.MATCH_PARENT
this@ReproductorActivity.nonFullScreen.visibility = View.GONE
this@ReproductorActivity.fullScreen.visibility = View.VISIBLE
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
this@ReproductorActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
}
catch (err: Exception){
err.printStackTrace()

View File

@ -6,7 +6,18 @@
android:layout_height="match_parent"
tools:context=".ReproductorActivity">
<RelativeLayout
android:id="@+id/fullScreen"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:visibility="gone" />
<ScrollView
android:id="@+id/nonFullScreen"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"

View File

@ -13,6 +13,12 @@
<item name="windowNoTitle">true</item>
</style>
<style name="P2playTheme.noBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorHeader</item>
<item name="colorPrimaryDark">@android:color/darker_gray</item>
<item name="colorAccent">@android:color/holo_orange_dark</item>
</style>
<style name="P2playTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.ActionBar" />
<style name="P2playTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />