Fix search bar text missing
This commit is contained in:
1 parent
513bce51ea
commit
11b7bbd7ef
4 files changed
+28
-28
No files matched your search
@@ -234,8 +234,8 @@ class DownloadsScene :
|
||||
|
||||
private fun updateTitle() {
|
||||
val title = getString(R.string.scene_download_title, mLabel ?: getString(R.string.download_all))
|
||||
setSearchBarHint(title)
|
||||
setEditTextHint(getString(R.string.search_bar_hint, title))
|
||||
setTitle(title)
|
||||
setSearchBarHint(getString(R.string.search_bar_hint, title))
|
||||
}
|
||||
|
||||
private fun onInit() {
|
||||
@@ -624,7 +624,7 @@ class DownloadsScene :
|
||||
val label = mLabels[position].takeUnless { position == 0 }
|
||||
if (mLabel != label) {
|
||||
mKeyword = null
|
||||
setSearchBarText(null)
|
||||
clearSearchBarText()
|
||||
mLabel = label
|
||||
updateForLabel()
|
||||
}
|
||||
|
||||
@@ -195,12 +195,12 @@ class FavoritesScene : SearchBarScene() {
|
||||
else -> getString(R.string.cloud_favorites)
|
||||
}
|
||||
if (keyword.isNullOrEmpty()) {
|
||||
setSearchBarHint(getString(R.string.favorites_title, favCatName))
|
||||
setSearchBarText(null)
|
||||
setTitle(getString(R.string.favorites_title, favCatName))
|
||||
clearSearchBarText()
|
||||
} else {
|
||||
setSearchBarHint(getString(R.string.favorites_title_2, favCatName, keyword))
|
||||
setTitle(getString(R.string.favorites_title_2, favCatName, keyword))
|
||||
}
|
||||
setEditTextHint(getString(R.string.search_bar_hint, favCatName))
|
||||
setSearchBarHint(getString(R.string.search_bar_hint, favCatName))
|
||||
Settings.recentFavCat = urlBuilder.favCat
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,15 @@ class GalleryListScene : SearchBarScene() {
|
||||
} else {
|
||||
onRestore(savedInstanceState)
|
||||
}
|
||||
|
||||
val mode = mUrlBuilder.mode
|
||||
if (mode != MODE_TOPLIST) {
|
||||
var keyword = mUrlBuilder.keyword
|
||||
if (mode == MODE_TAG) {
|
||||
keyword = wrapTagKeyword(keyword!!)
|
||||
}
|
||||
initialQuery = keyword.orEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@@ -241,13 +250,12 @@ class GalleryListScene : SearchBarScene() {
|
||||
}
|
||||
|
||||
private fun setSearchBarHint() {
|
||||
setEditTextHint(getString(if (EhUtils.isExHentai) R.string.gallery_list_search_bar_hint_exhentai else R.string.gallery_list_search_bar_hint_e_hentai))
|
||||
setSearchBarHint(getString(if (EhUtils.isExHentai) R.string.gallery_list_search_bar_hint_exhentai else R.string.gallery_list_search_bar_hint_e_hentai))
|
||||
}
|
||||
|
||||
// Update search bar title, drawer checked item
|
||||
private fun onUpdateUrlBuilder() {
|
||||
_binding ?: return
|
||||
var keyword = mUrlBuilder.keyword
|
||||
val category = mUrlBuilder.category
|
||||
val mode = mUrlBuilder.mode
|
||||
val isPopular = mode == MODE_WHATS_HOT
|
||||
@@ -263,20 +271,12 @@ class GalleryListScene : SearchBarScene() {
|
||||
binding.searchLayout.setCategory(category)
|
||||
}
|
||||
|
||||
// Update search edit text
|
||||
if (!mIsTopList) {
|
||||
if (mode == MODE_TAG) {
|
||||
keyword = wrapTagKeyword(keyword!!)
|
||||
}
|
||||
setSearchBarText(keyword)
|
||||
}
|
||||
|
||||
// Update title
|
||||
var title = requireContext().getSuitableTitleForUrlBuilder(mUrlBuilder, true)
|
||||
if (null == title) {
|
||||
title = resources.getString(R.string.search)
|
||||
}
|
||||
setSearchBarHint(title)
|
||||
setTitle(title)
|
||||
}
|
||||
|
||||
private val dialogState = DialogState()
|
||||
|
||||
@@ -318,7 +318,7 @@ fun SearchBarScreen(
|
||||
abstract class SearchBarScene : BaseScene() {
|
||||
private var mSuggestionProvider: SuggestionProvider? = null
|
||||
private var onApplySearch: (String) -> Unit = {}
|
||||
private var query by mutableStateOf("")
|
||||
var initialQuery = ""
|
||||
private var hint by mutableStateOf("")
|
||||
var showSearchFab by mutableStateOf(false)
|
||||
|
||||
@@ -340,7 +340,7 @@ abstract class SearchBarScene : BaseScene() {
|
||||
val density = LocalDensity.current
|
||||
val fabPadding = with(density) { 16.dp.roundToPx() }
|
||||
SearchBarScreen(
|
||||
initialQuery = query,
|
||||
initialQuery = initialQuery,
|
||||
hint = hint,
|
||||
showSearchFab = showSearchFab,
|
||||
onApplySearch = onApplySearch,
|
||||
@@ -383,18 +383,18 @@ abstract class SearchBarScene : BaseScene() {
|
||||
|
||||
open fun onSearchViewHidden() {}
|
||||
|
||||
fun setTitle(title: String?) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
fun clearSearchBarText() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
fun setSearchBarHint(hint: String?) {
|
||||
this.hint = hint.orEmpty()
|
||||
}
|
||||
|
||||
fun setSearchBarText(text: String?) {
|
||||
query = text.orEmpty()
|
||||
}
|
||||
|
||||
fun setEditTextHint(hint: String?) {
|
||||
this.hint = hint.orEmpty()
|
||||
}
|
||||
|
||||
fun setOnApplySearch(lambda: (String) -> Unit) {
|
||||
onApplySearch = lambda
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user