feat: custom quick reply

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
This commit is contained in:
Next Alone 2022-10-01 23:10:49 +08:00
parent 0d12810603
commit b1b2c631f6
No known key found for this signature in database
GPG Key ID: DBA7B0AEF8C1CD2C
5 changed files with 186 additions and 127 deletions

View File

@ -22336,7 +22336,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
icons.add(R.drawable.msg_reset);
}
if (allowRepeat && NaConfig.INSTANCE.getShowGreatOrPoor().Bool()) {
items.add(LocaleController.getString("Great", R.string.Great));
items.add(NaConfig.INSTANCE.getCustomGreat().String());
options.add(nkbtn_greatOrPoor);
icons.add(R.drawable.msg_prpr);
}
@ -30449,8 +30449,9 @@ selectedObjectGroup) != null) {
if (checkSlowMode(chatActivityEnterView.getSendButton())) {
return;
}
getSendMessagesHelper().sendMessage(isLongClick ? "破烂" : "好耶", dialog_id, selectedObject, threadMessageObject
, null, false, null, null, null, true, 0, null);
getSendMessagesHelper().sendMessage(isLongClick ? NaConfig.INSTANCE.getCustomPoor().String() : NaConfig.INSTANCE.getCustomGreat().String(),
dialog_id, selectedObject, threadMessageObject, null, false,
null, null, null, true, 0, null);
}
public void setScrollToMessage() {

View File

@ -83,6 +83,8 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
private final AbstractConfigCell hideSendAsChannelRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.hideSendAsChannel));
private final AbstractConfigCell showSpoilersDirectlyRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.showSpoilersDirectly));
private final AbstractConfigCell messageMenuRow = cellGroup.appendCell(new ConfigCellSelectBox(LocaleController.getString("MessageMenu"), null, null, this::showMessageMenuAlert));
private final AbstractConfigCell customGreatRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getCustomGreat(), LocaleController.getString(R.string.CustomGreatHint), null,(input) -> input.isEmpty() ? (String) NaConfig.INSTANCE.getCustomGreat().defaultValue : input));
private final AbstractConfigCell CustomPoorRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getCustomPoor(), LocaleController.getString(R.string.CustomPoorHint), null,(input) -> input.isEmpty() ? (String) NaConfig.INSTANCE.getCustomPoor().defaultValue : input));
private final AbstractConfigCell showServicesTime = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowServicesTime()));
private final AbstractConfigCell combineMessageRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getCombineMessage(), new String[]{
LocaleController.getString("combineMessageEnabledWithReply", R.string.CombineMessageEnabledWithReply),
@ -419,7 +421,7 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
break;
}
case 5 + 2: {
textCell.setTextAndCheck(LocaleController.getString("Great", R.string.Great), NaConfig.INSTANCE.getShowGreatOrPoor().Bool(), false);
textCell.setTextAndCheck(NaConfig.INSTANCE.getCustomGreat().String(), NaConfig.INSTANCE.getShowGreatOrPoor().Bool(), false);
break;
}
case 3 + 3 + 2: {

View File

@ -153,121 +153,169 @@ object NaConfig {
ConfigItem.configTypeBool,
true
)
val customTitle = addConfig(
"CustomTitle",
ConfigItem.configTypeString,
LocaleController.getString("NekoX", R.string.NekoX)
)
val useSystemUnlock = addConfig(
"UseSystemUnlock",
ConfigItem.configTypeBool,
true
)
val codeSyntaxHighlight = addConfig(
"CodeSyntaxHighlight",
ConfigItem.configTypeBool,
true
)
val dateOfForwardedMsg = addConfig(
"DateOfForwardedMsg",
ConfigItem.configTypeBool,
false
)
val showMessageID = addConfig(
"ShowMessageID",
ConfigItem.configTypeBool,
false
)
val showRPCError = addConfig(
"ShowRPCError",
ConfigItem.configTypeBool,
false
)
val showPremiumStarInChat = addConfig(
"ShowPremiumStarInChat",
ConfigItem.configTypeBool,
false
)
val showPremiumAvatarAnimation = addConfig(
"ShowPremiumAvatarAnimation",
ConfigItem.configTypeBool,
true
)
val alwaysSaveChatOffset = addConfig(
"AlwaysSaveChatOffset",
ConfigItem.configTypeBool,
true
)
val autoReplaceRepeat = addConfig(
"AutoReplaceRepeat",
ConfigItem.configTypeBool,
true
)
val autoInsertGIFCaption = addConfig(
"AutoInsertGIFCaption",
ConfigItem.configTypeBool,
true
)
val defaultMonoLanguage = addConfig(
"DefaultMonoLanguage",
ConfigItem.configTypeString,
""
)
val disableGlobalSearch = addConfig(
"DisableGlobalSearch",
ConfigItem.configTypeBool,
false
)
val hideOriginAfterTranslation: ConfigItem = addConfig(
"HideOriginAfterTranslation",
ConfigItem.configTypeBool,
false
)
val zalgoFilter = addConfig(
"ZalgoFilter",
ConfigItem.configTypeBool,
false
)
val customChannelLabel = addConfig(
"CustomChannelLabel",
ConfigItem.configTypeString,
LocaleController.getString("channelLabel", R.string.channelLabel)
)
val alwaysShowDownloadIcon = addConfig(
"AlwaysShowDownloadIcon",
ConfigItem.configTypeBool,
false
)
val showPhotoOpenInExternalApp = addConfig(
"ShowPhotoOpenInExternalApp",
ConfigItem.configTypeBool,
false
)
val quickToggleAnonymous = addConfig(
"QuickToggleAnonymous",
ConfigItem.configTypeBool,
false
)
val onlyShowBuiltInEmoji = addConfig(
"OnlyShowBuiltInEmoji",
ConfigItem.configTypeBool,
false
)
val realHideTimeForSticker = addConfig(
"RealHideTimeForSticker",
ConfigItem.configTypeBool,
false
)
val ignoreFolderCount = addConfig(
"IgnoreFolderCount",
ConfigItem.configTypeBool,
false
)
val customArtworkApi = addConfig(
"CustomArtworkApi",
ConfigItem.configTypeString,
""
)
val customTitle =
addConfig(
"CustomTitle",
ConfigItem.configTypeString,
LocaleController.getString(
"NekoX",
R.string.NekoX
)
)
val useSystemUnlock =
addConfig(
"UseSystemUnlock",
ConfigItem.configTypeBool,
true
)
val codeSyntaxHighlight =
addConfig(
"CodeSyntaxHighlight",
ConfigItem.configTypeBool,
true
)
val dateOfForwardedMsg =
addConfig(
"DateOfForwardedMsg",
ConfigItem.configTypeBool,
false
)
val showMessageID =
addConfig(
"ShowMessageID",
ConfigItem.configTypeBool,
false
)
val showRPCError =
addConfig(
"ShowRPCError",
ConfigItem.configTypeBool,
false
)
val showPremiumStarInChat =
addConfig(
"ShowPremiumStarInChat",
ConfigItem.configTypeBool,
false
)
val showPremiumAvatarAnimation =
addConfig(
"ShowPremiumAvatarAnimation",
ConfigItem.configTypeBool,
true
)
val alwaysSaveChatOffset =
addConfig(
"AlwaysSaveChatOffset",
ConfigItem.configTypeBool,
true
)
val autoReplaceRepeat =
addConfig(
"AutoReplaceRepeat",
ConfigItem.configTypeBool,
true
)
val autoInsertGIFCaption =
addConfig(
"AutoInsertGIFCaption",
ConfigItem.configTypeBool,
true
)
val defaultMonoLanguage =
addConfig(
"DefaultMonoLanguage",
ConfigItem.configTypeString,
""
)
val disableGlobalSearch =
addConfig(
"DisableGlobalSearch",
ConfigItem.configTypeBool,
false
)
val hideOriginAfterTranslation: ConfigItem =
addConfig(
"HideOriginAfterTranslation",
ConfigItem.configTypeBool,
false
)
val zalgoFilter =
addConfig(
"ZalgoFilter",
ConfigItem.configTypeBool,
false
)
val customChannelLabel =
addConfig(
"CustomChannelLabel",
ConfigItem.configTypeString,
LocaleController.getString(
"channelLabel",
R.string.channelLabel
)
)
val alwaysShowDownloadIcon =
addConfig(
"AlwaysShowDownloadIcon",
ConfigItem.configTypeBool,
false
)
val showPhotoOpenInExternalApp =
addConfig(
"ShowPhotoOpenInExternalApp",
ConfigItem.configTypeBool,
false
)
val quickToggleAnonymous =
addConfig(
"QuickToggleAnonymous",
ConfigItem.configTypeBool,
false
)
val onlyShowBuiltInEmoji =
addConfig(
"OnlyShowBuiltInEmoji",
ConfigItem.configTypeBool,
false
)
val realHideTimeForSticker =
addConfig(
"RealHideTimeForSticker",
ConfigItem.configTypeBool,
false
)
val ignoreFolderCount =
addConfig(
"IgnoreFolderCount",
ConfigItem.configTypeBool,
false
)
val customArtworkApi =
addConfig(
"CustomArtworkApi",
ConfigItem.configTypeString,
""
)
val customGreat =
addConfig(
"CustomGreat",
ConfigItem.configTypeString,
LocaleController.getString(
"Great",
R.string.Great
)
)
val CustomPoor =
addConfig(
"CustomPoor",
ConfigItem.configTypeString,
LocaleController.getString(
"Pool",
R.string.Poor
)
)
private fun addConfig(
k: String,

View File

@ -61,4 +61,8 @@
<string name="SaveWithoutMarkdown">禁用 Markdown</string>
<string name="SendAsEmoji">禁用小游戏</string>
<string name="CustomArtworkApi">自定义音乐封面 API</string>
<string name="CustomGreat">自定义快捷回复词</string>
<string name="CustomGreatHint">默认好耶</string>
<string name="CustomPoor">自定义长按快捷回复词</string>
<string name="CustomPoorHint">默认破烂</string>
</resources>

View File

@ -62,4 +62,8 @@
<string name="SaveWithoutMarkdown">Save without markdown</string>
<string name="SendAsEmoji">Send as emoji</string>
<string name="CustomArtworkApi">Custom Artwork Api</string>
<string name="CustomGreat">Custom reply word</string>
<string name="CustomGreatHint">Default great</string>
<string name="CustomPoor">Custom long click reply word</string>
<string name="CustomPoorHint">Default pool</string>
</resources>