Satellite tracker and pass predictor for Android, inspired by Gpredict
Kotlin amsatcelestrakgpsham-radiohamlibhamradiokotlinnasaradiosatellitesatellite-datasatellite-positionsatellite-predictionsatellitessatnogssdrspacespacexstarlink
Using liveData builder for appTimer, hilt update
Arty Bishopa8f3c5eb7771
diff --git a/app/src/main/java/com/rtbishop/look4sat/SharedViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/SharedViewModel.ktindex 72dfa8c9..e6e77c8f 100644--- a/app/src/main/java/com/rtbishop/look4sat/SharedViewModel.kt+++ b/app/src/main/java/com/rtbishop/look4sat/SharedViewModel.kt@@ -42,7 +42,6 @@ class SharedViewModel @Inject constructor(private val transmittersRepo: TransmittersRepo) : ViewModel() {- private val _appTimer = MutableLiveData(System.currentTimeMillis())private val _passes = MutableLiveData<Result<MutableList<SatPass>>>()private val _appEvent = MutableLiveData<Event<Int>>()private var selectedEntries = emptyList<SatEntry>()@@ -53,11 +52,16 @@ class SharedViewModel @Inject constructor(updateDefaultSourcesAndEntries()prefsManager.setFirstLaunchDone()}- startApplicationTimer()}fun getAppEvent(): LiveData<Event<Int>> = _appEvent- fun getAppTimer(): LiveData<Long> = _appTimer+ fun getAppTimer() = liveData {+ while (true) {+ emit(System.currentTimeMillis())+ delay(1000)+ }+ }+fun getSources() = sourcesRepo.getSources().asLiveData()fun getEntries() = entriesRepo.getEntries().asLiveData()fun getPasses(): LiveData<Result<MutableList<SatPass>>> = _passes@@ -122,15 +126,6 @@ class SharedViewModel @Inject constructor(_appEvent.value = event}- private fun startApplicationTimer(tickMillis: Long = 1000L) {- viewModelScope.launch(Dispatchers.IO) {- while (true) {- delay(tickMillis)- _appTimer.postValue(System.currentTimeMillis())- }- }- }-private fun getPasses(entry: SatEntry, dateNow: Date): MutableList<SatPass> {val gsp = prefsManager.getStationPosition()val predictor = PassPredictor(entry.tle, gsp)diff --git a/build.gradle b/build.gradleindex 510e74af..c9df13c5 100644--- a/build.gradle+++ b/build.gradle@@ -1,7 +1,7 @@buildscript {ext {gradle_version = '4.1.2'- gradle_plugin_version = '1.4.30'+ gradle_plugin_version = '1.4.31'material_version = '1.3.0'constraint_layout_version = '2.0.4'lifecycle_version = '2.3.0'@@ -9,7 +9,7 @@ buildscript {preference_version = '1.1.1'view_pager2_version = '1.0.0'room_version = '2.2.6'- hilt_version = '2.32-alpha'+ hilt_version = '2.33-beta'hilt_viewmodel_version = '1.0.0-alpha03'retrofit_version = '2.9.0'osmdroid_version = '6.1.10'