Code refactoring, move and cleanup

This commit is contained in:
Arty Bishop committed 2020-10-06 23:24:16 +01:00
1 parent d4ac615a8d
commit b87f2a6e72
41 files changed
+413 -1521

No files matched your search

-1
View File
@@ -64,7 +64,6 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.google.android.material:material:$material_version" implementation "com.google.android.material:material:$material_version"
implementation "androidx.appcompat:appcompat:$app_compat_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.constraintlayout:constraintlayout:$constraint_layout_version"
implementation "androidx.core:core-ktx:$ktx_version" implementation "androidx.core:core-ktx:$ktx_version"
implementation "androidx.preference:preference:$preference_version" implementation "androidx.preference:preference:$preference_version"
+1 -11
View File
@@ -32,19 +32,9 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme"> 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 <activity
android:name=".ui.MainActivity" android:name=".ui.MainActivity"
android:configChanges="orientation|screenSize" android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/AppTheme.Splash"> android:theme="@style/AppTheme.Splash">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@@ -23,7 +23,6 @@ import android.content.Context
import com.rtbishop.look4sat.dagger.modules.* import com.rtbishop.look4sat.dagger.modules.*
import com.rtbishop.look4sat.ui.MainActivity import com.rtbishop.look4sat.ui.MainActivity
import com.rtbishop.look4sat.ui.fragments.MapOsmFragment 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.PassListFragment
import com.rtbishop.look4sat.ui.fragments.PolarViewFragment import com.rtbishop.look4sat.ui.fragments.PolarViewFragment
import dagger.BindsInstance import dagger.BindsInstance
@@ -43,7 +42,6 @@ interface AppComponent {
} }
fun inject(mainActivity: MainActivity) fun inject(mainActivity: MainActivity)
fun inject(mapViewFragment: MapViewFragment)
fun inject(passListFragment: PassListFragment) fun inject(passListFragment: PassListFragment)
fun inject(polarViewFragment: PolarViewFragment) fun inject(polarViewFragment: PolarViewFragment)
fun inject(mapOsmFragment: MapOsmFragment) fun inject(mapOsmFragment: MapOsmFragment)
@@ -19,9 +19,7 @@
package com.rtbishop.look4sat.dagger.modules package com.rtbishop.look4sat.dagger.modules
import com.rtbishop.look4sat.network.RemoteDataSource import com.rtbishop.look4sat.repo.api.TransmittersApi
import com.rtbishop.look4sat.network.RemoteSource
import com.rtbishop.look4sat.network.TransmittersApi
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
@@ -38,12 +36,6 @@ class NetworkModule {
return OkHttpClient() return OkHttpClient()
} }
@Singleton
@Provides
fun provideRemoteDataSource(api: TransmittersApi, client: OkHttpClient): RemoteSource {
return RemoteDataSource(api, client)
}
@Singleton @Singleton
@Provides @Provides
fun provideTransmittersApi(): TransmittersApi { fun provideTransmittersApi(): TransmittersApi {
@@ -21,12 +21,10 @@ package com.rtbishop.look4sat.dagger.modules
import android.content.Context import android.content.Context
import androidx.room.Room import androidx.room.Room
import com.rtbishop.look4sat.persistence.LocalDataSource import com.rtbishop.look4sat.repo.SatelliteDb
import com.rtbishop.look4sat.persistence.LocalSource import com.rtbishop.look4sat.repo.dao.EntriesDao
import com.rtbishop.look4sat.persistence.SatelliteDb import com.rtbishop.look4sat.repo.dao.SourcesDao
import com.rtbishop.look4sat.persistence.dao.EntriesDao import com.rtbishop.look4sat.repo.dao.TransmittersDao
import com.rtbishop.look4sat.persistence.dao.SourcesDao
import com.rtbishop.look4sat.persistence.dao.TransmittersDao
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import javax.inject.Singleton import javax.inject.Singleton
@@ -52,16 +50,6 @@ class PersistenceModule {
return db.sourcesDao() return db.sourcesDao()
} }
@Singleton
@Provides
fun provideLocalDataSource(
entriesDao: EntriesDao,
transmittersDao: TransmittersDao,
sourcesDao: SourcesDao
): LocalSource {
return LocalDataSource(entriesDao, transmittersDao, sourcesDao)
}
@Singleton @Singleton
@Provides @Provides
fun provideSatelliteDb(context: Context): SatelliteDb { fun provideSatelliteDb(context: Context): SatelliteDb {
@@ -2,12 +2,15 @@ package com.rtbishop.look4sat.dagger.modules
import android.content.ContentResolver import android.content.ContentResolver
import android.content.Context 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.DefaultRepository
import com.rtbishop.look4sat.repo.Repository 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.Module
import dagger.Provides import dagger.Provides
import okhttp3.OkHttpClient
import javax.inject.Singleton import javax.inject.Singleton
@Module @Module
@@ -23,9 +26,19 @@ class RepoModule {
@Provides @Provides
fun provideDefaultRepository( fun provideDefaultRepository(
resolver: ContentResolver, resolver: ContentResolver,
localSource: LocalSource, transmittersApi: TransmittersApi,
remoteSource: RemoteSource client: OkHttpClient,
entriesDao: EntriesDao,
transmittersDao: TransmittersDao,
sourcesDao: SourcesDao
): Repository { ): Repository {
return DefaultRepository(resolver, localSource, remoteSource) return DefaultRepository(
resolver,
client,
transmittersApi,
entriesDao,
sourcesDao,
transmittersDao
)
} }
} }
@@ -1,53 +0,0 @@
/*
* Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
* Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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()
}
}
@@ -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>
}
@@ -1,84 +0,0 @@
/*
* Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
* Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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()
}
}
@@ -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()
}
@@ -25,16 +25,24 @@ import com.github.amsacode.predict4java.TLE
import com.rtbishop.look4sat.data.SatEntry import com.rtbishop.look4sat.data.SatEntry
import com.rtbishop.look4sat.data.TleSource import com.rtbishop.look4sat.data.TleSource
import com.rtbishop.look4sat.data.Transmitter import com.rtbishop.look4sat.data.Transmitter
import com.rtbishop.look4sat.network.RemoteSource import com.rtbishop.look4sat.repo.api.TransmittersApi
import com.rtbishop.look4sat.persistence.LocalSource 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.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import okhttp3.OkHttpClient
import okhttp3.Request
import java.io.InputStream
import javax.inject.Inject import javax.inject.Inject
class DefaultRepository @Inject constructor( class DefaultRepository @Inject constructor(
private val resolver: ContentResolver, private val resolver: ContentResolver,
private val localSource: LocalSource, private val client: OkHttpClient,
private val remoteSource: RemoteSource private val api: TransmittersApi,
private val entriesDao: EntriesDao,
private val sourcesDao: SourcesDao,
private val transmittersDao: TransmittersDao
) : Repository { ) : Repository {
override suspend fun updateEntriesFromFile(tleUri: Uri) { override suspend fun updateEntriesFromFile(tleUri: Uri) {
@@ -42,56 +50,88 @@ class DefaultRepository @Inject constructor(
resolver.openInputStream(tleUri)?.use { stream -> resolver.openInputStream(tleUri)?.use { stream ->
val tleList = TLE.importSat(stream) val tleList = TLE.importSat(stream)
val entries = tleList.map { SatEntry(it) } val entries = tleList.map { SatEntry(it) }
localSource.clearEntries() clearEntries()
localSource.insertEntries(entries) insertEntries(entries)
} }
} }
} }
override suspend fun updateEntriesFromUrl(urlList: List<TleSource>) { override suspend fun updateEntriesFromUrl(urlList: List<TleSource>) {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
val streams = remoteSource.fetchTleStreams(urlList) val streams = fetchTleStreams(urlList)
val entries = mutableListOf<SatEntry>() val entries = mutableListOf<SatEntry>()
streams.forEach { streams.forEach {
val list = TLE.importSat(it).map { tle -> SatEntry(tle) } val list = TLE.importSat(it).map { tle -> SatEntry(tle) }
entries.addAll(list) entries.addAll(list)
} }
localSource.clearEntries() clearEntries()
localSource.insertEntries(entries) 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> { override suspend fun getAllEntries(): List<SatEntry> {
return localSource.getAllEntries() return entriesDao.getAllEntries()
} }
override suspend fun getSelectedEntries(): List<SatEntry> { override suspend fun getSelectedEntries(): List<SatEntry> {
return localSource.getSelectedEntries() return entriesDao.getSelectedEntries()
} }
override suspend fun updateEntriesSelection(catNumList: List<Int>) { 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() { override suspend fun updateTransmitters() {
localSource.clearTransmitters()
localSource.insertTransmitters(remoteSource.fetchTransmitters())
} }
override suspend fun getTransmittersByCatNum(catNum: Int): List<Transmitter> { 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>) { override suspend fun updateSources(sources: List<TleSource>) {
localSource.clearSources() clearSources()
localSource.insertSources(sources) sourcesDao.insertSources(sources)
} }
override suspend fun getSources(): List<TleSource> { override suspend fun getSources(): List<TleSource> {
return localSource.getSources() return sourcesDao.getSources()
}
override suspend fun clearSources() {
sourcesDao.clearSources()
} }
} }
@@ -4,6 +4,7 @@ import android.net.Uri
import com.rtbishop.look4sat.data.SatEntry import com.rtbishop.look4sat.data.SatEntry
import com.rtbishop.look4sat.data.TleSource import com.rtbishop.look4sat.data.TleSource
import com.rtbishop.look4sat.data.Transmitter import com.rtbishop.look4sat.data.Transmitter
import java.io.InputStream
interface Repository { interface Repository {
@@ -11,21 +12,35 @@ interface Repository {
suspend fun updateEntriesFromUrl(urlList: List<TleSource>) 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 getAllEntries(): List<SatEntry>
suspend fun getSelectedEntries(): List<SatEntry> suspend fun getSelectedEntries(): List<SatEntry>
suspend fun updateEntriesSelection(catNumList: List<Int>) suspend fun updateEntriesSelection(catNumList: List<Int>)
suspend fun clearEntries()
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
suspend fun updateTransmitters() suspend fun updateTransmitters()
suspend fun getTransmittersByCatNum(catNum: Int): List<Transmitter> suspend fun getTransmittersByCatNum(catNum: Int): List<Transmitter>
suspend fun clearTransmitters()
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
suspend fun updateSources(sources: List<TleSource>) suspend fun updateSources(sources: List<TleSource>)
suspend fun getSources(): List<TleSource> suspend fun getSources(): List<TleSource>
suspend fun clearSources()
} }
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 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.Database
import androidx.room.RoomDatabase import androidx.room.RoomDatabase
@@ -25,9 +25,9 @@ import androidx.room.TypeConverters
import com.rtbishop.look4sat.data.SatEntry import com.rtbishop.look4sat.data.SatEntry
import com.rtbishop.look4sat.data.TleSource import com.rtbishop.look4sat.data.TleSource
import com.rtbishop.look4sat.data.Transmitter import com.rtbishop.look4sat.data.Transmitter
import com.rtbishop.look4sat.persistence.dao.EntriesDao import com.rtbishop.look4sat.repo.dao.EntriesDao
import com.rtbishop.look4sat.persistence.dao.SourcesDao import com.rtbishop.look4sat.repo.dao.SourcesDao
import com.rtbishop.look4sat.persistence.dao.TransmittersDao import com.rtbishop.look4sat.repo.dao.TransmittersDao
import com.rtbishop.look4sat.utility.Converters import com.rtbishop.look4sat.utility.Converters
@Database( @Database(
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 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 com.rtbishop.look4sat.data.Transmitter
import retrofit2.http.GET import retrofit2.http.GET
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 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.Dao
import androidx.room.Insert import androidx.room.Insert
@@ -1,4 +1,4 @@
package com.rtbishop.look4sat.persistence.dao package com.rtbishop.look4sat.repo.dao
import androidx.room.Dao import androidx.room.Dao
import androidx.room.Insert import androidx.room.Insert
@@ -1,4 +1,4 @@
package com.rtbishop.look4sat.persistence.dao package com.rtbishop.look4sat.repo.dao
import androidx.room.Dao import androidx.room.Dao
import androidx.room.Insert import androidx.room.Insert
@@ -1,221 +1,84 @@
/*
* Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
* Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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 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.os.Bundle
import android.view.View
import android.view.WindowManager import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat import androidx.navigation.fragment.NavHostFragment
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.ui.setupWithNavController import androidx.navigation.ui.setupWithNavController
import com.rtbishop.look4sat.Look4SatApp
import com.rtbishop.look4sat.R 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.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 { class MainActivity : AppCompatActivity() {
private val pickFileReqCode = 1001 // private val pickFileReqCode = 1001
private val permissionsReqCode = 1000 // private val permissionsReqCode = 1000
private val permissions = arrayOf( // private val permissions = arrayOf(
Manifest.permission.ACCESS_FINE_LOCATION, // Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.READ_EXTERNAL_STORAGE, // Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE // Manifest.permission.WRITE_EXTERNAL_STORAGE
) // )
@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
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme) setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val binding = ActivityMainBinding.inflate(layoutInflater)
mainBinding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root)
drawerBinding = DrawerHeaderBinding.inflate(layoutInflater, mainBinding.navView, true) val navHost = supportFragmentManager.findFragmentById(R.id.nav_frag) as NavHostFragment
setContentView(mainBinding.root) binding.navBottom.setupWithNavController(navHost.navController)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
(application as Look4SatApp).appComponent.inject(this) // viewModel.setDefaultTleSources()
viewModel = ViewModelProvider(this, viewModelFactory).get(SharedViewModel::class.java)
setupComponents() // if (!hasPermissions(this, permissions)) {
setupObservers() // ActivityCompat.requestPermissions(this, permissions, permissionsReqCode)
setupDrawer() // }
viewModel.setDefaultTleSources()
if (!hasPermissions(this, permissions)) {
ActivityCompat.requestPermissions(this, permissions, permissionsReqCode)
}
} }
@SuppressLint("SourceLockedOrientationActivity") // private fun hasPermissions(context: Context, permissions: Array<String>): Boolean =
private fun setupComponents() { // permissions.all {
val navController = findNavController(R.id.nav_host) // ActivityCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED
val toolbar = mainBinding.includeAppBar.toolbar // }
setSupportActionBar(toolbar) //
// private fun openFile() {
// val openFileIntent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
// addCategory(Intent.CATEGORY_OPENABLE)
// type = "*/*"
// }
// startActivityForResult(openFileIntent, pickFileReqCode)
// }
appBarConfig = AppBarConfiguration( // private fun openSourcesDialog() {
setOf(R.id.nav_pass_list, R.id.nav_map_view), // TleSourcesDialogFragment(viewModel.getTleSources()).apply {
mainBinding.drawerLayout // setSourcesListener(this@MainActivity)
) // show(supportFragmentManager, "TleSourcesDialog")
// }
// }
setupActionBarWithNavController(navController, appBarConfig) // override fun onSourcesSubmit(list: List<TleSource>) {
mainBinding.navView.setupWithNavController(navController) // viewModel.updateSatData(list)
// }
navController.addOnDestinationChangedListener { _, destination, _ -> // override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (destination.id) { // if (requestCode == pickFileReqCode && resultCode == RESULT_OK) {
R.id.nav_pass_list -> { // data?.data?.also { uri ->
this.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT // viewModel.updateEntriesFromFile(uri)
toolbar.visibility = View.VISIBLE // }
mainBinding.includeAppBar.toolbarLayout.visibility = View.VISIBLE // } else {
} // super.onActivityResult(requestCode, resultCode, data)
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() { // private fun gotoGitHub() {
viewModel.getGSP().observe(this, { result -> // val gitHubUrl = "https://github.com/rt-bishop/LookingSat"
when (result) { // val githubIntent = Intent(Intent.ACTION_VIEW, Uri.parse(gitHubUrl))
is Result.Success -> { // startActivity(githubIntent)
drawerBinding.drawerLatValue.text = // }
String.format(getString(R.string.pat_location), result.data.latitude) //
drawerBinding.drawerLonValue.text = // private fun View.lockButton() {
String.format(getString(R.string.pat_location), result.data.longitude) // lifecycleScope.launch {
} // this@lockButton.isEnabled = false
is Result.Error -> { // delay(3000)
when (result.exception) { // this@lockButton.isEnabled = true
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)
}
})
}
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)
}
}
override fun onSourcesSubmit(list: List<TleSource>) {
viewModel.updateSatData(list)
}
private fun View.lockButton() {
lifecycleScope.launch {
this@lockButton.isEnabled = false
delay(3000)
this@lockButton.isEnabled = true
}
}
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)
}
}
}
@@ -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)
}
}
@@ -52,14 +52,12 @@ class SharedViewModel @Inject constructor(
fun getTransmittersForSat(id: Int) = liveData { emit(repository.getTransmittersByCatNum(id)) } fun getTransmittersForSat(id: Int) = liveData { emit(repository.getTransmittersByCatNum(id)) }
fun getPassList(): LiveData<Result<MutableList<SatPass>>> = _satPassList fun getPassList(): LiveData<Result<MutableList<SatPass>>> = _satPassList
fun getUpdateStatus(): LiveData<Result<Int>> = _updateStatus
fun getGSP(): LiveData<Result<GroundStationPosition>> = _gsp fun getGSP(): LiveData<Result<GroundStationPosition>> = _gsp
fun getCompass() = prefsManager.getCompass() fun getCompass() = prefsManager.getCompass()
fun getRefreshRate() = prefsManager.getRefreshRate() fun getRefreshRate() = prefsManager.getRefreshRate()
fun getHoursAhead() = prefsManager.getHoursAhead() fun getHoursAhead() = prefsManager.getHoursAhead()
fun getMinElevation() = prefsManager.getMinElevation() fun getMinElevation() = prefsManager.getMinElevation()
fun setPositionFromPref() = _gsp.postValue(Result.Success(prefsManager.getPosition()))
suspend fun getAllEntries() = repository.getAllEntries() suspend fun getAllEntries() = repository.getAllEntries()
fun setPassPrefs(hoursAhead: Int, minEl: Double) { fun setPassPrefs(hoursAhead: Int, minEl: Double) {
@@ -1,149 +0,0 @@
/*
* Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
* Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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)
}
}
@@ -21,13 +21,8 @@ package com.rtbishop.look4sat.ui.fragments
import android.os.Bundle import android.os.Bundle
import android.os.CountDownTimer import android.os.CountDownTimer
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup
import android.widget.EditText import android.widget.EditText
import android.widget.ImageButton
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity 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.databinding.FragmentPassListBinding
import com.rtbishop.look4sat.ui.SharedViewModel import com.rtbishop.look4sat.ui.SharedViewModel
import com.rtbishop.look4sat.ui.adapters.SatPassAdapter 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 com.rtbishop.look4sat.utility.PrefsManager
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.util.* import java.util.*
@@ -61,36 +56,23 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
private lateinit var viewModel: SharedViewModel private lateinit var viewModel: SharedViewModel
private lateinit var satPassAdapter: SatPassAdapter private lateinit var satPassAdapter: SatPassAdapter
private lateinit var btnPassPrefs: ImageButton
private lateinit var aosTimer: CountDownTimer private lateinit var aosTimer: CountDownTimer
private lateinit var aosTimerText: TextView
private lateinit var mainActivity: FragmentActivity private lateinit var mainActivity: FragmentActivity
private lateinit var binding: FragmentPassListBinding
private var isTimerSet: Boolean = false private var isTimerSet: Boolean = false
private var satPassList: MutableList<SatPass> = mutableListOf() 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?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
mainActivity = requireActivity() mainActivity = requireActivity()
binding = FragmentPassListBinding.bind(view)
(mainActivity.application as Look4SatApp).appComponent.inject(this) (mainActivity.application as Look4SatApp).appComponent.inject(this)
viewModel = ViewModelProvider(mainActivity, modelFactory).get(SharedViewModel::class.java) viewModel = ViewModelProvider(mainActivity, modelFactory).get(SharedViewModel::class.java)
satPassAdapter = SatPassAdapter(satPassList, prefsManager) satPassAdapter = SatPassAdapter(satPassList, prefsManager)
aosTimerText = mainActivity.findViewById(R.id.toolbar_timer)
btnPassPrefs = mainActivity.findViewById(R.id.toolbar_filter)
setupObservers(binding) setupObservers()
setupComponents(binding) setupComponents()
} }
override fun onStart() { 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 -> viewModel.getPassList().observe(viewLifecycleOwner, { result ->
when (result) { when (result) {
is Result.Success -> { is Result.Success -> {
@@ -114,16 +96,16 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
binding.recPassList.visibility = View.INVISIBLE binding.recPassList.visibility = View.INVISIBLE
} }
setTimer() setTimer()
binding.refLayoutPassList.isRefreshing = false // binding.refLayoutPassList.isRefreshing = false
} }
is Result.InProgress -> { is Result.InProgress -> {
binding.refLayoutPassList.isRefreshing = true // binding.refLayoutPassList.isRefreshing = true
} }
} }
}) })
} }
private fun setupComponents(binding: FragmentPassListBinding) { private fun setupComponents() {
binding.recPassList.apply { binding.recPassList.apply {
layoutManager = LinearLayoutManager(mainActivity) layoutManager = LinearLayoutManager(mainActivity)
adapter = satPassAdapter adapter = satPassAdapter
@@ -133,17 +115,17 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
satPassAdapter.setList(satPassList) satPassAdapter.setList(satPassList)
setTimer() setTimer()
binding.refLayoutPassList.setProgressBackgroundColorSchemeResource(R.color.themeAccent) // binding.refLayoutPassList.setProgressBackgroundColorSchemeResource(R.color.themeAccent)
binding.refLayoutPassList.setColorSchemeResources(R.color.backgroundDark) // binding.refLayoutPassList.setColorSchemeResources(R.color.backgroundDark)
binding.refLayoutPassList.setOnRefreshListener { viewModel.calculatePasses() } // binding.refLayoutPassList.setOnRefreshListener { viewModel.calculatePasses() }
btnPassPrefs.setOnClickListener { binding.toolbarFilter.setOnClickListener {
showSatPassPrefsDialog(viewModel.getHoursAhead(), viewModel.getMinElevation()) showSatPassPrefsDialog(viewModel.getHoursAhead(), viewModel.getMinElevation())
} }
binding.fabSatSelect.setOnClickListener { binding.fabSatSelect.setOnClickListener {
lifecycleScope.launch { lifecycleScope.launch {
val list = viewModel.getAllEntries() as MutableList val list = viewModel.getAllEntries() as MutableList
if (list.isEmpty()) { if (list.isEmpty()) {
getString(R.string.err_update_data).toast(mainActivity, Toast.LENGTH_SHORT) getString(R.string.err_update_data).snack(requireView())
} else { } else {
showSelectSatDialog(list) showSelectSatDialog(list)
} }
@@ -167,23 +149,17 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
val elevation = elevationStr.toDouble() val elevation = elevationStr.toDouble()
when { when {
hours < 1 || hours > 168 -> { hours < 1 || hours > 168 -> {
getString(R.string.pref_hours_ahead_input_error).toast( getString(R.string.pref_hours_ahead_input_error).snack(requireView())
mainActivity,
Toast.LENGTH_SHORT
)
} }
elevation < 0 || elevation > 90 -> { elevation < 0 || elevation > 90 -> {
getString(R.string.pref_min_el_input_error).toast( getString(R.string.pref_min_el_input_error).snack(requireView())
mainActivity,
Toast.LENGTH_SHORT
)
} }
else -> { else -> {
viewModel.setPassPrefs(hours, elevation) viewModel.setPassPrefs(hours, elevation)
viewModel.calculatePasses() 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, _ -> setNegativeButton(getString(android.R.string.cancel)) { dialog, _ ->
@@ -234,7 +210,7 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
} }
override fun onTick(millisUntilFinished: Long) { override fun onTick(millisUntilFinished: Long) {
aosTimerText.text = String.format( binding.toolbarTimer.text = String.format(
mainActivity.getString(R.string.pat_timer), mainActivity.getString(R.string.pat_timer),
TimeUnit.MILLISECONDS.toHours(millisUntilFinished) % 60, TimeUnit.MILLISECONDS.toHours(millisUntilFinished) % 60,
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % 60, TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % 60,
@@ -254,7 +230,7 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
} }
override fun onTick(millisUntilFinished: Long) { override fun onTick(millisUntilFinished: Long) {
aosTimerText.text = String.format( binding.toolbarTimer.text = String.format(
mainActivity.getString(R.string.pat_timer), mainActivity.getString(R.string.pat_timer),
TimeUnit.MILLISECONDS.toHours(millisUntilFinished) % 60, TimeUnit.MILLISECONDS.toHours(millisUntilFinished) % 60,
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % 60, TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % 60,
@@ -270,12 +246,7 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
aosTimer.cancel() aosTimer.cancel()
isTimerSet = false isTimerSet = false
} }
if (resetToNull) aosTimerText.text = if (resetToNull) binding.toolbarTimer.text =
String.format(getString(R.string.pat_timer), 0, 0, 0) String.format(getString(R.string.pat_timer), 0, 0, 0)
} }
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
} }
@@ -22,19 +22,14 @@ package com.rtbishop.look4sat.ui.fragments
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.text.InputType import android.text.InputType
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.ViewModelProvider
import androidx.preference.EditTextPreference import androidx.preference.EditTextPreference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import com.rtbishop.look4sat.R import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.ui.SharedViewModel import com.rtbishop.look4sat.utility.Extensions.snack
import com.rtbishop.look4sat.utility.Extensions.toast
class PreferencesFragment : PreferenceFragmentCompat(), class PreferencesFragment : PreferenceFragmentCompat(),
SharedPreferences.OnSharedPreferenceChangeListener { SharedPreferences.OnSharedPreferenceChangeListener {
private lateinit var mainActivity: FragmentActivity
private lateinit var viewModel: SharedViewModel
private lateinit var keyLat: String private lateinit var keyLat: String
private lateinit var keyLon: String private lateinit var keyLon: String
private lateinit var keyAlt: String private lateinit var keyAlt: String
@@ -43,14 +38,10 @@ class PreferencesFragment : PreferenceFragmentCompat(),
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preference, rootKey) setPreferencesFromResource(R.xml.preference, rootKey)
val provider = EditTextPreference.SimpleSummaryProvider.getInstance() val provider = EditTextPreference.SimpleSummaryProvider.getInstance()
keyLat = preferenceManager.context.getString(R.string.pref_lat_key)
mainActivity = requireActivity() keyLon = preferenceManager.context.getString(R.string.pref_lon_key)
viewModel = ViewModelProvider(mainActivity).get(SharedViewModel::class.java) keyAlt = preferenceManager.context.getString(R.string.pref_alt_key)
keyDelay = preferenceManager.context.getString(R.string.pref_refresh_rate_key)
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)
findPreference<EditTextPreference>(keyLat)?.apply { findPreference<EditTextPreference>(keyLat)?.apply {
summaryProvider = provider summaryProvider = provider
@@ -62,7 +53,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
setOnPreferenceChangeListener { _, newValue -> setOnPreferenceChangeListener { _, newValue ->
val valueStr = newValue.toString() val valueStr = newValue.toString()
if (valueStr.isEmpty() || valueStr == "-" || valueStr.toDouble() < -90.0 || valueStr.toDouble() > 90.0) { 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 false
} }
return@setOnPreferenceChangeListener true return@setOnPreferenceChangeListener true
@@ -79,7 +70,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
setOnPreferenceChangeListener { _, newValue -> setOnPreferenceChangeListener { _, newValue ->
val valueStr = newValue.toString() val valueStr = newValue.toString()
if (valueStr.isEmpty() || valueStr == "-" || valueStr.toDouble() < -180.0 || valueStr.toDouble() > 180.0) { 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 false
} }
return@setOnPreferenceChangeListener true return@setOnPreferenceChangeListener true
@@ -96,7 +87,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
setOnPreferenceChangeListener { _, newValue -> setOnPreferenceChangeListener { _, newValue ->
val valueStr = newValue.toString() val valueStr = newValue.toString()
if (valueStr.isEmpty() || valueStr == "-" || valueStr.toDouble() < -413.0 || valueStr.toDouble() > 8850.0) { 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 false
} }
return@setOnPreferenceChangeListener true return@setOnPreferenceChangeListener true
@@ -109,7 +100,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
setOnPreferenceChangeListener { _, newValue -> setOnPreferenceChangeListener { _, newValue ->
val valueStr = newValue.toString() val valueStr = newValue.toString()
if (valueStr.isEmpty() || valueStr.toLong() < 250 || valueStr.toLong() > 10000) { 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 false
} }
return@setOnPreferenceChangeListener true return@setOnPreferenceChangeListener true
@@ -117,9 +108,7 @@ class PreferencesFragment : PreferenceFragmentCompat(),
} }
} }
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {}
if (key == keyLat || key == keyLon || key == keyAlt) viewModel.setPositionFromPref()
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
@@ -1,11 +1,11 @@
package com.rtbishop.look4sat.utility package com.rtbishop.look4sat.utility
import android.content.Context import android.view.View
import android.widget.Toast import com.google.android.material.snackbar.Snackbar
object Extensions { object Extensions {
fun String.toast(context: Context, duration: Int = Toast.LENGTH_SHORT): Toast { fun String.snack(view: View) {
return Toast.makeText(context, this, duration).apply { show() } Snackbar.make(view, this, Snackbar.LENGTH_SHORT).show()
} }
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

-28
View File
@@ -1,28 +0,0 @@
<!--
~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
~ Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
@@ -1,57 +0,0 @@
<!--
~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
~ Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
@@ -1,57 +0,0 @@
<!--
~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
~ Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
@@ -1,28 +0,0 @@
<!--
~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android.
~ Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
+33 -39
View File
@@ -1,44 +1,38 @@
<?xml version="1.0" encoding="utf-8"?><!-- <?xml version="1.0" encoding="utf-8"?>
~ Look4Sat. Amateur radio and weather satellite tracker and passes predictor for Android. <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
~ Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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"
xmlns:app="http://schemas.android.com/apk/res-auto" 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_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/include_app_bar" android:layout_width="0dp"
layout="@layout/app_bar_main" 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" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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" />
<com.google.android.material.navigation.NavigationView </androidx.constraintlayout.widget.ConstraintLayout>
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.drawerlayout.widget.DrawerLayout>
-38
View File
@@ -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>
-71
View File
@@ -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 (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
-40
View File
@@ -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 (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
-176
View File
@@ -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 (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
@@ -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 (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
+172 -134
View File
@@ -17,151 +17,189 @@
~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ~ 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" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/refLayoutPassList" android:id="@+id/refLayoutPassList"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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_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.recyclerview.widget.RecyclerView <androidx.appcompat.widget.Toolbar
android:id="@+id/recPassList" 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.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_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:paddingBottom="4dp" android:layout_marginStart="16dp"
android:visibility="invisible" android:layout_marginTop="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</androidx.recyclerview.widget.RecyclerView>
<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"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent" android:contentDescription="@string/placeholder"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toTopOf="@+id/tvInfoMain"
app:srcCompat="@drawable/ic_sat_asc_left" /> 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> </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>
-47
View File
@@ -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 (bishop.arty@gmail.com)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 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>
+1 -1
View File
@@ -19,7 +19,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:id="@+id/nav_satellites" 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" /> android:title="@string/menu_bottom_entries" />
<item <item
android:id="@+id/nav_passes" android:id="@+id/nav_passes"
+7 -9
View File
@@ -21,10 +21,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation" android:id="@+id/mobile_navigation"
app:startDestination="@id/nav_pass_list"> app:startDestination="@id/nav_passes">
<fragment <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:name="com.rtbishop.look4sat.ui.fragments.PassListFragment"
android:label="@string/menu_pass_list" android:label="@string/menu_pass_list"
tools:layout="@layout/fragment_pass_list"> tools:layout="@layout/fragment_pass_list">
@@ -48,13 +52,7 @@
</fragment> </fragment>
<fragment <fragment
android:id="@+id/nav_map_view" android:id="@+id/nav_world_map"
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:name="com.rtbishop.look4sat.ui.fragments.MapOsmFragment" android:name="com.rtbishop.look4sat.ui.fragments.MapOsmFragment"
android:label="@string/menu_map_osm" android:label="@string/menu_map_osm"
tools:layout="@layout/fragment_map_osm" /> tools:layout="@layout/fragment_map_osm" />
@@ -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>
-1
View File
@@ -23,7 +23,6 @@ buildscript {
gradle_plugin_version = '1.4.10' gradle_plugin_version = '1.4.10'
material_version = '1.2.1' material_version = '1.2.1'
app_compat_version = '1.2.0' app_compat_version = '1.2.0'
support_lib_version = '1.0.0'
constraint_layout_version = '2.0.1' constraint_layout_version = '2.0.1'
ktx_version = '1.3.1' ktx_version = '1.3.1'
preference_version = '1.1.1' preference_version = '1.1.1'