chore: cleanup pt 3
This commit is contained in:
parent
ea48809d07
commit
0a0da65f7c
26 changed files with 99 additions and 243 deletions
|
@ -2,7 +2,7 @@ package ani.dantotsu.profile
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.TypedValue
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.util.ColorEditor
|
||||
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartModel
|
||||
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartStackingType
|
||||
|
@ -53,13 +53,7 @@ class ChartBuilder {
|
|||
scrollPos: Float? = null,
|
||||
normalize: Boolean = false
|
||||
): AAOptions {
|
||||
val typedValue = TypedValue()
|
||||
context.theme.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorPrimary,
|
||||
typedValue,
|
||||
true
|
||||
)
|
||||
val primaryColor = typedValue.data
|
||||
val primaryColor = context.getThemeColor(com.google.android.material.R.attr.colorPrimary)
|
||||
var chartType = passedChartType
|
||||
var aaChartType = passedAaChartType
|
||||
var categories = passedCategories
|
||||
|
@ -309,31 +303,21 @@ class ChartBuilder {
|
|||
}
|
||||
|
||||
private fun setColors(aaOptions: AAOptions, context: Context) {
|
||||
val backgroundColor = TypedValue()
|
||||
context.theme.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorSurfaceVariant,
|
||||
backgroundColor,
|
||||
true
|
||||
)
|
||||
val backgroundColor = context.getThemeColor(com.google.android.material.R.attr.colorSurfaceVariant)
|
||||
val backgroundStyle = AAStyle().color(
|
||||
AAColor.rgbaColor(
|
||||
Color.red(backgroundColor.data),
|
||||
Color.green(backgroundColor.data),
|
||||
Color.blue(backgroundColor.data),
|
||||
Color.red(backgroundColor),
|
||||
Color.green(backgroundColor),
|
||||
Color.blue(backgroundColor),
|
||||
1f
|
||||
)
|
||||
)
|
||||
val colorOnBackground = TypedValue()
|
||||
context.theme.resolveAttribute(
|
||||
com.google.android.material.R.attr.colorOnSurface,
|
||||
colorOnBackground,
|
||||
true
|
||||
)
|
||||
val colorOnBackground = context.getThemeColor(com.google.android.material.R.attr.colorOnSurface)
|
||||
val onBackgroundStyle = AAStyle().color(
|
||||
AAColor.rgbaColor(
|
||||
Color.red(colorOnBackground.data),
|
||||
Color.green(colorOnBackground.data),
|
||||
Color.blue(colorOnBackground.data),
|
||||
Color.red(colorOnBackground),
|
||||
Color.green(colorOnBackground),
|
||||
Color.blue(colorOnBackground),
|
||||
1.0f
|
||||
)
|
||||
)
|
||||
|
@ -342,9 +326,9 @@ class ChartBuilder {
|
|||
aaOptions.chart?.backgroundColor(backgroundStyle.color)
|
||||
aaOptions.tooltip?.backgroundColor(
|
||||
AAColor.rgbaColor(
|
||||
Color.red(backgroundColor.data),
|
||||
Color.green(backgroundColor.data),
|
||||
Color.blue(backgroundColor.data),
|
||||
Color.red(backgroundColor),
|
||||
Color.green(backgroundColor),
|
||||
Color.blue(backgroundColor),
|
||||
1.0f
|
||||
)
|
||||
)
|
||||
|
|
|
@ -2,9 +2,9 @@ package ani.dantotsu.profile
|
|||
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import ani.dantotsu.databinding.ActivitySingleStatBinding
|
||||
import ani.dantotsu.getThemeColor
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.toast
|
||||
|
@ -20,9 +20,7 @@ class SingleStatActivity : AppCompatActivity() {
|
|||
setContentView(binding.root)
|
||||
val chartOptions = chartOptions
|
||||
if (chartOptions != null) {
|
||||
val typedvalue = TypedValue()
|
||||
theme.resolveAttribute(android.R.attr.windowBackground, typedvalue, true)
|
||||
chartOptions.chart?.backgroundColor = typedvalue.data
|
||||
chartOptions.chart?.backgroundColor = getThemeColor(android.R.attr.windowBackground)
|
||||
binding.chartView.aa_drawChartWithChartOptions(chartOptions)
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue