Changed FABs into Extended FABs that collapse on scroll; updated FABs and scrolling behaviour of app bars; removed dimens.xml files for landscape and larger widths that had been generated by Android Studio

This commit is contained in:
denizk0461
2023-05-13 10:00:40 +02:00
parent 92f7361488
commit 7ed230b4b9
14 changed files with 280 additions and 192 deletions
+164 -163
View File
@@ -16,8 +16,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
app:layout_scrollFlags="scroll">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -44,175 +44,177 @@
app:layout_constraintEnd_toStartOf="@id/button_notifications"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.TextButton"
style="@style/Widget.Material3.Button.IconButton.Outlined"
android:id="@+id/button_notifications"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
app:icon="@drawable/notifications_none"
app:iconPadding="0dp"
app:strokeColor="?attr/colorOutlineVariant"
app:layout_constraintTop_toTopOf="@id/app_title_bar"
app:layout_constraintBottom_toBottomOf="@id/app_title_bar"
app:layout_constraintEnd_toEndOf="parent"
app:iconTint="?attr/colorOnSurfaceVariant"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
android:text="@string/pref_game"/>
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
</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"/>
app:layout_scrollFlags="scroll"
app:tabMode="scrollable"
android:background="@android:color/transparent"/>
<HorizontalScrollView
android:id="@+id/scroll_view_chip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
app:layout_scrollFlags="scroll">
<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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
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"
app:chipStrokeColor="@color/list_chip_stroke"
android:text="@string/pref_game"/>
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
</com.google.android.material.appbar.AppBarLayout>
@@ -247,8 +249,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="bottom|end"
app:layout_dodgeInsetEdges="bottom"
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior">
app:layout_dodgeInsetEdges="bottom">
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="?attr/floatingActionButtonSmallStyle"
@@ -258,7 +259,8 @@
app:srcCompat="@drawable/clock"
android:contentDescription="@string/canteen_fab_opening_hours_content_desc"
android:tooltipText="@string/canteen_fab_opening_hours_content_desc"
android:layout_gravity="center_horizontal"
android:layout_gravity="end"
android:layout_marginHorizontal="24dp"
tools:ignore="UnusedAttribute"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
@@ -269,20 +271,19 @@
app:srcCompat="@drawable/switch_arrows"
android:contentDescription="@string/canteen_fab_switch_canteen_content_desc"
android:tooltipText="@string/canteen_fab_switch_canteen_content_desc"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_gravity="end"
android:layout_marginHorizontal="24dp"
tools:ignore="UnusedAttribute"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab_refresh_offers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/refresh"
android:contentDescription="@string/canteen_fab_refresh_content_desc"
android:tooltipText="@string/canteen_fab_refresh_content_desc"
app:icon="@drawable/refresh"
android:text="@string/canteen_fab_refresh_text"
android:layout_marginHorizontal="@dimen/fab_margin"
android:layout_marginBottom="@dimen/fab_margin"
tools:ignore="UnusedAttribute"/>
android:layout_marginBottom="@dimen/fab_margin"/>
</androidx.appcompat.widget.LinearLayoutCompat>
+7 -9
View File
@@ -22,14 +22,15 @@
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"/>
app:layout_scrollFlags="scroll"/>
<com.google.android.material.tabs.TabLayout
android:id="@+id/day_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="scrollable"
app:layout_scrollFlags="scroll|snap"/>
app:layout_scrollFlags="scroll"
android:background="@android:color/transparent"/>
</com.google.android.material.appbar.AppBarLayout>
@@ -49,17 +50,14 @@
android:text="@string/event_empty_fetch_button"
android:visibility="gone"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab_add_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/plus"
android:contentDescription="@string/sheet_schedule_update_header_add"
android:tooltipText="@string/sheet_schedule_update_header_add"
app:icon="@drawable/plus"
android:text="@string/schedule_fab_add_text"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="@dimen/fab_margin"
tools:ignore="UnusedAttribute"
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"/>
android:layout_marginBottom="@dimen/fab_margin"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -22,7 +22,7 @@
android:layout_marginBottom="8dp"
android:fontFamily="@font/lato_blackitalic"
android:text="@string/title_settings"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:layout_scrollFlags="scroll"
android:textSize="28sp"/>
</com.google.android.material.appbar.AppBarLayout>
@@ -4,4 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:paddingBottom="72dp"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
android:layoutAnimation="@anim/layout_animation_fall_down"/>
+3
View File
@@ -42,6 +42,8 @@
<string name="fetch_bar_help_sheet_content"> • Logge dich mit deinem Stud.IP-Login ein\n • Öffne deinen Stundenplan (falls er sich nicht automatisch öffnet)\n • Klicke auf den \'Speichern\'-Knopf, der unten in der rechten Ecke auftauchen sollte\n • Fertig!</string>
<string name="fetch_bar_save_desc">Speichere den Stundenplan in der App ab</string>
<string name="schedule_fab_add_text">Neue Veranstaltung</string>
<string name="save">Speichern</string>
<string name="delete">Löschen</string>
<string name="sheet_schedule_update_delete_confirm">Sicher?</string>
@@ -68,6 +70,7 @@
<string name="canteen_fab_opening_hours_content_desc">Zeige Öffnungszeiten</string>
<string name="canteen_fab_switch_canteen_content_desc">Wechsle Mensa</string>
<string name="canteen_fab_refresh_content_desc">Aktualisiere Angebote</string>
<string name="canteen_fab_refresh_text">Aktualisieren</string>
<!-- TODO replace 'this canteen' with %s -->
<string name="text_sheet_opening_hours_title">%s Öffnungszeiten</string>
-3
View File
@@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>
@@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">200dp</dimen>
</resources>
@@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>
+3
View File
@@ -43,6 +43,8 @@
<string name="fetch_bar_help_sheet_content"> • Log in with your Stud.IP login\n • Open your timetable view (in case it doesn\'t open automatically)\n • Click the \'save\' button that should appear in the bottom right corner\n • Done!</string>
<string name="fetch_bar_save_desc">Save the timetable in the app</string>
<string name="schedule_fab_add_text">New event</string>
<string name="save">Save</string>
<string name="delete">Delete</string>
<string name="sheet_schedule_update_delete_confirm">Sure?</string>
@@ -70,6 +72,7 @@
<string name="canteen_fab_opening_hours_content_desc">Show opening hours</string>
<string name="canteen_fab_switch_canteen_content_desc">Switch canteen</string>
<string name="canteen_fab_refresh_content_desc">Refresh offers</string>
<string name="canteen_fab_refresh_text">Refresh</string>
<string name="text_sheet_opening_hours_title">%s opening hours</string>
<string name="text_sheet_opening_hours_empty">The opening hours could not be downloaded.</string>