Showing the information layout when no satellites are selected

This commit is contained in:
Arty Bishop committed 2020-01-21 16:35:23 +00:00
1 parent 700ade62bb
commit e11e4863d3
8 files changed
+250 -22

No files matched your search

@@ -69,7 +69,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
private val urlList = listOf(
"https://celestrak.com/NORAD/elements/amateur.txt",
"https://celestrak.com/NORAD/elements/starlink.txt",
"https://celestrak.com/NORAD/elements/weather.txt"
)
@@ -29,6 +29,7 @@ import android.widget.ImageButton
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
@@ -55,6 +56,7 @@ class PassListFragment : Fragment() {
private lateinit var aosTimer: CountDownTimer
private lateinit var aosTimerText: TextView
private lateinit var swipeLayout: SwipeRefreshLayout
private lateinit var infoLayout: ConstraintLayout
private lateinit var mainActivity: MainActivity
private lateinit var satPassList: MutableList<SatPass>
private var isTimerSet: Boolean = false
@@ -86,6 +88,7 @@ class PassListFragment : Fragment() {
aosTimerText = mainActivity.findViewById(R.id.toolbar_timer)
btnPassPrefs = mainActivity.findViewById(R.id.toolbar_filter)
swipeLayout = view.findViewById(R.id.pass_list_refresh)
infoLayout = view.findViewById(R.id.pass_info_layout)
satPassRecycler = view.findViewById(R.id.pass_list_recycler)
passListFab = view.findViewById(R.id.pass_list_fab)
}
@@ -114,6 +117,13 @@ class PassListFragment : Fragment() {
viewModel.passSatList.observe(viewLifecycleOwner, Observer {
satPassList = it
satPassAdapter.setList(satPassList)
if (satPassList.isNotEmpty()) {
infoLayout.visibility = View.INVISIBLE
satPassRecycler.visibility = View.VISIBLE
} else {
infoLayout.visibility = View.VISIBLE
satPassRecycler.visibility = View.INVISIBLE
}
setTimer()
swipeLayout.isRefreshing = false
})
@@ -0,0 +1,28 @@
<!--
~ Look4Sat. Amateur radio & weather satellites passes calculator 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="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z" />
</vector>
+31
View File
@@ -0,0 +1,31 @@
<!--
~ Look4Sat. Amateur radio & weather satellites passes calculator 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="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:fillColor="#52C0C0C0"
android:pathData="m96.642,31.504c7.911,7.997 17.143,13.584 25.365,15.581l1.754,-3.997C123.78,43.048 123.786,43.005 123.802,42.965 125.834,38.995 127,34.495 127,29.715 127,13.881 114.379,1 98.867,1c-5.125,0 -9.92,1.429 -14.064,3.884l-3.398,1.598c0.08,0.306 0.133,0.599 0.221,0.91 2.32,8.104 7.652,16.667 15.016,24.112z" />
<path
android:fillColor="#52C0C0C0"
android:pathData="M93.876,34.3C86.053,26.391 80.369,17.225 77.87,8.49 77.84,8.385 77.818,8.285 77.788,8.181L2.629,43.513c-1.404,0.66 -2.019,2.358 -1.372,3.791 0.472,1.046 1.485,1.663 2.545,1.663 0.392,0 0.79,-0.084 1.169,-0.263L74.045,16.235c-1.873,3.578 -2.997,7.611 -3.228,11.885L35.566,51.732c-1.294,0.866 -1.653,2.638 -0.805,3.957 0.538,0.836 1.431,1.29 2.344,1.29 0.526,0 1.06,-0.151 1.533,-0.469L71.189,34.707c1.4,8.11 6.135,15.044 12.715,19.285l-54.945,68.337c-0.981,1.22 -0.808,3.021 0.388,4.023 0.521,0.437 1.149,0.649 1.775,0.649 0.809,0 1.611,-0.357 2.166,-1.045L89.056,56.595c3.06,1.168 6.357,1.838 9.811,1.838 4.932,0 9.566,-1.312 13.601,-3.597L84.602,118.323c-0.633,1.44 0,3.131 1.41,3.777 0.372,0.17 0.76,0.25 1.144,0.25 1.07,0 2.092,-0.629 2.556,-1.691L120.402,50.739C111.642,48.416 102.042,42.555 93.876,34.3Z" />
</vector>
+1 -1
View File
@@ -48,7 +48,7 @@
style="@style/CardPassName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginStart="2dp"
android:text="@string/pass_satName"
app:layout_constraintBaseline_toBaselineOf="@+id/pass_satId"
app:layout_constraintStart_toEndOf="@+id/pass_img" />
+145 -17
View File
@@ -1,11 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?><!--
~ Look4Sat. Amateur radio & weather satellites passes calculator 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.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/pass_list_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/pass_list_refresh"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -14,22 +32,132 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:paddingBottom="4dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.recyclerview.widget.RecyclerView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/pass_list_fab"
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
android:id="@+id/pass_info_layout"
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">
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/info_swipe_img"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginTop="8dp"
android:contentDescription="@string/placeholder"
app:layout_constraintEnd_toStartOf="@+id/guide_right"
app:layout_constraintStart_toStartOf="@+id/guide_left"
app:layout_constraintTop_toTopOf="@+id/guide_top"
app:srcCompat="@drawable/ic_arrow_swipe" />
<TextView
android:id="@+id/info_swipe_text"
style="@style/PassInfoText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/info_swipe_text"
app:layout_constraintEnd_toStartOf="@+id/guide_right"
app:layout_constraintStart_toStartOf="@+id/guide_left"
app:layout_constraintTop_toBottomOf="@+id/info_swipe_img" />
<ImageView
android:id="@+id/info_img_sputnik"
android:layout_width="176dp"
android:layout_height="176dp"
android:contentDescription="@string/placeholder"
app:layout_constraintBottom_toTopOf="@+id/info_main_text"
app:layout_constraintEnd_toStartOf="@+id/guide_right"
app:layout_constraintStart_toStartOf="@+id/guide_left"
app:layout_constraintTop_toBottomOf="@+id/info_swipe_text"
app:layout_constraintVertical_chainStyle="packed"
app:srcCompat="@drawable/ic_sputnik" />
<TextView
android:id="@+id/info_main_text"
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/info_select_text"
app:layout_constraintEnd_toStartOf="@+id/guide_right"
app:layout_constraintStart_toStartOf="@+id/guide_left"
app:layout_constraintTop_toTopOf="@+id/guide_center"
app:layout_constraintVertical_bias="0.25"
app:layout_constraintVertical_chainStyle="spread" />
<TextView
android:id="@+id/info_select_text"
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/guide_bottom"
app:layout_constraintEnd_toStartOf="@+id/guide_right"
app:layout_constraintStart_toStartOf="@+id/guide_left" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guide_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="16dp" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guide_left"
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/guide_center"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guide_right"
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/guide_bottom"
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/pass_list_fab"
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>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+11 -3
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Look4Sat. Amateur radio & weather satellites passes calculator for Android.
~ Copyright (C) 2019, 2020 Arty Bishop (bishop.arty@gmail.com)
~
@@ -73,7 +72,7 @@
<string name="no_mode">Mode: Null</string>
<string name="no_uplink">Uplink: Null</string>
<string name="no_downlink">Downlink: Null</string>
<string name="no_selected_sat">No satellites were shortlisted</string>
<string name="no_selected_sat">No satellites were selected</string>
<string name="no_transmitters">No transmitters found for this Satellite</string>
<string name="err_no_permissions">Missing permissions</string>
@@ -114,6 +113,15 @@
<string name="trans_down_low">Downlink: %.4f MHz</string>
<string name="trans_down_lowHigh">Downlink: %.4f - %.4f MHz</string>
<string name="info_swipe_text">
Swipe the screen to refresh the list of passes for selected satellites</string>
<string name="info_main_text">
Look4Sat is using the Two-Line Element set to calculate the satellites positions \n
You can update the TLE file via the corresponding button in the main menu \n \n
Once the list is calculated, press a pass item for detailed information</string>
<string name="info_select_text">
Press this button to select the satellites you wish to track</string>
<string name="btn_yes">Yes</string>
<string name="btn_no">No</string>
<string name="btn_ok">OK</string>
+24
View File
@@ -1,3 +1,22 @@
<!--
~ Look4Sat. Amateur radio & weather satellites passes calculator 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.
-->
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents">
@@ -93,6 +112,11 @@
<item name="android:textSize">15sp</item>
</style>
<style name="PassInfoText">
<item name="android:textColor">@color/themeLight</item>
<item name="android:textSize">17sp</item>
</style>
<style name="MapText">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>