Scrolling ability has been added to the toolbars of the fragments, but in the process, I ducked up the canteen fragment. TODO: figure out a solution for where to put the chip group

This commit is contained in:
denizk0461
2023-05-02 16:05:33 +02:00
parent 2f4b205703
commit 51c4c9120b
7 changed files with 239 additions and 222 deletions
+197 -197
View File
@@ -1,224 +1,224 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/snackbar_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
android:fitsSystemWindows="true">
<com.google.android.material.button.MaterialButton
android:id="@+id/button_canteen_picker"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:fontFamily="@font/lato_bolditalic"/>
<TextView
android:id="@+id/app_title_bar"
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="@string/title_food"
android:textSize="32sp"
android:fontFamily="@font/lato_bolditalic"
android:layout_marginHorizontal="16dp"/>
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/button_canteen_picker"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:layout_gravity="start"
android:fontFamily="@font/lato_bolditalic"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.TextButton"
android:id="@+id/button_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
app:icon="@drawable/info"
app:iconPadding="0dp"
android:layout_gravity="end"
app:iconTint="?attr/colorOnSurfaceVariant"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<HorizontalScrollView
android:id="@+id/scroll_view_chip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:layout_gravity="bottom">
<com.google.android.material.chip.ChipGroup
android:id="@+id/chips_preference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="8dp">
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_fair"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/handshake"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_fair_text"
app:chipIconTint="@color/list_chip_fair_text"
app:chipBackgroundColor="@color/list_chip_fair_bg"
android:text="@string/pref_fair"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_fish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/fish"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_fish_text"
app:chipIconTint="@color/list_chip_fish_text"
app:chipBackgroundColor="@color/list_chip_fish_bg"
android:text="@string/pref_fish"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_poultry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/chicken"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_poultry_text"
app:chipIconTint="@color/list_chip_poultry_text"
app:chipBackgroundColor="@color/list_chip_poultry_bg"
android:text="@string/pref_poultry"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_lamb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/sheep"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_lamb_text"
app:chipIconTint="@color/list_chip_lamb_text"
app:chipBackgroundColor="@color/list_chip_lamb_bg"
android:text="@string/pref_lamb"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_vital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/yoga"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_vital_text"
app:chipIconTint="@color/list_chip_vital_text"
app:chipBackgroundColor="@color/list_chip_vital_bg"
android:text="@string/pref_vital"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_beef"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/cow"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_beef_text"
app:chipIconTint="@color/list_chip_beef_text"
app:chipBackgroundColor="@color/list_chip_beef_bg"
android:text="@string/pref_beef"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_pork"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/pig"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_pork_text"
app:chipIconTint="@color/list_chip_pork_text"
app:chipBackgroundColor="@color/list_chip_pork_bg"
android:text="@string/pref_pork"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_vegetarian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/carrot"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_vegetarian_text"
app:chipIconTint="@color/list_chip_vegetarian_text"
app:chipBackgroundColor="@color/list_chip_vegetarian_bg"
android:text="@string/pref_vegetarian"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_vegan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/leaf"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_vegan_text"
app:chipIconTint="@color/list_chip_vegan_text"
app:chipBackgroundColor="@color/list_chip_vegan_bg"
android:text="@string/pref_vegan"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_game"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/deer"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_game_text"
app:chipIconTint="@color/list_chip_game_text"
app:chipBackgroundColor="@color/list_chip_game_bg"
android:text="@string/pref_game"/>
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
<TextView
android:id="@+id/app_title_bar"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="@string/title_food"
android:textSize="32sp"
android:fontFamily="@font/lato_bolditalic"
android:layout_marginHorizontal="16dp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<com.google.android.material.tabs.TabLayout
android:id="@+id/day_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|snap"
app:tabMode="scrollable"/>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.TextButton"
android:id="@+id/button_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
app:icon="@drawable/info"
app:iconPadding="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:iconTint="?attr/colorOnSurfaceVariant"/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar"
app:layout_constraintBottom_toTopOf="@+id/scroll_view_chip">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.appcompat.widget.LinearLayoutCompat
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.appcompat.widget.LinearLayoutCompat>
android:layout_height="match_parent"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/snackbar_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/scroll_view_chip"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<!-- <androidx.coordinatorlayout.widget.CoordinatorLayout-->
<!-- android:id="@+id/snackbar_container"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="bottom"/>-->
<HorizontalScrollView
android:id="@+id/scroll_view_chip"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<com.google.android.material.chip.ChipGroup
android:id="@+id/chips_preference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:paddingHorizontal="8dp">
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_fair"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/handshake"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_fair_text"
app:chipIconTint="@color/list_chip_fair_text"
app:chipBackgroundColor="@color/list_chip_fair_bg"
android:text="@string/pref_fair"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_fish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/fish"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_fish_text"
app:chipIconTint="@color/list_chip_fish_text"
app:chipBackgroundColor="@color/list_chip_fish_bg"
android:text="@string/pref_fish"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_poultry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/chicken"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_poultry_text"
app:chipIconTint="@color/list_chip_poultry_text"
app:chipBackgroundColor="@color/list_chip_poultry_bg"
android:text="@string/pref_poultry"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_lamb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/sheep"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_lamb_text"
app:chipIconTint="@color/list_chip_lamb_text"
app:chipBackgroundColor="@color/list_chip_lamb_bg"
android:text="@string/pref_lamb"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_vital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/yoga"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_vital_text"
app:chipIconTint="@color/list_chip_vital_text"
app:chipBackgroundColor="@color/list_chip_vital_bg"
android:text="@string/pref_vital"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_beef"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/cow"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_beef_text"
app:chipIconTint="@color/list_chip_beef_text"
app:chipBackgroundColor="@color/list_chip_beef_bg"
android:text="@string/pref_beef"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_pork"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/pig"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_pork_text"
app:chipIconTint="@color/list_chip_pork_text"
app:chipBackgroundColor="@color/list_chip_pork_bg"
android:text="@string/pref_pork"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_vegetarian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/carrot"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_vegetarian_text"
app:chipIconTint="@color/list_chip_vegetarian_text"
app:chipBackgroundColor="@color/list_chip_vegetarian_bg"
android:text="@string/pref_vegetarian"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_vegan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/leaf"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_vegan_text"
app:chipIconTint="@color/list_chip_vegan_text"
app:chipBackgroundColor="@color/list_chip_vegan_bg"
android:text="@string/pref_vegan"/>
<com.google.android.material.chip.Chip
style="@style/FilterChipNoCheck"
android:id="@+id/chip_pref_game"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipIcon="@drawable/deer"
app:chipIconEnabled="true"
android:textColor="@color/list_chip_game_text"
app:chipIconTint="@color/list_chip_game_text"
app:chipBackgroundColor="@color/list_chip_game_bg"
android:text="@string/pref_game"/>
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>