Bring back menu for SplashFragment

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2023-07-06 20:10:51 +05:30
parent 4f6a838411
commit fd4f6acdff
2 changed files with 64 additions and 1 deletions

View File

@@ -55,7 +55,27 @@ class SplashFragment : Fragment(R.layout.fragment_splash) {
}
// Toolbar
binding.layoutToolbarAction.toolbar.elevation = 0f
binding.layoutToolbarAction.toolbar.apply {
elevation = 0f
inflateMenu(R.menu.menu_splash)
setOnMenuItemClickListener {
when (it.itemId) {
R.id.menu_blacklist_manager -> {
findNavController().navigate(R.id.blacklistFragment)
}
R.id.menu_spoof_manager -> {
findNavController().navigate(R.id.spoofFragment)
}
R.id.menu_account_manager -> {
findNavController().navigate(R.id.accountFragment)
}
R.id.menu_settings -> {
findNavController().navigate(R.id.settingsFragment)
}
}
true
}
}
if (!Preferences.getBoolean(requireContext(), PREFERENCE_INTRO)) {
findNavController().navigate(
@@ -128,8 +148,10 @@ class SplashFragment : Fragment(R.layout.fragment_splash) {
private fun updateActionLayout(isVisible: Boolean) {
if (isVisible) {
binding.layoutAction.show()
binding.layoutToolbarAction.toolbar.invalidateMenu()
} else {
binding.layoutAction.hide()
binding.layoutToolbarAction.toolbar.menu.clear()
}
}

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Aurora Store
~ Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
~
~ Aurora Store is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 2 of the License, or
~ (at your option) any later version.
~
~ Aurora Store is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
~
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_blacklist_manager"
android:icon="@drawable/ic_blacklist"
android:title="@string/title_blacklist_manager" />
<item
android:id="@+id/menu_spoof_manager"
android:icon="@drawable/ic_anonymous"
android:title="@string/title_spoof_manager" />
<item
android:id="@+id/menu_account_manager"
android:icon="@drawable/ic_account_manager"
android:title="@string/title_account_manager" />
<item
android:id="@+id/menu_settings"
android:icon="@drawable/ic_menu_settings"
android:title="@string/title_settings" />
</menu>