Fixes color issue + cleanup

hh
Laurent 5 years ago
parent 57aed18350
commit 995c476467
  1. 46
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryActivity.kt
  2. 1
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerAnimator.kt
  3. 6
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/TableDrawer.kt
  4. 4
      app/src/main/java/net/pokeranalytics/android/util/video/MMediaMuxer.kt

@ -162,7 +162,7 @@ class HandHistoryActivity : BaseActivity() {
TableDrawer.configurePaints(this, animator) TableDrawer.configurePaints(this, animator)
val muxer = MMediaMuxer() val muxer = MMediaMuxer()
muxer.Init(this, width.toInt(), height.toInt(), "hhVideo", "YES!") muxer.Init(null, width.toInt(), height.toInt(), "hhVideo", "YES!")
animator.frames(this) { bitmap, count -> animator.frames(this) { bitmap, count ->
@ -179,50 +179,6 @@ class HandHistoryActivity : BaseActivity() {
val path = muxer.GetPath() val path = muxer.GetPath()
Timber.d("**** Video path = $path") Timber.d("**** Video path = $path")
// Timber.d("**** Start video test")
//
// val width = 480
// val height = 480
//
// val bitmap = Bitmap.createBitmap(480, 480, Bitmap.Config.ARGB_8888)
// val canvas = Canvas(bitmap)
//
// val paint = Paint()
// paint.isAntiAlias = true
// paint.style = Paint.Style.STROKE
// paint.strokeWidth = 20.0.toFloat()
// paint.color = requireContext().getColor(R.color.blue)
//
// canvas.drawRect(Rect(0,0, width, height), paint)
//
// bitmap.let {
//
// val muxer = MMediaMuxer()
//
// Timber.d("width = ${it.width}, height = ${it.height}")
//
// val width = (it.width / 2) * 2
// val height= (it.height / 2) * 2
//
// muxer.Init(requireActivity(), width, height, "hhVideo", "YES!")
//
// Timber.d("**** Adds frames")
// for (i in 0..50) {
//
// try {
// val byteArray = it.toByteArray()
// muxer.AddFrame(byteArray)
// } catch (e: Exception) {
// Timber.e("error = ${e.message}")
// }
// }
// Timber.d("**** Create video")
// muxer.CreateVideo()
//
// val path = muxer.GetPath()
// Timber.d("**** Video path = $path")
// }
} }
private fun gifExport() { private fun gifExport() {

@ -141,6 +141,7 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) {
init { init {
loadHandHistory(this.handHistory) loadHandHistory(this.handHistory)
TableDrawer.clearColors()
} }
private fun loadHandHistory(handHistory: HandHistory) { private fun loadHandHistory(handHistory: HandHistory) {

@ -30,9 +30,11 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) {
private val colorsByAmount = hashMapOf<Double, ChipColor>() private val colorsByAmount = hashMapOf<Double, ChipColor>()
fun configurePaints(context: Context, animator: ReplayerAnimator) { fun clearColors() {
this.colorsByAmount.clear() this.colorsByAmount.clear()
}
fun configurePaints(context: Context, animator: ReplayerAnimator) {
backgroundPaint.color = context.getColor(backgroundColor) backgroundPaint.color = context.getColor(backgroundColor)

@ -106,7 +106,7 @@ class MMediaMuxer {
} }
fun ShowProgressBar() { fun ShowProgressBar() {
_activity!!.runOnUiThread { _activity?.runOnUiThread {
pd = ProgressDialog(_activity) pd = ProgressDialog(_activity)
pd!!.setTitle(_title) pd!!.setTitle(_title)
pd!!.setCancelable(false) pd!!.setCancelable(false)
@ -117,7 +117,7 @@ class MMediaMuxer {
} }
fun HideProgressBar() { fun HideProgressBar() {
Thread(Runnable { _activity!!.runOnUiThread { pd!!.dismiss() } }).start() Thread(Runnable { _activity?.runOnUiThread { pd!!.dismiss() } }).start()
} }
private fun bufferEncoder() { private fun bufferEncoder() {

Loading…
Cancel
Save