mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 07:16:04 -04:00
Fixed: Toolbar title was not appearing when closing the SearchView
.
This commit is contained in:
parent
ad9d43b455
commit
79e0ec72c1
@ -182,6 +182,7 @@ abstract class PageFragment : OnItemClickListener, BaseFragment(), FragmentActiv
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
Log.e("ON_VIEW_CREATED", "onViewCreated: $screenTitle")
|
||||||
pageScreenState.value = pageScreenState.value.copy(
|
pageScreenState.value = pageScreenState.value.copy(
|
||||||
searchQueryHint = searchQueryHint,
|
searchQueryHint = searchQueryHint,
|
||||||
searchText = "",
|
searchText = "",
|
||||||
@ -242,7 +243,6 @@ abstract class PageFragment : OnItemClickListener, BaseFragment(), FragmentActiv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onSwitchCheckedChanged(isChecked: Boolean): () -> Unit = {
|
private fun onSwitchCheckedChanged(isChecked: Boolean): () -> Unit = {
|
||||||
Log.e("PAGE_FRAGMENT", "onSwitchCheckedChanged: $isChecked")
|
|
||||||
pageScreenState.value = pageScreenState.value.copy(switchIsChecked = isChecked)
|
pageScreenState.value = pageScreenState.value.copy(switchIsChecked = isChecked)
|
||||||
pageViewModel.actions.offer(Action.UserClickedShowAllToggle(isChecked))
|
pageViewModel.actions.offer(Action.UserClickedShowAllToggle(isChecked))
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,8 @@ fun PageScreen(
|
|||||||
@Composable
|
@Composable
|
||||||
private fun searchBarIfActive(
|
private fun searchBarIfActive(
|
||||||
state: PageFragmentScreenState
|
state: PageFragmentScreenState
|
||||||
): (@Composable () -> Unit)? = {
|
): (@Composable () -> Unit)? = if (state.isSearchActive) {
|
||||||
if (state.isSearchActive) {
|
{
|
||||||
KiwixSearchView(
|
KiwixSearchView(
|
||||||
placeholder = state.searchQueryHint,
|
placeholder = state.searchQueryHint,
|
||||||
value = state.searchText,
|
value = state.searchText,
|
||||||
@ -105,9 +105,9 @@ private fun searchBarIfActive(
|
|||||||
onValueChange = { state.searchValueChangedListener(it) },
|
onValueChange = { state.searchValueChangedListener(it) },
|
||||||
onClearClick = { state.clearSearchButtonClickListener.invoke() }
|
onClearClick = { state.clearSearchButtonClickListener.invoke() }
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -16,7 +16,7 @@ class BookmarksFragment : PageFragment() {
|
|||||||
PageAdapter(PageItemDelegate(this))
|
PageAdapter(PageItemDelegate(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
override val screenTitle: Int by lazy { R.string.bookmarks }
|
override val screenTitle: Int = R.string.bookmarks
|
||||||
override val noItemsString: String by lazy { getString(R.string.no_bookmarks) }
|
override val noItemsString: String by lazy { getString(R.string.no_bookmarks) }
|
||||||
override val switchString: String by lazy { getString(R.string.bookmarks_from_current_book) }
|
override val switchString: String by lazy { getString(R.string.bookmarks_from_current_book) }
|
||||||
override val deleteIconTitle: Int by lazy {
|
override val deleteIconTitle: Int by lazy {
|
||||||
|
@ -21,7 +21,7 @@ class HistoryFragment : PageFragment() {
|
|||||||
|
|
||||||
override val noItemsString: String by lazy { getString(R.string.no_history) }
|
override val noItemsString: String by lazy { getString(R.string.no_history) }
|
||||||
override val switchString: String by lazy { getString(R.string.history_from_current_book) }
|
override val switchString: String by lazy { getString(R.string.history_from_current_book) }
|
||||||
override val screenTitle: Int by lazy { R.string.history }
|
override val screenTitle: Int = R.string.history
|
||||||
override val deleteIconTitle: Int by lazy {
|
override val deleteIconTitle: Int by lazy {
|
||||||
R.string.pref_clear_all_history_title
|
R.string.pref_clear_all_history_title
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import org.kiwix.kiwixmobile.core.page.notes.viewmodel.NotesViewModel
|
|||||||
class NotesFragment : PageFragment() {
|
class NotesFragment : PageFragment() {
|
||||||
override val pageViewModel by lazy { viewModel<NotesViewModel>(viewModelFactory) }
|
override val pageViewModel by lazy { viewModel<NotesViewModel>(viewModelFactory) }
|
||||||
|
|
||||||
override val screenTitle: Int get() = R.string.pref_notes
|
override val screenTitle: Int = R.string.pref_notes
|
||||||
|
|
||||||
override val pageAdapter: PageAdapter by lazy {
|
override val pageAdapter: PageAdapter by lazy {
|
||||||
PageAdapter(PageDelegate.PageItemDelegate(this))
|
PageAdapter(PageDelegate.PageItemDelegate(this))
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.kiwix.kiwixmobile.core.ui.components
|
package org.kiwix.kiwixmobile.core.ui.components
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@ -97,6 +98,7 @@ private fun AppBarTitleSection(
|
|||||||
@StringRes titleId: Int,
|
@StringRes titleId: Int,
|
||||||
searchBar: (@Composable () -> Unit)? = null
|
searchBar: (@Composable () -> Unit)? = null
|
||||||
) {
|
) {
|
||||||
|
Log.e("ON_VIEW_CREATED", "AppBarTitleSection: $titleId , and searchBar = $searchBar")
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@ -106,6 +108,7 @@ private fun AppBarTitleSection(
|
|||||||
searchBar?.let {
|
searchBar?.let {
|
||||||
it()
|
it()
|
||||||
} ?: run {
|
} ?: run {
|
||||||
|
Log.e("ON_VIEW_CREATED", "AppBarTitle: $titleId")
|
||||||
AppBarTitle(titleId)
|
AppBarTitle(titleId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user