parent
4fe79df786
commit
296b7942b0
@ -0,0 +1,35 @@ |
||||
package net.pokeranalytics.android.ui.view.handhistory |
||||
|
||||
import android.content.Context |
||||
import android.graphics.Canvas |
||||
import android.graphics.Paint |
||||
import android.graphics.RectF |
||||
import android.util.AttributeSet |
||||
import android.view.View |
||||
import net.pokeranalytics.android.R |
||||
|
||||
class Circle(context: Context, attrs: AttributeSet) : View(context, attrs) { |
||||
|
||||
companion object { |
||||
private val START_ANGLE_POINT = 270 |
||||
private val STROKE_WIDTH = 40 |
||||
} |
||||
|
||||
private val paint: Paint = Paint() |
||||
private lateinit var rect: RectF |
||||
|
||||
var angle: Float = 180.0f |
||||
|
||||
init { |
||||
paint.isAntiAlias = true |
||||
paint.style = Paint.Style.STROKE |
||||
paint.strokeWidth = STROKE_WIDTH.toFloat() |
||||
paint.color = getContext().getColor(R.color.chart_selected_bar) |
||||
} |
||||
|
||||
override fun onDraw(canvas: Canvas) { |
||||
super.onDraw(canvas) |
||||
canvas.drawArc(rect, START_ANGLE_POINT.toFloat(), angle, false, paint) |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,53 @@ |
||||
package net.pokeranalytics.android.ui.view.handhistory |
||||
|
||||
import android.content.Context |
||||
import android.util.AttributeSet |
||||
import android.view.LayoutInflater |
||||
import android.widget.FrameLayout |
||||
import net.pokeranalytics.android.R |
||||
import timber.log.Timber |
||||
|
||||
class VideoView : FrameLayout { |
||||
|
||||
/** |
||||
* Constructors |
||||
*/ |
||||
constructor(context: Context) : super(context) { |
||||
init() |
||||
} |
||||
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { |
||||
init() |
||||
} |
||||
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { |
||||
init() |
||||
} |
||||
|
||||
open fun getResourceLayout(): Int { |
||||
return R.layout.view_video |
||||
} |
||||
|
||||
private lateinit var frameLayout: FrameLayout |
||||
|
||||
/** |
||||
* Init |
||||
*/ |
||||
private fun init() { |
||||
|
||||
this.setBackgroundColor(context.getColor(R.color.blue)) |
||||
|
||||
val layoutInflater = LayoutInflater.from(context) |
||||
frameLayout = layoutInflater.inflate(getResourceLayout(), this, false) as FrameLayout |
||||
// val layoutParams = LayoutParams(480, 480) |
||||
|
||||
val width = frameLayout.layoutParams.width |
||||
val height = frameLayout.layoutParams.height |
||||
Timber.d("W = $width, H = $height") |
||||
|
||||
this.layoutParams = frameLayout.layoutParams |
||||
addView(frameLayout, frameLayout.layoutParams) |
||||
|
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,12 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<net.pokeranalytics.android.ui.view.handhistory.Circle |
||||
android:id="@+id/circle" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" /> |
||||
|
||||
</FrameLayout> |
||||
Loading…
Reference in new issue