adding the initial search menu bar
This commit is contained in:
parent
f4186d08a9
commit
43cd82cce6
|
@ -26,7 +26,7 @@ class MainActivity : SimpleActivity() {
|
|||
setupOptionsMenu()
|
||||
refreshMenuItems()
|
||||
|
||||
updateMaterialActivityViews(main_coordinator, main_holder, useTransparentNavigation = false, useTopSearchMenu = false)
|
||||
updateMaterialActivityViews(main_coordinator, main_holder, useTransparentNavigation = false, useTopSearchMenu = true)
|
||||
|
||||
if (checkAppSideloading()) {
|
||||
return
|
||||
|
@ -54,7 +54,7 @@ class MainActivity : SimpleActivity() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupTabColors()
|
||||
setupToolbar(main_toolbar, statusBarColor = getProperBackgroundColor())
|
||||
updateMenuColors()
|
||||
getPagerAdapter()?.onResume()
|
||||
}
|
||||
|
||||
|
@ -76,14 +76,26 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (main_menu.isSearchOpen) {
|
||||
main_menu.closeSearch()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshMenuItems() {
|
||||
main_toolbar.menu.apply {
|
||||
main_menu.getToolbar().menu.apply {
|
||||
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupOptionsMenu() {
|
||||
main_toolbar.setOnMenuItemClickListener { menuItem ->
|
||||
main_menu.getToolbar().inflateMenu(R.menu.menu)
|
||||
main_menu.toggleHideOnScroll(false)
|
||||
main_menu.setupMenu()
|
||||
|
||||
main_menu.getToolbar().setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
|
||||
R.id.settings -> launchSettings()
|
||||
|
@ -94,6 +106,11 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateMenuColors() {
|
||||
updateStatusbarColor(getProperBackgroundColor())
|
||||
main_menu.updateColors()
|
||||
}
|
||||
|
||||
private fun tryInitVoiceRecorder() {
|
||||
if (isRPlus()) {
|
||||
setupViewPager()
|
||||
|
|
|
@ -5,13 +5,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/main_toolbar"
|
||||
<com.simplemobiletools.commons.views.MySearchMenu
|
||||
android:id="@+id/main_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/color_primary"
|
||||
app:menu="@menu/menu"
|
||||
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/main_holder"
|
||||
|
|
Loading…
Reference in New Issue