Skip to content

Satellite tracker and pass predictor for Android, inspired by Gpredict

v3.1.1 - R4UAB source, minor fixes, libs update

Arty Bishopbbb89b7e6bd4
diff --git a/app/build.gradle b/app/build.gradle
index 7941dc20..1fdb4efb 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -14,9 +14,8 @@ android {
applicationId "com.rtbishop.look4sat"
minSdk 21
targetSdk 31
- versionCode 310
- versionName '3.1.0'
- resConfigs 'en,ru,zh_CN'
+ versionCode 311
+ versionName '3.1.1'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/java/com/rtbishop/look4sat/framework/SettingsManager.kt b/app/src/main/java/com/rtbishop/look4sat/framework/SettingsManager.kt
index ef79e7a5..68c6a068 100644
--- a/app/src/main/java/com/rtbishop/look4sat/framework/SettingsManager.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/framework/SettingsManager.kt
@@ -29,7 +29,6 @@ class SettingsManager @Inject constructor(private val prefs: SharedPreferences)
companion object {
const val keyFirstEverLaunch = "isFirstEverLaunch"
- const val keyDataSources = "dataSources"
const val keyModes = "satModes"
const val keyCompass = "compass"
const val keyRadarSweep = "radarSweep"
@@ -203,15 +202,6 @@ class SettingsManager @Inject constructor(private val prefs: SharedPreferences)
prefs.edit { putString(keyBTFormat, value) }
}
- override fun loadDataSources(): List<String> {
- val sourcesList = prefs.getStringSet(keyDataSources, null)?.toList()
- return if (sourcesList.isNullOrEmpty()) defaultSources else sourcesList.sortedDescending()
- }
-
- override fun saveDataSources(sources: List<String>) {
- if (sources.isNotEmpty()) prefs.edit { putStringSet(keyDataSources, sources.toSet()) }
- }
-
private fun SharedPreferences.getDouble(key: String, default: Double): Double {
return Double.fromBits(getLong(key, default.toRawBits()))
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/passesScreen/PassesViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/passesScreen/PassesViewModel.kt
index 449358cc..16e97f99 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/passesScreen/PassesViewModel.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/passesScreen/PassesViewModel.kt
@@ -42,7 +42,7 @@ class PassesViewModel @Inject constructor(
init {
viewModelScope.launch {
if (!settings.isFirstEverLaunchDone()) {
- repository.updateFromWebNew()
+ repository.updateFromWeb()
settings.setFirstEverLaunchDone()
}
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SettingsViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SettingsViewModel.kt
index 6226e695..fb3e74d2 100644
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SettingsViewModel.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SettingsViewModel.kt
@@ -45,7 +45,7 @@ class SettingsViewModel @Inject constructor(
fun updateDataFromWeb() {
// settings.saveDataSources(sources)
// repository.updateFromWeb(sources)
- repository.updateFromWebNew()
+ repository.updateFromWeb()
}
fun clearData() {
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SourcesAdapter.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SourcesAdapter.kt
deleted file mode 100644
index 9123653f..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SourcesAdapter.kt
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Look4Sat. Amateur radio satellite tracker and pass predictor.
- * Copyright (C) 2019-2022 Arty Bishop ([email protected])
- *
- * 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 <https://www.gnu.org/licenses/>.
- */
-package com.rtbishop.look4sat.presentation.settingsScreen
-
-import android.view.LayoutInflater
-import android.view.ViewGroup
-import androidx.core.widget.doOnTextChanged
-import androidx.recyclerview.widget.AsyncListDiffer
-import androidx.recyclerview.widget.DiffUtil
-import androidx.recyclerview.widget.RecyclerView
-import com.rtbishop.look4sat.databinding.ItemSourceBinding
-import com.rtbishop.look4sat.framework.model.DataSource
-
-class SourcesAdapter(private val clickListener: SourcesClickListener) :
- RecyclerView.Adapter<SourcesAdapter.SourceHolder>() {
-
- private val diffCallback = object : DiffUtil.ItemCallback<DataSource>() {
- override fun areItemsTheSame(oldItem: DataSource, newItem: DataSource): Boolean {
- return oldItem.url == newItem.url
- }
-
- override fun areContentsTheSame(oldItem: DataSource, newItem: DataSource): Boolean {
- return oldItem.url == newItem.url
- }
- }
- private val differ = AsyncListDiffer(this, diffCallback)
- private val httpsString = "https://"
-
- fun getSources() = differ.currentList.filter { source -> source.url.contains(httpsString) }
-
- fun addSource() {
- submitList((getSources() as MutableList).apply { add(DataSource(httpsString)) })
- }
-
- fun removeSource(source: DataSource) {
- submitList((getSources() as MutableList).apply { remove(source) })
- }
-
- fun submitList(items: List<DataSource>) = differ.submitList(items)
-
- override fun getItemCount(): Int = differ.currentList.size
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SourceHolder {
- return SourceHolder.from(parent)
- }
-
- override fun onBindViewHolder(holder: SourceHolder, position: Int) {
- holder.bind(differ.currentList[position], clickListener)
- }
-
- class SourceHolder(private val binding: ItemSourceBinding) :
- RecyclerView.ViewHolder(binding.root) {
-
- fun bind(source: DataSource, listener: SourcesClickListener) {
- binding.run {
- sourceText.setText(source.url)
- sourceText.doOnTextChanged { text, _, _, _ -> source.url = text.toString() }
- sourceInput.setEndIconOnClickListener { listener.removeSource(source) }
- }
- }
-
- companion object {
- fun from(parent: ViewGroup): SourceHolder {
- val inflater = LayoutInflater.from(parent.context)
- return SourceHolder(ItemSourceBinding.inflate(inflater, parent, false))
- }
- }
- }
-
- interface SourcesClickListener {
- fun removeSource(source: DataSource)
- }
-}
diff --git a/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SourcesDialog.kt b/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SourcesDialog.kt
deleted file mode 100644
index e153c673..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/presentation/settingsScreen/SourcesDialog.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Look4Sat. Amateur radio satellite tracker and pass predictor.
- * Copyright (C) 2019-2022 Arty Bishop ([email protected])
- *
- * 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 <https://www.gnu.org/licenses/>.
- */
-package com.rtbishop.look4sat.presentation.settingsScreen
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.view.WindowManager
-import androidx.appcompat.app.AppCompatDialogFragment
-import androidx.lifecycle.lifecycleScope
-import androidx.recyclerview.widget.LinearLayoutManager
-import com.rtbishop.look4sat.R
-import com.rtbishop.look4sat.databinding.DialogSourcesBinding
-import com.rtbishop.look4sat.domain.ISettingsManager
-import com.rtbishop.look4sat.framework.model.DataSource
-import com.rtbishop.look4sat.presentation.setNavResult
-import dagger.hilt.android.AndroidEntryPoint
-import javax.inject.Inject
-
-@AndroidEntryPoint
-class SourcesDialog : AppCompatDialogFragment(), SourcesAdapter.SourcesClickListener {
-
- @Inject
- lateinit var settings: ISettingsManager
- private lateinit var binding: DialogSourcesBinding
- private lateinit var sourcesAdapter: SourcesAdapter
-
- override fun onCreateView(inflater: LayoutInflater, group: ViewGroup?, state: Bundle?): View {
- binding = DialogSourcesBinding.inflate(inflater, group, false)
- return binding.root
- }
-
- override fun onViewCreated(view: View, state: Bundle?) {
- super.onViewCreated(view, state)
- dialog?.window?.setBackgroundDrawableResource(R.color.transparent)
- dialog?.window?.setLayout(
- (resources.displayMetrics.widthPixels * 0.94).toInt(),
- WindowManager.LayoutParams.WRAP_CONTENT
- )
- lifecycleScope.launchWhenResumed {
- val sources = settings.loadDataSources().map { url -> DataSource(url) }
- val layoutManager = LinearLayoutManager(requireContext())
- sourcesAdapter = SourcesAdapter(this@SourcesDialog).apply { submitList(sources) }
- binding.run {
- sourcesRecycler.apply {
- this.adapter = sourcesAdapter
- this.layoutManager = layoutManager
- }
- sourcesBtnAdd.setOnClickListener { sourcesAdapter.addSource() }
- sourcesBtnNeg.setOnClickListener { dismiss() }
- sourcesBtnPos.setOnClickListener {
- setNavResult("sources", sourcesAdapter.getSources().map { item -> item.url })
- dismiss()
- }
- }
- }
- }
-
- override fun removeSource(source: DataSource) = sourcesAdapter.removeSource(source)
-}
diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml
index bce3cb07..872cc852 100644
--- a/app/src/main/res/navigation/nav_graph.xml
+++ b/app/src/main/res/navigation/nav_graph.xml
@@ -54,13 +54,6 @@
android:id="@+id/nav_settings"
android:name="com.rtbishop.look4sat.presentation.settingsScreen.SettingsFragment"
tools:layout="@layout/fragment_settings">
- <action
- android:id="@+id/settings_to_sources"
- app:destination="@id/nav_sources"
- app:enterAnim="@anim/nav_default_enter_anim"
- app:exitAnim="@anim/nav_default_exit_anim"
- app:popEnterAnim="@anim/nav_default_pop_enter_anim"
- app:popExitAnim="@anim/nav_default_pop_exit_anim" />
</fragment>
<dialog
android:id="@+id/nav_modes"
@@ -70,10 +63,6 @@
android:id="@+id/nav_filter"
android:name="com.rtbishop.look4sat.presentation.passesScreen.FilterDialog"
tools:layout="@layout/dialog_filter" />
- <dialog
- android:id="@+id/nav_sources"
- android:name="com.rtbishop.look4sat.presentation.settingsScreen.SourcesDialog"
- tools:layout="@layout/dialog_sources" />
<dialog
android:id="@+id/nav_position"
android:name="com.rtbishop.look4sat.presentation.settingsScreen.PositionDialog"
diff --git a/base/src/main/java/com/rtbishop/look4sat/domain/IDataRepository.kt b/base/src/main/java/com/rtbishop/look4sat/domain/IDataRepository.kt
index fe356c44..caacbcae 100644
--- a/base/src/main/java/com/rtbishop/look4sat/domain/IDataRepository.kt
+++ b/base/src/main/java/com/rtbishop/look4sat/domain/IDataRepository.kt
@@ -40,9 +40,7 @@ interface IDataRepository {
fun updateFromFile(uri: String)
- fun updateFromWeb(urls: List<String>)
-
- fun updateFromWebNew()
+ fun updateFromWeb()
fun setUpdateStateHandled()
diff --git a/base/src/main/java/com/rtbishop/look4sat/domain/ISettingsManager.kt b/base/src/main/java/com/rtbishop/look4sat/domain/ISettingsManager.kt
index b555acc1..c0aa875e 100644
--- a/base/src/main/java/com/rtbishop/look4sat/domain/ISettingsManager.kt
+++ b/base/src/main/java/com/rtbishop/look4sat/domain/ISettingsManager.kt
@@ -21,13 +21,6 @@ import com.rtbishop.look4sat.domain.predict.GeoPos
interface ISettingsManager {
- val defaultSources: List<String>
- get() = listOf(
- "https://www.prismnet.com/~mmccants/tles/inttles.zip",
- "https://www.prismnet.com/~mmccants/tles/classfd.zip",
- "https://celestrak.com/NORAD/elements/gp.php?GROUP=active&FORMAT=csv",
- "https://amsat.org/tle/current/nasabare.txt"
- )
val sourcesMap: Map<String, String>
get() = mapOf(
"All" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=active&FORMAT=csv",
@@ -47,6 +40,7 @@ interface ISettingsManager {
"New" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=last-30-days&FORMAT=csv",
"OneWeb" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=oneweb&FORMAT=csv",
"Orbcomm" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=orbcomm&FORMAT=csv",
+ "R4UAB" to "https://r4uab.ru/satonline.txt",
"Resource" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=resource&FORMAT=csv",
"SatNOGS" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=satnogs&FORMAT=csv",
"Science" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=science&FORMAT=csv",
@@ -128,8 +122,4 @@ interface ISettingsManager {
fun getBTFormat(): String
fun setBTFormat(value: String)
-
- fun loadDataSources(): List<String>
-
- fun saveDataSources(sources: List<String>)
}
diff --git a/base/src/main/java/com/rtbishop/look4sat/domain/data/DataRepository.kt b/base/src/main/java/com/rtbishop/look4sat/domain/data/DataRepository.kt
index cf358659..d12d2961 100644
--- a/base/src/main/java/com/rtbishop/look4sat/domain/data/DataRepository.kt
+++ b/base/src/main/java/com/rtbishop/look4sat/domain/data/DataRepository.kt
@@ -66,38 +66,7 @@ class DataRepository(
}
}
- override fun updateFromWeb(urls: List<String>) {
- _updateState.value = DataState.Loading
- repositoryScope.launch(exceptionHandler) {
- val streams = mutableListOf<InputStream>()
- val entries = mutableListOf<SatEntry>()
- val jobs = urls.associateWith { url -> async { remoteSource.getDataStream(url) } }
- jobs.mapValues { job -> job.value.await() }.forEach { result ->
- result.value?.let { stream ->
- when {
- result.key.contains("=csv", true) -> {
- val orbitalData = dataParser.parseCSVStream(stream)
- entries.addAll(orbitalData.map { data -> SatEntry(data) })
- }
- result.key.contains(".zip", true) -> {
- streams.add(ZipInputStream(stream).apply { nextEntry })
- }
- else -> streams.add(stream)
- }
- }
- }
- streams.forEach { stream -> entries.addAll(importSatellites(stream)) }
- entrySource.insertEntries(entries)
- }
- repositoryScope.launch(exceptionHandler) {
- remoteSource.getDataStream(remoteSource.radioApi)?.let { stream ->
- radioSource.insertRadios(dataParser.parseJSONStream(stream))
- _updateState.value = DataState.Success(0L)
- }
- }
- }
-
- override fun updateFromWebNew() {
+ override fun updateFromWeb() {
_updateState.value = DataState.Loading
repositoryScope.launch(exceptionHandler) {
val importedEntries = mutableListOf<SatEntry>()
@@ -106,7 +75,7 @@ class DataRepository(
jobsMap.mapValues { job -> job.value.await() }.forEach { entry ->
entry.value?.let { stream ->
when (val type = entry.key) {
- "AMSAT" -> {
+ "AMSAT", "R4UAB" -> {
// parse tle stream
val satellites = importSatellites(stream)
val catnums = satellites.map { it.data.catnum }
diff --git a/build.gradle b/build.gradle
index e9321431..c890a4ec 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,28 +1,28 @@
buildscript {
ext {
- hilt_version = '2.42'
+ hilt_version = '2.43.2'
safe_args_version = '2.4.1'
- application_version = '7.2.1'
+ application_version = '7.2.2'
library_version = '7.1.2'
kotlin_android_version = '1.6.10'
core_ktx_version = '1.8.0'
- core_splashscreen_version = '1.0.0-rc01'
+ core_splashscreen_version = '1.0.0'
constraint_version = '2.1.4'
- lifecycle_version = '2.4.1'
- navigation_version = '2.4.2'
- room_version = '2.4.2'
+ lifecycle_version = '2.5.1'
+ navigation_version = '2.5.1'
+ room_version = '2.4.3'
material_version = '1.6.1'
osmdroid_version = '6.1.13'
json_version = '20220320'
compose_version = '1.1.1'
activity_compose_version = '1.4.0'
material_adapter_version = '1.1.10'
- fragment_test_version = '1.4.1'
+ fragment_test_version = '1.5.1'
leakcanary_version = '2.9.1'
junit_version = '4.13.2'
- mockito_version = '4.6.0'
+ mockito_version = '4.6.1'
robolectric_version = '4.8.1'
- coroutines_test_version = '1.6.2'
+ coroutines_test_version = '1.6.4'
androidx_test_version = '1.4.0'
androidx_junit_version = '1.1.3'
espresso_version = '3.4.0'
diff --git a/fastlane/metadata/android/en-US/changelogs/311.txt b/fastlane/metadata/android/en-US/changelogs/311.txt
new file mode 100644
index 00000000..bbbe9677
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/311.txt
@@ -0,0 +1,5 @@
+Re-enabled the rotator control switch (fix)
+Increased radar sweep rotation speed
+Fixed negative lat/lon manual input bug
+Added R4UAB TLE source and category
+Updated libraries and dependencies
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/whatsnew/whatsnew-en-US b/fastlane/metadata/android/en-US/whatsnew/whatsnew-en-US
index 2113a92d..bbbe9677 100644
--- a/fastlane/metadata/android/en-US/whatsnew/whatsnew-en-US
+++ b/fastlane/metadata/android/en-US/whatsnew/whatsnew-en-US
@@ -1,6 +1,5 @@
-Integrated AJohns bluetooth reporting function
-Ref - https://github.com/rt-bishop/Look4Sat/pull/87
-Integrated BA7LWN Simplified Chinese translation
-Ref - https://github.com/rt-bishop/Look4Sat/pull/92
-Added satellites sorting by their reported categories
-Removed custom sources dialog, use file import instead
\ No newline at end of file
+Re-enabled the rotator control switch (fix)
+Increased radar sweep rotation speed
+Fixed negative lat/lon manual input bug
+Added R4UAB TLE source and category
+Updated libraries and dependencies
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 7f27900d..7af4b25a 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Sun Apr 17 13:48:12 BST 2022
+#Sun Aug 07 12:57:36 BST 2022
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME