From d3ba1c3181289e8bb74f95094a1fd8165291a556 Mon Sep 17 00:00:00 2001 From: Natthan Krish <natthankrish@Nates-MacBook-Pro.local> Date: Wed, 13 Mar 2024 00:12:14 +0700 Subject: [PATCH] fix: top bar --- .idea/deploymentTargetDropDown.xml | 2 +- .../java/com/example/bondoman/activities/MainActivity.kt | 7 +++++++ app/src/main/res/layout/activity_main.xml | 9 ++------- app/src/main/res/layout/fragment_graf.xml | 3 ++- app/src/main/res/values/styles.xml | 2 ++ app/src/main/res/values/themes.xml | 6 ++++-- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 123512b..82f13d6 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -15,7 +15,7 @@ </deviceKey> </Target> </targetSelectedWithDropDown> - <timeTargetWasSelectedWithDropDown value="2024-03-12T14:57:15.412212Z" /> + <timeTargetWasSelectedWithDropDown value="2024-03-12T16:51:54.989040Z" /> </State> </entry> </value> diff --git a/app/src/main/java/com/example/bondoman/activities/MainActivity.kt b/app/src/main/java/com/example/bondoman/activities/MainActivity.kt index a8a5a2a..5adf31b 100644 --- a/app/src/main/java/com/example/bondoman/activities/MainActivity.kt +++ b/app/src/main/java/com/example/bondoman/activities/MainActivity.kt @@ -16,5 +16,12 @@ class MainActivity : AppCompatActivity() { >(R.id.bottom_navigation_view) val navController = findNavController(R.id.nav_fragment) bottomNavigationView.setupWithNavController(navController) + + + bottomNavigationView.setOnItemSelectedListener { menuItem -> + supportActionBar?.setTitle(menuItem.title.toString()) + true + } + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index ea709b6..8056900 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -6,12 +6,6 @@ android:layout_height="match_parent" tools:context=".activities.MainActivity"> - <Toolbar - android:id="@+id/current_page" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_constraintTop_toTopOf="parent"/> - <fragment android:id="@+id/nav_fragment" android:name="androidx.navigation.fragment.NavHostFragment" @@ -21,7 +15,7 @@ app:layout_constraintBottom_toTopOf="@+id/bottom_navigation_view" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" - app:layout_constraintTop_toBottomOf="@+id/current_page" + app:layout_constraintTop_toBottomOf="parent" app:navGraph="@navigation/nav_graph"/> <com.google.android.material.bottomnavigation.BottomNavigationView @@ -31,6 +25,7 @@ android:layout_marginStart="0dp" android:layout_marginEnd="0dp" app:itemIconTint="@color/menu_color" + app:itemTextColor="@color/green" app:itemBackground="@color/brown_1" android:background="?android:attr/windowBackground" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/fragment_graf.xml b/app/src/main/res/layout/fragment_graf.xml index f803bad..953ea7f 100644 --- a/app/src/main/res/layout/fragment_graf.xml +++ b/app/src/main/res/layout/fragment_graf.xml @@ -9,6 +9,7 @@ <TextView android:layout_width="match_parent" android:layout_height="match_parent" - android:text="@string/hello_blank_fragment" /> + android:text="@string/hello_blank_fragment" + android:background="@color/black"/> </FrameLayout> \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index fd4aac3..5e4c951 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -4,4 +4,6 @@ <item name="colorPrimary">@color/green</item> <item name="android:textColorSecondary">@color/brown_2</item> </style> + + </resources> \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index ac296b3..9a0a1e2 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,8 +1,8 @@ <resources xmlns:tools="http://schemas.android.com/tools"> <!-- Base application theme. --> - <style name="Theme.BondoMan" parent="Theme.MaterialComponents.Light.NoActionBar"> + <style name="Theme.BondoMan" parent="Theme.MaterialComponents.Light.DarkActionBar"> <!-- Primary brand color. --> - <item name="colorPrimary">@color/green</item> + <item name="colorPrimary">@color/white</item> <item name="colorPrimaryVariant">@color/black</item> <item name="colorOnPrimary">@color/black</item> <!-- Secondary brand color. --> @@ -10,6 +10,8 @@ <item name="colorSecondaryVariant">@color/teal_700</item> <item name="colorOnSecondary">@color/black</item> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> + <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Light</item> + <!-- Customize your theme here. --> </style> </resources> \ No newline at end of file -- GitLab