Archived
Replaced fragment switching functionality in MainActivity.kt with Navigation component, simplifying logic significantly; upgraded to AGP 8.0.1
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:defaultNavHost="true"
|
||||
app:navGraph="@navigation/main_nav_graph"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/nav_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -44,6 +44,15 @@
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<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"/>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/scroll_view_chip"
|
||||
android:layout_width="match_parent"
|
||||
@@ -181,15 +190,6 @@
|
||||
|
||||
</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
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/plan"
|
||||
android:id="@+id/schedule"
|
||||
android:icon="@drawable/design"
|
||||
android:title="@string/nav_schedule"
|
||||
android:enabled="true"/>
|
||||
<item
|
||||
android:id="@+id/food"
|
||||
android:id="@+id/canteen"
|
||||
android:icon="@drawable/restaurant"
|
||||
android:title="@string/nav_food"
|
||||
android:enabled="true"/>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation 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/main_nav_graph"
|
||||
app:startDestination="@id/schedule">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/schedule"
|
||||
android:name="com.denizk0461.studip.fragment.EventFragment"
|
||||
android:label="EventFragment"
|
||||
tools:layout="@layout/fragment_event"/>
|
||||
<fragment
|
||||
android:id="@+id/canteen"
|
||||
android:name="com.denizk0461.studip.fragment.CanteenFragment"
|
||||
android:label="CanteenFragment"/>
|
||||
<fragment
|
||||
android:id="@+id/settings"
|
||||
android:name="com.denizk0461.studip.fragment.SettingsFragment"
|
||||
android:label="SettingsFragment"
|
||||
tools:layout="@layout/fragment_settings"/>
|
||||
</navigation>
|
||||
Reference in New Issue
Block a user