|
|
|
@ -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()
|
|
|
|
|