Skip to content

Satellite tracker and pass predictor for Android, inspired by Gpredict

Code refactoring, move and cleanup

Arty Bishopb87f2a6e72b2
diff --git a/app/build.gradle b/app/build.gradle
index e42dc8ce..205ab162 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -64,7 +64,6 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.google.android.material:material:$material_version"
implementation "androidx.appcompat:appcompat:$app_compat_version"
- implementation "androidx.legacy:legacy-support-v4:$support_lib_version"
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
implementation "androidx.core:core-ktx:$ktx_version"
implementation "androidx.preference:preference:$preference_version"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7b35f156..35da8305 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -32,19 +32,9 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
- <activity
- android:name=".ui.NavActivity"
- android:screenOrientation="portrait">
- <!-- <intent-filter>-->
- <!-- <action android:name="android.intent.action.MAIN" />-->
-
- <!-- <category android:name="android.intent.category.LAUNCHER" />-->
- <!-- </intent-filter>-->
- </activity>
<activity
android:name=".ui.MainActivity"
- android:configChanges="orientation|screenSize"
- android:label="@string/app_name"
+ android:screenOrientation="portrait"
android:theme="@style/AppTheme.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/app/src/main/java/com/rtbishop/look4sat/dagger/AppComponent.kt b/app/src/main/java/com/rtbishop/look4sat/dagger/AppComponent.kt
index 815359e9..07928430 100644
--- a/app/src/main/java/com/rtbishop/look4sat/dagger/AppComponent.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/dagger/AppComponent.kt
@@ -23,7 +23,6 @@ import android.content.Context
import com.rtbishop.look4sat.dagger.modules.*
import com.rtbishop.look4sat.ui.MainActivity
import com.rtbishop.look4sat.ui.fragments.MapOsmFragment
-import com.rtbishop.look4sat.ui.fragments.MapViewFragment
import com.rtbishop.look4sat.ui.fragments.PassListFragment
import com.rtbishop.look4sat.ui.fragments.PolarViewFragment
import dagger.BindsInstance
@@ -43,7 +42,6 @@ interface AppComponent {
}
fun inject(mainActivity: MainActivity)
- fun inject(mapViewFragment: MapViewFragment)
fun inject(passListFragment: PassListFragment)
fun inject(polarViewFragment: PolarViewFragment)
fun inject(mapOsmFragment: MapOsmFragment)
diff --git a/app/src/main/java/com/rtbishop/look4sat/dagger/modules/NetworkModule.kt b/app/src/main/java/com/rtbishop/look4sat/dagger/modules/NetworkModule.kt
index 06052ea0..ddc62ec9 100644
--- a/app/src/main/java/com/rtbishop/look4sat/dagger/modules/NetworkModule.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/dagger/modules/NetworkModule.kt
@@ -19,9 +19,7 @@
package com.rtbishop.look4sat.dagger.modules
-import com.rtbishop.look4sat.network.RemoteDataSource
-import com.rtbishop.look4sat.network.RemoteSource
-import com.rtbishop.look4sat.network.TransmittersApi
+import com.rtbishop.look4sat.repo.api.TransmittersApi
import dagger.Module
import dagger.Provides
import okhttp3.OkHttpClient
@@ -38,12 +36,6 @@ class NetworkModule {
return OkHttpClient()
}
- @Singleton
- @Provides
- fun provideRemoteDataSource(api: TransmittersApi, client: OkHttpClient): RemoteSource {
- return RemoteDataSource(api, client)
- }
-
@Singleton
@Provides
fun provideTransmittersApi(): TransmittersApi {
diff --git a/app/src/main/java/com/rtbishop/look4sat/dagger/modules/PersistenceModule.kt b/app/src/main/java/com/rtbishop/look4sat/dagger/modules/PersistenceModule.kt
index a92943a8..c74f2098 100644
--- a/app/src/main/java/com/rtbishop/look4sat/dagger/modules/PersistenceModule.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/dagger/modules/PersistenceModule.kt
@@ -21,12 +21,10 @@ package com.rtbishop.look4sat.dagger.modules
import android.content.Context
import androidx.room.Room
-import com.rtbishop.look4sat.persistence.LocalDataSource
-import com.rtbishop.look4sat.persistence.LocalSource
-import com.rtbishop.look4sat.persistence.SatelliteDb
-import com.rtbishop.look4sat.persistence.dao.EntriesDao
-import com.rtbishop.look4sat.persistence.dao.SourcesDao
-import com.rtbishop.look4sat.persistence.dao.TransmittersDao
+import com.rtbishop.look4sat.repo.SatelliteDb
+import com.rtbishop.look4sat.repo.dao.EntriesDao
+import com.rtbishop.look4sat.repo.dao.SourcesDao
+import com.rtbishop.look4sat.repo.dao.TransmittersDao
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
@@ -52,16 +50,6 @@ class PersistenceModule {
return db.sourcesDao()
}
- @Singleton
- @Provides
- fun provideLocalDataSource(
- entriesDao: EntriesDao,
- transmittersDao: TransmittersDao,
- sourcesDao: SourcesDao
- ): LocalSource {
- return LocalDataSource(entriesDao, transmittersDao, sourcesDao)
- }
-
@Singleton
@Provides
fun provideSatelliteDb(context: Context): SatelliteDb {
diff --git a/app/src/main/java/com/rtbishop/look4sat/dagger/modules/RepoModule.kt b/app/src/main/java/com/rtbishop/look4sat/dagger/modules/RepoModule.kt
index 8cbe6b73..51e97c82 100644
--- a/app/src/main/java/com/rtbishop/look4sat/dagger/modules/RepoModule.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/dagger/modules/RepoModule.kt
@@ -2,12 +2,15 @@ package com.rtbishop.look4sat.dagger.modules
import android.content.ContentResolver
import android.content.Context
-import com.rtbishop.look4sat.network.RemoteSource
-import com.rtbishop.look4sat.persistence.LocalSource
import com.rtbishop.look4sat.repo.DefaultRepository
import com.rtbishop.look4sat.repo.Repository
+import com.rtbishop.look4sat.repo.api.TransmittersApi
+import com.rtbishop.look4sat.repo.dao.EntriesDao
+import com.rtbishop.look4sat.repo.dao.SourcesDao
+import com.rtbishop.look4sat.repo.dao.TransmittersDao
import dagger.Module
import dagger.Provides
+import okhttp3.OkHttpClient
import javax.inject.Singleton
@Module
@@ -23,9 +26,19 @@ class RepoModule {
@Provides
fun provideDefaultRepository(
resolver: ContentResolver,
- localSource: LocalSource,
- remoteSource: RemoteSource
+ transmittersApi: TransmittersApi,
+ client: OkHttpClient,
+ entriesDao: EntriesDao,
+ transmittersDao: TransmittersDao,
+ sourcesDao: SourcesDao
): Repository {
- return DefaultRepository(resolver, localSource, remoteSource)
+ return DefaultRepository(
+ resolver,
+ client,
+ transmittersApi,
+ entriesDao,
+ sourcesDao,
+ transmittersDao
+ )
}
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/network/RemoteDataSource.kt b/app/src/main/java/com/rtbishop/look4sat/network/RemoteDataSource.kt
deleted file mode 100644
index bec3cab6..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/network/RemoteDataSource.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- * Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package com.rtbishop.look4sat.network
-
-import android.util.Log
-import com.rtbishop.look4sat.data.TleSource
-import com.rtbishop.look4sat.data.Transmitter
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.withContext
-import okhttp3.OkHttpClient
-import okhttp3.Request
-import java.io.InputStream
-import javax.inject.Inject
-
-class RemoteDataSource @Inject constructor(
- private val api: TransmittersApi,
- private val client: OkHttpClient
-) : RemoteSource {
-
- override suspend fun fetchTleStreams(urlList: List<TleSource>): List<InputStream> {
- val streams = mutableListOf<InputStream>()
- withContext(Dispatchers.IO) {
- urlList.withIndex().forEach {
- val request = Request.Builder().url(it.value.url).build()
- val stream = client.newCall(request).execute().body?.byteStream()
- stream?.let { inputStream -> streams.add(inputStream) }
- }
- }
- Log.d("myTag", urlList.toString())
- return streams
- }
-
- override suspend fun fetchTransmitters(): List<Transmitter> {
- return api.fetchTransmitters()
- }
-}
diff --git a/app/src/main/java/com/rtbishop/look4sat/network/RemoteSource.kt b/app/src/main/java/com/rtbishop/look4sat/network/RemoteSource.kt
deleted file mode 100644
index 840d6eeb..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/network/RemoteSource.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.rtbishop.look4sat.network
-
-import com.rtbishop.look4sat.data.TleSource
-import com.rtbishop.look4sat.data.Transmitter
-import java.io.InputStream
-
-interface RemoteSource {
-
- suspend fun fetchTleStreams(urlList: List<TleSource>): List<InputStream>
-
- suspend fun fetchTransmitters(): List<Transmitter>
-}
diff --git a/app/src/main/java/com/rtbishop/look4sat/persistence/LocalDataSource.kt b/app/src/main/java/com/rtbishop/look4sat/persistence/LocalDataSource.kt
deleted file mode 100644
index ec92e7e0..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/persistence/LocalDataSource.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- * Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package com.rtbishop.look4sat.persistence
-
-import com.rtbishop.look4sat.data.SatEntry
-import com.rtbishop.look4sat.data.TleSource
-import com.rtbishop.look4sat.data.Transmitter
-import com.rtbishop.look4sat.persistence.dao.EntriesDao
-import com.rtbishop.look4sat.persistence.dao.SourcesDao
-import com.rtbishop.look4sat.persistence.dao.TransmittersDao
-import javax.inject.Inject
-
-class LocalDataSource @Inject constructor(
- private val entriesDao: EntriesDao,
- private val transmittersDao: TransmittersDao,
- private val sourcesDao: SourcesDao
-) : LocalSource {
-
- override suspend fun insertEntries(entries: List<SatEntry>) {
- entriesDao.insertEntries(entries)
- }
-
- override suspend fun getAllEntries(): List<SatEntry> {
- return entriesDao.getAllEntries()
- }
-
- override suspend fun getSelectedEntries(): List<SatEntry> {
- return entriesDao.getSelectedEntries()
- }
-
- override suspend fun updateEntriesSelection(catNumList: List<Int>) {
- entriesDao.clearEntriesSelection()
- catNumList.forEach { entriesDao.updateEntrySelection(it) }
- }
-
- override suspend fun clearEntries() {
- entriesDao.clearEntries()
- }
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
-
- override suspend fun insertTransmitters(transmitters: List<Transmitter>) {
- transmittersDao.insertTransmitters(transmitters)
- }
-
- override suspend fun getTransmittersByCatNum(catNum: Int): List<Transmitter> {
- return transmittersDao.getTransmittersByCatNum(catNum)
- }
-
- override suspend fun clearTransmitters() {
- transmittersDao.clearTransmitters()
- }
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
-
- override suspend fun insertSources(sources: List<TleSource>) {
- sourcesDao.insertSources(sources)
- }
-
- override suspend fun getSources(): List<TleSource> {
- return sourcesDao.getSources()
- }
-
- override suspend fun clearSources() {
- sourcesDao.clearSources()
- }
-}
diff --git a/app/src/main/java/com/rtbishop/look4sat/persistence/LocalSource.kt b/app/src/main/java/com/rtbishop/look4sat/persistence/LocalSource.kt
deleted file mode 100644
index f10d8876..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/persistence/LocalSource.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.rtbishop.look4sat.persistence
-
-import com.rtbishop.look4sat.data.SatEntry
-import com.rtbishop.look4sat.data.TleSource
-import com.rtbishop.look4sat.data.Transmitter
-
-interface LocalSource {
-
- suspend fun insertEntries(entries: List<SatEntry>)
-
- suspend fun getAllEntries(): List<SatEntry>
-
- suspend fun getSelectedEntries(): List<SatEntry>
-
- suspend fun updateEntriesSelection(catNumList: List<Int>)
-
- suspend fun clearEntries()
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
-
- suspend fun insertTransmitters(transmitters: List<Transmitter>)
-
- suspend fun getTransmittersByCatNum(catNum: Int): List<Transmitter>
-
- suspend fun clearTransmitters()
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
-
- suspend fun insertSources(sources: List<TleSource>)
-
- suspend fun getSources(): List<TleSource>
-
- suspend fun clearSources()
-}
diff --git a/app/src/main/java/com/rtbishop/look4sat/repo/DefaultRepository.kt b/app/src/main/java/com/rtbishop/look4sat/repo/DefaultRepository.kt
index ed91fae7..6065999c 100644
--- a/app/src/main/java/com/rtbishop/look4sat/repo/DefaultRepository.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/repo/DefaultRepository.kt
@@ -25,16 +25,24 @@ import com.github.amsacode.predict4java.TLE
import com.rtbishop.look4sat.data.SatEntry
import com.rtbishop.look4sat.data.TleSource
import com.rtbishop.look4sat.data.Transmitter
-import com.rtbishop.look4sat.network.RemoteSource
-import com.rtbishop.look4sat.persistence.LocalSource
+import com.rtbishop.look4sat.repo.api.TransmittersApi
+import com.rtbishop.look4sat.repo.dao.EntriesDao
+import com.rtbishop.look4sat.repo.dao.SourcesDao
+import com.rtbishop.look4sat.repo.dao.TransmittersDao
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
+import okhttp3.OkHttpClient
+import okhttp3.Request
+import java.io.InputStream
import javax.inject.Inject
class DefaultRepository @Inject constructor(
private val resolver: ContentResolver,
- private val localSource: LocalSource,
- private val remoteSource: RemoteSource
+ private val client: OkHttpClient,
+ private val api: TransmittersApi,
+ private val entriesDao: EntriesDao,
+ private val sourcesDao: SourcesDao,
+ private val transmittersDao: TransmittersDao
) : Repository {
override suspend fun updateEntriesFromFile(tleUri: Uri) {
@@ -42,56 +50,88 @@ class DefaultRepository @Inject constructor(
resolver.openInputStream(tleUri)?.use { stream ->
val tleList = TLE.importSat(stream)
val entries = tleList.map { SatEntry(it) }
- localSource.clearEntries()
- localSource.insertEntries(entries)
+ clearEntries()
+ insertEntries(entries)
}
}
}
override suspend fun updateEntriesFromUrl(urlList: List<TleSource>) {
withContext(Dispatchers.IO) {
- val streams = remoteSource.fetchTleStreams(urlList)
+ val streams = fetchTleStreams(urlList)
val entries = mutableListOf<SatEntry>()
streams.forEach {
val list = TLE.importSat(it).map { tle -> SatEntry(tle) }
entries.addAll(list)
}
- localSource.clearEntries()
- localSource.insertEntries(entries)
+ clearEntries()
+ insertEntries(entries)
}
}
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
+ override suspend fun fetchTleStreams(urlList: List<TleSource>): List<InputStream> =
+ withContext(Dispatchers.IO) {
+ val streams = mutableListOf<InputStream>()
+ urlList.withIndex().forEach {
+ val request = Request.Builder().url(it.value.url).build()
+ val stream = client.newCall(request).execute().body?.byteStream()
+ stream?.let { inputStream -> streams.add(inputStream) }
+ }
+ return@withContext streams
+ }
+
+ override suspend fun fetchTransmitters(): List<Transmitter> {
+ return api.fetchTransmitters()
+ }
+
+ override suspend fun insertEntries(entries: List<SatEntry>) {
+ entriesDao.insertEntries(entries)
+ }
+
override suspend fun getAllEntries(): List<SatEntry> {
- return localSource.getAllEntries()
+ return entriesDao.getAllEntries()
}
override suspend fun getSelectedEntries(): List<SatEntry> {
- return localSource.getSelectedEntries()
+ return entriesDao.getSelectedEntries()
}
override suspend fun updateEntriesSelection(catNumList: List<Int>) {
- localSource.updateEntriesSelection(catNumList)
+ entriesDao.clearEntriesSelection()
+ catNumList.forEach { entriesDao.updateEntrySelection(it) }
+ }
+
+ override suspend fun clearEntries() {
+ entriesDao.clearEntries()
}
////////////////////////////////////////////////////////////////////////////////////////////////
override suspend fun updateTransmitters() {
- localSource.clearTransmitters()
- localSource.insertTransmitters(remoteSource.fetchTransmitters())
}
override suspend fun getTransmittersByCatNum(catNum: Int): List<Transmitter> {
- return localSource.getTransmittersByCatNum(catNum)
+ return transmittersDao.getTransmittersByCatNum(catNum)
+ }
+
+ override suspend fun clearTransmitters() {
+ transmittersDao.clearTransmitters()
}
////////////////////////////////////////////////////////////////////////////////////////////////
override suspend fun updateSources(sources: List<TleSource>) {
- localSource.clearSources()
- localSource.insertSources(sources)
+ clearSources()
+ sourcesDao.insertSources(sources)
}
override suspend fun getSources(): List<TleSource> {
- return localSource.getSources()
+ return sourcesDao.getSources()
+ }
+
+ override suspend fun clearSources() {
+ sourcesDao.clearSources()
}
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/repo/Repository.kt b/app/src/main/java/com/rtbishop/look4sat/repo/Repository.kt
index b92fe4e2..13d04ad8 100644
--- a/app/src/main/java/com/rtbishop/look4sat/repo/Repository.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/repo/Repository.kt
@@ -4,6 +4,7 @@ import android.net.Uri
import com.rtbishop.look4sat.data.SatEntry
import com.rtbishop.look4sat.data.TleSource
import com.rtbishop.look4sat.data.Transmitter
+import java.io.InputStream
interface Repository {
@@ -11,21 +12,35 @@ interface Repository {
suspend fun updateEntriesFromUrl(urlList: List<TleSource>)
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
+ suspend fun fetchTleStreams(urlList: List<TleSource>): List<InputStream>
+
+ suspend fun fetchTransmitters(): List<Transmitter>
+
+ suspend fun insertEntries(entries: List<SatEntry>)
+
suspend fun getAllEntries(): List<SatEntry>
suspend fun getSelectedEntries(): List<SatEntry>
suspend fun updateEntriesSelection(catNumList: List<Int>)
+ suspend fun clearEntries()
+
////////////////////////////////////////////////////////////////////////////////////////////////
suspend fun updateTransmitters()
suspend fun getTransmittersByCatNum(catNum: Int): List<Transmitter>
+ suspend fun clearTransmitters()
+
////////////////////////////////////////////////////////////////////////////////////////////////
suspend fun updateSources(sources: List<TleSource>)
suspend fun getSources(): List<TleSource>
+
+ suspend fun clearSources()
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/persistence/SatelliteDb.kt b/app/src/main/java/com/rtbishop/look4sat/repo/SatelliteDb.kt
similarity index 87%
rename from app/src/main/java/com/rtbishop/look4sat/persistence/SatelliteDb.kt
rename to app/src/main/java/com/rtbishop/look4sat/repo/SatelliteDb.kt
index 76250183..d54e0038 100644
--- a/app/src/main/java/com/rtbishop/look4sat/persistence/SatelliteDb.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/repo/SatelliteDb.kt
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-package com.rtbishop.look4sat.persistence
+package com.rtbishop.look4sat.repo
import androidx.room.Database
import androidx.room.RoomDatabase
@@ -25,9 +25,9 @@ import androidx.room.TypeConverters
import com.rtbishop.look4sat.data.SatEntry
import com.rtbishop.look4sat.data.TleSource
import com.rtbishop.look4sat.data.Transmitter
-import com.rtbishop.look4sat.persistence.dao.EntriesDao
-import com.rtbishop.look4sat.persistence.dao.SourcesDao
-import com.rtbishop.look4sat.persistence.dao.TransmittersDao
+import com.rtbishop.look4sat.repo.dao.EntriesDao
+import com.rtbishop.look4sat.repo.dao.SourcesDao
+import com.rtbishop.look4sat.repo.dao.TransmittersDao
import com.rtbishop.look4sat.utility.Converters
@Database(
diff --git a/app/src/main/java/com/rtbishop/look4sat/network/TransmittersApi.kt b/app/src/main/java/com/rtbishop/look4sat/repo/api/TransmittersApi.kt
similarity index 96%
rename from app/src/main/java/com/rtbishop/look4sat/network/TransmittersApi.kt
rename to app/src/main/java/com/rtbishop/look4sat/repo/api/TransmittersApi.kt
index a0abc5b6..f98f87c9 100644
--- a/app/src/main/java/com/rtbishop/look4sat/network/TransmittersApi.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/repo/api/TransmittersApi.kt
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-package com.rtbishop.look4sat.network
+package com.rtbishop.look4sat.repo.api
import com.rtbishop.look4sat.data.Transmitter
import retrofit2.http.GET
diff --git a/app/src/main/java/com/rtbishop/look4sat/persistence/dao/EntriesDao.kt b/app/src/main/java/com/rtbishop/look4sat/repo/dao/EntriesDao.kt
similarity index 97%
rename from app/src/main/java/com/rtbishop/look4sat/persistence/dao/EntriesDao.kt
rename to app/src/main/java/com/rtbishop/look4sat/repo/dao/EntriesDao.kt
index 98f12c2b..54b72914 100644
--- a/app/src/main/java/com/rtbishop/look4sat/persistence/dao/EntriesDao.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/repo/dao/EntriesDao.kt
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-package com.rtbishop.look4sat.persistence.dao
+package com.rtbishop.look4sat.repo.dao
import androidx.room.Dao
import androidx.room.Insert
diff --git a/app/src/main/java/com/rtbishop/look4sat/persistence/dao/SourcesDao.kt b/app/src/main/java/com/rtbishop/look4sat/repo/dao/SourcesDao.kt
similarity index 90%
rename from app/src/main/java/com/rtbishop/look4sat/persistence/dao/SourcesDao.kt
rename to app/src/main/java/com/rtbishop/look4sat/repo/dao/SourcesDao.kt
index 7a3a9777..c0b8d099 100644
--- a/app/src/main/java/com/rtbishop/look4sat/persistence/dao/SourcesDao.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/repo/dao/SourcesDao.kt
@@ -1,4 +1,4 @@
-package com.rtbishop.look4sat.persistence.dao
+package com.rtbishop.look4sat.repo.dao
import androidx.room.Dao
import androidx.room.Insert
diff --git a/app/src/main/java/com/rtbishop/look4sat/persistence/dao/TransmittersDao.kt b/app/src/main/java/com/rtbishop/look4sat/repo/dao/TransmittersDao.kt
similarity index 92%
rename from app/src/main/java/com/rtbishop/look4sat/persistence/dao/TransmittersDao.kt
rename to app/src/main/java/com/rtbishop/look4sat/repo/dao/TransmittersDao.kt
index eb64d883..913ec579 100644
--- a/app/src/main/java/com/rtbishop/look4sat/persistence/dao/TransmittersDao.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/repo/dao/TransmittersDao.kt
@@ -1,4 +1,4 @@
-package com.rtbishop.look4sat.persistence.dao
+package com.rtbishop.look4sat.repo.dao
import androidx.room.Dao
import androidx.room.Insert
diff --git a/app/src/main/java/com/rtbishop/look4sat/ui/MainActivity.kt b/app/src/main/java/com/rtbishop/look4sat/ui/MainActivity.kt
index 2cd1a7c2..d97f3e98 100644
--- a/app/src/main/java/com/rtbishop/look4sat/ui/MainActivity.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/ui/MainActivity.kt
@@ -1,221 +1,84 @@
-/*
- * Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- * Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
package com.rtbishop.look4sat.ui
-import android.Manifest
-import android.annotation.SuppressLint
-import android.content.Context
-import android.content.Intent
-import android.content.pm.ActivityInfo
-import android.content.pm.PackageManager
-import android.net.Uri
import android.os.Bundle
-import android.view.View
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
-import androidx.core.app.ActivityCompat
-import androidx.lifecycle.ViewModelProvider
-import androidx.lifecycle.lifecycleScope
-import androidx.navigation.findNavController
-import androidx.navigation.ui.AppBarConfiguration
-import androidx.navigation.ui.navigateUp
-import androidx.navigation.ui.setupActionBarWithNavController
+import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
-import com.rtbishop.look4sat.Look4SatApp
import com.rtbishop.look4sat.R
-import com.rtbishop.look4sat.dagger.ViewModelFactory
-import com.rtbishop.look4sat.data.Result
-import com.rtbishop.look4sat.data.TleSource
import com.rtbishop.look4sat.databinding.ActivityMainBinding
-import com.rtbishop.look4sat.databinding.DrawerHeaderBinding
-import com.rtbishop.look4sat.ui.fragments.TleSourcesDialogFragment
-import com.rtbishop.look4sat.utility.Extensions.toast
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.launch
-import javax.inject.Inject
-
-class MainActivity : AppCompatActivity(), TleSourcesDialogFragment.SourcesSubmitListener {
- private val pickFileReqCode = 1001
- private val permissionsReqCode = 1000
- private val permissions = arrayOf(
- Manifest.permission.ACCESS_FINE_LOCATION,
- Manifest.permission.READ_EXTERNAL_STORAGE,
- Manifest.permission.WRITE_EXTERNAL_STORAGE
- )
+class MainActivity : AppCompatActivity() {
- @Inject
- lateinit var viewModelFactory: ViewModelFactory
- private lateinit var viewModel: SharedViewModel
- private lateinit var mainBinding: ActivityMainBinding
- private lateinit var drawerBinding: DrawerHeaderBinding
- private lateinit var appBarConfig: AppBarConfiguration
+// private val pickFileReqCode = 1001
+// private val permissionsReqCode = 1000
+// private val permissions = arrayOf(
+// Manifest.permission.ACCESS_FINE_LOCATION,
+// Manifest.permission.READ_EXTERNAL_STORAGE,
+// Manifest.permission.WRITE_EXTERNAL_STORAGE
+// )
override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
-
- mainBinding = ActivityMainBinding.inflate(layoutInflater)
- drawerBinding = DrawerHeaderBinding.inflate(layoutInflater, mainBinding.navView, true)
- setContentView(mainBinding.root)
+ val binding = ActivityMainBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+ val navHost = supportFragmentManager.findFragmentById(R.id.nav_frag) as NavHostFragment
+ binding.navBottom.setupWithNavController(navHost.navController)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
- (application as Look4SatApp).appComponent.inject(this)
- viewModel = ViewModelProvider(this, viewModelFactory).get(SharedViewModel::class.java)
-
- setupComponents()
- setupObservers()
- setupDrawer()
-
- viewModel.setDefaultTleSources()
-
- if (!hasPermissions(this, permissions)) {
- ActivityCompat.requestPermissions(this, permissions, permissionsReqCode)
- }
- }
-
- @SuppressLint("SourceLockedOrientationActivity")
- private fun setupComponents() {
- val navController = findNavController(R.id.nav_host)
- val toolbar = mainBinding.includeAppBar.toolbar
- setSupportActionBar(toolbar)
-
- appBarConfig = AppBarConfiguration(
- setOf(R.id.nav_pass_list, R.id.nav_map_view),
- mainBinding.drawerLayout
- )
-
- setupActionBarWithNavController(navController, appBarConfig)
- mainBinding.navView.setupWithNavController(navController)
-
- navController.addOnDestinationChangedListener { _, destination, _ ->
- when (destination.id) {
- R.id.nav_pass_list -> {
- this.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
- toolbar.visibility = View.VISIBLE
- mainBinding.includeAppBar.toolbarLayout.visibility = View.VISIBLE
- }
- R.id.nav_map_view -> {
- this.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
- toolbar.visibility = View.GONE
- mainBinding.includeAppBar.toolbarLayout.visibility = View.GONE
- }
- R.id.nav_map_osm -> {
- this.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
- toolbar.visibility = View.GONE
- mainBinding.includeAppBar.toolbarLayout.visibility = View.GONE
- }
- else -> {
- this.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
- toolbar.visibility = View.VISIBLE
- mainBinding.includeAppBar.toolbarLayout.visibility = View.GONE
- }
- }
- }
- }
-
- private fun setupObservers() {
- viewModel.getGSP().observe(this, { result ->
- when (result) {
- is Result.Success -> {
- drawerBinding.drawerLatValue.text =
- String.format(getString(R.string.pat_location), result.data.latitude)
- drawerBinding.drawerLonValue.text =
- String.format(getString(R.string.pat_location), result.data.longitude)
- }
- is Result.Error -> {
- when (result.exception) {
- is SecurityException ->
- getString(R.string.err_no_permissions).toast(this)
- is IllegalArgumentException ->
- getString(R.string.update_loc_failure).toast(this)
- }
- }
- }
- })
- viewModel.getUpdateStatus().observe(this, { result ->
- when (result) {
- is Result.Success -> getString(R.string.import_data_success).toast(this)
- is Result.Error -> getString(R.string.import_data_failure).toast(this)
- }
- })
- }
+// viewModel.setDefaultTleSources()
- private fun setupDrawer() {
- drawerBinding.drawerBtnLoc.setOnClickListener {
- viewModel.updatePosition()
- it.lockButton()
- }
- drawerBinding.drawerBtnTleFile.setOnClickListener {
- val openFileIntent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
- addCategory(Intent.CATEGORY_OPENABLE)
- type = "*/*"
- }
- startActivityForResult(openFileIntent, pickFileReqCode)
- mainBinding.drawerLayout.closeDrawers()
- it.lockButton()
- }
- drawerBinding.drawerBtnTleUrl.setOnClickListener {
- TleSourcesDialogFragment(viewModel.getTleSources()).apply {
- setSourcesListener(this@MainActivity)
- show(supportFragmentManager, "TleSourcesDialog")
- }
- mainBinding.drawerLayout.closeDrawers()
- it.lockButton()
- }
- drawerBinding.drawerBtnGithub.setOnClickListener {
- val gitHubUrl = "https://github.com/rt-bishop/LookingSat"
- val githubIntent = Intent(Intent.ACTION_VIEW, Uri.parse(gitHubUrl))
- startActivity(githubIntent)
- }
+// if (!hasPermissions(this, permissions)) {
+// ActivityCompat.requestPermissions(this, permissions, permissionsReqCode)
+// }
}
- override fun onSourcesSubmit(list: List<TleSource>) {
- viewModel.updateSatData(list)
- }
-
- private fun View.lockButton() {
- lifecycleScope.launch {
- delay(3000)
- }
- }
-
- private fun hasPermissions(context: Context, permissions: Array<String>): Boolean =
- permissions.all {
- ActivityCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED
- }
-
- override fun onSupportNavigateUp(): Boolean {
- val navController = findNavController(R.id.nav_host)
- return navController.navigateUp(appBarConfig) || super.onSupportNavigateUp()
- }
-
- override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
- if (requestCode == pickFileReqCode && resultCode == RESULT_OK) {
- data?.data?.also { uri ->
- viewModel.updateEntriesFromFile(uri)
- }
- } else {
- super.onActivityResult(requestCode, resultCode, data)
- }
- }
-}
+// private fun hasPermissions(context: Context, permissions: Array<String>): Boolean =
+// permissions.all {
+// ActivityCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED
+// }
+//
+// private fun openFile() {
+// val openFileIntent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
+// addCategory(Intent.CATEGORY_OPENABLE)
+// type = "*/*"
+// }
+// startActivityForResult(openFileIntent, pickFileReqCode)
+// }
+
+// private fun openSourcesDialog() {
+// TleSourcesDialogFragment(viewModel.getTleSources()).apply {
+// setSourcesListener(this@MainActivity)
+// show(supportFragmentManager, "TleSourcesDialog")
+// }
+// }
+
+// override fun onSourcesSubmit(list: List<TleSource>) {
+// viewModel.updateSatData(list)
+// }
+
+// override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+// if (requestCode == pickFileReqCode && resultCode == RESULT_OK) {
+// data?.data?.also { uri ->
+// viewModel.updateEntriesFromFile(uri)
+// }
+// } else {
+// super.onActivityResult(requestCode, resultCode, data)
+// }
+// }
+
+// private fun gotoGitHub() {
+// val gitHubUrl = "https://github.com/rt-bishop/LookingSat"
+// val githubIntent = Intent(Intent.ACTION_VIEW, Uri.parse(gitHubUrl))
+// startActivity(githubIntent)
+// }
+//
+// private fun View.lockButton() {
+// lifecycleScope.launch {
+// [email protected] = false
+// delay(3000)
+// }
+// }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/rtbishop/look4sat/ui/NavActivity.kt b/app/src/main/java/com/rtbishop/look4sat/ui/NavActivity.kt
deleted file mode 100644
index 11368458..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/ui/NavActivity.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.rtbishop.look4sat.ui
-
-import android.os.Bundle
-import androidx.appcompat.app.AppCompatActivity
-import androidx.navigation.fragment.NavHostFragment
-import androidx.navigation.ui.setupWithNavController
-import com.rtbishop.look4sat.R
-import com.rtbishop.look4sat.databinding.ActivityNavBinding
-
-class NavActivity : AppCompatActivity() {
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- val binding = ActivityNavBinding.inflate(layoutInflater)
- setContentView(binding.root)
- val navHost = supportFragmentManager.findFragmentById(R.id.nav_frag) as NavHostFragment
- binding.navBottom.setupWithNavController(navHost.navController)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/rtbishop/look4sat/ui/SharedViewModel.kt b/app/src/main/java/com/rtbishop/look4sat/ui/SharedViewModel.kt
index 3aae806e..ad2bad1f 100644
--- a/app/src/main/java/com/rtbishop/look4sat/ui/SharedViewModel.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/ui/SharedViewModel.kt
@@ -52,14 +52,12 @@ class SharedViewModel @Inject constructor(
fun getTransmittersForSat(id: Int) = liveData { emit(repository.getTransmittersByCatNum(id)) }
fun getPassList(): LiveData<Result<MutableList<SatPass>>> = _satPassList
- fun getUpdateStatus(): LiveData<Result<Int>> = _updateStatus
fun getGSP(): LiveData<Result<GroundStationPosition>> = _gsp
fun getCompass() = prefsManager.getCompass()
fun getRefreshRate() = prefsManager.getRefreshRate()
fun getHoursAhead() = prefsManager.getHoursAhead()
fun getMinElevation() = prefsManager.getMinElevation()
- fun setPositionFromPref() = _gsp.postValue(Result.Success(prefsManager.getPosition()))
suspend fun getAllEntries() = repository.getAllEntries()
fun setPassPrefs(hoursAhead: Int, minEl: Double) {
diff --git a/app/src/main/java/com/rtbishop/look4sat/ui/fragments/MapViewFragment.kt b/app/src/main/java/com/rtbishop/look4sat/ui/fragments/MapViewFragment.kt
deleted file mode 100644
index 106dd362..00000000
--- a/app/src/main/java/com/rtbishop/look4sat/ui/fragments/MapViewFragment.kt
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- * Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package com.rtbishop.look4sat.ui.fragments
-
-import android.os.Bundle
-import android.view.View
-import androidx.appcompat.app.AlertDialog
-import androidx.fragment.app.Fragment
-import androidx.fragment.app.FragmentActivity
-import androidx.lifecycle.ViewModelProvider
-import androidx.lifecycle.lifecycleScope
-import com.github.amsacode.predict4java.GroundStationPosition
-import com.github.amsacode.predict4java.TLE
-import com.rtbishop.look4sat.Look4SatApp
-import com.rtbishop.look4sat.R
-import com.rtbishop.look4sat.dagger.ViewModelFactory
-import com.rtbishop.look4sat.data.Result
-import com.rtbishop.look4sat.data.SatPass
-import com.rtbishop.look4sat.databinding.FragmentMapViewBinding
-import com.rtbishop.look4sat.ui.SharedViewModel
-import com.rtbishop.look4sat.ui.views.MapView
-import com.rtbishop.look4sat.utility.Extensions.toast
-import com.rtbishop.look4sat.utility.PassPredictor
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.launch
-import java.util.*
-import javax.inject.Inject
-
-class MapViewFragment : Fragment(R.layout.fragment_map_view) {
-
- @Inject
- lateinit var modelFactory: ViewModelFactory
- private lateinit var mainActivity: FragmentActivity
- private lateinit var viewModel: SharedViewModel
- private lateinit var mapView: MapView
- private lateinit var predictor: PassPredictor
- private lateinit var selectedSat: TLE
- private lateinit var binding: FragmentMapViewBinding
- private var gsp = GroundStationPosition(0.0, 0.0, 0.0)
- private var satPassList = emptyList<SatPass>()
- private var checkedItem = 0
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- binding = FragmentMapViewBinding.bind(view)
- mainActivity = requireActivity()
- (mainActivity.application as Look4SatApp).appComponent.inject(this)
- viewModel = ViewModelProvider(mainActivity, modelFactory).get(SharedViewModel::class.java)
- setupObservers(binding)
- }
-
- private fun setupObservers(binding: FragmentMapViewBinding) {
- viewModel.getGSP().observe(viewLifecycleOwner, { result ->
- when (result) {
- is Result.Success -> gsp = result.data
- }
- })
-
- viewModel.getPassList().observe(viewLifecycleOwner, { result ->
- when (result) {
- is Result.Success -> {
- satPassList = result.data
- setupMapView(binding)
- }
- }
- })
- }
-
- private fun setupMapView(binding: FragmentMapViewBinding) {
- if (satPassList.isNotEmpty()) {
- satPassList = satPassList.distinctBy { it.tle }
- satPassList = satPassList.sortedBy { it.tle.name }
- binding.fabMap.setOnClickListener { showSelectSatDialog(satPassList) }
- selectedSat = satPassList.first().tle
- predictor = satPassList.first().predictor
- mapView = MapView(mainActivity, gsp)
- mapView.setList(satPassList)
- mapView.setChecked(checkedItem)
- binding.frameMap.addView(mapView)
- refreshView()
- } else {
- binding.fabMap.setOnClickListener {
- getString(R.string.err_no_sat_selected).toast(mainActivity)
- }
- }
- }
-
- private fun refreshView() {
- lifecycleScope.launch {
- while (true) {
- mapView.invalidate()
- setDataToTextViews()
- delay(viewModel.getRefreshRate())
- }
- }
- }
-
- private fun showSelectSatDialog(list: List<SatPass>) {
- val tleArray = arrayOfNulls<String>(list.size).apply {
- list.withIndex().forEach {
- this[it.index] = it.value.tle.name
- }
- }
-
- val builder = AlertDialog.Builder(mainActivity)
- builder.setTitle(getString(R.string.dialog_show_track))
- .setSingleChoiceItems(tleArray, checkedItem) { dialog, which ->
- checkedItem = which
- selectedSat = list[which].tle
- predictor = list[which].predictor
- mapView.setChecked(checkedItem)
- mapView.invalidate()
- dialog.dismiss()
- }
- .create()
- .show()
- }
-
- private fun setDataToTextViews() {
- val currentTime = Date(System.currentTimeMillis())
- val position = predictor.getSatPos(currentTime)
- var lon = Math.toDegrees(position.longitude).toFloat()
- val lat = Math.toDegrees(position.latitude).toFloat()
- val rng = position.range
-
- if (lon > 180f) lon -= 360f
-
- binding.tvMapLat.text = String.format(mainActivity.getString(R.string.pat_latitude), lat)
- binding.tvMapLon.text = String.format(mainActivity.getString(R.string.pat_longitude), lon)
- binding.tvMapRng.text = String.format(mainActivity.getString(R.string.pat_distance), rng)
- }
-}
diff --git a/app/src/main/java/com/rtbishop/look4sat/ui/fragments/PassListFragment.kt b/app/src/main/java/com/rtbishop/look4sat/ui/fragments/PassListFragment.kt
index b359e199..53173f32 100644
--- a/app/src/main/java/com/rtbishop/look4sat/ui/fragments/PassListFragment.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/ui/fragments/PassListFragment.kt
@@ -21,13 +21,8 @@ package com.rtbishop.look4sat.ui.fragments
import android.os.Bundle
import android.os.CountDownTimer
-import android.view.LayoutInflater
import android.view.View
-import android.view.ViewGroup
import android.widget.EditText
-import android.widget.ImageButton
-import android.widget.TextView
-import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
@@ -44,7 +39,7 @@ import com.rtbishop.look4sat.data.SatPass
import com.rtbishop.look4sat.databinding.FragmentPassListBinding
import com.rtbishop.look4sat.ui.SharedViewModel
import com.rtbishop.look4sat.ui.adapters.SatPassAdapter
-import com.rtbishop.look4sat.utility.Extensions.toast
+import com.rtbishop.look4sat.utility.Extensions.snack
import com.rtbishop.look4sat.utility.PrefsManager
import kotlinx.coroutines.launch
import java.util.*
@@ -61,36 +56,23 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
private lateinit var viewModel: SharedViewModel
private lateinit var satPassAdapter: SatPassAdapter
- private lateinit var btnPassPrefs: ImageButton
private lateinit var aosTimer: CountDownTimer
- private lateinit var aosTimerText: TextView
private lateinit var mainActivity: FragmentActivity
+ private lateinit var binding: FragmentPassListBinding
private var isTimerSet: Boolean = false
private var satPassList: MutableList<SatPass> = mutableListOf()
- private var _binding: FragmentPassListBinding? = null
- private val binding get() = _binding!!
-
- override fun onCreateView(
- inflater: LayoutInflater,
- container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View? {
- _binding = FragmentPassListBinding.inflate(inflater, container, false)
- return binding.root
- }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity = requireActivity()
+ binding = FragmentPassListBinding.bind(view)
(mainActivity.application as Look4SatApp).appComponent.inject(this)
viewModel = ViewModelProvider(mainActivity, modelFactory).get(SharedViewModel::class.java)
satPassAdapter = SatPassAdapter(satPassList, prefsManager)
- aosTimerText = mainActivity.findViewById(R.id.toolbar_timer)
- btnPassPrefs = mainActivity.findViewById(R.id.toolbar_filter)
- setupObservers(binding)
- setupComponents(binding)
+ setupObservers()
+ setupComponents()
}
override fun onStart() {
@@ -100,7 +82,7 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
}
}
- private fun setupObservers(binding: FragmentPassListBinding) {
+ private fun setupObservers() {
viewModel.getPassList().observe(viewLifecycleOwner, { result ->
when (result) {
is Result.Success -> {
@@ -114,16 +96,16 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
binding.recPassList.visibility = View.INVISIBLE
}
setTimer()
- binding.refLayoutPassList.isRefreshing = false
+// binding.refLayoutPassList.isRefreshing = false
}
is Result.InProgress -> {
- binding.refLayoutPassList.isRefreshing = true
+// binding.refLayoutPassList.isRefreshing = true
}
}
})
}
- private fun setupComponents(binding: FragmentPassListBinding) {
+ private fun setupComponents() {
binding.recPassList.apply {
layoutManager = LinearLayoutManager(mainActivity)
adapter = satPassAdapter
@@ -133,17 +115,17 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
satPassAdapter.setList(satPassList)
setTimer()
- binding.refLayoutPassList.setProgressBackgroundColorSchemeResource(R.color.themeAccent)
- binding.refLayoutPassList.setColorSchemeResources(R.color.backgroundDark)
- binding.refLayoutPassList.setOnRefreshListener { viewModel.calculatePasses() }
- btnPassPrefs.setOnClickListener {
+// binding.refLayoutPassList.setProgressBackgroundColorSchemeResource(R.color.themeAccent)
+// binding.refLayoutPassList.setColorSchemeResources(R.color.backgroundDark)
+// binding.refLayoutPassList.setOnRefreshListener { viewModel.calculatePasses() }
+ binding.toolbarFilter.setOnClickListener {
showSatPassPrefsDialog(viewModel.getHoursAhead(), viewModel.getMinElevation())
}
binding.fabSatSelect.setOnClickListener {
lifecycleScope.launch {
val list = viewModel.getAllEntries() as MutableList
if (list.isEmpty()) {
- getString(R.string.err_update_data).toast(mainActivity, Toast.LENGTH_SHORT)
+ getString(R.string.err_update_data).snack(requireView())
} else {
showSelectSatDialog(list)
}
@@ -167,23 +149,17 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
val elevation = elevationStr.toDouble()
when {
hours < 1 || hours > 168 -> {
- getString(R.string.pref_hours_ahead_input_error).toast(
- mainActivity,
- Toast.LENGTH_SHORT
- )
+ getString(R.string.pref_hours_ahead_input_error).snack(requireView())
}
elevation < 0 || elevation > 90 -> {
- getString(R.string.pref_min_el_input_error).toast(
- mainActivity,
- Toast.LENGTH_SHORT
- )
+ getString(R.string.pref_min_el_input_error).snack(requireView())
}
else -> {
viewModel.setPassPrefs(hours, elevation)
viewModel.calculatePasses()
}
}
- } else getString(R.string.err_enter_value).toast(mainActivity, Toast.LENGTH_SHORT)
+ } else getString(R.string.err_enter_value).snack(requireView())
}
setNegativeButton(getString(android.R.string.cancel)) { dialog, _ ->
@@ -234,7 +210,7 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
}
override fun onTick(millisUntilFinished: Long) {
- aosTimerText.text = String.format(
+ binding.toolbarTimer.text = String.format(
mainActivity.getString(R.string.pat_timer),
TimeUnit.MILLISECONDS.toHours(millisUntilFinished) % 60,
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % 60,
@@ -254,7 +230,7 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
}
override fun onTick(millisUntilFinished: Long) {
- aosTimerText.text = String.format(
+ binding.toolbarTimer.text = String.format(
mainActivity.getString(R.string.pat_timer),
TimeUnit.MILLISECONDS.toHours(millisUntilFinished) % 60,
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % 60,
@@ -270,12 +246,7 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
aosTimer.cancel()
isTimerSet = false
}
- if (resetToNull) aosTimerText.text =
+ if (resetToNull) binding.toolbarTimer.text =
String.format(getString(R.string.pat_timer), 0, 0, 0)
}
-
- override fun onDestroyView() {
- super.onDestroyView()
- _binding = null
- }
}
diff --git a/app/src/main/java/com/rtbishop/look4sat/ui/fragments/PreferencesFragment.kt b/app/src/main/java/com/rtbishop/look4sat/ui/fragments/PreferencesFragment.kt
index 1a755a95..c40ff994 100644
--- a/app/src/main/java/com/rtbishop/look4sat/ui/fragments/PreferencesFragment.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/ui/fragments/PreferencesFragment.kt
@@ -22,19 +22,14 @@ package com.rtbishop.look4sat.ui.fragments
import android.content.SharedPreferences
import android.os.Bundle
import android.text.InputType
-import androidx.fragment.app.FragmentActivity
-import androidx.lifecycle.ViewModelProvider
import androidx.preference.EditTextPreference
import androidx.preference.PreferenceFragmentCompat
import com.rtbishop.look4sat.R
-import com.rtbishop.look4sat.ui.SharedViewModel
-import com.rtbishop.look4sat.utility.Extensions.toast
+import com.rtbishop.look4sat.utility.Extensions.snack
class PreferencesFragment : PreferenceFragmentCompat(),
SharedPreferences.OnSharedPreferenceChangeListener {
- private lateinit var mainActivity: FragmentActivity
- private lateinit var viewModel: SharedViewModel
private lateinit var keyLat: String
private lateinit var keyLon: String
private lateinit var keyAlt: String
@@ -43,14 +38,10 @@ class PreferencesFragment : PreferenceFragmentCompat(),
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preference, rootKey)
val provider = EditTextPreference.SimpleSummaryProvider.getInstance()
-
- mainActivity = requireActivity()
- viewModel = ViewModelProvider(mainActivity).get(SharedViewModel::class.java)
-
- keyLat = mainActivity.getString(R.string.pref_lat_key)
- keyLon = mainActivity.getString(R.string.pref_lon_key)
- keyAlt = mainActivity.getString(R.string.pref_alt_key)
- keyDelay = mainActivity.getString(R.string.pref_refresh_rate_key)
+ keyLat = preferenceManager.context.getString(R.string.pref_lat_key)
+ keyLon = preferenceManager.context.getString(R.string.pref_lon_key)
+ keyAlt = preferenceManager.context.getString(R.string.pref_alt_key)
+ keyDelay = preferenceManager.context.getString(R.string.pref_refresh_rate_key)
findPreference<EditTextPreference>(keyLat)?.apply {
summaryProvider = provider
@@ -62,7 +53,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
setOnPreferenceChangeListener { _, newValue ->
val valueStr = newValue.toString()
if (valueStr.isEmpty() || valueStr == "-" || valueStr.toDouble() < -90.0 || valueStr.toDouble() > 90.0) {
- getString(R.string.pref_lat_input_error).toast(mainActivity)
+ getString(R.string.pref_lat_input_error).snack(requireView())
return@setOnPreferenceChangeListener false
}
return@setOnPreferenceChangeListener true
@@ -79,7 +70,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
setOnPreferenceChangeListener { _, newValue ->
val valueStr = newValue.toString()
if (valueStr.isEmpty() || valueStr == "-" || valueStr.toDouble() < -180.0 || valueStr.toDouble() > 180.0) {
- getString(R.string.pref_lon_input_error).toast(mainActivity)
+ getString(R.string.pref_lon_input_error).snack(requireView())
return@setOnPreferenceChangeListener false
}
return@setOnPreferenceChangeListener true
@@ -96,7 +87,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
setOnPreferenceChangeListener { _, newValue ->
val valueStr = newValue.toString()
if (valueStr.isEmpty() || valueStr == "-" || valueStr.toDouble() < -413.0 || valueStr.toDouble() > 8850.0) {
- getString(R.string.pref_alt_input_error).toast(mainActivity)
+ getString(R.string.pref_alt_input_error).snack(requireView())
return@setOnPreferenceChangeListener false
}
return@setOnPreferenceChangeListener true
@@ -109,7 +100,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
setOnPreferenceChangeListener { _, newValue ->
val valueStr = newValue.toString()
if (valueStr.isEmpty() || valueStr.toLong() < 250 || valueStr.toLong() > 10000) {
- getString(R.string.pref_refresh_rate_input_error).toast(mainActivity)
+ getString(R.string.pref_refresh_rate_input_error).snack(requireView())
return@setOnPreferenceChangeListener false
}
return@setOnPreferenceChangeListener true
@@ -117,9 +108,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
}
}
- override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
- if (key == keyLat || key == keyLon || key == keyAlt) viewModel.setPositionFromPref()
- }
+ override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {}
override fun onResume() {
super.onResume()
diff --git a/app/src/main/java/com/rtbishop/look4sat/utility/Extensions.kt b/app/src/main/java/com/rtbishop/look4sat/utility/Extensions.kt
index fe32e8be..8e129401 100644
--- a/app/src/main/java/com/rtbishop/look4sat/utility/Extensions.kt
+++ b/app/src/main/java/com/rtbishop/look4sat/utility/Extensions.kt
@@ -1,11 +1,11 @@
package com.rtbishop.look4sat.utility
-import android.content.Context
-import android.widget.Toast
+import android.view.View
+import com.google.android.material.snackbar.Snackbar
object Extensions {
- fun String.toast(context: Context, duration: Int = Toast.LENGTH_SHORT): Toast {
- return Toast.makeText(context, this, duration).apply { show() }
+ fun String.snack(view: View) {
+ Snackbar.make(view, this, Snackbar.LENGTH_SHORT).show()
}
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-nodpi/worldmap_bg_dark.webp b/app/src/main/res/drawable-nodpi/worldmap_bg_dark.webp
deleted file mode 100644
index 9f19b71b..00000000
Binary files a/app/src/main/res/drawable-nodpi/worldmap_bg_dark.webp and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_about.xml b/app/src/main/res/drawable/ic_about.xml
deleted file mode 100644
index f6a43e79..00000000
--- a/app/src/main/res/drawable/ic_about.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#C0C0C0"
- android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z" />
-</vector>
diff --git a/app/src/main/res/drawable/ic_sat_asc_right.xml b/app/src/main/res/drawable/ic_sat_asc_right.xml
deleted file mode 100644
index 72d3d41e..00000000
--- a/app/src/main/res/drawable/ic_sat_asc_right.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:width="128dp"
- android:height="128dp"
- android:viewportWidth="128"
- android:viewportHeight="128">
- <path
- android:fillAlpha="1"
- android:fillColor="#FF000000"
- android:fillType="evenOdd"
- android:pathData="m22.862,13.879a2.864,2.864 90,0 0,-1.701 0.85l-19.334,19.331a2.864,2.864 90,0 0,0 4.027l26.584,26.625a2.864,2.864 90,0 0,1.835 0.805l7.922,0.626 -5.773,5.772a2.864,2.864 90,0 0,0 4.027l19.602,19.644a2.864,2.864 90,0 0,4.073 0l5.773,-5.772 0.627,7.92a2.864,2.864 90,0 0,0.805 1.835l26.629,26.58a2.864,2.864 90,0 0,4.073 0l19.289,-19.286a2.864,2.864 90,0 0,0 -4.072l-26.584,-26.625a2.864,2.864 90,0 0,-1.835 -0.805l-7.922,-0.626 5.773,-5.772a2.864,2.864 90,0 0,0 -4.072l-19.603,-19.599a2.864,2.864 90,0 0,-4.073 0l-5.773,5.772 -0.626,-7.92a2.864,2.864 90,0 0,-0.806 -1.835l-26.629,-26.58a2.864,2.864 90,0 0,-2.059 -0.85,2.864 2.864,90 0,0 -0.269,0zM23.175,20.77 L47.03,44.62 47.835,55.315 42.42,60.729 31.724,59.879 7.87,36.074zM72.674,80.15 L83.371,81 107.225,104.806 91.919,120.109 68.109,96.259 67.259,85.564z"
- android:strokeColor="#00000000"
- tools:ignore="VectorPath" />
- <path
- android:fillAlpha="1"
- android:fillColor="#FF000000"
- android:fillType="evenOdd"
- android:pathData="m65.347,12.194a2.864,2.864 90,1 0,0 5.727c11.457,0 22.876,4.351 31.634,13.107 8.741,8.74 13.095,20.174 13.095,31.614a2.864,2.864 90,1 0,5.728 0c0,-12.897 -4.935,-25.829 -14.773,-35.664 -9.85,-9.848 -22.772,-14.785 -35.684,-14.785z"
- android:strokeColor="#00000000" />
- <path
- android:fillAlpha="1"
- android:fillColor="#FF000000"
- android:fillType="evenOdd"
- android:pathData="m65.347,1a2.864,2.864 90,1 0,0 5.727c14.325,0 28.612,5.441 39.547,16.375 10.935,10.933 16.378,25.233 16.378,39.541a2.864,2.864 90,1 0,5.728 0c0,-15.763 -6.025,-31.562 -18.055,-43.59 -12.029,-12.028 -27.818,-18.052 -43.597,-18.052z"
- android:strokeColor="#00000000" />
- <path
- android:fillAlpha="1"
- android:fillColor="#FF000000"
- android:fillType="evenOdd"
- android:pathData="m65.347,23.302a2.864,2.864 90,1 0,0 5.727c8.62,0 17.201,3.263 23.778,9.839 6.577,6.576 9.855,15.174 9.855,23.774a2.864,2.864 90,1 0,5.728 0c0,-10.061 -3.861,-20.153 -11.533,-27.824 -7.672,-7.671 -17.756,-11.517 -27.829,-11.517z"
- android:strokeColor="#00000000" />
- <path
- android:fillAlpha="1"
- android:fillColor="#FF000000"
- android:fillType="evenOdd"
- android:pathData="m65.347,34.525a2.864,2.864 90,1 0,0 5.727c5.737,0 11.453,2.174 15.836,6.557 4.384,4.383 6.558,10.098 6.558,15.834a2.864,2.864 90,1 0,5.728 0c0,-7.192 -2.757,-14.406 -8.236,-19.883 -5.479,-5.478 -12.693,-8.234 -19.887,-8.234z"
- android:strokeColor="#00000000" />
-</vector>
diff --git a/app/src/main/res/drawable/ic_sat_desc_left.xml b/app/src/main/res/drawable/ic_sat_desc_left.xml
deleted file mode 100644
index 8dc1f5c7..00000000
--- a/app/src/main/res/drawable/ic_sat_desc_left.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:width="128dp"
- android:height="128dp"
- android:viewportWidth="128"
- android:viewportHeight="128">
- <path
- android:fillAlpha="1"
- android:fillColor="#C0C0C0"
- android:fillType="evenOdd"
- android:pathData="m105.138,114.121a2.864,2.864 90,0 0,1.701 -0.85l19.334,-19.331a2.864,2.864 90,0 0,-0 -4.027l-26.584,-26.625a2.864,2.864 90,0 0,-1.835 -0.805l-7.922,-0.626 5.773,-5.772a2.864,2.864 90,0 0,-0 -4.027l-19.602,-19.644a2.864,2.864 90,0 0,-4.073 -0l-5.773,5.772 -0.627,-7.92a2.864,2.864 90,0 0,-0.805 -1.835l-26.629,-26.58a2.864,2.864 90,0 0,-4.073 -0l-19.289,19.286a2.864,2.864 90,0 0,-0 4.072l26.584,26.625a2.864,2.864 90,0 0,1.835 0.805l7.922,0.626 -5.773,5.772a2.864,2.864 90,0 0,-0 4.072l19.603,19.599a2.864,2.864 90,0 0,4.073 -0l5.773,-5.772 0.626,7.92a2.864,2.864 90,0 0,0.806 1.835l26.629,26.58a2.864,2.864 90,0 0,2.059 0.85,2.864 2.864,90 0,0 0.269,-0zM104.825,107.23 L80.97,83.38 80.165,72.685 85.58,67.271 96.276,68.121 120.13,91.926zM55.326,47.85 L44.629,47 20.775,23.194 36.081,7.891 59.891,31.741 60.741,42.436z"
- android:strokeColor="#00000000"
- tools:ignore="VectorPath" />
- <path
- android:fillAlpha="1"
- android:fillColor="#FFE082"
- android:fillType="evenOdd"
- android:pathData="m62.653,115.806a2.864,2.864 90,1 0,-0 -5.727c-11.457,-0 -22.876,-4.351 -31.634,-13.107 -8.741,-8.74 -13.095,-20.174 -13.095,-31.614a2.864,2.864 90,1 0,-5.728 -0c-0,12.897 4.935,25.829 14.773,35.664 9.85,9.848 22.772,14.785 35.684,14.785z"
- android:strokeColor="#00000000" />
- <path
- android:fillAlpha="1"
- android:fillColor="#FFE082"
- android:fillType="evenOdd"
- android:pathData="m62.653,127a2.864,2.864 90,1 0,-0 -5.727c-14.325,-0 -28.612,-5.441 -39.547,-16.375 -10.935,-10.933 -16.378,-25.233 -16.378,-39.541a2.864,2.864 90,1 0,-5.728 -0c-0,15.763 6.025,31.562 18.055,43.59 12.029,12.028 27.818,18.052 43.597,18.052z"
- android:strokeColor="#00000000" />
- <path
- android:fillAlpha="1"
- android:fillColor="#FFE082"
- android:fillType="evenOdd"
- android:pathData="m62.653,104.698a2.864,2.864 90,1 0,-0 -5.727c-8.62,-0 -17.201,-3.263 -23.778,-9.839 -6.577,-6.576 -9.855,-15.174 -9.855,-23.774a2.864,2.864 90,1 0,-5.728 -0c-0,10.061 3.861,20.153 11.533,27.824 7.672,7.671 17.756,11.517 27.829,11.517z"
- android:strokeColor="#00000000" />
- <path
- android:fillAlpha="1"
- android:fillColor="#FFE082"
- android:fillType="evenOdd"
- android:pathData="m62.653,93.475a2.864,2.864 90,1 0,-0 -5.727c-5.737,-0 -11.453,-2.174 -15.836,-6.557 -4.384,-4.383 -6.558,-10.098 -6.558,-15.834a2.864,2.864 90,1 0,-5.728 -0c-0,7.192 2.757,14.406 8.236,19.883 5.479,5.478 12.693,8.234 19.887,8.234z"
- android:strokeColor="#00000000" />
-</vector>
diff --git a/app/src/main/res/drawable/ic_update_loc.xml b/app/src/main/res/drawable/ic_update_loc.xml
deleted file mode 100644
index a18d30c0..00000000
--- a/app/src/main/res/drawable/ic_update_loc.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="32dp"
- android:height="32dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="@color/themeIcon"
- android:pathData="M12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94L13,1h-2v2.06C6.83,3.52 3.52,6.83 3.06,11L1,11v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94L11,23h2v-2.06c4.17,-0.46 7.48,-3.77 7.94,-7.94L23,13v-2h-2.06zM12,19c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z" />
-</vector>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 81a29d70..386dec1d 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,44 +1,38 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/drawer_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true"
- tools:openDrawer="start">
+ android:layout_height="match_parent">
- <include
- android:id="@+id/include_app_bar"
- layout="@layout/app_bar_main"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ <androidx.coordinatorlayout.widget.CoordinatorLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toTopOf="@+id/nav_bottom"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <androidx.fragment.app.FragmentContainerView
+ android:id="@+id/nav_frag"
+ android:name="androidx.navigation.fragment.NavHostFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:defaultNavHost="true"
+ app:navGraph="@navigation/nav_graph" />
- <com.google.android.material.navigation.NavigationView
- android:id="@+id/nav_view"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="start"
- android:fitsSystemWindows="true"
- app:headerLayout="@layout/drawer_header"
- app:menu="@menu/drawer_menu" />
+ </androidx.coordinatorlayout.widget.CoordinatorLayout>
+
+ <com.google.android.material.bottomnavigation.BottomNavigationView
+ android:id="@+id/nav_bottom"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ app:itemIconSize="24dp"
+ app:itemIconTint="@color/nav_item_selector"
+ app:itemTextColor="@color/nav_item_selector"
+ app:labelVisibilityMode="selected"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:menu="@menu/nav_menu" />
-</androidx.drawerlayout.widget.DrawerLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_nav.xml b/app/src/main/res/layout/activity_nav.xml
deleted file mode 100644
index 0793a628..00000000
--- a/app/src/main/res/layout/activity_nav.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <androidx.coordinatorlayout.widget.CoordinatorLayout
- android:layout_width="0dp"
- android:layout_height="0dp"
- app:layout_constraintBottom_toTopOf="@+id/nav_bottom"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent">
-
- <androidx.fragment.app.FragmentContainerView
- android:id="@+id/nav_frag"
- android:name="androidx.navigation.fragment.NavHostFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:defaultNavHost="true"
- app:navGraph="@navigation/temp_graph" />
-
- </androidx.coordinatorlayout.widget.CoordinatorLayout>
-
- <com.google.android.material.bottomnavigation.BottomNavigationView
- android:id="@+id/nav_bottom"
- android:layout_width="match_parent"
- android:layout_height="48dp"
- app:itemIconSize="24dp"
- app:itemIconTint="@color/nav_item_selector"
- app:itemTextColor="@color/nav_item_selector"
- app:labelVisibilityMode="selected"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:menu="@menu/nav_menu" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml
deleted file mode 100644
index 084d2b76..00000000
--- a/app/src/main/res/layout/app_bar_main.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".ui.MainActivity">
-
- <com.google.android.material.appbar.AppBarLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <androidx.appcompat.widget.Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize"
- app:titleTextColor="@color/themeAccent">
-
- <androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/toolbar_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <TextView
- android:id="@+id/toolbar_timer"
- style="@style/ToolbarText"
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_marginEnd="24dp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/toolbar_filter"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- <ImageButton
- android:id="@+id/toolbar_filter"
- style="@style/ToolbarButton"
- android:contentDescription="@string/placeholder"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- </androidx.constraintlayout.widget.ConstraintLayout>
-
- </androidx.appcompat.widget.Toolbar>
-
- </com.google.android.material.appbar.AppBarLayout>
-
- <include
- android:id="@+id/include_main_content"
- layout="@layout/content_main" />
-
-</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
deleted file mode 100644
index 7c17bae1..00000000
--- a/app/src/main/res/layout/content_main.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:layout_behavior="@string/appbar_scrolling_view_behavior"
- tools:showIn="@layout/app_bar_main">
-
- <fragment
- android:id="@+id/nav_host"
- android:name="androidx.navigation.fragment.NavHostFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:defaultNavHost="true"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintLeft_toLeftOf="parent"
- app:layout_constraintRight_toRightOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:navGraph="@navigation/nav_graph"
- tools:ignore="FragmentTagUsage" />
-</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/layout/drawer_header.xml b/app/src/main/res/layout/drawer_header.xml
deleted file mode 100644
index 6334e909..00000000
--- a/app/src/main/res/layout/drawer_header.xml
+++ /dev/null
@@ -1,176 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/drawer_layout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/ic_launcher_background"
- android:theme="@style/ThemeOverlay.AppCompat.Dark">
-
- <TextView
- android:id="@+id/drawer_title"
- style="@style/DrawerHeader.Title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="4dp"
- android:text="@string/drawer_title"
- app:layout_constraintEnd_toStartOf="@+id/drawer_sat_img"
- app:layout_constraintHorizontal_bias="0.5"
- app:layout_constraintHorizontal_chainStyle="spread_inside"
- app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
- app:layout_constraintTop_toTopOf="@+id/guidelineTop" />
-
- <ImageView
- android:id="@+id/drawer_sat_img"
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="4dp"
- android:layout_marginBottom="4dp"
- android:contentDescription="@string/app_name"
- app:layout_constraintBottom_toBottomOf="@+id/drawer_title"
- app:layout_constraintDimensionRatio="1:1"
- app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
- app:layout_constraintHorizontal_bias="0.5"
- app:layout_constraintStart_toEndOf="@+id/drawer_title"
- app:layout_constraintTop_toTopOf="@+id/drawer_title"
- app:srcCompat="@drawable/ic_sat_desc_left" />
-
- <TextView
- android:id="@+id/drawer_lat"
- style="@style/DrawerHeader.Item"
- android:layout_marginStart="4dp"
- android:text="@string/drawer_lat_text"
- app:layout_constraintBaseline_toBaselineOf="@+id/drawer_lat_value"
- app:layout_constraintStart_toStartOf="@+id/guidelineLeft" />
-
- <TextView
- android:id="@+id/drawer_lat_value"
- style="@style/DrawerHeader.ItemValue"
- android:layout_width="wrap_content"
- android:layout_marginTop="4dp"
- android:text="@string/pat_location"
- app:layout_constraintStart_toStartOf="@+id/drawer_lon_value"
- app:layout_constraintTop_toBottomOf="@+id/drawer_sat_img" />
-
- <TextView
- android:id="@+id/drawer_lon"
- style="@style/DrawerHeader.Item"
- android:layout_marginStart="4dp"
- android:text="@string/drawer_lon_text"
- app:layout_constraintBaseline_toBaselineOf="@+id/drawer_lon_value"
- app:layout_constraintStart_toStartOf="@+id/guidelineLeft" />
-
- <TextView
- android:id="@+id/drawer_lon_value"
- style="@style/DrawerHeader.ItemValue"
- android:layout_width="wrap_content"
- android:text="@string/pat_location"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.1"
- app:layout_constraintStart_toEndOf="@+id/mainBarrier"
- app:layout_constraintTop_toBottomOf="@+id/drawer_lat_value" />
-
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/drawer_btn_loc"
- style="@style/DrawerHeader.Button"
- android:layout_width="0dp"
- android:drawableEnd="@drawable/ic_update_loc"
- android:text="@string/update_loc"
- app:layout_constraintBottom_toTopOf="@+id/drawer_btn_tle_file"
- app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
- app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
- app:layout_constraintTop_toBottomOf="@+id/drawer_lon_value" />
-
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/drawer_btn_tle_file"
- style="@style/DrawerHeader.Button"
- android:layout_width="0dp"
- android:drawableEnd="@drawable/ic_file_open"
- android:text="@string/import_data_file"
- app:layout_constraintBottom_toTopOf="@+id/drawer_btn_tle_url"
- app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
- app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
- app:layout_constraintTop_toBottomOf="@+id/drawer_btn_loc" />
-
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/drawer_btn_tle_url"
- style="@style/DrawerHeader.Button"
- android:layout_width="0dp"
- android:drawableEnd="@drawable/ic_update_tle"
- android:text="@string/import_data_web"
- app:layout_constraintBottom_toTopOf="@+id/drawer_btn_github"
- app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
- app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
- app:layout_constraintTop_toBottomOf="@+id/drawer_btn_tle_file" />
-
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/drawer_btn_github"
- style="@style/DrawerHeader.Button"
- android:layout_width="0dp"
- android:drawableEnd="@drawable/ic_goto_github"
- android:text="@string/goto_github"
- app:layout_constraintBottom_toTopOf="@+id/guidelineBottom"
- app:layout_constraintEnd_toStartOf="@+id/guidelineRight"
- app:layout_constraintHorizontal_bias="0.5"
- app:layout_constraintHorizontal_chainStyle="spread_inside"
- app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
- app:layout_constraintTop_toBottomOf="@+id/drawer_btn_tle_url" />
-
- <androidx.constraintlayout.widget.Barrier
- android:id="@+id/mainBarrier"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:barrierDirection="end"
- app:constraint_referenced_ids="drawer_lat,drawer_lon"
- tools:layout_editor_absoluteX="101dp"
- tools:layout_editor_absoluteY="8dp" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guidelineTop"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- app:layout_constraintGuide_begin="24dp" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guidelineLeft"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- app:layout_constraintGuide_begin="6dp" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guidelineRight"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- app:layout_constraintGuide_end="6dp" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guidelineBottom"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- app:layout_constraintGuide_end="6dp" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/layout/fragment_map_view.xml b/app/src/main/res/layout/fragment_map_view.xml
deleted file mode 100644
index b741447c..00000000
--- a/app/src/main/res/layout/fragment_map_view.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".ui.fragments.MapViewFragment">
-
- <FrameLayout
- android:id="@+id/frameMap"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/worldmap_bg_dark"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- <com.google.android.material.floatingactionbutton.FloatingActionButton
- android:id="@+id/fabMap"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|start"
- android:layout_marginStart="8dp"
- android:layout_marginBottom="8dp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:srcCompat="@drawable/ic_sat_asc_right" />
-
- <TextView
- android:id="@+id/tvMapLat"
- style="@style/MapText"
- android:layout_marginStart="4dp"
- android:layout_marginTop="4dp"
- android:text="@string/pat_latitude"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- <TextView
- android:id="@+id/tvMapLon"
- style="@style/MapText"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="4dp"
- android:text="@string/pat_longitude"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- <TextView
- android:id="@+id/tvMapRng"
- style="@style/MapText"
- android:layout_marginEnd="4dp"
- android:layout_marginBottom="4dp"
- android:text="@string/pat_distance"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/layout/fragment_pass_list.xml b/app/src/main/res/layout/fragment_pass_list.xml
index f6f8e8a1..6b4cc68d 100644
--- a/app/src/main/res/layout/fragment_pass_list.xml
+++ b/app/src/main/res/layout/fragment_pass_list.xml
@@ -17,151 +17,189 @@
~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-->
-<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/refLayoutPassList"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <androidx.constraintlayout.widget.ConstraintLayout
+ <com.google.android.material.appbar.AppBarLayout
+ android:id="@+id/appBarLayout"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="wrap_content"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <androidx.appcompat.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ app:titleTextColor="@color/themeAccent">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/toolbar_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/toolbar_timer"
+ style="@style/ToolbarText"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_marginEnd="16dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="@+id/toolbar_filter"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <ImageButton
+ android:id="@+id/toolbar_filter"
+ style="@style/ToolbarButton"
+ android:contentDescription="@string/placeholder"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+ </androidx.appcompat.widget.Toolbar>
+
+ </com.google.android.material.appbar.AppBarLayout>
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/recPassList"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:paddingBottom="4dp"
+ android:visibility="invisible"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/appBarLayout">
+
+ </androidx.recyclerview.widget.RecyclerView>
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/recPassList"
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/layoutInfo"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:visibility="visible"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/appBarLayout">
+
+ <ImageView
+ android:id="@+id/imgInfoSwipe"
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:contentDescription="@string/placeholder"
+ app:layout_constraintEnd_toStartOf="@+id/guideRight"
+ app:layout_constraintStart_toStartOf="@+id/guideLeft"
+ app:layout_constraintTop_toTopOf="@+id/guideTop"
+ app:srcCompat="@drawable/ic_arrow_swipe" />
+
+ <TextView
+ android:id="@+id/tvInfoSwipe"
+ style="@style/PassInfoText"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:gravity="center"
+ android:text="@string/info_swipe_text"
+ app:layout_constraintEnd_toStartOf="@+id/guideRight"
+ app:layout_constraintStart_toStartOf="@+id/guideLeft"
+ app:layout_constraintTop_toBottomOf="@+id/imgInfoSwipe" />
+
+ <ImageView
+ android:id="@+id/imgInfoSputnik"
android:layout_width="0dp"
android:layout_height="0dp"
- android:paddingBottom="4dp"
- android:visibility="invisible"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent">
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="16dp"
+ android:layout_marginEnd="16dp"
+ android:layout_marginBottom="16dp"
+ android:contentDescription="@string/placeholder"
+ app:layout_constraintBottom_toTopOf="@+id/tvInfoMain"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintEnd_toStartOf="@+id/guideRight"
+ app:layout_constraintStart_toStartOf="@+id/guideLeft"
+ app:layout_constraintTop_toBottomOf="@+id/tvInfoSwipe"
+ app:layout_constraintVertical_chainStyle="packed"
+ app:srcCompat="@drawable/ic_sputnik" />
+
+ <TextView
+ android:id="@+id/tvInfoMain"
+ style="@style/PassInfoText"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:text="@string/info_main_text"
+ app:layout_constraintBottom_toTopOf="@+id/tvSatSelect"
+ app:layout_constraintEnd_toStartOf="@+id/guideRight"
+ app:layout_constraintStart_toStartOf="@+id/guideLeft"
+ app:layout_constraintTop_toTopOf="@+id/guideCenter"
+ app:layout_constraintVertical_bias="0.32"
+ app:layout_constraintVertical_chainStyle="spread" />
+
+ <TextView
+ android:id="@+id/tvSatSelect"
+ style="@style/PassInfoText"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="64dp"
+ android:text="@string/info_select_text"
+ app:layout_constraintBottom_toTopOf="@+id/guideBottom"
+ app:layout_constraintEnd_toStartOf="@+id/guideRight"
+ app:layout_constraintStart_toStartOf="@+id/guideLeft" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideTop"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_begin="24dp" />
- </androidx.recyclerview.widget.RecyclerView>
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideLeft"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_begin="16dp" />
- <androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/layoutInfo"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="visible"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent">
-
- <ImageView
- android:id="@+id/imgInfoSwipe"
- android:layout_width="36dp"
- android:layout_height="36dp"
- android:contentDescription="@string/placeholder"
- app:layout_constraintEnd_toStartOf="@+id/guideRight"
- app:layout_constraintStart_toStartOf="@+id/guideLeft"
- app:layout_constraintTop_toTopOf="@+id/guideTop"
- app:srcCompat="@drawable/ic_arrow_swipe" />
-
- <TextView
- android:id="@+id/tvInfoSwipe"
- style="@style/PassInfoText"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:gravity="center"
- android:text="@string/info_swipe_text"
- app:layout_constraintEnd_toStartOf="@+id/guideRight"
- app:layout_constraintStart_toStartOf="@+id/guideLeft"
- app:layout_constraintTop_toBottomOf="@+id/imgInfoSwipe" />
-
- <ImageView
- android:id="@+id/imgInfoSputnik"
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_marginStart="16dp"
- android:layout_marginTop="16dp"
- android:layout_marginEnd="16dp"
- android:layout_marginBottom="16dp"
- android:contentDescription="@string/placeholder"
- app:layout_constraintBottom_toTopOf="@+id/tvInfoMain"
- app:layout_constraintDimensionRatio="1:1"
- app:layout_constraintEnd_toStartOf="@+id/guideRight"
- app:layout_constraintStart_toStartOf="@+id/guideLeft"
- app:layout_constraintTop_toBottomOf="@+id/tvInfoSwipe"
- app:layout_constraintVertical_chainStyle="packed"
- app:srcCompat="@drawable/ic_sputnik" />
-
- <TextView
- android:id="@+id/tvInfoMain"
- style="@style/PassInfoText"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="@string/info_main_text"
- app:layout_constraintBottom_toTopOf="@+id/tvSatSelect"
- app:layout_constraintEnd_toStartOf="@+id/guideRight"
- app:layout_constraintStart_toStartOf="@+id/guideLeft"
- app:layout_constraintTop_toTopOf="@+id/guideCenter"
- app:layout_constraintVertical_bias="0.32"
- app:layout_constraintVertical_chainStyle="spread" />
-
- <TextView
- android:id="@+id/tvSatSelect"
- style="@style/PassInfoText"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_marginEnd="64dp"
- android:text="@string/info_select_text"
- app:layout_constraintBottom_toTopOf="@+id/guideBottom"
- app:layout_constraintEnd_toStartOf="@+id/guideRight"
- app:layout_constraintStart_toStartOf="@+id/guideLeft" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guideTop"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- app:layout_constraintGuide_begin="24dp" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guideLeft"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- app:layout_constraintGuide_begin="16dp" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guideCenter"
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:orientation="horizontal"
- app:layout_constraintGuide_percent="0.5" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guideRight"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- app:layout_constraintGuide_end="16dp" />
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guideBottom"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- app:layout_constraintGuide_end="16dp" />
-
- </androidx.constraintlayout.widget.ConstraintLayout>
-
- <com.google.android.material.floatingactionbutton.FloatingActionButton
- android:id="@+id/fabSatSelect"
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideCenter"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_percent="0.5" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom|end"
- android:layout_marginEnd="16dp"
- android:layout_marginBottom="16dp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:srcCompat="@drawable/ic_sat_asc_left" />
+ android:orientation="vertical"
+ app:layout_constraintGuide_end="16dp" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideBottom"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_end="16dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
-</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+ <com.google.android.material.floatingactionbutton.FloatingActionButton
+ android:id="@+id/fabSatSelect"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|end"
+ android:layout_marginEnd="16dp"
+ android:layout_marginBottom="16dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:srcCompat="@drawable/ic_sat_asc_left" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/menu/drawer_menu.xml b/app/src/main/res/menu/drawer_menu.xml
deleted file mode 100644
index 0755c453..00000000
--- a/app/src/main/res/menu/drawer_menu.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
- ~ Copyright (C) 2019, 2020 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 2 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, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- -->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- tools:showIn="navigation_view">
-
- <group android:checkableBehavior="single">
- <item
- android:id="@+id/nav_pass_list"
- android:icon="@drawable/ic_sat_asc_right"
- android:title="@string/menu_pass_list" />
- <item
- android:id="@+id/nav_map_view"
- android:icon="@drawable/ic_world_map"
- android:title="@string/menu_map_view" />
- <item
- android:id="@+id/nav_map_osm"
- android:icon="@drawable/ic_world_map"
- android:title="@string/menu_map_osm" />
- <item
- android:id="@+id/nav_settings"
- android:icon="@drawable/ic_settings"
- android:title="@string/menu_settings" />
- <item
- android:id="@+id/nav_about"
- android:icon="@drawable/ic_about"
- android:title="@string/menu_about" />
- </group>
-</menu>
diff --git a/app/src/main/res/menu/nav_menu.xml b/app/src/main/res/menu/nav_menu.xml
index c19440bb..ccc1e428 100644
--- a/app/src/main/res/menu/nav_menu.xml
+++ b/app/src/main/res/menu/nav_menu.xml
@@ -19,7 +19,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_satellites"
- android:icon="@drawable/ic_sat_desc_left"
+ android:icon="@drawable/ic_sat_asc_left"
android:title="@string/menu_bottom_entries" />
<item
android:id="@+id/nav_passes"
diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml
index 3715c312..22f155dd 100644
--- a/app/src/main/res/navigation/nav_graph.xml
+++ b/app/src/main/res/navigation/nav_graph.xml
@@ -21,10 +21,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
- app:startDestination="@id/nav_pass_list">
+ app:startDestination="@id/nav_passes">
<fragment
- android:id="@+id/nav_pass_list"
+ android:id="@+id/nav_satellites"
+ android:name="com.rtbishop.look4sat.ui.fragments.AboutFragment" />
+
+ <fragment
+ android:id="@+id/nav_passes"
android:name="com.rtbishop.look4sat.ui.fragments.PassListFragment"
android:label="@string/menu_pass_list"
tools:layout="@layout/fragment_pass_list">
@@ -48,13 +52,7 @@
</fragment>
<fragment
- android:id="@+id/nav_map_view"
- android:name="com.rtbishop.look4sat.ui.fragments.MapViewFragment"
- android:label="@string/menu_map_view"
- tools:layout="@layout/fragment_map_view" />
-
- <fragment
- android:id="@+id/nav_map_osm"
+ android:id="@+id/nav_world_map"
android:name="com.rtbishop.look4sat.ui.fragments.MapOsmFragment"
android:label="@string/menu_map_osm"
tools:layout="@layout/fragment_map_osm" />
diff --git a/app/src/main/res/navigation/temp_graph.xml b/app/src/main/res/navigation/temp_graph.xml
deleted file mode 100644
index 3dd676a7..00000000
--- a/app/src/main/res/navigation/temp_graph.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<navigation xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/temp_graph"
- app:startDestination="@id/nav_about">
-
- <fragment
- android:id="@+id/nav_satellites"
- android:name="com.rtbishop.look4sat.ui.fragments.AboutFragment" />
- <fragment
- android:id="@+id/nav_passes"
- android:name="com.rtbishop.look4sat.ui.fragments.AboutFragment" />
- <fragment
- android:id="@+id/nav_world_map"
- android:name="com.rtbishop.look4sat.ui.fragments.AboutFragment" />
- <fragment
- android:id="@+id/nav_settings"
- android:name="com.rtbishop.look4sat.ui.fragments.AboutFragment" />
- <fragment
- android:id="@+id/nav_about"
- android:name="com.rtbishop.look4sat.ui.fragments.AboutFragment"
- android:label="fragment_about"
- tools:layout="@layout/fragment_about" />
-</navigation>
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 04c24f1c..546e4d54 100644
--- a/build.gradle
+++ b/build.gradle
@@ -23,7 +23,6 @@ buildscript {
gradle_plugin_version = '1.4.10'
material_version = '1.2.1'
app_compat_version = '1.2.0'
- support_lib_version = '1.0.0'
constraint_layout_version = '2.0.1'
ktx_version = '1.3.1'
preference_version = '1.1.1'