forked from shihaam/thijooree
redsign wheel page (reorgnatize wheel)
This commit is contained in:
@@ -55,12 +55,12 @@ class CircularNavFragment : Fragment() {
|
|||||||
CircularWheelView.WheelItem(def.id, def.iconRes, ctx.getString(def.titleRes))
|
CircularWheelView.WheelItem(def.id, def.iconRes, ctx.getString(def.titleRes))
|
||||||
}
|
}
|
||||||
items = listOf(
|
items = listOf(
|
||||||
CircularWheelView.WheelItem(R.id.nav_dashboard, R.drawable.ic_nav_dashboard, ctx.getString(R.string.nav_dashboard)),
|
savedSlots[3], // 4 o'clock (strip slot 3)
|
||||||
savedSlots[0], // 2 o'clock
|
CircularWheelView.WheelItem(R.id.nav_dashboard, R.drawable.ic_nav_dashboard, ctx.getString(R.string.nav_dashboard)), // 6 o'clock
|
||||||
savedSlots[1], // 4 o'clock
|
CircularWheelView.WheelItem(R.id.nav_more, R.drawable.ic_nav_more, ctx.getString(R.string.nav_more)), // 8 o'clock
|
||||||
CircularWheelView.WheelItem(R.id.nav_more, R.drawable.ic_nav_more, ctx.getString(R.string.nav_more)),
|
savedSlots[0], // 10 o'clock (strip slot 0 — first in strip)
|
||||||
savedSlots[2], // 8 o'clock
|
savedSlots[1], // 12 o'clock (strip slot 1)
|
||||||
savedSlots[3], // 10 o'clock
|
savedSlots[2], // 2 o'clock (strip slot 2)
|
||||||
)
|
)
|
||||||
accentColor = colorPrimary
|
accentColor = colorPrimary
|
||||||
surfaceColor = colorSurface
|
surfaceColor = colorSurface
|
||||||
@@ -264,7 +264,7 @@ class CircularWheelView @JvmOverloads constructor(
|
|||||||
// Divider lines between segments
|
// Divider lines between segments
|
||||||
dividerPaint.color = (labelColor and 0x00FFFFFF) or (100 shl 24)
|
dividerPaint.color = (labelColor and 0x00FFFFFF) or (100 shl 24)
|
||||||
for (i in 0 until segCount) {
|
for (i in 0 until segCount) {
|
||||||
val rad = Math.toRadians((-90.0 + i * segDeg))
|
val rad = Math.toRadians((i * segDeg).toDouble())
|
||||||
val cos = cos(rad).toFloat()
|
val cos = cos(rad).toFloat()
|
||||||
val sin = sin(rad).toFloat()
|
val sin = sin(rad).toFloat()
|
||||||
canvas.drawLine(
|
canvas.drawLine(
|
||||||
@@ -276,7 +276,7 @@ class CircularWheelView @JvmOverloads constructor(
|
|||||||
|
|
||||||
// Segment content
|
// Segment content
|
||||||
for (i in 0 until segCount) {
|
for (i in 0 until segCount) {
|
||||||
val midDeg = -90f + i * segDeg + segDeg / 2f
|
val midDeg = i * segDeg + segDeg / 2f
|
||||||
drawSegment(canvas, i, midDeg)
|
drawSegment(canvas, i, midDeg)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ class CircularWheelView @JvmOverloads constructor(
|
|||||||
|
|
||||||
private fun segmentAt(x: Float, y: Float): Int {
|
private fun segmentAt(x: Float, y: Float): Int {
|
||||||
var a = angleAt(x, y) - wheelAngle
|
var a = angleAt(x, y) - wheelAngle
|
||||||
a = ((a + 90f) % 360f + 360f) % 360f
|
a = (a % 360f + 360f) % 360f
|
||||||
return (a / (360f / items.size)).toInt() % items.size
|
return (a / (360f / items.size)).toInt() % items.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user