Merge branch 'remove-search-limit' into 'master'

allow searches down to 1 character

See merge request videostreaming/grayjay!40
This commit is contained in:
Koen 2024-11-21 09:43:02 +00:00
commit 4b5d347413
2 changed files with 17 additions and 13 deletions

View file

@ -26,6 +26,7 @@ import com.futo.platformplayer.stores.FragmentedStorage
import com.futo.platformplayer.stores.SearchHistoryStorage
class SearchTopBarFragment : TopFragment() {
@Suppress("PrivatePropertyName")
private val TAG = "SearchTopBarFragment"
private var _editSearch: EditText? = null;
@ -191,29 +192,32 @@ class SearchTopBarFragment : TopFragment() {
}
private fun onDone() {
val editSearch = _editSearch;
val editSearch = _editSearch
if (editSearch != null) {
val text = editSearch.text.toString();
if (text.length < 3) {
UIDialogs.toast(getString(R.string.please_use_at_least_3_characters));
return;
val text = editSearch.text.toString()
if (text.isEmpty()) {
UIDialogs.toast(getString(R.string.please_use_at_least_1_character))
return
}
editSearch.clearFocus();
_inputMethodManager?.hideSoftInputFromWindow(editSearch.windowToken, 0);
editSearch.clearFocus()
_inputMethodManager?.hideSoftInputFromWindow(editSearch.windowToken, 0)
if (Settings.instance.search.searchHistory) {
val storage = FragmentedStorage.get<SearchHistoryStorage>();
storage.add(text);
val storage = FragmentedStorage.get<SearchHistoryStorage>()
storage.add(text)
}
if (_searchType == SearchType.CREATOR) {
onSearch.emit(text);
onSearch.emit(text)
} else {
onSearch.emit(text);
onSearch.emit(text)
}
} else {
Logger.w(TAG, "Unexpected condition happened where done is edit search is null but done is triggered.");
Logger.w(
TAG,
"Unexpected condition happened where done is edit search is null but done is triggered."
)
}
}

View file

@ -726,7 +726,7 @@
<string name="not_yet_available_retrying_in_time_s">Not yet available, retrying in {time}s</string>
<string name="failed_to_retry_for_live_stream">Failed to retry for live stream</string>
<string name="this_app_is_in_development_please_submit_bug_reports_and_understand_that_many_features_are_incomplete">This app is in development. Please submit bug reports and understand that many features are incomplete.</string>
<string name="please_use_at_least_3_characters">Please use at least 3 characters</string>
<string name="please_use_at_least_1_character">Please use at least 1 character</string>
<string name="are_you_sure_you_want_to_delete_this_video">Are you sure you want to delete this video?</string>
<string name="tap_to_open">Tap to open</string>
<string name="update_available_exclamation">Update available!</string>