Skip to content

Commit

Permalink
Replace ceres with andromeda
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Jan 6, 2024
1 parent 59c414b commit 769cbdb
Show file tree
Hide file tree
Showing 107 changed files with 233 additions and 242 deletions.
13 changes: 3 additions & 10 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ dependencies {
implementation("com.google.android.flexbox:flexbox:3.0.0")

// Andromeda
val andromedaVersion = "c6ed873972"
val andromedaVersion = "81d7c0b694"
implementation("com.github.kylecorry31.andromeda:core:$andromedaVersion")
implementation("com.github.kylecorry31.andromeda:fragments:$andromedaVersion")
implementation("com.github.kylecorry31.andromeda:forms:$andromedaVersion")
Expand Down Expand Up @@ -164,18 +164,11 @@ dependencies {
implementation("com.github.kylecorry31.andromeda:exceptions:$andromedaVersion")
implementation("com.github.kylecorry31.andromeda:print:$andromedaVersion")
implementation("com.github.kylecorry31.andromeda:list:$andromedaVersion")

// Ceres
val ceresVersion = "ca2e86e350"
implementation("com.github.kylecorry31.ceres:list:$ceresVersion")
implementation("com.github.kylecorry31.ceres:toolbar:$ceresVersion")
implementation("com.github.kylecorry31.ceres:badge:$ceresVersion")
implementation("com.github.kylecorry31.ceres:chart:$ceresVersion")
implementation("com.github.kylecorry31.ceres:image:$ceresVersion")
implementation("com.github.kylecorry31.andromeda:views:$andromedaVersion")

// Misc
implementation("com.github.kylecorry31:subsampling-scale-image-view:3.11.9")
implementation("com.github.kylecorry31:sol:8.0.1")
implementation("com.github.kylecorry31:sol:9.1.1")
implementation("com.github.kylecorry31:luna:6a88851e2b")
// debugImplementation("com.squareup.leakcanary:leakcanary-android:2.12")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import android.graphics.Color
import androidx.annotation.DrawableRes
import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.andromeda.core.ui.Colors.withAlpha
import com.kylecorry.ceres.chart.Chart
import com.kylecorry.ceres.chart.data.AreaChartLayer
import com.kylecorry.ceres.chart.data.BitmapChartLayer
import com.kylecorry.ceres.chart.data.FullAreaChartLayer
import com.kylecorry.ceres.chart.data.HorizontalLineChartLayer
import com.kylecorry.ceres.chart.data.LineChartLayer
import com.kylecorry.ceres.chart.data.TextChartLayer
import com.kylecorry.andromeda.views.chart.Chart
import com.kylecorry.andromeda.views.chart.data.AreaChartLayer
import com.kylecorry.andromeda.views.chart.data.BitmapChartLayer
import com.kylecorry.andromeda.views.chart.data.FullAreaChartLayer
import com.kylecorry.andromeda.views.chart.data.HorizontalLineChartLayer
import com.kylecorry.andromeda.views.chart.data.LineChartLayer
import com.kylecorry.andromeda.views.chart.data.TextChartLayer
import com.kylecorry.sol.math.Vector2
import com.kylecorry.sol.units.Reading
import com.kylecorry.trail_sense.R
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.kylecorry.trail_sense.astronomy.ui.items

import com.kylecorry.ceres.list.ListItem
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.sol.units.Coordinate
import java.time.LocalDate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import com.google.android.flexbox.JustifyContent
import com.kylecorry.andromeda.core.math.DecimalFormatter
import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.andromeda.core.ui.Colors.withAlpha
import com.kylecorry.ceres.list.ListIcon
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ListItemData
import com.kylecorry.ceres.list.ListItemDataAlignment
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ListItemData
import com.kylecorry.andromeda.views.list.ListItemDataAlignment
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.sol.science.astronomy.RiseSetTransitTimes
import com.kylecorry.sol.units.Bearing
import com.kylecorry.trail_sense.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.kylecorry.trail_sense.astronomy.ui.items
import android.content.Context
import com.kylecorry.andromeda.core.coroutines.onDefault
import com.kylecorry.andromeda.core.math.DecimalFormatter
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.astronomy.ui.format.EclipseFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.kylecorry.trail_sense.astronomy.ui.items

import android.content.Context
import com.kylecorry.andromeda.core.coroutines.onDefault
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.readableName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.kylecorry.trail_sense.astronomy.ui.items

import android.content.Context
import com.kylecorry.andromeda.core.coroutines.onDefault
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.astronomy.ui.MoonPhaseImageMapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.kylecorry.trail_sense.astronomy.ui.items

import android.content.Context
import com.kylecorry.andromeda.core.coroutines.onDefault
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.astronomy.ui.format.EclipseFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.kylecorry.trail_sense.astronomy.ui.items

import android.content.Context
import com.kylecorry.andromeda.core.coroutines.onDefault
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.sol.science.astronomy.SunTimesMode
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.trail_sense.R
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.kylecorry.trail_sense.navigation.beacons.ui.list

import android.content.Context
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.ceres.list.ListMenuItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.andromeda.views.list.ListMenuItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.navigation.beacons.domain.BeaconGroup
import com.kylecorry.trail_sense.shared.colors.AppColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import com.kylecorry.andromeda.core.sensors.Quality
import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.andromeda.core.ui.Colors
import com.kylecorry.andromeda.sense.location.IGPS
import com.kylecorry.ceres.list.ListIcon
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.ceres.list.ListMenuItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.andromeda.views.list.ListMenuItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.sol.units.Distance
import com.kylecorry.sol.units.DistanceUnits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.kylecorry.trail_sense.navigation.beacons.ui.list

import android.content.Context
import com.kylecorry.andromeda.sense.location.IGPS
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.trail_sense.navigation.beacons.domain.Beacon
import com.kylecorry.trail_sense.navigation.beacons.domain.BeaconGroup
import com.kylecorry.trail_sense.navigation.beacons.domain.IBeacon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.kylecorry.trail_sense.navigation.paths.ui

import android.content.Context
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.trail_sense.navigation.paths.domain.IPath
import com.kylecorry.trail_sense.navigation.paths.domain.Path
import com.kylecorry.trail_sense.navigation.paths.domain.PathGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import android.graphics.Color
import androidx.annotation.ColorInt
import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.andromeda.core.tryOrNothing
import com.kylecorry.ceres.chart.Chart
import com.kylecorry.ceres.chart.data.AreaChartLayer
import com.kylecorry.ceres.chart.data.ChartLayer
import com.kylecorry.ceres.chart.data.LineChartLayer
import com.kylecorry.ceres.chart.data.ScatterChartLayer
import com.kylecorry.andromeda.views.chart.Chart
import com.kylecorry.andromeda.views.chart.data.AreaChartLayer
import com.kylecorry.andromeda.views.chart.data.ChartLayer
import com.kylecorry.andromeda.views.chart.data.LineChartLayer
import com.kylecorry.andromeda.views.chart.data.ScatterChartLayer
import com.kylecorry.sol.math.Vector2
import com.kylecorry.sol.units.Distance
import com.kylecorry.sol.units.DistanceUnits
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.kylecorry.trail_sense.navigation.paths.ui

import android.content.Context
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.ceres.list.ListMenuItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.andromeda.views.list.ListMenuItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.navigation.paths.domain.PathGroup
import com.kylecorry.trail_sense.shared.colors.AppColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.kylecorry.trail_sense.navigation.paths.ui
import android.content.Context
import androidx.core.text.bold
import androidx.core.text.buildSpannedString
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.ceres.list.ListMenuItem
import com.kylecorry.ceres.list.ResourceListIcon
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.andromeda.views.list.ListMenuItem
import com.kylecorry.andromeda.views.list.ResourceListIcon
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.navigation.paths.domain.LineStyle
import com.kylecorry.trail_sense.navigation.paths.domain.Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import com.kylecorry.andromeda.core.ui.Colors.withAlpha
import com.kylecorry.andromeda.fragments.BoundBottomSheetDialogFragment
import com.kylecorry.andromeda.fragments.inBackground
import com.kylecorry.andromeda.fragments.observe
import com.kylecorry.ceres.chart.Chart
import com.kylecorry.ceres.chart.data.AreaChartLayer
import com.kylecorry.andromeda.views.chart.Chart
import com.kylecorry.andromeda.views.chart.data.AreaChartLayer
import com.kylecorry.sol.units.Distance
import com.kylecorry.sol.units.DistanceUnits
import com.kylecorry.sol.units.Reading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context
import android.util.AttributeSet
import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import com.kylecorry.ceres.chart.Chart
import com.kylecorry.andromeda.views.chart.Chart
import com.kylecorry.sol.units.Pressure
import com.kylecorry.sol.units.Reading
import com.kylecorry.trail_sense.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import com.kylecorry.andromeda.core.ui.setState
import com.kylecorry.andromeda.fragments.AndromedaFragment
import com.kylecorry.andromeda.fragments.show
import com.kylecorry.andromeda.pickers.Pickers
import com.kylecorry.ceres.chart.Chart
import com.kylecorry.ceres.list.CeresListView
import com.kylecorry.ceres.list.ListItem
import com.kylecorry.andromeda.views.chart.Chart
import com.kylecorry.andromeda.views.list.AndromedaListView
import com.kylecorry.andromeda.views.list.ListItem
import com.kylecorry.sol.units.Distance
import com.kylecorry.sol.units.DistanceUnits
import com.kylecorry.trail_sense.R
Expand Down Expand Up @@ -416,7 +416,7 @@ object CustomUiUtils {
emptyText: String? = null
) {
val view = View.inflate(context, R.layout.view_list_dialog, null)
val list = view.findViewById<CeresListView>(R.id.list)
val list = view.findViewById<AndromedaListView>(R.id.list)
val empty = view.findViewById<TextView>(R.id.empty_text)

if (emptyText != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.kylecorry.trail_sense.shared.extensions

import com.kylecorry.andromeda.core.topics.generic.ITopic

fun <T> ITopic<T>.getOrNull(): T? {
fun <T: Any> ITopic<T>.getOrNull(): T? {
val current = value
return if (current.isPresent) {
current.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context
import android.view.View
import android.widget.FrameLayout
import com.kylecorry.andromeda.alerts.Alerts
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.grouping.Groupable
import com.kylecorry.trail_sense.shared.lists.GroupListManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.content.Context
import android.util.AttributeSet
import android.widget.LinearLayout
import androidx.core.view.isVisible
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.databinding.ViewGroupableSelectorBinding
import com.kylecorry.trail_sense.shared.grouping.Groupable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.kylecorry.trail_sense.shared.lists

import android.widget.TextView
import com.kylecorry.andromeda.core.tryOrLog
import com.kylecorry.ceres.list.CeresListView
import com.kylecorry.ceres.list.ListItemMapper
import com.kylecorry.andromeda.views.list.AndromedaListView
import com.kylecorry.andromeda.views.list.ListItemMapper
import com.kylecorry.trail_sense.shared.grouping.Groupable

fun <T : Groupable> GroupListManager<T>.bind(view: com.kylecorry.trail_sense.shared.views.SearchView) {
Expand All @@ -13,7 +13,7 @@ fun <T : Groupable> GroupListManager<T>.bind(view: com.kylecorry.trail_sense.sha
}

fun <T : Groupable> GroupListManager<T>.bind(
list: CeresListView,
list: AndromedaListView,
title: TextView,
mapper: ListItemMapper<T>,
titleProvider: (root: T?) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.widget.FrameLayout
import androidx.navigation.findNavController
import com.kylecorry.andromeda.alerts.Alerts
import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.ceres.badge.CeresBadge
import com.kylecorry.andromeda.views.badge.Badge
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.FormatService

Expand All @@ -16,7 +16,7 @@ class NorthReferenceBadge(
attrs: AttributeSet? = null
) : FrameLayout(context, attrs) {

private val badge = CeresBadge(context, attrs)
private val badge = Badge(context, attrs)
private val formatter = FormatService.getInstance(context)

var useTrueNorth: Boolean = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.kylecorry.trail_sense.shared.views.chart.label

import com.kylecorry.ceres.chart.label.ChartLabelFormatter
import com.kylecorry.andromeda.views.chart.label.ChartLabelFormatter
import com.kylecorry.sol.units.Distance
import com.kylecorry.sol.units.DistanceUnits
import com.kylecorry.trail_sense.shared.FormatService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.kylecorry.trail_sense.shared.views.chart.label

import android.content.Context
import com.kylecorry.ceres.chart.label.ChartLabelFormatter
import com.kylecorry.andromeda.views.chart.label.ChartLabelFormatter
import com.kylecorry.sol.time.Time
import com.kylecorry.sol.time.Time.toZonedDateTime
import com.kylecorry.trail_sense.shared.FormatService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.kylecorry.trail_sense.tools.battery.ui

import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.andromeda.core.ui.Colors.withAlpha
import com.kylecorry.ceres.chart.Chart
import com.kylecorry.ceres.chart.data.AreaChartLayer
import com.kylecorry.andromeda.views.chart.Chart
import com.kylecorry.andromeda.views.chart.data.AreaChartLayer
import com.kylecorry.sol.units.Reading
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.shared.CustomUiUtils.getPrimaryColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import android.view.View
import androidx.core.graphics.drawable.toBitmap
import androidx.core.math.MathUtils
import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.sol.science.physics.PhysicsService
import com.kylecorry.sol.science.optics.Optics
import com.kylecorry.sol.units.Distance
import com.kylecorry.sol.units.DistanceUnits
import com.kylecorry.trail_sense.R
Expand All @@ -30,7 +30,6 @@ class LightBarView : View {
private var gradient: List<Int> = listOf()
private var candela: Float = 0f
var units: DistanceUnits = DistanceUnits.Meters
private val lightService = PhysicsService()
private var imageSize = 0

constructor(context: Context?) : super(context)
Expand Down Expand Up @@ -78,7 +77,7 @@ class LightBarView : View {
private fun updateGradients(){
val intensities = (1..100).map {
val distance = if (units == DistanceUnits.Feet) it * 3 else it
lightService.luxAtDistance(candela, Distance(distance.toFloat(), units))
Optics.luxAtDistance(candela, Distance(distance.toFloat(), units))
}

// TODO: Calculate distance of each intensity description
Expand Down
Loading

0 comments on commit 769cbdb

Please sign in to comment.