Further changes to layouts and fragments

This commit is contained in:
Arty Bishop committed 2022-01-09 17:59:24 +00:00
1 parent f58f851151
commit 0f4a70b204
26 files changed
+140 -316

No files matched your search

@@ -22,9 +22,6 @@ import android.content.pm.ActivityInfo
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.databinding.ActivityMainBinding
import dagger.hilt.android.AndroidEntryPoint
@@ -36,9 +33,6 @@ class Look4SatActivity : AppCompatActivity() {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
super.onCreate(savedInstanceState)
installSplashScreen()
val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
val navHost = supportFragmentManager.findFragmentById(R.id.main_nav_host) as NavHostFragment
binding.mainNavBottom.setupWithNavController(navHost.navController)
setContentView(ActivityMainBinding.inflate(layoutInflater).root)
}
}
@@ -24,17 +24,15 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.SimpleItemAnimator
import com.google.android.material.snackbar.Snackbar
import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.databinding.FragmentEntriesBinding
import com.rtbishop.look4sat.domain.model.SatItem
import com.rtbishop.look4sat.domain.model.DataState
import com.rtbishop.look4sat.domain.model.SatItem
import com.rtbishop.look4sat.presentation.ItemDivider
import com.rtbishop.look4sat.presentation.getNavResult
import com.rtbishop.look4sat.presentation.navigateSafe
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
@@ -59,12 +57,12 @@ class EntriesFragment : Fragment(R.layout.fragment_entries) {
adapter = entriesAdapter
layoutManager = GridLayoutManager(requireContext(), 2)
(itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
addItemDecoration(ItemDivider(R.drawable.rec_divider_light))
addItemDecoration(ItemDivider(R.drawable.rec_divider_dark))
}
entriesImportWeb.setOnClickListener {
findNavController().navigateSafe(R.id.action_entries_to_sources)
}
entriesImportFile.setOnClickListener { filePicker.launch("*/*") }
// entriesImportWeb.setOnClickListener {
// findNavController().navigateSafe(R.id.action_entries_to_sources)
// }
// entriesImportFile.setOnClickListener { filePicker.launch("*/*") }
entriesSelectMode.setOnClickListener { showModesDialog() }
entriesSelectAll.setOnClickListener { viewModel.selectCurrentItems() }
entriesSearchBar.setOnQueryTextListener(viewModel)
@@ -26,6 +26,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SimpleItemAnimator
import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.databinding.FragmentPassesBinding
@@ -67,19 +68,21 @@ class PassesFragment : Fragment(R.layout.fragment_passes), PassesAdapter.PassesC
layoutManager = LinearLayoutManager(context)
(itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
addItemDecoration(ItemDivider(R.drawable.rec_divider_dark))
// addOnScrollListener(object : RecyclerView.OnScrollListener() {
// override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
// if (dy > 0 && passesFab.visibility == View.VISIBLE) passesFab.hide()
// else if (dy < 0 && passesFab.visibility != View.VISIBLE) passesFab.show()
// }
// })
addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (dy > 0 && passesFab.visibility == View.VISIBLE) passesFab.hide()
else if (dy < 0 && passesFab.visibility != View.VISIBLE) passesFab.show()
}
})
}
passesRefresh.setOnClickListener { findNavController().navigate(R.id.nav_pass_prefs) }
// passesSwipe.apply {
// setColorSchemeResources(R.color.greySurface)
// setProgressBackgroundColorSchemeResource(R.color.themeLight)
// setOnRefreshListener { passesViewModel.forceCalculation() }
// }
passesSwipe.apply {
setColorSchemeResources(R.color.greySurface)
setProgressBackgroundColorSchemeResource(R.color.themeLight)
setOnRefreshListener { passesViewModel.forceCalculation() }
}
passesFilter.setOnClickListener { findNavController().navigate(R.id.nav_pass_prefs) }
passesSettings.setOnClickListener { findNavController().navigate(R.id.nav_prefs) }
passesFab.setOnClickListener { findNavController().navigate(R.id.nav_entries) }
}
// val appBarConfiguration = AppBarConfiguration(setOf(R.id.nav_passes))
// binding.passesToolbar.setupWithNavController(findNavController(), appBarConfiguration)
@@ -109,7 +112,7 @@ class PassesFragment : Fragment(R.layout.fragment_passes), PassesAdapter.PassesC
is DataState.Success -> {
passesAdapter.submitList(dataState.data)
binding.apply {
// passesSwipe.isRefreshing = false
passesSwipe.isRefreshing = false
passesError.visibility = View.INVISIBLE
passesProgress.visibility = View.INVISIBLE
passesRecycler.visibility = View.VISIBLE
@@ -118,7 +121,7 @@ class PassesFragment : Fragment(R.layout.fragment_passes), PassesAdapter.PassesC
}
is DataState.Loading -> {
binding.apply {
// passesSwipe.isRefreshing = true
passesSwipe.isRefreshing = true
passesTimer.text = 0L.toTimerString()
passesError.visibility = View.INVISIBLE
passesRecycler.visibility = View.INVISIBLE
@@ -127,7 +130,7 @@ class PassesFragment : Fragment(R.layout.fragment_passes), PassesAdapter.PassesC
}
else -> {
binding.apply {
// passesSwipe.isRefreshing = false
passesSwipe.isRefreshing = false
passesTimer.text = 0L.toTimerString()
passesProgress.visibility = View.INVISIBLE
passesRecycler.visibility = View.INVISIBLE
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

+3 -3
View File
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/themeLight"
android:pathData="M10,18h4v-2h-4v2zM3,6v2h18L21,6L3,6zM6,13h12v-2L6,11v2z" />
<path
android:fillColor="@android:color/white"
android:pathData="M10,18h4v-2h-4v2zM3,6v2h18L21,6L3,6zM6,13h12v-2L6,11v2z" />
</vector>
@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/themeLight"
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 -1
View File
@@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/themeLight"
android:fillColor="@android:color/white"
android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z" />
</vector>
+3 -3
View File
@@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/themeLight"
android:pathData="M21.41,11.58l-9,-9C12.05,2.22 11.55,2 11,2H4c-1.1,0 -2,0.9 -2,2v7c0,0.55 0.22,1.05 0.59,1.42l9,9c0.36,0.36 0.86,0.58 1.41,0.58 0.55,0 1.05,-0.22 1.41,-0.59l7,-7c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-0.55 -0.23,-1.06 -0.59,-1.42zM5.5,7C4.67,7 4,6.33 4,5.5S4.67,4 5.5,4 7,4.67 7,5.5 6.33,7 5.5,7z" />
<path
android:fillColor="@color/themeLight"
android:pathData="M21.41,11.58l-9,-9C12.05,2.22 11.55,2 11,2H4c-1.1,0 -2,0.9 -2,2v7c0,0.55 0.22,1.05 0.59,1.42l9,9c0.36,0.36 0.86,0.58 1.41,0.58 0.55,0 1.05,-0.22 1.41,-0.59l7,-7c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-0.55 -0.23,-1.06 -0.59,-1.42zM5.5,7C4.67,7 4,6.33 4,5.5S4.67,4 5.5,4 7,4.67 7,5.5 6.33,7 5.5,7z" />
</vector>
-9
View File
@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/themeLight"
android:pathData="M19,8l-4,4h3c0,3.31 -2.69,6 -6,6 -1.01,0 -1.97,-0.25 -2.8,-0.7l-1.46,1.46C8.97,19.54 10.43,20 12,20c4.42,0 8,-3.58 8,-8h3l-4,-4zM6,12c0,-3.31 2.69,-6 6,-6 1.01,0 1.97,0.25 2.8,0.7l1.46,-1.46C15.03,4.46 13.57,4 12,4c-4.42,0 -8,3.58 -8,8H1l4,4 4,-4H6z" />
</vector>
@@ -4,8 +4,8 @@
<shape android:shape="rectangle">
<size
android:width="1dp"
android:height="2dp" />
android:height="1dp" />
<solid android:color="@color/greyDark" />
</shape>
</item>
</layer-list>
</layer-list>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size
android:width="1dp"
android:height="0.5dp" />
<solid android:color="@color/greyDivider" />
</shape>
</item>
</layer-list>
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="0dp"
android:color="@color/greySurface" />
<solid android:color="@color/greySurface" />
<corners android:radius="8dp" />
</shape>
+6 -28
View File
@@ -1,31 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_root"
android:id="@+id/main_nav_host"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/main_nav_host"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@+id/main_nav_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/main_nav_bottom"
android:layout_width="match_parent"
android:layout_height="48dp"
app:itemBackground="@color/greySurface"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/nav_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph" />
+17 -50
View File
@@ -1,76 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/entries_root"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/greyCard">
<androidx.cardview.widget.CardView
<androidx.appcompat.widget.Toolbar
android:id="@+id/entries_bar"
style="@style/TopBar"
style="@style/Toolbar"
android:layout_width="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/entries_import_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:elevation="4dp"
android:text="@string/entries_update"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/entries_import_web"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/entries_import_web" />
<ImageButton
android:id="@+id/entries_import_web"
android:layout_width="64dp"
android:layout_height="48dp"
android:backgroundTint="@color/greyDark"
android:contentDescription="@string/placeholder"
android:elevation="4dp"
android:src="@drawable/ic_update_web"
app:layout_constraintBottom_toBottomOf="@+id/entries_import_file"
app:layout_constraintEnd_toStartOf="@+id/entries_import_file"
app:layout_constraintTop_toTopOf="@+id/entries_import_file"
tools:ignore="DuplicateSpeakableTextCheck" />
<ImageButton
android:id="@+id/entries_import_file"
android:layout_width="64dp"
android:layout_height="48dp"
android:layout_marginEnd="4dp"
android:backgroundTint="@color/greyDark"
android:contentDescription="@string/placeholder"
android:elevation="4dp"
android:src="@drawable/ic_update_file"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<SearchView
android:id="@+id/entries_search_bar"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:elevation="16dp"
android:iconifiedByDefault="false"
android:queryHint="@string/entries_search_hint"
app:layout_constraintBottom_toBottomOf="@+id/entries_select_mode"
app:layout_constraintBottom_toBottomOf="@+id/entries_bar"
app:layout_constraintEnd_toStartOf="@+id/entries_select_mode"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/entries_import_web" />
app:layout_constraintTop_toTopOf="@+id/entries_bar" />
<ImageButton
android:id="@+id/entries_select_mode"
android:layout_width="64dp"
android:layout_height="48dp"
android:elevation="16dp"
android:backgroundTint="@color/greySurface"
android:contentDescription="@string/placeholder"
android:src="@drawable/ic_satellite"
app:layout_constraintBottom_toBottomOf="@+id/entries_select_all"
app:layout_constraintBottom_toBottomOf="@+id/entries_bar"
app:layout_constraintEnd_toStartOf="@+id/entries_select_all"
app:layout_constraintTop_toTopOf="@+id/entries_select_all" />
app:layout_constraintTop_toTopOf="@+id/entries_bar" />
<ImageButton
android:id="@+id/entries_select_all"
@@ -78,19 +44,20 @@
android:layout_height="48dp"
android:backgroundTint="@color/greySurface"
android:contentDescription="@string/placeholder"
android:elevation="16dp"
android:src="@drawable/ic_select_all"
app:layout_constraintEnd_toEndOf="@+id/entries_import_file"
app:layout_constraintTop_toBottomOf="@+id/entries_import_file" />
app:layout_constraintBottom_toBottomOf="@+id/entries_select_mode"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/entries_select_mode" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/entries_recycler"
android:layout_width="0dp"
android:layout_height="0dp"
android:padding="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/entries_search_bar" />
app:layout_constraintTop_toBottomOf="@+id/entries_bar" />
<ProgressBar
android:id="@+id/entries_progress"
+4 -4
View File
@@ -107,8 +107,8 @@
android:id="@+id/map_btn_prev"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginStart="@dimen/fab_padding"
android:layout_marginBottom="@dimen/fab_padding"
android:layout_marginStart="48dp"
android:layout_marginBottom="48dp"
android:backgroundTint="@color/greySurface"
android:contentDescription="@string/placeholder"
android:rotation="180"
@@ -121,8 +121,8 @@
android:id="@+id/map_btn_next"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginEnd="@dimen/fab_padding"
android:layout_marginBottom="@dimen/fab_padding"
android:layout_marginEnd="48dp"
android:layout_marginBottom="48dp"
android:backgroundTint="@color/greySurface"
android:contentDescription="@string/placeholder"
android:src="@drawable/ic_next"
+43 -13
View File
@@ -5,9 +5,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
<androidx.appcompat.widget.Toolbar
android:id="@+id/passes_bar"
style="@style/TopBar"
android:layout_width="0dp"
style="@style/Toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -17,7 +18,7 @@
style="@style/TimerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="4dp"
android:elevation="16dp"
android:text="@string/timer_zero"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="@+id/passes_bar"
@@ -26,29 +27,46 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/passes_refresh"
android:layout_width="64dp"
android:layout_height="0dp"
android:id="@+id/passes_filter"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="4dp"
android:backgroundTint="@color/greyDark"
android:background="?android:attr/actionBarItemBackground"
android:contentDescription="@string/placeholder"
android:elevation="4dp"
android:elevation="16dp"
android:src="@drawable/ic_filter"
app:layout_constraintBottom_toBottomOf="@+id/passes_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/passes_bar" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/passes_recycler"
<ImageButton
android:id="@+id/passes_settings"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="4dp"
android:background="?android:attr/actionBarItemBackground"
android:contentDescription="@string/placeholder"
android:elevation="16dp"
android:src="@drawable/ic_nav_prefs"
app:layout_constraintBottom_toBottomOf="@+id/passes_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/passes_bar" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/passes_swipe"
android:layout_width="0dp"
android:layout_height="0dp"
android:padding="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passes_bar">
</androidx.recyclerview.widget.RecyclerView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/passes_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<ProgressBar
android:id="@+id/passes_progress"
@@ -56,7 +74,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/passes_recycler"
app:layout_constraintBottom_toBottomOf="@+id/passes_swipe"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passes_bar" />
@@ -73,4 +91,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passes_bar" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/passes_fab"
style="@style/Widget.MaterialComponents.FloatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:contentDescription="@string/placeholder"
android:src="@drawable/ic_sputnik_dark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="@+id/passes_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/greySurface"
app:navigationIcon="?attr/homeAsUpIndicator">
<TextView
android:id="@+id/passes_timer"
style="@style/TimerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/timer_zero"
android:textSize="42sp" />
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/passes_swipe"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/passes_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="2dp" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<TextView
android:id="@+id/passes_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/passes_error"
android:textSize="20sp"
android:visibility="invisible" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/passes_fab"
style="@style/Widget.MaterialComponents.FloatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:contentDescription="@string/placeholder"
android:src="@drawable/ic_sputnik_dark" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
+5 -5
View File
@@ -7,9 +7,10 @@
android:layout_height="match_parent"
android:keepScreenOn="true">
<androidx.cardview.widget.CardView
<androidx.appcompat.widget.Toolbar
android:id="@+id/radar_bar"
style="@style/TopBar"
style="@style/Toolbar"
android:layout_width="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -19,7 +20,7 @@
style="@style/TimerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="4dp"
android:elevation="16dp"
android:text="@string/timer_zero"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="@+id/radar_bar"
@@ -99,7 +100,7 @@
android:layout_marginEnd="4dp"
android:backgroundTint="@color/greyDark"
android:contentDescription="@string/placeholder"
android:elevation="4dp"
android:elevation="16dp"
android:src="@drawable/ic_nav_map"
app:layout_constraintBottom_toBottomOf="@+id/radar_bar"
app:layout_constraintEnd_toEndOf="@+id/radar_bar"
@@ -111,7 +112,6 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:overScrollMode="never"
android:padding="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
+1 -1
View File
@@ -3,7 +3,7 @@
android:id="@+id/entry_checkbox"
android:layout_width="match_parent"
android:layout_height="36dp"
android:background="@null"
android:background="@color/greyCard"
android:ellipsize="end"
android:lines="1"
android:text="@string/placeholder"
+1 -14
View File
@@ -4,7 +4,7 @@
android:id="@+id/pass_geo_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/greyDark"
android:backgroundTint="@color/greyCard"
app:cardCornerRadius="0dp">
<androidx.constraintlayout.widget.ConstraintLayout
@@ -13,19 +13,6 @@
android:layout_height="match_parent"
android:background="?android:selectableItemBackground">
<ImageView
android:id="@+id/pass_geo_bg"
android:layout_width="0dp"
android:layout_height="0dp"
android:alpha="0.64"
android:contentDescription="@string/placeholder"
android:scaleType="centerCrop"
android:src="@drawable/card_pass_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/pass_geo_name"
android:layout_width="wrap_content"
+1 -14
View File
@@ -4,7 +4,7 @@
android:id="@+id/pass_leo_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/greyDark"
android:backgroundTint="@color/greyCard"
app:cardCornerRadius="0dp">
<androidx.constraintlayout.widget.ConstraintLayout
@@ -13,19 +13,6 @@
android:layout_height="match_parent"
android:background="?android:selectableItemBackground">
<ImageView
android:id="@+id/pass_leo_bg"
android:layout_width="0dp"
android:layout_height="0dp"
android:alpha="0.64"
android:contentDescription="@string/placeholder"
android:scaleType="centerCrop"
android:src="@drawable/card_pass_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/pass_leo_name"
android:layout_width="wrap_content"
-19
View File
@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_entries"
android:icon="@drawable/ic_nav_entries"
android:title="@string/menu_entries" />
<item
android:id="@+id/nav_passes"
android:icon="@drawable/ic_nav_passes"
android:title="@string/menu_passes" />
<item
android:id="@+id/nav_map"
android:icon="@drawable/ic_nav_map"
android:title="@string/menu_map" />
<item
android:id="@+id/nav_prefs"
android:icon="@drawable/ic_nav_prefs"
android:title="@string/menu_prefs" />
</menu>
+7 -6
View File
@@ -2,14 +2,15 @@
<resources>
<color name="themeLight">#FFE082</color>
<color name="themeDark">#FFCA28</color>
<color name="greyDark">#121212</color>
<color name="bgDarkest">#121212</color>
<color name="bgDarker">#1E1E1E</color>
<color name="bgDark">#2A2A2A</color>
<color name="greyLight">#D0D0D0</color>
<color name="greyDivider">#808080</color>
<color name="greySurface">#1e1e1e</color>
<color name="greyButton">#242424</color>
<color name="greySurface">#1E1E1E</color>
<color name="greyCard">#181818</color>
<color name="greyDark">#121212</color>
<color name="mapInfoLayout">#99000000</color>
<color name="mtrl_textinput_disabled_color">@color/greyButton</color>
<color name="mtrl_textinput_default_box_stroke_color">@color/greyLight</color>
<color name="mtrl_textinput_disabled_color">@color/bgDark</color>
</resources>
+1 -2
View File
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="fab_padding">48dp</dimen>
<dimen name="design_bottom_navigation_text_size" tools:override="true">12sp</dimen>
<dimen name="design_bottom_navigation_active_text_size" tools:override="true">12sp</dimen>
</resources>
</resources>
+9 -10
View File
@@ -12,17 +12,16 @@
<item name="colorSecondary">@color/themeLight</item>
<item name="colorAccent">@color/themeLight</item>
<item name="android:textColorPrimary">@color/greyLight</item>
<item name="android:statusBarColor">@color/greyDark</item>
<item name="android:statusBarColor">@color/greyCard</item>
<item name="android:windowBackground">@color/greyDark</item>
<item name="android:navigationBarColor">@color/greyDark</item>
<item name="android:navigationBarColor">@color/greySurface</item>
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>
<style name="TopBar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">48dp</item>
<item name="cardBackgroundColor">@color/greySurface</item>
<item name="cardCornerRadius">0dp</item>
<style name="Toolbar">
<item name="android:layout_height">?android:attr/actionBarSize</item>
<item name="android:background">@color/greySurface</item>
<item name="android:elevation">8dp</item>
</style>
<style name="DialogText">
@@ -33,7 +32,7 @@
</style>
<style name="InfoButton">
<item name="android:backgroundTint">@color/bgDark</item>
<item name="android:backgroundTint">@color/greyButton</item>
<item name="android:textColor">@color/themeLight</item>
<item name="android:textSize">15sp</item>
<item name="android:drawablePadding">4dp</item>
@@ -47,8 +46,8 @@
<item name="android:layout_marginStart">8dp</item>
<item name="android:layout_marginTop">8dp</item>
<item name="android:layout_marginEnd">8dp</item>
<item name="cardBackgroundColor">@color/bgDarker</item>
<item name="cardCornerRadius">4dp</item>
<item name="cardBackgroundColor">@color/greyCard</item>
<item name="cardCornerRadius">8dp</item>
</style>
<style name="TimerText">
@@ -19,14 +19,15 @@ package com.rtbishop.look4sat
import com.rtbishop.look4sat.domain.DataParser
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.Test
@ExperimentalCoroutinesApi
class DataParserTest {
private val dataParser = DataParser(TestCoroutineDispatcher())
private val testDispatcher = StandardTestDispatcher()
private val dataParser = DataParser(testDispatcher)
private val validCSVStream = """
OBJECT_NAME,OBJECT_ID,EPOCH,MEAN_MOTION,ECCENTRICITY,INCLINATION,RA_OF_ASC_NODE,ARG_OF_PERICENTER,MEAN_ANOMALY,EPHEMERIS_TYPE,CLASSIFICATION_TYPE,NORAD_CAT_ID,ELEMENT_SET_NO,REV_AT_EPOCH,BSTAR,MEAN_MOTION_DOT,MEAN_MOTION_DDOT
ISS (ZARYA),1998-067A,2021-11-16T12:28:09.322176,15.48582035,.0004694,51.6447,309.4881,203.6966,299.8876,0,U,25544,999,31220,.31985E-4,.1288E-4,0
@@ -56,31 +57,31 @@ class DataParserTest {
""".trimIndent().byteInputStream()
@Test
fun `Given valid CSV stream returns valid data`() = runBlockingTest {
fun `Given valid CSV stream returns valid data`() = runTest(testDispatcher) {
val parsedList = dataParser.parseCSVStream(validCSVStream)
assert(parsedList[0].epoch == 21320.51955234)
}
@Test
fun `Given invalid CSV stream returns empty list`() = runBlockingTest {
fun `Given invalid CSV stream returns empty list`() = runTest(testDispatcher) {
val parsedList = dataParser.parseCSVStream(invalidCSVStream)
assert(parsedList.isEmpty())
}
@Test
fun `Given valid TLE stream returns valid data`() = runBlockingTest {
fun `Given valid TLE stream returns valid data`() = runTest(testDispatcher) {
val parsedList = dataParser.parseTLEStream(validTLEStream)
assert(parsedList[0].epoch == 21320.51955234)
}
@Test
fun `Given invalid TLE stream returns empty list`() = runBlockingTest {
fun `Given invalid TLE stream returns empty list`() = runTest(testDispatcher) {
val parsedList = dataParser.parseTLEStream(invalidTLEStream)
assert(parsedList.isEmpty())
}
@Test
fun `Given valid data streams parsed results match`() = runBlockingTest {
fun `Given valid data streams parsed results match`() = runTest(testDispatcher) {
val csvResult = dataParser.parseCSVStream(validCSVStream)
val tleResult = dataParser.parseTLEStream(validTLEStream)
println(csvResult)
@@ -89,13 +90,13 @@ class DataParserTest {
}
@Test
fun `Given valid JSON stream returns valid data`() = runBlockingTest {
fun `Given valid JSON stream returns valid data`() = runTest(testDispatcher) {
val parsedList = dataParser.parseJSONStream(validJSONStream)
assert(parsedList[0].downlink == 136658500L)
}
@Test
fun `Given invalid JSON stream returns empty list`() = runBlockingTest {
fun `Given invalid JSON stream returns empty list`() = runTest(testDispatcher) {
val parsedList = dataParser.parseJSONStream(invalidJSONStream)
assert(parsedList.isEmpty())
}