From a6f3a4b6b47d1a2a161d47dc9107beb0b91fce43 Mon Sep 17 00:00:00 2001 From: ivan agosto Date: Sat, 16 Feb 2019 00:33:54 -0600 Subject: [PATCH 01/10] Commentaries with html parsed --- .../org/libre/agosto/p2play/adapters/CommentariesAdapter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/libre/agosto/p2play/adapters/CommentariesAdapter.kt b/app/src/main/java/org/libre/agosto/p2play/adapters/CommentariesAdapter.kt index 77a93df..e02e325 100644 --- a/app/src/main/java/org/libre/agosto/p2play/adapters/CommentariesAdapter.kt +++ b/app/src/main/java/org/libre/agosto/p2play/adapters/CommentariesAdapter.kt @@ -6,6 +6,7 @@ import android.content.Intent import android.graphics.drawable.Drawable import android.os.AsyncTask import android.support.v7.widget.RecyclerView +import android.text.Html import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -65,7 +66,7 @@ class CommentariesAdapter(private val myDataset: ArrayList) : if(myDataset[position].userImageUrl!="") Picasso.get().load("https://"+ManagerSingleton.url+myDataset[position].userImageUrl).into(holder.userImg); - holder.commentary.text = myDataset[position].commentary + holder.commentary.text = Html.fromHtml(myDataset[position].commentary) } From 2abdcb8375dba79edc2b23d97cb1cd9a2d6ac28d Mon Sep 17 00:00:00 2001 From: ivan agosto Date: Sun, 17 Feb 2019 14:29:33 -0600 Subject: [PATCH 02/10] Full screen bugs fixed --- app/src/main/AndroidManifest.xml | 1 + .../agosto/p2play/ReproductorActivity.kt | 50 +++++++++++++++---- .../main/res/layout/activity_reproductor.xml | 11 ++++ app/src/main/res/values/styles.xml | 6 +++ 4 files changed, 58 insertions(+), 10 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dd6f1cb..461580c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -28,6 +28,7 @@ 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 365168c..ede7f5e 100644 --- a/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt +++ b/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt @@ -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() diff --git a/app/src/main/res/layout/activity_reproductor.xml b/app/src/main/res/layout/activity_reproductor.xml index bed671b..9c9f7e9 100644 --- a/app/src/main/res/layout/activity_reproductor.xml +++ b/app/src/main/res/layout/activity_reproductor.xml @@ -6,7 +6,18 @@ android:layout_height="match_parent" tools:context=".ReproductorActivity"> + + true + +