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