Skip to content

Commit

Permalink
Update Andromeda
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Jan 7, 2022
1 parent 69ccf46 commit f8c9969
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 99 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ dependencies {
implementation("com.github.kylecorry31:sol:5.6.0")

// Andromeda
val andromedaVersion = "2.7.0-beta01"
val andromedaVersion = "2.7.0"
implementation("com.github.kylecorry31.andromeda:core:$andromedaVersion")
implementation("com.github.kylecorry31.andromeda:fragments:$andromedaVersion")
implementation("com.github.kylecorry31.andromeda:forms:$andromedaVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.google.android.material.bottomnavigation.BottomNavigationView
import com.kylecorry.andromeda.alerts.Alerts
import com.kylecorry.andromeda.alerts.dialog
import com.kylecorry.andromeda.core.system.Exceptions
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.core.system.Package
import com.kylecorry.andromeda.core.system.Screen
import com.kylecorry.andromeda.core.tryOrNothing
Expand All @@ -36,7 +37,6 @@ import com.kylecorry.trail_sense.shared.CustomUiUtils
import com.kylecorry.trail_sense.shared.ExceptionUtils
import com.kylecorry.trail_sense.shared.UserPreferences
import com.kylecorry.trail_sense.shared.sensors.SensorService
import com.kylecorry.trail_sense.shared.uri.GeoUri
import com.kylecorry.trail_sense.shared.views.ErrorBannerView
import com.kylecorry.trail_sense.tools.clinometer.ui.ClinometerFragment
import com.kylecorry.trail_sense.tools.flashlight.ui.FragmentToolFlashlight
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.kylecorry.trail_sense.navigation.beacons.infrastructure.share

import android.net.Uri
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.trail_sense.navigation.beacons.domain.Beacon
import com.kylecorry.trail_sense.shared.colors.AppColor
import com.kylecorry.trail_sense.shared.uri.GeoUri
import com.kylecorry.trail_sense.shared.from
import com.kylecorry.trail_sense.shared.uri.IUriEncoder

class BeaconUriEncoder : IUriEncoder<Beacon> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.navigation.fragment.findNavController
import com.kylecorry.andromeda.alerts.Alerts
import com.kylecorry.andromeda.camera.Camera
import com.kylecorry.andromeda.core.filterIndices
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.core.time.Timer
import com.kylecorry.andromeda.fragments.BoundFragment
import com.kylecorry.andromeda.gpx.GPXData
Expand All @@ -31,13 +32,9 @@ import com.kylecorry.trail_sense.navigation.beacons.infrastructure.export.Beacon
import com.kylecorry.trail_sense.navigation.beacons.infrastructure.export.BeaconGpxImporter
import com.kylecorry.trail_sense.navigation.beacons.infrastructure.persistence.BeaconGroupEntity
import com.kylecorry.trail_sense.navigation.beacons.infrastructure.persistence.BeaconRepo
import com.kylecorry.trail_sense.shared.CustomUiUtils
import com.kylecorry.trail_sense.shared.FormatService
import com.kylecorry.trail_sense.shared.UserPreferences
import com.kylecorry.trail_sense.shared.alertNoCameraPermission
import com.kylecorry.trail_sense.shared.*
import com.kylecorry.trail_sense.shared.io.IOFactory
import com.kylecorry.trail_sense.shared.sensors.SensorService
import com.kylecorry.trail_sense.shared.uri.GeoUri
import com.kylecorry.trail_sense.tools.qr.infrastructure.BeaconQREncoder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController
import androidx.navigation.fragment.findNavController
import com.kylecorry.andromeda.core.capitalizeWords
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.fragments.BoundFragment
import com.kylecorry.sol.math.SolMath.roundPlaces
import com.kylecorry.sol.science.geology.GeologyService
Expand All @@ -31,7 +32,6 @@ import com.kylecorry.trail_sense.shared.FormatService
import com.kylecorry.trail_sense.shared.UserPreferences
import com.kylecorry.trail_sense.shared.colors.AppColor
import com.kylecorry.trail_sense.shared.sensors.SensorService
import com.kylecorry.trail_sense.shared.uri.GeoUri
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.kylecorry.trail_sense.navigation.paths.ui.commands

import android.content.Context
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.sol.math.SolMath.roundPlaces
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.navigation.paths.domain.Path
import com.kylecorry.trail_sense.navigation.paths.domain.PathPoint
import com.kylecorry.trail_sense.shared.AppUtils
import com.kylecorry.trail_sense.shared.uri.GeoUri


class CreateBeaconFromPointCommand(private val context: Context) : IPathPointCommand {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.kylecorry.andromeda.camera.Camera
import com.kylecorry.andromeda.core.coroutines.ControlledRunner
import com.kylecorry.andromeda.core.sensors.Quality
import com.kylecorry.andromeda.core.sensors.asLiveData
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.core.system.Resources
import com.kylecorry.andromeda.core.system.Screen
import com.kylecorry.andromeda.core.time.Throttle
Expand Down Expand Up @@ -60,7 +61,6 @@ import com.kylecorry.trail_sense.shared.sensors.CustomGPS
import com.kylecorry.trail_sense.shared.sensors.SensorService
import com.kylecorry.trail_sense.shared.sensors.overrides.CachedGPS
import com.kylecorry.trail_sense.shared.sensors.overrides.OverrideGPS
import com.kylecorry.trail_sense.shared.uri.GeoUri
import com.kylecorry.trail_sense.shared.views.UserError
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.kylecorry.trail_sense.shared

import android.content.Context
import androidx.core.content.ContextCompat
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.core.system.Intents
import com.kylecorry.trail_sense.shared.uri.GeoUri

object AppUtils {

Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/com/kylecorry/trail_sense/shared/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import android.widget.SeekBar
import androidx.fragment.app.Fragment
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.kylecorry.andromeda.alerts.Alerts
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.core.units.PixelCoordinate
import com.kylecorry.andromeda.location.IGPS
import com.kylecorry.sol.math.SolMath.roundPlaces
import com.kylecorry.sol.math.Vector2
import com.kylecorry.trail_sense.MainActivity
import com.kylecorry.trail_sense.R
import com.kylecorry.trail_sense.navigation.beacons.domain.Beacon
import com.kylecorry.trail_sense.navigation.paths.domain.PathPoint
import com.kylecorry.trail_sense.shared.database.Identifiable

Expand Down Expand Up @@ -67,4 +70,15 @@ fun SeekBar.setOnProgressChangeListener(listener: (progress: Int, fromUser: Bool
}

})
}

fun GeoUri.Companion.from(beacon: Beacon): GeoUri {
val params = mutableMapOf(
"label" to beacon.name
)
if (beacon.elevation != null) {
params["ele"] = beacon.elevation.roundPlaces(2).toString()
}

return GeoUri(beacon.coordinate, null, params)
}
81 changes: 0 additions & 81 deletions app/src/main/java/com/kylecorry/trail_sense/shared/uri/GeoUri.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kylecorry.trail_sense.shared.uri

import android.net.Uri
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.sol.units.Coordinate

class LocationUriEncoder : IUriEncoder<Coordinate> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import com.kylecorry.andromeda.alerts.Alerts
import com.kylecorry.andromeda.core.sensors.asLiveData
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.core.time.Throttle
import com.kylecorry.andromeda.fragments.BoundFragment
import com.kylecorry.andromeda.preferences.Preferences
Expand All @@ -30,7 +31,6 @@ import com.kylecorry.trail_sense.shared.FormatService
import com.kylecorry.trail_sense.shared.Position
import com.kylecorry.trail_sense.shared.getPathPoint
import com.kylecorry.trail_sense.shared.sensors.SensorService
import com.kylecorry.trail_sense.shared.uri.GeoUri
import com.kylecorry.trail_sense.tools.maps.domain.Map
import com.kylecorry.trail_sense.tools.maps.domain.MapCalibrationPoint
import com.kylecorry.trail_sense.tools.maps.domain.PercentCoordinate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import com.kylecorry.andromeda.buzz.HapticFeedbackType
import com.kylecorry.andromeda.camera.Camera
import com.kylecorry.andromeda.clipboard.Clipboard
import com.kylecorry.andromeda.core.bitmap.BitmapUtils.toBitmap
import com.kylecorry.andromeda.core.system.GeoUriParser
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.core.system.Intents
import com.kylecorry.andromeda.core.tryOrNothing
import com.kylecorry.andromeda.fragments.BoundFragment
Expand Down Expand Up @@ -282,7 +282,7 @@ class ScanQRFragment : BoundFragment<FragmentScanTextBinding>() {
}

private fun isLocation(text: String): Boolean {
return GeoUriParser.parse(Uri.parse(text)) != null
return GeoUri.from(Uri.parse(text)) != null
}

private fun isURL(text: String): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.view.ViewGroup
import androidx.core.view.isVisible
import com.kylecorry.andromeda.alerts.Alerts
import com.kylecorry.andromeda.clipboard.Clipboard
import com.kylecorry.andromeda.core.system.GeoUri
import com.kylecorry.andromeda.fragments.BoundFragment
import com.kylecorry.sol.science.geology.GeologyService
import com.kylecorry.sol.units.Bearing
Expand All @@ -17,7 +18,6 @@ import com.kylecorry.trail_sense.shared.AppUtils
import com.kylecorry.trail_sense.shared.FormatService
import com.kylecorry.trail_sense.shared.UserPreferences
import com.kylecorry.trail_sense.shared.sensors.SensorService
import com.kylecorry.trail_sense.shared.uri.GeoUri

class FragmentToolTriangulate : BoundFragment<FragmentToolTriangulateBinding>() {

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
<argument
android:name="initial_location"
android:defaultValue="@null"
app:argType="com.kylecorry.trail_sense.shared.uri.GeoUri" />
app:argType="com.kylecorry.andromeda.core.system.GeoUri" />

<action
android:id="@+id/action_beaconListFragment_to_placeBeaconFragment"
Expand Down Expand Up @@ -436,7 +436,7 @@
<argument
android:name="initial_location"
android:defaultValue="@null"
app:argType="com.kylecorry.trail_sense.shared.uri.GeoUri" />
app:argType="com.kylecorry.andromeda.core.system.GeoUri" />

</fragment>
<fragment
Expand Down

0 comments on commit f8c9969

Please sign in to comment.