的
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,23 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
kotlin("android")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
apply(from = rootProject.file("gradle/configure-android.gradle"))
|
||||
apply(from = rootProject.file("gradle/configure-compose.gradle"))
|
||||
apply(from = rootProject.file("gradle/jitpack-publish.gradle"))
|
||||
|
||||
dependencies {
|
||||
implementation(Kotlin.stdLib)
|
||||
|
||||
implementation(Compose.animation)
|
||||
implementation(Compose.core)
|
||||
implementation(Compose.layout)
|
||||
implementation(Compose.foundation)
|
||||
implementation(Compose.runtime)
|
||||
debugImplementation(Compose.tooling)
|
||||
}
|
||||
android {
|
||||
namespace = "com.github.tehras.charts.common"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest />
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.github.tehras.charts.piechart
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Paint
|
||||
import androidx.compose.ui.graphics.PaintingStyle
|
||||
import androidx.compose.ui.unit.Density
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
data class AxisLine(
|
||||
val thickness: Dp = 1.5.dp,
|
||||
val color: Color = Color.Gray
|
||||
) {
|
||||
private val paint = Paint().apply {
|
||||
this.color = this@AxisLine.color
|
||||
this.style = PaintingStyle.Stroke
|
||||
}
|
||||
|
||||
fun paint(density: Density) = paint.apply {
|
||||
this.strokeWidth = thickness.value * density.density
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.github.tehras.charts.piechart.animation
|
||||
|
||||
import androidx.compose.animation.core.TweenSpec
|
||||
|
||||
fun simpleChartAnimation() = TweenSpec<Float>(durationMillis = 500)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.github.tehras.charts.piechart.utils
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
fun Color.toLegacyInt(): Int {
|
||||
return android.graphics.Color.argb(
|
||||
(alpha * 255.0f + 0.5f).toInt(),
|
||||
(red * 255.0f + 0.5f).toInt(),
|
||||
(green * 255.0f + 0.5f).toInt(),
|
||||
(blue * 255.0f + 0.5f).toInt()
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user