diff --git a/app/src/main/java/com/rtbishop/look4sat/di/ApplicationModule.kt b/app/src/main/java/com/rtbishop/look4sat/di/ApplicationModule.kt
index 30307255..509e5f19 100644
--- a/app/src/main/java/com/rtbishop/look4sat/di/ApplicationModule.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/di/ApplicationModule.kt
@@ -23,6 +23,7 @@ import android.content.SharedPreferences
import android.hardware.SensorManager
import android.location.LocationManager
import androidx.preference.PreferenceManager
+import com.rtbishop.look4sat.domain.predict4kotlin.QthConverter
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -33,6 +34,11 @@ import dagger.hilt.components.SingletonComponent
@InstallIn(SingletonComponent::class)
object ApplicationModule {
+ @Provides
+ fun provideQthConverter(): QthConverter {
+ return QthConverter()
+ }
+
@Provides
fun provideContentResolver(@ApplicationContext context: Context): ContentResolver {
return context.contentResolver
diff --git a/app/src/main/java/com/rtbishop/look4sat/di/LocalSourceModule.kt b/app/src/main/java/com/rtbishop/look4sat/di/DataSourceModule.kt
similarity index 78%
rename from app/src/main/java/com/rtbishop/look4sat/di/LocalSourceModule.kt
rename to app/src/main/java/com/rtbishop/look4sat/di/DataSourceModule.kt
index c9110b21..d4bd46e9 100644
--- a/app/src/main/java/com/rtbishop/look4sat/di/LocalSourceModule.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/di/DataSourceModule.kt
@@ -23,6 +23,8 @@ import com.rtbishop.look4sat.data.DefaultSatelliteRepo
import com.rtbishop.look4sat.data.LocalDataSource
import com.rtbishop.look4sat.data.RemoteDataSource
import com.rtbishop.look4sat.domain.SatelliteRepo
+import com.rtbishop.look4sat.framework.api.NetworkDataSource
+import com.rtbishop.look4sat.framework.api.SatelliteService
import com.rtbishop.look4sat.framework.db.RoomConverters
import com.rtbishop.look4sat.framework.db.RoomDataSource
import com.rtbishop.look4sat.framework.db.SatelliteDao
@@ -34,15 +36,17 @@ import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.CoroutineDispatcher
+import retrofit2.Retrofit
+import retrofit2.converter.moshi.MoshiConverterFactory
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
-object LocalSourceModule {
+object DataSourceModule {
@Provides
- fun provideLocalDataSource(satelliteDao: SatelliteDao): LocalDataSource {
- return RoomDataSource(satelliteDao)
+ fun provideMoshi(): Moshi {
+ return Moshi.Builder().build()
}
@Provides
@@ -56,8 +60,8 @@ object LocalSourceModule {
}
@Provides
- fun provideMoshi(): Moshi {
- return Moshi.Builder().build()
+ fun provideLocalDataSource(satelliteDao: SatelliteDao): LocalDataSource {
+ return RoomDataSource(satelliteDao)
}
@Provides
@@ -70,4 +74,18 @@ object LocalSourceModule {
RoomConverters.initialize(moshi)
return Room.databaseBuilder(context, SatelliteDb::class.java, "SatelliteDb").build()
}
+
+ @Provides
+ fun provideRemoteDataSource(satelliteService: SatelliteService): RemoteDataSource {
+ return NetworkDataSource(satelliteService)
+ }
+
+ @Provides
+ fun provideSatDataService(): SatelliteService {
+ return Retrofit.Builder()
+ .baseUrl("https://db.satnogs.org/api/")
+ .addConverterFactory(MoshiConverterFactory.create())
+ .build()
+ .create(SatelliteService::class.java)
+ }
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/di/InteractorsModule.kt b/app/src/main/java/com/rtbishop/look4sat/di/InteractorsModule.kt
index ed445956..9c4a74b1 100644
--- a/app/src/main/java/com/rtbishop/look4sat/di/InteractorsModule.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/di/InteractorsModule.kt
@@ -1,3 +1,20 @@
+/*
+ * Look4Sat. Amateur radio satellite tracker and pass predictor.
+ * Copyright (C) 2019-2021 Arty Bishop (bishop.arty@gmail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
package com.rtbishop.look4sat.di
import com.rtbishop.look4sat.domain.SatelliteRepo
diff --git a/app/src/main/java/com/rtbishop/look4sat/di/RemoteSourceModule.kt b/app/src/main/java/com/rtbishop/look4sat/di/RemoteSourceModule.kt
deleted file mode 100644
index e7a98b2e..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/di/RemoteSourceModule.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Look4Sat. Amateur radio satellite tracker and pass predictor.
- * Copyright (C) 2019-2021 Arty Bishop (bishop.arty@gmail.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.rtbishop.look4sat.di
-
-import com.rtbishop.look4sat.data.RemoteDataSource
-import com.rtbishop.look4sat.framework.api.NetworkDataSource
-import com.rtbishop.look4sat.framework.api.SatelliteService
-import dagger.Module
-import dagger.Provides
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import retrofit2.Retrofit
-import retrofit2.converter.moshi.MoshiConverterFactory
-
-@Module
-@InstallIn(SingletonComponent::class)
-object RemoteSourceModule {
-
- @Provides
- fun provideRemoteDataSource(satelliteService: SatelliteService): RemoteDataSource {
- return NetworkDataSource(satelliteService)
- }
-
- @Provides
- fun provideSatDataService(): SatelliteService {
- return Retrofit.Builder()
- .baseUrl("https://db.satnogs.org/api/")
- .addConverterFactory(MoshiConverterFactory.create())
- .build()
- .create(SatelliteService::class.java)
- }
-}
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/mapScreen/MapFragment.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/mapScreen/MapFragment.kt
index 071fbccd..22e97d5a 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/mapScreen/MapFragment.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/mapScreen/MapFragment.kt
@@ -91,7 +91,7 @@ class MapFragment : Fragment(R.layout.fragment_map) {
setInfoWindow(null)
setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
icon = ContextCompat.getDrawable(requireContext(), R.drawable.ic_map_pos)
- position = GeoPoint(osmPos.lat, osmPos.lon)
+ position = GeoPoint(osmPos.latitude, osmPos.longitude)
mapView.overlays[0] = this
mapView.invalidate()
}
@@ -105,8 +105,8 @@ class MapFragment : Fragment(R.layout.fragment_map) {
altitude.text = String.format(getString(R.string.pat_altitude), sat.altitude)
distance.text = String.format(getString(R.string.pat_distance), sat.range)
velocity.text = String.format(getString(R.string.pat_osm_vel), sat.velocity)
- mapLat.text = String.format(getString(R.string.pat_osm_lat), sat.osmPos.lat)
- mapLon.text = String.format(getString(R.string.pat_osm_lon), sat.osmPos.lon)
+ mapLat.text = String.format(getString(R.string.pat_osm_lat), sat.osmPos.latitude)
+ mapLon.text = String.format(getString(R.string.pat_osm_lon), sat.osmPos.longitude)
mapView.overlays[1] = sat.groundTrack
mapView.overlays[2] = sat.footprint
mapView.invalidate()
@@ -127,7 +127,7 @@ class MapFragment : Fragment(R.layout.fragment_map) {
setTextIcon(it.key.tle.name)
setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_CENTER)
try {
- position = GeoPoint(it.value.lat, it.value.lon)
+ position = GeoPoint(it.value.latitude, it.value.longitude)
} catch (e: IllegalArgumentException) {
Timber.d("Position: $position")
}
@@ -143,7 +143,7 @@ class MapFragment : Fragment(R.layout.fragment_map) {
setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_CENTER)
icon = ContextCompat.getDrawable(requireContext(), R.drawable.ic_map_sat)
try {
- position = GeoPoint(it.value.lat, it.value.lon)
+ position = GeoPoint(it.value.latitude, it.value.longitude)
} catch (e: IllegalArgumentException) {
Timber.d("Position: $position")
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/mapScreen/MapViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/mapScreen/MapViewModel.kt
index b4bb3a3b..7b86c4ea 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/mapScreen/MapViewModel.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/mapScreen/MapViewModel.kt
@@ -23,6 +23,7 @@ import androidx.lifecycle.*
import com.rtbishop.look4sat.framework.model.SelectedSat
import com.rtbishop.look4sat.interactors.GetSelectedSatellites
import com.rtbishop.look4sat.domain.predict4kotlin.Position
+import com.rtbishop.look4sat.domain.predict4kotlin.QthConverter
import com.rtbishop.look4sat.domain.predict4kotlin.SatPos
import com.rtbishop.look4sat.domain.predict4kotlin.Satellite
import com.rtbishop.look4sat.utility.*
@@ -71,7 +72,7 @@ class MapViewModel @Inject constructor(
fun getSatMarkers(): LiveData