feat: Custom Search Hashtag Default Page

This commit is contained in:
xtaodada 2024-06-27 22:17:10 +08:00
parent 3cd1473cc9
commit d0bc9f0cb7
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
5 changed files with 37 additions and 0 deletions

View File

@ -32953,8 +32953,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
if (ChatObject.isChannelAndNotMegaGroup(currentChat) && ChatObject.isPublic(currentChat) && searchingHashtag != null) { if (ChatObject.isChannelAndNotMegaGroup(currentChat) && ChatObject.isPublic(currentChat) && searchingHashtag != null) {
defaultSearchPage = 2; defaultSearchPage = 2;
// ----- Nagram Hook Start -----
defaultSearchPage = NaConfig.INSTANCE.getSearchHashtagDefaultPageChannel().Int();
// ----- Nagram Hook End -----
} else { } else {
defaultSearchPage = 0; defaultSearchPage = 0;
// ----- Nagram Hook Start -----
defaultSearchPage = NaConfig.INSTANCE.getSearchHashtagDefaultPageChat().Int();
// ----- Nagram Hook End -----
} }
openSearchKeyboard = false; openSearchKeyboard = false;
if (searchItem != null) { if (searchItem != null) {

View File

@ -190,6 +190,17 @@ public class NekoChatSettingsActivity extends BaseNekoXSettingsActivity implemen
private final AbstractConfigCell repeatConfirmRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.repeatConfirm)); private final AbstractConfigCell repeatConfirmRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.repeatConfirm));
private final AbstractConfigCell dividerConfirms = cellGroup.appendCell(new ConfigCellDivider()); private final AbstractConfigCell dividerConfirms = cellGroup.appendCell(new ConfigCellDivider());
// search tag
private final AbstractConfigCell headerSearchTag = cellGroup.appendCell(new ConfigCellHeader(LocaleController.getString("SavedTagSearchHint")));
private final String[] searchPagesString = new String[]{
LocaleController.getString(R.string.SearchThisChat),
LocaleController.getString(R.string.SearchMyMessages),
LocaleController.getString(R.string.SearchPublicPosts),
};
private final AbstractConfigCell searchHashtagDefaultPageChannelRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getSearchHashtagDefaultPageChannel(), searchPagesString, null));
private final AbstractConfigCell searchHashtagDefaultPageChatRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getSearchHashtagDefaultPageChat(), searchPagesString, null));
private final AbstractConfigCell dividerSearchTag = cellGroup.appendCell(new ConfigCellDivider());
private ListAdapter listAdapter; private ListAdapter listAdapter;
private ActionBarMenuItem menuItem; private ActionBarMenuItem menuItem;
private StickerSizeCell stickerSizeCell; private StickerSizeCell stickerSizeCell;

View File

@ -626,6 +626,18 @@ object NaConfig {
ConfigItem.configTypeBool, ConfigItem.configTypeBool,
false false
) )
val searchHashtagDefaultPageChannel =
addConfig(
"SearchHashtagDefaultPageChannel",
ConfigItem.configTypeInt,
0
)
val searchHashtagDefaultPageChat =
addConfig(
"SearchHashtagDefaultPageChat",
ConfigItem.configTypeInt,
0
)
private fun addConfig( private fun addConfig(
k: String, k: String,

View File

@ -156,4 +156,6 @@
您也可以使用纯文本,但请不要忘记使用转义符号。</string> 您也可以使用纯文本,但请不要忘记使用转义符号。</string>
<string name="RegexFiltersAddError">正则表达式语法错误</string> <string name="RegexFiltersAddError">正则表达式语法错误</string>
<string name="ShowTimeHint">点击消息时间显示详细信息</string> <string name="ShowTimeHint">点击消息时间显示详细信息</string>
<string name="SearchHashtagDefaultPageChannel">在频道点击标签默认搜索页面</string>
<string name="SearchHashtagDefaultPageChat">在其他对话点击标签默认搜索页面</string>
</resources> </resources>

View File

@ -156,4 +156,6 @@
You can also use plain text, but don\'t forget to escape brackets.</string> You can also use plain text, but don\'t forget to escape brackets.</string>
<string name="RegexFiltersAddError">Regex syntax error</string> <string name="RegexFiltersAddError">Regex syntax error</string>
<string name="ShowTimeHint">Click message time to display details</string> <string name="ShowTimeHint">Click message time to display details</string>
<string name="SearchHashtagDefaultPageChannel">Channel Click Hashtag Default Search Page</string>
<string name="SearchHashtagDefaultPageChat">Chat Click Hashtag Default Search Page</string>
</resources> </resources>