Added entries recycler item divider, further fixes to the UI

This commit is contained in:
Arty Bishop committed 2020-10-06 23:24:17 +01:00
1 parent 704dac6a75
commit 3935765491
16 files changed
+61 -123

No files matched your search

@@ -5,9 +5,11 @@ import android.os.Bundle
import android.view.View import android.view.View
import android.widget.SearchView import android.widget.SearchView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.rtbishop.look4sat.Look4SatApp import com.rtbishop.look4sat.Look4SatApp
import com.rtbishop.look4sat.R import com.rtbishop.look4sat.R
@@ -45,11 +47,19 @@ class EntriesFragment : Fragment(R.layout.fragment_entries),
binding.apply { binding.apply {
importWeb.setOnClickListener { showSourcesDialog() } importWeb.setOnClickListener { showSourcesDialog() }
importFile.setOnClickListener { showFileDialog() } importFile.setOnClickListener { showFileDialog() }
selectAll.setOnClickListener { entriesAdapter.selectAll() }
entriesFab.setOnClickListener { goToPassesAndCalculateForSelection() }
searchBar.setOnQueryTextListener(this@EntriesFragment) searchBar.setOnQueryTextListener(this@EntriesFragment)
entriesRecycler.layoutManager = LinearLayoutManager(requireActivity()) selectAll.setOnClickListener { entriesAdapter.selectAll() }
entriesRecycler.adapter = entriesAdapter entriesRecycler.apply {
val linearLayoutMgr = LinearLayoutManager(requireContext())
val divider = DividerItemDecoration(requireContext(), linearLayoutMgr.orientation)
val drawable = ResourcesCompat
.getDrawable(resources, R.drawable.entries_divider, requireActivity().theme)
drawable?.let { divider.setDrawable(it) }
layoutManager = linearLayoutMgr
adapter = entriesAdapter
addItemDecoration(divider)
}
entriesFab.setOnClickListener { goToPassesAndCalculateForSelection() }
} }
} }
@@ -27,13 +27,13 @@ import android.view.View
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.rtbishop.look4sat.BuildConfig import com.rtbishop.look4sat.BuildConfig
import com.rtbishop.look4sat.R import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.databinding.FragmentAboutBinding import com.rtbishop.look4sat.databinding.FragmentInfoBinding
class AboutFragment : Fragment(R.layout.fragment_about) { class InfoFragment : Fragment(R.layout.fragment_info) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
FragmentAboutBinding.bind(view).apply { FragmentInfoBinding.bind(view).apply {
version.text = String.format(getString(R.string.app_version), BuildConfig.VERSION_NAME) version.text = String.format(getString(R.string.app_version), BuildConfig.VERSION_NAME)
message.movementMethod = LinkMovementMethod.getInstance() message.movementMethod = LinkMovementMethod.getInstance()
} }
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="8dp"
android:right="8dp">
<shape android:shape="rectangle">
<size
android:width="1dp"
android:height="0.5dp" />
<solid android:color="@color/shuttle_gray" />
</shape>
</item>
</layer-list>
@@ -21,7 +21,7 @@
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:angle="270" android:angle="270"
android:endColor="@color/themeButton" android:endColor="@color/themeDark"
android:startColor="@color/backgroundDark" android:startColor="@color/backgroundDark"
android:type="linear" /> android:type="linear" />
</shape> </shape>
+2 -1
View File
@@ -20,10 +20,11 @@
android:id="@+id/nav_bottom" android:id="@+id/nav_bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@color/themeDark"
app:itemIconSize="24dp" app:itemIconSize="24dp"
app:itemIconTint="@color/nav_item_selector" app:itemIconTint="@color/nav_item_selector"
app:itemTextColor="@color/nav_item_selector" app:itemTextColor="@color/nav_item_selector"
app:labelVisibilityMode="selected" app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -1,88 +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"
android:id="@+id/dialog_sat_entry_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp">
<TextView
android:id="@+id/dialog_title"
style="@style/DialogText"
android:layout_width="0dp"
android:layout_marginTop="8dp"
android:text="@string/dialog_select_sat"
app:layout_constraintEnd_toEndOf="@+id/dialog_btn_positive"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/dialog_btn_neutral"
app:layout_constraintTop_toTopOf="parent" />
<SearchView
android:id="@+id/dialog_search"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:queryHint="@string/dialog_entries_hint"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dialog_title" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/dialog_recycler"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@+id/dialog_btn_negative"
app:layout_constraintEnd_toEndOf="@+id/dialog_search"
app:layout_constraintStart_toStartOf="@+id/dialog_search"
app:layout_constraintTop_toBottomOf="@+id/dialog_search" />
<TextView
android:id="@+id/dialog_btn_neutral"
style="@style/DialogText"
android:layout_marginStart="8dp"
android:text="@string/btn_all_none"
app:layout_constraintBaseline_toBaselineOf="@+id/dialog_btn_negative"
app:layout_constraintStart_toStartOf="@+id/dialog_recycler" />
<TextView
android:id="@+id/dialog_btn_negative"
style="@style/DialogText"
android:layout_marginEnd="24dp"
android:text="@string/btn_cancel"
app:layout_constraintBaseline_toBaselineOf="@+id/dialog_btn_positive"
app:layout_constraintEnd_toStartOf="@+id/dialog_btn_positive" />
<TextView
android:id="@+id/dialog_btn_positive"
style="@style/DialogText"
android:layout_width="36dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:gravity="end"
android:text="@string/btn_ok"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/dialog_recycler" />
</androidx.constraintlayout.widget.ConstraintLayout>
+10 -10
View File
@@ -29,7 +29,7 @@
<View <View
android:id="@+id/entries_bar" android:id="@+id/entries_bar"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="96dp" android:layout_height="48dp"
android:background="@color/themeDark" android:background="@color/themeDark"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -39,7 +39,7 @@
android:id="@+id/import_msg" android:id="@+id/import_msg"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="24dp"
android:text="@string/sat_import" android:text="@string/sat_import"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/import_web" app:layout_constraintBottom_toBottomOf="@+id/import_web"
@@ -48,9 +48,8 @@
<ImageButton <ImageButton
android:id="@+id/import_web" android:id="@+id/import_web"
android:layout_width="48dp" android:layout_width="64dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_marginEnd="4dp"
android:backgroundTint="@color/backgroundDark" android:backgroundTint="@color/backgroundDark"
android:contentDescription="@string/placeholder" android:contentDescription="@string/placeholder"
android:src="@drawable/ic_update_web" android:src="@drawable/ic_update_web"
@@ -60,9 +59,9 @@
<ImageButton <ImageButton
android:id="@+id/import_file" android:id="@+id/import_file"
android:layout_width="48dp" android:layout_width="64dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="4dp"
android:backgroundTint="@color/backgroundDark" android:backgroundTint="@color/backgroundDark"
android:contentDescription="@string/placeholder" android:contentDescription="@string/placeholder"
android:src="@drawable/ic_update_file" android:src="@drawable/ic_update_file"
@@ -73,17 +72,18 @@
android:id="@+id/search_bar" android:id="@+id/search_bar"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:iconifiedByDefault="false" android:iconifiedByDefault="false"
android:queryHint="@string/dialog_entries_hint" android:queryHint="@string/dialog_entries_hint"
app:layout_constraintBottom_toBottomOf="@+id/entries_bar"
app:layout_constraintEnd_toStartOf="@+id/select_all" app:layout_constraintEnd_toStartOf="@+id/select_all"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/entries_bar" />
<ImageButton <ImageButton
android:id="@+id/select_all" android:id="@+id/select_all"
android:layout_width="48dp" android:layout_width="64dp"
android:layout_height="48dp" android:layout_height="48dp"
android:backgroundTint="@color/backgroundDark" android:backgroundTint="@color/themeDark"
android:contentDescription="@string/placeholder" android:contentDescription="@string/placeholder"
android:src="@drawable/ic_select_all" android:src="@drawable/ic_select_all"
app:layout_constraintEnd_toEndOf="@+id/import_file" app:layout_constraintEnd_toEndOf="@+id/import_file"
@@ -22,7 +22,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.fragments.AboutFragment"> tools:context=".ui.fragments.InfoFragment">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -64,8 +64,6 @@
android:id="@+id/passes_recycler" android:id="@+id/passes_recycler"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
+6 -1
View File
@@ -20,7 +20,12 @@
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android" <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sat_entry_checkbox" android:id="@+id/sat_entry_checkbox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="36dp" android:layout_height="34dp"
android:background="@null"
android:button="@null"
android:drawableEnd="?android:attr/listChoiceIndicatorMultiple"
android:paddingStart="24dp"
android:paddingEnd="20dp"
android:text="@string/placeholder" android:text="@string/placeholder"
android:textColor="@color/themeLight" android:textColor="@color/themeLight"
android:textSize="17sp" /> android:textSize="17sp" />
+2 -2
View File
@@ -34,7 +34,7 @@
android:icon="@drawable/ic_menu_prefs" android:icon="@drawable/ic_menu_prefs"
android:title="@string/menu_prefs" /> android:title="@string/menu_prefs" />
<item <item
android:id="@+id/nav_about" android:id="@+id/nav_info"
android:icon="@drawable/ic_menu_about" android:icon="@drawable/ic_menu_info"
android:title="@string/menu_about" /> android:title="@string/menu_about" />
</menu> </menu>
+3 -3
View File
@@ -68,8 +68,8 @@
android:name="com.rtbishop.look4sat.ui.fragments.PrefsFragment" /> android:name="com.rtbishop.look4sat.ui.fragments.PrefsFragment" />
<fragment <fragment
android:id="@+id/nav_about" android:id="@+id/nav_info"
android:name="com.rtbishop.look4sat.ui.fragments.AboutFragment" android:name="com.rtbishop.look4sat.ui.fragments.InfoFragment"
tools:layout="@layout/fragment_about" /> tools:layout="@layout/fragment_info" />
</navigation> </navigation>
+2 -2
View File
@@ -24,13 +24,13 @@
<string name="menu_passes">Пролеты</string> <string name="menu_passes">Пролеты</string>
<string name="menu_map">Карта Мира</string> <string name="menu_map">Карта Мира</string>
<string name="menu_prefs">Настройки</string> <string name="menu_prefs">Настройки</string>
<string name="menu_about">О приложении</string> <string name="menu_about">Инфо</string>
<string name="dialog_select_sat">Выберите спутники для слежения</string> <string name="dialog_select_sat">Выберите спутники для слежения</string>
<string name="dialog_show_track">Показать трассу орбиты для</string> <string name="dialog_show_track">Показать трассу орбиты для</string>
<string name="dialog_filter_passes">Фильтровать пролеты</string> <string name="dialog_filter_passes">Фильтровать пролеты</string>
<string name="dialog_tle_sources">Управление источниками TLE</string> <string name="dialog_tle_sources">Управление источниками TLE</string>
<string name="dialog_entries_hint">Имя/Идентификатор</string> <string name="dialog_entries_hint">ID / Имя</string>
<string name="pref_hours_ahead_hint">Количество часов</string> <string name="pref_hours_ahead_hint">Количество часов</string>
<string name="pref_hours_ahead_summary">Показать пролеты за след. Х часов</string> <string name="pref_hours_ahead_summary">Показать пролеты за след. Х часов</string>
+1 -1
View File
@@ -23,7 +23,7 @@
<color name="themeDark">#191919</color> <color name="themeDark">#191919</color>
<color name="themeIcon">#FFE082</color> <color name="themeIcon">#FFE082</color>
<color name="themeButton">#242424</color> <color name="themeButton">#242424</color>
<color name="backgroundDark">#080808</color> <color name="backgroundDark">#121212</color>
<color name="backgroundMapText">#CC000000</color> <color name="backgroundMapText">#CC000000</color>
<color name="backgroundMapInfoLayout">#66000000</color> <color name="backgroundMapInfoLayout">#66000000</color>
<color name="satTrack">#D50000</color> <color name="satTrack">#D50000</color>
+3 -4
View File
@@ -25,13 +25,13 @@
<string name="menu_passes">Passes</string> <string name="menu_passes">Passes</string>
<string name="menu_map">World Map</string> <string name="menu_map">World Map</string>
<string name="menu_prefs">Settings</string> <string name="menu_prefs">Settings</string>
<string name="menu_about">About</string> <string name="menu_about">Info</string>
<string name="dialog_select_sat">Select satellites to track</string> <string name="dialog_select_sat">Select satellites to track</string>
<string name="dialog_show_track">Show ground track for</string> <string name="dialog_show_track">Show ground track for</string>
<string name="dialog_filter_passes">Filter passes</string> <string name="dialog_filter_passes">Filter passes</string>
<string name="dialog_tle_sources">Manage TLE sources</string> <string name="dialog_tle_sources">Manage TLE sources</string>
<string name="dialog_entries_hint">Name/CatNum</string> <string name="dialog_entries_hint">ID / Name</string>
<string name="pref_hours_ahead_hint">Hours ahead</string> <string name="pref_hours_ahead_hint">Hours ahead</string>
<string name="pref_hours_ahead_summary">Show passes that occur within X hours</string> <string name="pref_hours_ahead_summary">Show passes that occur within X hours</string>
@@ -65,9 +65,8 @@
<string name="pass_satId" translatable="false">ID: %d</string> <string name="pass_satId" translatable="false">ID: %d</string>
<string name="pass_aos_az">AOS — %2d°</string> <string name="pass_aos_az">AOS — %2d°</string>
<string name="pass_los_az">%2d° — LOS</string> <string name="pass_los_az">%2d° — LOS</string>
<string name="pass_dateTime" translatable="false">dd MMM @ HH:mm:ss</string> <string name="pass_dateTime" translatable="false">dd MMM - HH:mm:ss</string>
<string name="pat_location" translatable="false">%.4f</string>
<string name="pat_azimuth">Az: %.1f°</string> <string name="pat_azimuth">Az: %.1f°</string>
<string name="pat_elevation">El: %.1f°</string> <string name="pat_elevation">El: %.1f°</string>
<string name="pat_latitude">Lat: %.1f°</string> <string name="pat_latitude">Lat: %.1f°</string>