Separated list logic from application logic, support for multiple list fragments

This commit is contained in:
Daniele Verducci (Slimpenguin)
2024-02-17 09:07:59 +01:00
parent a1d6f1dabe
commit fa65c33ec6
9 changed files with 333 additions and 236 deletions
+3 -50
View File
@@ -98,35 +98,6 @@
android:lines="1"
android:textSize="16sp"
android:text="@string/search_in_all"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/sort_mode"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:layout_marginRight="@dimen/spacer_1x"
android:layout_gravity="center_vertical|end"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/list_mode"
android:paddingStart="@dimen/spacer_1x"
android:paddingTop="@dimen/spacer_2x"
android:paddingEnd="@dimen/spacer_1x"
android:paddingBottom="@dimen/spacer_2x"
android:tint="@color/text_color"
android:translationX="@dimen/spacer_1x"
android:src="@drawable/ic_alphabetical_asc" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/view_mode"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="center_vertical|end"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/list_mode"
android:paddingStart="@dimen/spacer_1x"
android:paddingTop="@dimen/spacer_2x"
android:paddingEnd="@dimen/spacer_1x"
android:paddingBottom="@dimen/spacer_2x" android:tint="@color/text_color"
android:translationX="@dimen/spacer_1x"
android:src="@drawable/ic_view_module"
android:visibility="gone"/> <!-- TODO: Replace with Map View icon -->
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
@@ -135,30 +106,12 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/spacer_1hx"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:name="it.danieleverducci.nextcloudmaps.fragments.GeofavoriteListFragment" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
app:spanCount="1"
tools:itemCount="3"
tools:listitem="@layout/item_geofav">
</androidx.recyclerview.widget.RecyclerView>
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<!-- Add from map FAB -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
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/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/spacer_1hx"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/sort_mode"
android:layout_width="wrap_content"
android:layout_height="@dimen/floating_bar_height"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/list_mode"
android:paddingStart="@dimen/spacer_2x"
android:paddingEnd="@dimen/spacer_2x"
android:tint="@color/text_color"
android:src="@drawable/ic_alphabetical_asc" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
app:spanCount="1"
tools:itemCount="3"
tools:listitem="@layout/item_geofav">
</androidx.recyclerview.widget.RecyclerView>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+3
View File
@@ -39,4 +39,7 @@
<!-- FAB dimensions -->
<dimen name="fab_vertical_offset">75dp</dimen>
<!-- Floating bar below search bar -->
<dimen name="floating_bar_height">36dp</dimen>
</resources>