Commit b29f0f10 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

preview of statusprogress view ceil

parent 123a4254
package com.biganto.visual.roompark.view_utils.status_progress_view
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.PointF
import android.util.AttributeSet
import android.view.View
/**
* Created by Vladislav Bogdashkin on 19.09.2019.
*/
class StatusProgressCeil @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
private var direction:StatusProgressDirection = StatusProgressDirection.HORIZONTAL
private val fillEnableColor:Int = Color.WHITE
private val fillDisableColor:Int = Color.CYAN
private val enablePaint:Paint = Paint()
get(){
field.style = Paint.Style.STROKE
field.strokeWidth = 3F
field.color = fillEnableColor
return field
}
private val disablePaint:Paint = Paint()
get(){
field.style = Paint.Style.STROKE
field.strokeWidth = 3F
field.color = fillEnableColor
return field
}
private val enableRadius:Float
get() { return when(direction){
StatusProgressDirection.HORIZONTAL -> height/2f
StatusProgressDirection.VERTICAL -> width/2f
}}
private val disableRadius:Float
get() { return when(direction){
StatusProgressDirection.HORIZONTAL -> height/2f
StatusProgressDirection.VERTICAL -> width/2f
}}
private var enableDisableCrossRadius:Int = 0
private val centerStatus:PointF
get() {
return when(direction){
StatusProgressDirection.HORIZONTAL ->
PointF(width/2f,height/2f)
StatusProgressDirection.VERTICAL ->
PointF(width/2f,height/2f)
}
}
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
canvas?.drawColor(Color.TRANSPARENT)
canvas?.drawCircle(centerStatus.x,centerStatus.y,enableRadius,enablePaint)
}
}
enum class StatusProgressDirection{
HORIZONTAL,
VERTICAL
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment