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); icons.add(R.drawable.msg_reset);
} }
if (allowRepeat && NaConfig.INSTANCE.getShowGreatOrPoor().Bool()) { if (allowRepeat && NaConfig.INSTANCE.getShowGreatOrPoor().Bool()) {
items.add(LocaleController.getString("Great", R.string.Great)); items.add(NaConfig.INSTANCE.getCustomGreat().String());
options.add(nkbtn_greatOrPoor); options.add(nkbtn_greatOrPoor);
icons.add(R.drawable.msg_prpr); icons.add(R.drawable.msg_prpr);
} }
@ -30328,7 +30328,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} }
} }
private void repeatMessage(boolean isLongClick, boolean isRepeatasCopy) { private void repeatMessage(boolean isLongClick, boolean isRepeatasCopy) {
if (checkSlowMode(chatActivityEnterView.getSendButton())) { if (checkSlowMode(chatActivityEnterView.getSendButton())) {
return; return;
@ -30352,7 +30352,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return; return;
} }
} }
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("Repeat", R.string.Repeat)); builder.setTitle(LocaleController.getString("Repeat", R.string.Repeat));
builder.setMessage(LocaleController.getString("repeatConfirmText", R.string.repeatConfirmText)); builder.setMessage(LocaleController.getString("repeatConfirmText", R.string.repeatConfirmText));
@ -30366,7 +30366,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create()); showDialog(builder.create());
} }
private void doRepeatMessage(boolean isLongClick, ArrayList<MessageObject> messages, boolean isRepeatAsCopy) { private void doRepeatMessage(boolean isLongClick, ArrayList<MessageObject> messages, boolean isRepeatAsCopy) {
if (selectedObject != null && selectedObject.messageOwner != null && (isLongClick || isThreadChat() || getMessagesController().isChatNoForwards(currentChat))) { if (selectedObject != null && selectedObject.messageOwner != null && (isLongClick || isThreadChat() || getMessagesController().isChatNoForwards(currentChat))) {
// If selected message contains `replyTo`: // If selected message contains `replyTo`:
@ -30394,14 +30394,14 @@ selectedObjectGroup) != null) {
} }
return; return;
} }
if (isRepeatAsCopy) { if (isRepeatAsCopy) {
forwardMessages(messages, true, false, true, 0); forwardMessages(messages, true, false, true, 0);
} else { } else {
forwardMessages(messages, false, false, true, 0); forwardMessages(messages, false, false, true, 0);
} }
} }
public void invertReplyMessage(boolean isLongClick) { public void invertReplyMessage(boolean isLongClick) {
if (checkSlowMode(chatActivityEnterView.getSendButton())) { if (checkSlowMode(chatActivityEnterView.getSendButton())) {
return; return;
@ -30444,15 +30444,16 @@ selectedObjectGroup) != null) {
} }
} }
} }
public void sendGreatOrGreat(boolean isLongClick) { public void sendGreatOrGreat(boolean isLongClick) {
if (checkSlowMode(chatActivityEnterView.getSendButton())) { if (checkSlowMode(chatActivityEnterView.getSendButton())) {
return; return;
} }
getSendMessagesHelper().sendMessage(isLongClick ? "破烂" : "好耶", dialog_id, selectedObject, threadMessageObject getSendMessagesHelper().sendMessage(isLongClick ? NaConfig.INSTANCE.getCustomPoor().String() : NaConfig.INSTANCE.getCustomGreat().String(),
, null, false, null, null, null, true, 0, null); dialog_id, selectedObject, threadMessageObject, null, false,
null, null, null, true, 0, null);
} }
public void setScrollToMessage() { public void setScrollToMessage() {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("InputMessageId", R.string.InputMessageId)); builder.setTitle(LocaleController.getString("InputMessageId", R.string.InputMessageId));
@ -30475,7 +30476,7 @@ selectedObjectGroup) != null) {
editText.setPadding(0, 0, 0, 0); editText.setPadding(0, 0, 0, 0);
editText.setInputType(InputType.TYPE_CLASS_NUMBER); editText.setInputType(InputType.TYPE_CLASS_NUMBER);
builder.setView(editText); builder.setView(editText);
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), builder.setPositiveButton(LocaleController.getString("OK", R.string.OK),
(dialogInterface, i) -> { (dialogInterface, i) -> {
try { try {

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 hideSendAsChannelRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.hideSendAsChannel));
private final AbstractConfigCell showSpoilersDirectlyRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.showSpoilersDirectly)); 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 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 showServicesTime = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowServicesTime()));
private final AbstractConfigCell combineMessageRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getCombineMessage(), new String[]{ private final AbstractConfigCell combineMessageRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NaConfig.INSTANCE.getCombineMessage(), new String[]{
LocaleController.getString("combineMessageEnabledWithReply", R.string.CombineMessageEnabledWithReply), LocaleController.getString("combineMessageEnabledWithReply", R.string.CombineMessageEnabledWithReply),
@ -419,7 +421,7 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
break; break;
} }
case 5 + 2: { 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; break;
} }
case 3 + 3 + 2: { case 3 + 3 + 2: {

View File

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

View File

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

View File

@ -62,4 +62,8 @@
<string name="SaveWithoutMarkdown">Save without markdown</string> <string name="SaveWithoutMarkdown">Save without markdown</string>
<string name="SendAsEmoji">Send as emoji</string> <string name="SendAsEmoji">Send as emoji</string>
<string name="CustomArtworkApi">Custom Artwork Api</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> </resources>