@ -41,6 +41,7 @@ import org.isoron.uhabits.utils.InterfaceUtils.getFontAwesome
import org.isoron.uhabits.utils.InterfaceUtils.spToPixels
import org.isoron.uhabits.utils.InterfaceUtils.spToPixels
import org.isoron.uhabits.utils.PaletteUtils.getAndroidTestColor
import org.isoron.uhabits.utils.PaletteUtils.getAndroidTestColor
import org.isoron.uhabits.utils.StyledResources
import org.isoron.uhabits.utils.StyledResources
import kotlin.math.max
import kotlin.math.min
import kotlin.math.min
import kotlin.math.roundToLong
import kotlin.math.roundToLong
@ -48,7 +49,7 @@ class RingView : View {
private var color : Int
private var color : Int
private var precision : Float
private var precision : Float
private var percentage : Float
private var percentage : Float
private var diameter = 0
private var diameter = 1
private var thickness : Float
private var thickness : Float
private var rect : RectF ? = null
private var rect : RectF ? = null
private var pRing : TextPaint ? = null
private var pRing : TextPaint ? = null
@ -169,7 +170,7 @@ class RingView : View {
super . onMeasure ( widthMeasureSpec , heightMeasureSpec )
super . onMeasure ( widthMeasureSpec , heightMeasureSpec )
val width = MeasureSpec . getSize ( widthMeasureSpec )
val width = MeasureSpec . getSize ( widthMeasureSpec )
val height = MeasureSpec . getSize ( heightMeasureSpec )
val height = MeasureSpec . getSize ( heightMeasureSpec )
diameter = m in( height , width )
diameter = m ax( 1 , m in( height , width ) )
pRing !! . textSize = textSize
pRing !! . textSize = textSize
em = pRing !! . measureText ( " M " )
em = pRing !! . measureText ( " M " )
setMeasuredDimension ( diameter , diameter )
setMeasuredDimension ( diameter , diameter )