feat: add repeat as copy and double tap action
This commit is contained in:
parent
b7ae6e5254
commit
c19c25e21d
@ -289,7 +289,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import kotlin.Unit;
|
||||
import tw.nekomimi.nekogram.ui.BottomBuilder;
|
||||
import tw.nekomimi.nekogram.ui.MessageDetailsActivity;
|
||||
import tw.nekomimi.nekogram.ui.MessageHelper;
|
||||
import tw.nekomimi.nekogram.utils.EnvUtil;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.NekoXConfig;
|
||||
@ -301,6 +300,7 @@ import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
import tw.nekomimi.nekogram.utils.PGPUtil;
|
||||
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
||||
import tw.nekomimi.nekogram.utils.TelegramUtil;
|
||||
import xyz.nextalone.nagram.DoubleTapConfig;
|
||||
import xyz.nextalone.nagram.NaConfig;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -330,6 +330,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private final static int nkbtn_deldlcache = 2013;
|
||||
private final static int nkbtn_view_history = 2014;
|
||||
private final static int nkbtn_repeat = 2015;
|
||||
private final static int nkbtn_repeatascopy = 2025;
|
||||
private final static int nkbtn_stickerdl = 2016;
|
||||
private final static int nkbtn_unpin = 2017;
|
||||
private final static int nkbtn_view_in_chat = 2018;
|
||||
@ -1499,31 +1500,85 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
createMenu(view, true, false, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDoubleTap(View view, int position) {
|
||||
if (view instanceof ChatMessageCell && NekoConfig.reactions.Int() == 1){
|
||||
ChatMessageCell cell = (ChatMessageCell) view;
|
||||
return !cell.getMessageObject().isSending() && !cell.getMessageObject().isEditing() && cell.getMessageObject().type != 16 && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode();
|
||||
}
|
||||
TLRPC.TL_availableReaction reaction = getMediaDataController().getReactionsMap().get(getMediaDataController().getDoubleTapReaction());
|
||||
if (reaction == null) {
|
||||
boolean allowRepeat;
|
||||
if (NaConfig.INSTANCE.getDoubleTapAction().Int() == DoubleTapConifig.DOUBLE_TAP_ACTION_NONE || !(view instanceof ChatMessageCell)) {
|
||||
return false;
|
||||
}
|
||||
if (NekoConfig.reactions.Int() == 2) return false;
|
||||
boolean available = dialog_id >= 0;
|
||||
if (!available && chatInfo != null) {
|
||||
for (String s : chatInfo.available_reactions) {
|
||||
if (s.equals(reaction.reaction)) {
|
||||
available = true;
|
||||
break;
|
||||
if (NaConfig.INSTANCE.getDoubleTapAction().Int() == DoubleTapConfig.DOUBLE_TAP_ACTION_REACTION) {
|
||||
TLRPC.TL_availableReaction reaction = getMediaDataController().getReactionsMap().get(getMediaDataController().getDoubleTapReaction());
|
||||
if (reaction == null) {
|
||||
return false;
|
||||
}
|
||||
boolean available = dialog_id >= 0;
|
||||
if (!available && chatInfo != null) {
|
||||
for (String s : chatInfo.available_reactions) {
|
||||
if (s.equals(reaction.reaction)) {
|
||||
available = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!available || !(view instanceof ChatMessageCell)) {
|
||||
return false;
|
||||
}
|
||||
ChatMessageCell cell = (ChatMessageCell) view;
|
||||
return !cell.getMessageObject().isSending() && !cell.getMessageObject().isEditing() && cell.getMessageObject().type != 16 && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode() && !cell.getMessageObject().isSponsored();
|
||||
} else {
|
||||
var cell = (ChatMessageCell) view;
|
||||
var message = cell.getMessageObject();
|
||||
var messageGroup = getValidGroupedMessage(message);
|
||||
var noforwards = getMessagesController().isChatNoForwards(currentChat) || message.messageOwner.noforwards;
|
||||
boolean allowChatActions = chatMode != MODE_SCHEDULED && (threadMessageObjects == null || !threadMessageObjects.contains(message)) &&
|
||||
!message.isSponsored() && (getMessageType(message) != 1 || message.getDialogId() != mergeDialogId) &&
|
||||
!(message.messageOwner.action instanceof TLRPC.TL_messageActionSecureValuesSent) &&
|
||||
(currentEncryptedChat != null || message.getId() >= 0) &&
|
||||
(bottomOverlayChat == null || bottomOverlayChat.getVisibility() != View.VISIBLE) &&
|
||||
(currentChat == null || ((!ChatObject.isNotInChat(currentChat) || isThreadChat()) && (!ChatObject.isChannel(currentChat) || ChatObject.canPost(currentChat) || currentChat.megagroup) && ChatObject.canSendMessages(currentChat)));
|
||||
boolean allowEdit = message.canEditMessage(currentChat) && !chatActivityEnterView.hasAudioToSend() && message.getDialogId() != mergeDialogId;
|
||||
if (allowEdit && messageGroup != null) {
|
||||
int captionsCount = 0;
|
||||
for (int a = 0, N = messageGroup.messages.size(); a < N; a++) {
|
||||
MessageObject messageObject = messageGroup.messages.get(a);
|
||||
if (a == 0 || !TextUtils.isEmpty(messageObject.caption)) {
|
||||
selectedObjectToEditCaption = messageObject;
|
||||
if (!TextUtils.isEmpty(messageObject.caption)) {
|
||||
captionsCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
allowEdit = captionsCount < 2;
|
||||
}
|
||||
switch (NaConfig.INSTANCE.getDoubleTapAction().Int()) {
|
||||
/*case NekoConfig.DOUBLE_TAP_ACTION_TRANSLATE:
|
||||
if (NekoConfig.transType != NekoConfig.TRANS_TYPE_EXTERNAL || !noforwards) {
|
||||
MessageObject messageObject = getMessageHelper().getMessageForTranslate(message, messageGroup);
|
||||
if (messageObject != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
*/
|
||||
case DoubleTapConfig.DOUBLE_TAP_ACTION_REPLY:
|
||||
return message.getId() > 0 && allowChatActions;
|
||||
case DoubleTapConfig.DOUBLE_TAP_ACTION_SAVE:
|
||||
return !message.isSponsored() && chatMode != MODE_SCHEDULED && !message.needDrawBluredPreview() && !message.isLiveLocation() && message.type != 16 && !getMessagesController().isChatNoForwards(currentChat) && !UserObject.isUserSelf(currentUser);
|
||||
case DoubleTapConfig.DOUBLE_TAP_ACTION_REPEAT:
|
||||
allowRepeat = allowChatActions &&
|
||||
(!isThreadChat() && !noforwards ||
|
||||
getMessageHelper().getMessageForRepeat(message, messageGroup) != null);
|
||||
return allowRepeat && !message.isSponsored() && chatMode != MODE_SCHEDULED && !message.needDrawBluredPreview() && !message.isLiveLocation() && message.type != 16;
|
||||
case DoubleTapConfig.DOUBLE_TAP_ACTION_REPEATASCOPY:
|
||||
allowRepeat = allowChatActions &&
|
||||
(!isThreadChat() && !noforwards ||
|
||||
getMessageHelper().getMessageForRepeat(message, messageGroup) != null);
|
||||
return allowRepeat && !message.isSponsored() && chatMode != MODE_SCHEDULED && !message.needDrawBluredPreview() && !message.isLiveLocation() && message.type != 16;
|
||||
case DoubleTapConfig.DOUBLE_TAP_ACTION_EDIT:
|
||||
return allowEdit;
|
||||
}
|
||||
}
|
||||
if (!available || !(view instanceof ChatMessageCell)) {
|
||||
return false;
|
||||
}
|
||||
ChatMessageCell cell = (ChatMessageCell) view;
|
||||
return !cell.getMessageObject().isSending() && !cell.getMessageObject().isEditing() && cell.getMessageObject().type != 16 && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode() && !cell.getMessageObject().isSponsored();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -3132,6 +3187,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
actionModeOtherItem.addSubItem(nkbtn_savemessage, R.drawable.menu_saved, LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages));
|
||||
if (NekoConfig.showRepeat.Bool() && !noforward)
|
||||
actionModeOtherItem.addSubItem(nkbtn_repeat, R.drawable.msg_repeat, LocaleController.getString("Repeat", R.string.Repeat));
|
||||
if(NekoConfig.showRepeatasCopy.Bool() && !noforward)
|
||||
actionModeOtherItem.addSubItem(nkbtn_repeat, R.drawable.msg_repeat, LocaleController.getString("RepeatasCopy", R.string.Repeat));
|
||||
if (NekoConfig.showMessageHide.Bool()) {
|
||||
actionModeOtherItem.addSubItem(nkbtn_hide, R.drawable.baseline_remove_circle_24, LocaleController.getString("Hide", R.string.Hide));
|
||||
}
|
||||
@ -22043,10 +22100,19 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
boolean allowRepeat = currentUser != null
|
||||
|| (currentChat != null && ChatObject.canSendMessages(currentChat));
|
||||
if (allowRepeat && NekoConfig.showRepeat.Bool() && !noforwardOverride) {
|
||||
items.add(LocaleController.getString("Repeat", R.string.Repeat));
|
||||
options.add(nkbtn_repeat);
|
||||
icons.add(R.drawable.msg_repeat);
|
||||
if (allowRepeat && NekoConfig.showRepeat.Bool() ) {
|
||||
if (!noforward){
|
||||
items.add(LocaleController.getString("Repeat", R.string.Repeat));
|
||||
options.add(nkbtn_repeat);
|
||||
icons.add(R.drawable.msg_repeat);
|
||||
items.add(LocaleController.getString("RepeatasCopy", R.string.RepeatasCopy));
|
||||
options.add(nkbtn_repeatascopy);
|
||||
icons.add(R.drawable.msg_repeat);
|
||||
}else{
|
||||
items.add(LocaleController.getString("RepeatasCopy", R.string.RepeatasCopy));
|
||||
options.add(nkbtn_repeatascopy);
|
||||
icons.add(R.drawable.msg_repeat);
|
||||
}
|
||||
}
|
||||
if (NaConfig.INSTANCE.getShowInvertReply().Bool()) {
|
||||
items.add(LocaleController.getString("InvertReply", R.string.InvertReply));
|
||||
@ -24069,7 +24135,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
}
|
||||
case nkbtn_repeat: {
|
||||
repeatMessage(true);
|
||||
repeatMessage(true,false);
|
||||
return 2;
|
||||
}
|
||||
case nkbtn_repeatascopy: {
|
||||
repeatMessage(true,true);
|
||||
return 2;
|
||||
}
|
||||
case nkbtn_invertReply: {
|
||||
@ -29263,7 +29333,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
return;
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
} else if (id == nkbtn_repeat) {
|
||||
repeatMessage(false);
|
||||
repeatMessage(false,false);
|
||||
clearSelectionMode();
|
||||
}else if (id == nkbtn_repeatascopy){
|
||||
repeatMessage(false,true);
|
||||
clearSelectionMode();
|
||||
} else if (id == nkbtn_invertReply) {
|
||||
invertReplyMessage(false);
|
||||
@ -29278,7 +29351,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
// from "items"
|
||||
switch (id) {
|
||||
case nkbtn_repeat: {
|
||||
repeatMessage(false);
|
||||
repeatMessage(false,false);
|
||||
break;
|
||||
}
|
||||
case nkbtn_repeatascopy:{
|
||||
repeatMessage(false,true);
|
||||
break;
|
||||
}
|
||||
case nkbtn_invertReply: {
|
||||
@ -29549,7 +29626,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
|
||||
private void repeatMessage(boolean isLongClick) {
|
||||
private void repeatMessage(boolean isLongClick,boolean isRepeatasCopy) {
|
||||
if (checkSlowMode(chatActivityEnterView.getSendButton())) {
|
||||
return;
|
||||
}
|
||||
@ -29562,22 +29639,31 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
messages.add(selectedMessagesIds[0].get(selectedMessagesIds[0].keyAt(k)));
|
||||
}
|
||||
if (!NekoConfig.repeatConfirm.Bool()) {
|
||||
doRepeatMessage(isLongClick, messages);
|
||||
return;
|
||||
if (isRepeatasCopy){
|
||||
doRepeatMessage(isLongClick, messages,true);
|
||||
return;
|
||||
}else{
|
||||
doRepeatMessage(isLongClick, messages,false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("Repeat", R.string.Repeat));
|
||||
builder.setMessage(LocaleController.getString("repeatConfirmText", R.string.repeatConfirmText));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> {
|
||||
doRepeatMessage(isLongClick, messages);
|
||||
if (isRepeatasCopy){
|
||||
doRepeatMessage(isLongClick, messages,true);
|
||||
}else{
|
||||
doRepeatMessage(isLongClick, messages,false);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
|
||||
private void doRepeatMessage(boolean isLongClick, ArrayList<MessageObject> messages) {
|
||||
if (selectedObject != null && selectedObject.messageOwner != null && (isLongClick || isThreadChat() || getMessagesController().isChatNoForwards(currentChat))) {
|
||||
private void doRepeatMessage(boolean isLongClick, ArrayList<MessageObject> messages,boolean isRepeatasCopy) {
|
||||
if (selectedObject != null && selectedObject.messageOwner != null && (isLongClick || isThreadChat() || getMessagesController().isChatNoForwards(currentChat) )) {
|
||||
// If selected message contains `replyTo`:
|
||||
// When longClick it will reply to the `replyMessage` of selectedMessage
|
||||
// When not LongClick but in a threadchat: reply to the Thread
|
||||
@ -29601,7 +29687,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
return;
|
||||
}
|
||||
|
||||
forwardMessages(messages, false, false, true, 0);
|
||||
if (isRepeatasCopy){
|
||||
forwardMessages(messages, true, false, true, 0);
|
||||
}else {
|
||||
forwardMessages(messages, false, false, true, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void invertReplyMessage(boolean isLongClick){
|
||||
|
@ -69,6 +69,7 @@ public class NekoConfig {
|
||||
public static ConfigItem showMessageDetails = addConfig("showMessageDetails", configTypeBool, false);
|
||||
public static ConfigItem showTranslate = addConfig("showTranslate", configTypeBool, true);
|
||||
public static ConfigItem showRepeat = addConfig("showRepeat", configTypeBool, false);
|
||||
public static ConfigItem showRepeatasCopy = addConfig("showRepeatasCopy",configTypeBool,false);
|
||||
public static ConfigItem showShareMessages = addConfig("showShareMessages", configTypeBool, false);
|
||||
public static ConfigItem showMessageHide = addConfig("showMessageHide", configTypeBool, false);
|
||||
|
||||
@ -289,6 +290,8 @@ public class NekoConfig {
|
||||
showTranslate.setConfigBool(preferences.getBoolean("showTranslate", true));
|
||||
if (preferences.contains("showRepeat"))
|
||||
showRepeat.setConfigBool(preferences.getBoolean("showRepeat", false));
|
||||
if (preferences.contains("showRepeatasCopy"))
|
||||
showRepeatasCopy.setConfigBool(preferences.getBoolean("showRepeatasCopy",false));
|
||||
if (preferences.contains("showShareMessages"))
|
||||
showShareMessages.setConfigBool(preferences.getBoolean("showShareMessages", false));
|
||||
if (preferences.contains("showMessageHide"))
|
||||
|
@ -57,6 +57,7 @@ import tw.nekomimi.nekogram.config.cell.ConfigCellSelectBox;
|
||||
import tw.nekomimi.nekogram.config.cell.ConfigCellTextCheck;
|
||||
import tw.nekomimi.nekogram.config.cell.ConfigCellTextDetail;
|
||||
import tw.nekomimi.nekogram.config.cell.ConfigCellTextInput;
|
||||
import xyz.nextalone.nagram.DoubleTapConfig;
|
||||
import xyz.nextalone.nagram.NaConfig;
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
@ -99,16 +100,19 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
|
||||
LocaleController.getString("MapPreviewProviderYandex", R.string.MapPreviewProviderYandex),
|
||||
LocaleController.getString("MapPreviewProviderNobody", R.string.MapPreviewProviderNobody)
|
||||
}, null));
|
||||
private final AbstractConfigCell DoubleTapActionRow = cellGroup.appendCell(new ConfigCellCustom(CellGroup.ITEM_TYPE_TEXT_SETTINGS_CELL,true));
|
||||
private final AbstractConfigCell messageMenuRow = cellGroup.appendCell(new ConfigCellSelectBox(LocaleController.getString("MessageMenu"), null, null, () -> {
|
||||
showMessageMenuAlert();
|
||||
}));
|
||||
private final AbstractConfigCell textStyleRow = cellGroup.appendCell(new ConfigCellSelectBox(LocaleController.getString("TextStyle"), null, null, this::showTextStyleAlert));
|
||||
private final AbstractConfigCell reactionsRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NekoConfig.reactions,
|
||||
/*private final AbstractConfigCell reactionsRow = cellGroup.appendCell(new ConfigCellSelectBox(null, NekoConfig.reactions,
|
||||
new String[]{
|
||||
LocaleController.getString("doubleTapSendReactions", R.string.doubleTapSendReactions),
|
||||
LocaleController.getString("doubleTapShowReactions", R.string.doubleTapShowReactions),
|
||||
LocaleController.getString("ReactionsDisabled", R.string.ReactionsDisabled),
|
||||
}, null));
|
||||
|
||||
*/
|
||||
private final AbstractConfigCell repeatConfirmRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.repeatConfirm));
|
||||
private final AbstractConfigCell rememberAllBackMessagesRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.rememberAllBackMessages));
|
||||
private final AbstractConfigCell hideSendAsChannelRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.hideSendAsChannel));
|
||||
@ -234,6 +238,32 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.show();
|
||||
}else if (position == cellGroup.rows.indexOf(DoubleTapActionRow)) {
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
arrayList.add(LocaleController.getString("Disable", R.string.Disable));
|
||||
types.add(DoubleTapConfig.DOUBLE_TAP_ACTION_NONE);
|
||||
arrayList.add(LocaleController.getString("Reactions", R.string.Reactions));
|
||||
types.add(DoubleTapConfig.DOUBLE_TAP_ACTION_REACTION);
|
||||
//arrayList.add(LocaleController.getString("TranslateMessage", R.string.TranslateMessage));
|
||||
//types.add(DoubleTapConfig.DOUBLE_TAP_ACTION_TRANSLATE);
|
||||
arrayList.add(LocaleController.getString("Reply", R.string.Reply));
|
||||
types.add(DoubleTapConfig.DOUBLE_TAP_ACTION_REPLY);
|
||||
arrayList.add(LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages));
|
||||
types.add(DoubleTapConfig.DOUBLE_TAP_ACTION_SAVE);
|
||||
arrayList.add(LocaleController.getString("Repeat", R.string.Repeat));
|
||||
types.add(DoubleTapConfig.DOUBLE_TAP_ACTION_REPEAT);
|
||||
arrayList.add(LocaleController.getString("RepeatasCopy", R.string.RepeatasCopy));
|
||||
types.add(DoubleTapConfig.DOUBLE_TAP_ACTION_REPEATASCOPY);
|
||||
arrayList.add(LocaleController.getString("Edit", R.string.Edit));
|
||||
types.add(DoubleTapConfig.DOUBLE_TAP_ACTION_EDIT);
|
||||
PopupBuilder builder = new PopupBuilder(view);
|
||||
builder.setItems(arrayList, (i,str) -> {
|
||||
NaConfig.INSTANCE.getDoubleTapAction().setConfigInt(types.get(i));
|
||||
listAdapter.notifyItemChanged(position);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -349,42 +379,46 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("InvertReply", R.string.InvertReply), NaConfig.INSTANCE.getShowInvertReply().Bool(), false);
|
||||
textCell.setChecked(NekoConfig.showRepeatasCopy.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("InvertReply", R.string.InvertReply), NaConfig.INSTANCE.getShowInvertReply().Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("Great", R.string.Great), NaConfig.INSTANCE.getShowGreatOrPoor().Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 3 + 2: {
|
||||
case 3 + 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ViewHistory", R.string.ViewHistory), NekoConfig.showViewHistory.Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 4 + 2: {
|
||||
case 4 + 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("Translate", R.string.Translate), NekoConfig.showTranslate.Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 5 + 2: {
|
||||
case 5 + 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ReportChat", R.string.ReportChat), NekoConfig.showReport.Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 6 + 2: {
|
||||
case 6 + 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("EditAdminRights", R.string.EditAdminRights), NekoConfig.showAdminActions.Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 7 + 2: {
|
||||
case 7 + 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ChangePermissions", R.string.ChangePermissions), NekoConfig.showChangePermissions.Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 8 + 2: {
|
||||
case 8 + 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("Hide", R.string.Hide), NekoConfig.showMessageHide.Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 9 + 2: {
|
||||
case 9 + 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ShareMessages", R.string.ShareMessages), NekoConfig.showShareMessages.Bool(), false);
|
||||
break;
|
||||
}
|
||||
case 10 + 2: {
|
||||
case 10 + 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("MessageDetails", R.string.MessageDetails), NekoConfig.showMessageDetails.Bool(), false);
|
||||
break;
|
||||
}
|
||||
@ -408,42 +442,46 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
textCell.setChecked(NaConfig.INSTANCE.getShowInvertReply().toggleConfigBool());
|
||||
textCell.setChecked(NekoConfig.showRepeatasCopy.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
textCell.setChecked(NaConfig.INSTANCE.getShowInvertReply().toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
textCell.setChecked(NaConfig.INSTANCE.getShowGreatOrPoor().toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 3 + 2: {
|
||||
case 3 + 3: {
|
||||
textCell.setChecked(NekoConfig.showViewHistory.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 4 + 2: {
|
||||
case 4 + 3: {
|
||||
textCell.setChecked(NekoConfig.showTranslate.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 5 + 2: {
|
||||
case 5 + 3: {
|
||||
textCell.setChecked(NekoConfig.showReport.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 6 + 2: {
|
||||
case 6 + 3: {
|
||||
textCell.setChecked(NekoConfig.showAdminActions.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 7 + 2: {
|
||||
case 7 + 3: {
|
||||
textCell.setChecked(NekoConfig.showChangePermissions.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 8 + 2: {
|
||||
case 8 + 3: {
|
||||
textCell.setChecked(NekoConfig.showMessageHide.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 9 + 2: {
|
||||
case 9 + 3: {
|
||||
textCell.setChecked(NekoConfig.showShareMessages.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
case 10 + 2:{
|
||||
case 10 + 3:{
|
||||
textCell.setChecked(NekoConfig.showMessageDetails.toggleConfigBool());
|
||||
break;
|
||||
}
|
||||
@ -685,6 +723,8 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
|
||||
TextSettingsCell textCell = (TextSettingsCell) holder.itemView;
|
||||
if (position == cellGroup.rows.indexOf(maxRecentStickerCountRow)) {
|
||||
textCell.setTextAndValue(LocaleController.getString("maxRecentStickerCount", R.string.maxRecentStickerCount), String.valueOf(NekoConfig.maxRecentStickerCount.Int()), true);
|
||||
}else if ( position == cellGroup.rows.indexOf(DoubleTapActionRow)) {
|
||||
textCell.setTextAndValue(LocaleController.getString("DoubleTapAction", R.string.DoubleTapAction), new DoubleTapConfig().doubleTapActionMap.get(NaConfig.INSTANCE.getDoubleTapAction().Int()), true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -414,4 +414,29 @@ public class MessageHelper extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
public MessageObject getMessageForRepeat(MessageObject selectedObject, MessageObject.GroupedMessages selectedObjectGroup) {
|
||||
MessageObject messageObject = null;
|
||||
if (selectedObjectGroup != null && !selectedObjectGroup.isDocuments) {
|
||||
messageObject = getTargetMessageObjectFromGroup(selectedObjectGroup);
|
||||
} else if (!TextUtils.isEmpty(selectedObject.messageOwner.message) || selectedObject.isAnyKindOfSticker()) {
|
||||
messageObject = selectedObject;
|
||||
}
|
||||
return messageObject;
|
||||
}
|
||||
|
||||
private MessageObject getTargetMessageObjectFromGroup(MessageObject.GroupedMessages selectedObjectGroup) {
|
||||
MessageObject messageObject = null;
|
||||
for (MessageObject object : selectedObjectGroup.messages) {
|
||||
if (!TextUtils.isEmpty(object.messageOwner.message)) {
|
||||
if (messageObject != null) {
|
||||
messageObject = null;
|
||||
break;
|
||||
} else {
|
||||
messageObject = object;
|
||||
}
|
||||
}
|
||||
}
|
||||
return messageObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
package xyz.nextalone.nagram;
|
||||
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DoubleTapConfig {
|
||||
public static final int DOUBLE_TAP_ACTION_NONE = 0;
|
||||
public static final int DOUBLE_TAP_ACTION_REACTION = 1;
|
||||
//public static final int DOUBLE_TAP_ACTION_TRANSLATE = 2;
|
||||
public static final int DOUBLE_TAP_ACTION_REPLY = 2;
|
||||
public static final int DOUBLE_TAP_ACTION_SAVE = 3;
|
||||
public static final int DOUBLE_TAP_ACTION_REPEAT = 4;
|
||||
public static final int DOUBLE_TAP_ACTION_REPEATASCOPY = 5;
|
||||
public static final int DOUBLE_TAP_ACTION_EDIT = 6;
|
||||
|
||||
public Map<Integer, String> doubleTapActionMap = new HashMap<>();
|
||||
|
||||
public DoubleTapConfig() {
|
||||
doubleTapActionMap.put(DOUBLE_TAP_ACTION_NONE, LocaleController.getString("Disable", R.string.Disable));
|
||||
doubleTapActionMap.put(DOUBLE_TAP_ACTION_REACTION, LocaleController.getString("Reactions", R.string.Reactions));
|
||||
//doubleTapActionMap.put(DOUBLE_TAP_ACTION_TRANSLATE, LocaleController.getString("Translate", R.string.Translate));
|
||||
doubleTapActionMap.put(DOUBLE_TAP_ACTION_REPLY, LocaleController.getString("Reply", R.string.Reply));
|
||||
doubleTapActionMap.put(DOUBLE_TAP_ACTION_SAVE, LocaleController.getString("Save", R.string.Save));
|
||||
doubleTapActionMap.put(DOUBLE_TAP_ACTION_REPEAT, LocaleController.getString("Repeat", R.string.Repeat));
|
||||
doubleTapActionMap.put(DOUBLE_TAP_ACTION_REPEATASCOPY, LocaleController.getString("RepeatasCopy", R.string.RepeatasCopy));
|
||||
doubleTapActionMap.put(DOUBLE_TAP_ACTION_EDIT, LocaleController.getString("Edit", R.string.Edit));
|
||||
}
|
||||
}
|
@ -115,6 +115,12 @@ object NaConfig {
|
||||
ConfigItem.configTypeBool,
|
||||
false
|
||||
)
|
||||
var DoubleTapAction =
|
||||
addConfig(
|
||||
"DoubleTapAction",
|
||||
ConfigItem.configTypeInt,
|
||||
0
|
||||
)
|
||||
|
||||
fun addConfig(
|
||||
k: String,
|
||||
|
@ -14,4 +14,6 @@
|
||||
<string name="TextUndo">撤销</string>
|
||||
<string name="TextRedo">重做</string>
|
||||
<string name="NoiseSuppressAndVoiceEnhance">噪音抑制和语音增强</string>
|
||||
<string name="RepeatasCopy">无引用复读</string>
|
||||
<string name="DoubleTapAction"></string>
|
||||
</resources>
|
||||
|
@ -14,4 +14,6 @@
|
||||
<string name="TextUndo">Undo</string>
|
||||
<string name="TextRedo">Redo</string>
|
||||
<string name="NoiseSuppressAndVoiceEnhance">Noise Suppress And Voice Enhance</string>
|
||||
<string name="RepeatasCopy">Repeat as Copy</string>
|
||||
<string name="DoubleTapAction">Double Tap Action</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user