switch to the Player tab on clicking Search
This commit is contained in:
parent
43cd82cce6
commit
4f98921aab
|
@ -95,6 +95,14 @@ class MainActivity : SimpleActivity() {
|
|||
main_menu.toggleHideOnScroll(false)
|
||||
main_menu.setupMenu()
|
||||
|
||||
main_menu.onSearchOpenListener = {
|
||||
view_pager.currentItem = 1
|
||||
}
|
||||
|
||||
main_menu.onSearchTextChangedListener = { text ->
|
||||
getPagerAdapter()?.searchTextChanged(text)
|
||||
}
|
||||
|
||||
main_menu.getToolbar().setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
|
||||
|
@ -142,6 +150,9 @@ class MainActivity : SimpleActivity() {
|
|||
main_tabs_holder.onTabSelectionChanged(
|
||||
tabUnselectedAction = {
|
||||
updateBottomTabItemColors(it.customView, false)
|
||||
if (it.position == 1) {
|
||||
main_menu.closeSearch()
|
||||
}
|
||||
},
|
||||
tabSelectedAction = {
|
||||
view_pager.currentItem = it.position
|
||||
|
|
|
@ -43,4 +43,8 @@ class ViewPagerAdapter(private val activity: SimpleActivity) : PagerAdapter() {
|
|||
}
|
||||
|
||||
fun finishActMode() = (mFragments[1] as? PlayerFragment)?.finishActMode()
|
||||
|
||||
fun searchTextChanged(text: String) {
|
||||
(mFragments[1] as? PlayerFragment)?.onSearchTextChanged(text)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -390,6 +390,10 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
|
|||
player_progress_max.text = (recording?.duration ?: 0).getFormattedDuration()
|
||||
}
|
||||
|
||||
fun onSearchTextChanged(text: String) {
|
||||
|
||||
}
|
||||
|
||||
private fun togglePlayPause() {
|
||||
if (getIsPlaying()) {
|
||||
pausePlayback()
|
||||
|
|
Loading…
Reference in New Issue