diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/SearchDialogFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/SearchDialogFragment.kt index fdc0c56a26..8a9be5a417 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/SearchDialogFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/SearchDialogFragment.kt @@ -155,7 +155,7 @@ class SearchDialogFragment : BaseDialogFragment(), TelegramHelper.TelegramSearch } private fun runSearch(text: String) { - if (getString(R.string.saved_messages).startsWith(text, true)) { + if (getSavedMessagesChatTitle().startsWith(text, true)) { val savedMessages = telegramHelper.getChat(telegramHelper.getCurrentUserId().toLong()) if (savedMessages != null) { telegramHelper.searchChats(savedMessages.title) @@ -164,11 +164,13 @@ class SearchDialogFragment : BaseDialogFragment(), TelegramHelper.TelegramSearch telegramHelper.searchChats(text) telegramHelper.searchChatsOnServer(text) telegramHelper.searchContacts(text) - if (text.length > 4 && !getString(R.string.saved_messages).startsWith(text, true)) { + if (text.length > 4 && !getSavedMessagesChatTitle().startsWith(text, true)) { telegramHelper.searchPublicChats(text) } } + private fun getSavedMessagesChatTitle() = getString(R.string.saved_messages) + override fun onResume() { super.onResume() telegramHelper.addSearchListener(this) @@ -392,13 +394,13 @@ class SearchDialogFragment : BaseDialogFragment(), TelegramHelper.TelegramSearch val title = when (item) { is TdApi.Chat -> { if (telegramHelper.isPrivateChat(item) && (item.type as TdApi.ChatTypePrivate).userId == currentUserId) { - getString(R.string.saved_messages) + getSavedMessagesChatTitle() } else { item.title } } is TdApi.User -> { - if (item.id == currentUserId) getString(R.string.saved_messages) else TelegramUiHelper.getUserName(item) + if (item.id == currentUserId) getSavedMessagesChatTitle() else TelegramUiHelper.getUserName(item) } else -> null }