Fixes & Add send comment after forward

This commit is contained in:
世界 2020-11-10 16:51:53 +00:00
parent caa8be6d81
commit 2cf1980a4d
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
9 changed files with 143 additions and 40 deletions

View File

@ -2,8 +2,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def verName = "7.2.1-rc05"
def verCode = 112
def verName = "7.2.1-rc06"
def verCode = 113
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -139,4 +139,4 @@
# Osmdroid
-dontwarn org.osmdroid.**
-keepattributes LineNumberTable
-keepattributes SourceFile,LineNumberTable

View File

@ -3393,6 +3393,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
attributeAudio.duration = (int) (recordTimeCount / 1000);
audioToSend.attributes.add(attributeAudio);
if (duration > 700) {
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.beforeAudioDidSent, recordingGuid, send == 2 ? audioToSend : null, send == 2 ? recordingAudioFileToSend.getAbsolutePath() : null);
if (send == 1) {
SendMessagesHelper.getInstance(recordingCurrentAccount).sendMessage(audioToSend, null, recordingAudioFileToSend.getAbsolutePath(), recordDialogId, recordReplyingMsg, recordReplyingTopMsg, null, null, null, null, notify, scheduleDate, 0, null);
}

View File

@ -141,6 +141,8 @@ public class NotificationCenter {
public static final int recordStopped = totalEvents++;
public static final int screenshotTook = totalEvents++;
public static final int albumsDidLoad = totalEvents++;
public static final int beforeAudioDidSent = totalEvents++;
public static final int audioDidSent = totalEvents++;
public static final int audioRecordTooShort = totalEvents++;
public static final int audioRouteChanged = totalEvents++;

View File

@ -238,7 +238,6 @@ import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import tw.nekomimi.nekogram.JalaliCalendar;
import tw.nekomimi.nekogram.MessageDetailsActivity;
import tw.nekomimi.nekogram.MessageHelper;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.parts.MessageTransKt;
@ -2665,7 +2664,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
t = chatListViewPaddingTop - AndroidUtilities.dp(20);
}
if (b > chatListView.getMeasuredHeight() + AndroidUtilities.dp(20)) {
if (b > chatListView.getMeasuredHeight() + AndroidUtilities.dp(20)) {
b = chatListView.getMeasuredHeight() + AndroidUtilities.dp(20);
}
@ -2763,7 +2762,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (backgroundColor != color) {
backgroundPaint.setColor(backgroundColor = color);
}
canvas.drawRect(0,getMeasuredHeight() - fixedKeyboardHeight, getMeasuredWidth(), getMeasuredHeight(), backgroundPaint);
canvas.drawRect(0, getMeasuredHeight() - fixedKeyboardHeight, getMeasuredWidth(), getMeasuredHeight(), backgroundPaint);
}
}
@ -3683,7 +3682,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
t = chatListViewPaddingTop - AndroidUtilities.dp(20);
}
if (b > chatListView.getMeasuredHeight() + AndroidUtilities.dp(20)) {
if (b > chatListView.getMeasuredHeight() + AndroidUtilities.dp(20)) {
b = chatListView.getMeasuredHeight() + AndroidUtilities.dp(20);
}
@ -4741,7 +4740,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
/*if (forceNextPinnedMessageId != 0 && chatListView.isFastScrollAnimationRunning()) {
currentPinned = findClosest(pinnedMessageIds, forceNextPinnedMessageId, currentPinnedMessageIndex);
} else {*/
currentPinned = currentPinnedMessageId;
currentPinned = currentPinnedMessageId;
//}
scrollToMessageId(currentPinned, 0, true, 0, true);
if (!pinnedMessageIds.isEmpty()) {
@ -5959,6 +5958,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
hideFieldPanel(notify, scheduleDate, true);
}
@Override
public void
beforeMessageSend(CharSequence message, boolean notify, int scheduleDate) {
ChatActivity.this.beforeMessageSend(notify, scheduleDate, true);
}
@Override
public void onSwitchRecordMode(boolean video) {
showVoiceHint(false, video);
@ -7183,7 +7188,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (!inPreviewMode && chatActivityEnterView != null) {
if (chatActivityEnterView.getAnimatedTop() != 0) {
chatListViewPaddingTop += chatActivityEnterView.getHeightWithTopView() - AndroidUtilities.dp(51) - chatActivityEnterView.getAnimatedTop();
} else if (!chatActivityEnterView.pannelAniamationInProgress()) {
} else if (!chatActivityEnterView.pannelAniamationInProgress()) {
chatListViewPaddingTop += chatActivityEnterView.getHeightWithTopView() - AndroidUtilities.dp(51);
chatListViewPaddingTop -= chatListView.getTranslationY();
}
@ -9198,7 +9203,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (!fromMyName) {
AlertsCreator.showSendMediaAlert(getSendMessagesHelper().sendMessage(arrayList, did == 0 ? dialog_id : did, notify, scheduleDate), this);
} else {
getMessageHelper().processForwardFromMyName(arrayList, did == 0 ? dialog_id : did, notify, scheduleDate);
getMessageHelper().processForwardFromMyName(arrayList, did == 0 ? dialog_id : did, notify, scheduleDate);
}
}
@ -9246,6 +9251,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
showFieldPanel(show, null, messageObjectToEdit, null, null, true, 0, false, true);
}
public void beforeMessageSend(boolean notify, int scheduleDate, boolean beforeSend) {
if (beforeSend != NekoConfig.sendCommentAfterForward) return;
if (forwardingMessages != null) {
ArrayList<MessageObject> messagesToForward = forwardingMessages;
forwardingMessages = null;
forwardMessages(messagesToForward, noForwardQuote, notify, scheduleDate != 0 && scheduleDate != 0x7ffffffe ? scheduleDate + 1 : scheduleDate);
}
}
public void showFieldPanel(boolean show, MessageObject messageObjectToReply, MessageObject messageObjectToEdit, ArrayList<MessageObject> messageObjectsToForward, TLRPC.WebPage webPage, boolean notify, int scheduleDate, boolean cancel, boolean animated) {
if (chatActivityEnterView == null) {
return;
@ -9606,11 +9620,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return;
}
}
if (forwardingMessages != null) {
ArrayList<MessageObject> messagesToForward = forwardingMessages;
forwardingMessages = null;
forwardMessages(messagesToForward, noForwardQuote, notify, scheduleDate != 0 && scheduleDate != 0x7ffffffe ? scheduleDate + 1 : scheduleDate);
}
beforeMessageSend(notify, scheduleDate, false);
chatActivityEnterView.setForceShowSendButton(false, false);
if (!waitingForSendingMessageLoad) {
chatActivityEnterView.hideTopView(animated);
@ -19772,6 +19782,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (photoEntry == null) {
return;
}
beforeMessageSend(notify, scheduleDate, true);
fillEditingMediaWithCaption(photoEntry.caption, photoEntry.entities);
if (photoEntry.isVideo) {
if (videoEditedInfo != null) {

View File

@ -162,6 +162,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
public interface ChatActivityEnterViewDelegate {
default void beforeMessageSend(CharSequence message, boolean notify, int scheduleDate) {
}
void onMessageSend(CharSequence message, boolean notify, int scheduleDate);
void needSendTyping();
@ -1897,6 +1900,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.recordProgressChanged);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.closeChats);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.audioDidSent);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.beforeAudioDidSent);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.audioRouteChanged);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingDidReset);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
@ -2010,6 +2014,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
messageEditText = new EditTextCaption(context) {
private void send(InputContentInfoCompat inputContentInfo, boolean notify, int scheduleDate) {
if (delegate != null) {
delegate.beforeMessageSend(null, true, scheduleDate);
}
ClipDescription description = inputContentInfo.getDescription();
if (description.hasMimeType("image/gif")) {
SendMessagesHelper.prepareSendingDocument(accountInstance, null, null, inputContentInfo.getContentUri(), null, "image/gif", dialog_id, replyingMessageObject, getThreadMessage(), inputContentInfo, null, notify, 0);
@ -4054,6 +4061,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.recordProgressChanged);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.closeChats);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.audioDidSent);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.beforeAudioDidSent);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.audioRouteChanged);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingDidReset);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
@ -4143,6 +4151,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.recordProgressChanged);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.closeChats);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.audioDidSent);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.beforeAudioDidSent);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.audioRouteChanged);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingDidReset);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
@ -4157,6 +4166,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.recordProgressChanged);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.closeChats);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.audioDidSent);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.beforeAudioDidSent);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.audioRouteChanged);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingDidReset);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
@ -4311,8 +4321,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
isInInput = use;
if (duration == 0) botButton.setVisibility(use ? View.GONE : View.VISIBLE);
if (use) {
if (duration == 0) botButton.setVisibility(View.GONE);
fromRes = R.drawable.deproko_baseline_attach_26;
targetRes = R.drawable.ic_ab_other;
@ -4320,7 +4331,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
attachButton.setOnClickListener(this::onMenuClick);
attachButton.setContentDescription(LocaleController.getString("AccDescrAttachButton", R.string.AccDescrChatAttachEnterMenu));
} else {
if (duration == 0) botButton.setVisibility(View.VISIBLE);
fromRes = R.drawable.ic_ab_other;
targetRes = R.drawable.deproko_baseline_attach_26;
@ -4426,6 +4436,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
exitAnimation.setDuration(200);
AnimatorSet attachIconAnimator = null;
AnimatorSet botIconAnimator = null;
if (attachButton != null) {
checkAttachButton(false, 150);
if (!attachButton.isShown()) {
@ -4441,6 +4452,19 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
);
attachIconAnimator.setDuration(150);
}
if (checkBotButton()) {
botButton.setAlpha(0f);
botButton.setScaleX(0);
botButton.setScaleY(0);
botIconAnimator = new AnimatorSet();
botIconAnimator.playTogether(
ObjectAnimator.ofFloat(botButton, View.ALPHA, 1.0f),
ObjectAnimator.ofFloat(botButton, View.SCALE_X, 1.0f),
ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 1.0f)
);
botIconAnimator.setDuration(150);
}
}
emojiButton[0].setAlpha(0f);
@ -4476,6 +4500,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
recordPannelAnimation.playTogether(
exitAnimation,
attachIconAnimator,
botIconAnimator,
iconsEndAnimator
);
} else {
@ -4544,6 +4569,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
checkSendButton(true);
return;
} else if (audioToSend != null) {
if (delegate != null) {
delegate.beforeMessageSend(null, notify, scheduleDate);
}
MessageObject playing = MediaController.getInstance().getPlayingMessageObject();
if (playing != null && playing == audioToSendMessageObject) {
MediaController.getInstance().cleanupPlayer(true, true);
@ -4569,14 +4597,20 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
}
}
if (processSendingText(message, notify, scheduleDate)) {
messageEditText.setText("");
lastTypingTimeSend = 0;
if (StrUtil.isNotBlank(message)) {
if (delegate != null) {
delegate.onMessageSend(message, notify, scheduleDate);
delegate.beforeMessageSend(message, notify, scheduleDate);
}
if (processSendingText(message, notify, scheduleDate)) {
messageEditText.setText("");
lastTypingTimeSend = 0;
if (delegate != null) {
delegate.onMessageSend(message, notify, scheduleDate);
}
}
} else if (forceShowSendButton) {
if (delegate != null) {
delegate.beforeMessageSend(null, notify, scheduleDate);
delegate.onMessageSend(null, notify, scheduleDate);
}
}
@ -5055,6 +5089,11 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
scheduledButton.setTranslationX(0);
}
}
if (checkBotButton()) {
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_X, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.ALPHA, 1f));
}
runningAnimation2.playTogether(animators);
runningAnimation2.setDuration(100);
runningAnimation2.addListener(new AnimatorListenerAdapter() {
@ -5088,11 +5127,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
animators.add(ObjectAnimator.ofFloat(expandStickersButton, View.SCALE_X, 1.0f));
animators.add(ObjectAnimator.ofFloat(expandStickersButton, View.SCALE_Y, 1.0f));
animators.add(ObjectAnimator.ofFloat(expandStickersButton, View.ALPHA, 1.0f));
if (botButton.getVisibility() == GONE) {
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_X, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.ALPHA, 1f));
}
if (cancelBotButton.getVisibility() == VISIBLE) {
animators.add(ObjectAnimator.ofFloat(cancelBotButton, View.SCALE_X, 0.1f));
animators.add(ObjectAnimator.ofFloat(cancelBotButton, View.SCALE_Y, 0.1f));
@ -5214,6 +5248,11 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
scheduledButton.setTranslationX(0);
}
}
if (checkBotButton()) {
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_X, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.ALPHA, 1f));
}
runningAnimation2.playTogether(animators);
runningAnimation2.setDuration(100);
runningAnimation2.addListener(new AnimatorListenerAdapter() {
@ -5247,11 +5286,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
animators.add(ObjectAnimator.ofFloat(audioVideoButtonContainer, View.SCALE_X, 1.0f));
animators.add(ObjectAnimator.ofFloat(audioVideoButtonContainer, View.SCALE_Y, 1.0f));
animators.add(ObjectAnimator.ofFloat(audioVideoButtonContainer, View.ALPHA, 1.0f));
if (botButton.getVisibility() == GONE) {
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_X, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.ALPHA, 1f));
}
if (cancelBotButton.getVisibility() == VISIBLE) {
animators.add(ObjectAnimator.ofFloat(cancelBotButton, View.SCALE_X, 0.1f));
animators.add(ObjectAnimator.ofFloat(cancelBotButton, View.SCALE_Y, 0.1f));
@ -5816,17 +5850,15 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (attachLayout != null) {
iconsAnimator.playTogether(
ObjectAnimator.ofFloat(attachLayout, View.ALPHA, 1f),
ObjectAnimator.ofFloat(attachLayout, View.TRANSLATION_X, 0)
);
}
if (attachButton != null) {
iconsAnimator.playTogether(
ObjectAnimator.ofFloat(attachLayout, View.TRANSLATION_X, 0),
ObjectAnimator.ofFloat(attachButton, View.SCALE_X, 1f),
ObjectAnimator.ofFloat(attachButton, View.SCALE_Y, 1f)
);
}
if (botButton != null) {
iconsAnimator.playTogether(
ObjectAnimator.ofFloat(botButton, View.ALPHA, 1f),
ObjectAnimator.ofFloat(botButton, View.TRANSLATION_X, 0),
ObjectAnimator.ofFloat(botButton, View.SCALE_X, 1f),
ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 1f)
);
@ -6173,7 +6205,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
setSlowModeButtonVisible(false);
cancelBotButton.setVisibility(GONE);
audioVideoButtonContainer.setVisibility(GONE);
if (!NekoConfig.useChatAttachMediaMenu) attachLayout.setVisibility(GONE);
if (!NekoConfig.useChatAttachMediaMenu) {
attachLayout.setVisibility(GONE);
} else {
checkAttachButton(true, 150);
updateFieldRight(1);
}
sendButtonContainer.setVisibility(GONE);
if (scheduledButton != null) {
scheduledButton.setVisibility(GONE);
@ -6246,7 +6283,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (getVisibility() == VISIBLE) {
delegate.onAttachButtonShow();
}
checkAttachButton(false, 150);
checkAttachButton(false, 0);
updateFieldRight(1);
}
updateFieldHint();
@ -6501,6 +6538,28 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
}
private boolean checkBotButton() {
if (botButton == null) {
return false;
}
if (hasBotCommands || botReplyMarkup != null) {
if (botReplyMarkup != null) {
if (isPopupShowing() && currentPopupContentType == 1) {
botButtonDrawablel.setIcon(R.drawable.baseline_keyboard_24, true);
botButton.setContentDescription(LocaleController.getString("AccDescrShowKeyboard", R.string.AccDescrShowKeyboard));
} else {
botButtonDrawablel.setIcon(R.drawable.deproko_baseline_bots_24, true);
botButton.setContentDescription(LocaleController.getString("AccDescrBotKeyboard", R.string.AccDescrBotKeyboard));
}
} else {
botButtonDrawablel.setIcon(R.drawable.deproko_baseline_bots_command_26, true);
botButton.setContentDescription(LocaleController.getString("AccDescrBotCommands", R.string.AccDescrBotCommands));
}
return true;
}
return false;
}
private void updateBotButton() {
if (botButton == null) {
return;
@ -6521,10 +6580,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
botButtonDrawablel.setIcon(R.drawable.deproko_baseline_bots_command_26, true);
botButton.setContentDescription(LocaleController.getString("AccDescrBotCommands", R.string.AccDescrBotCommands));
}
updateFieldRight(2);
} else {
botButton.setVisibility(GONE);
}
updateFieldRight(2);
attachLayout.setPivotX(AndroidUtilities.dp((botButton == null || botButton.getVisibility() == GONE) && (notifyButton == null || notifyButton.getVisibility() == GONE) ? 48 : 96));
}
@ -6571,6 +6630,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
botKeyboardViewVisible = false;
botKeyboardView.setDelegate(button -> {
MessageObject object = replyingMessageObject != null ? replyingMessageObject : ((int) dialog_id < 0 ? botButtonsMessageObject : null);
if (delegate != null) {
delegate.beforeMessageSend(null, true, 0);
}
boolean open = didPressedBotButton(button, object, replyingMessageObject != null ? replyingMessageObject : botButtonsMessageObject);
if (replyingMessageObject != null) {
openKeyboardInternal();
@ -6811,6 +6873,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
return;
}
if (delegate != null) {
delegate.beforeMessageSend(null, notify, scheduleDate);
}
if (stickersExpanded) {
if (searchingType != 0) {
emojiView.hideSearchKeyboard();
@ -7061,6 +7126,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
return;
}
if (delegate != null) {
delegate.beforeMessageSend(null, true, scheduleDate);
}
if (searchingType != 0) {
searchingType = 0;
emojiView.closeSearch(true);
@ -7775,6 +7843,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
}
}
} else if (id == NotificationCenter.beforeAudioDidSent) {
if (delegate != null) {
delegate.beforeMessageSend(null, true, 0);
}
} else if (id == NotificationCenter.audioRouteChanged) {
if (parentActivity != null) {
boolean frontSpeaker = (Boolean) args[0];

View File

@ -122,6 +122,7 @@ public class NekoConfig {
public static boolean ignoreContentRestrictions;
public static boolean useChatAttachMediaMenu;
public static boolean disableLinkPreviewByDefault;
public static boolean sendCommentAfterForward;
public static String getOpenPGPAppName() {
@ -257,6 +258,7 @@ public class NekoConfig {
ignoreContentRestrictions = preferences.getBoolean("ignoreContentRestrictions", false);
useChatAttachMediaMenu = preferences.getBoolean("useChatAttachMediaMenu", true);
disableLinkPreviewByDefault = preferences.getBoolean("disableLinkPreviewByDefault", false);
sendCommentAfterForward = preferences.getBoolean("sendCommentAfterForward", true);
}
@ -806,4 +808,9 @@ public class NekoConfig {
}
public static void toggleSendCommentAfterForward() {
preferences.edit().putBoolean("sendCommentAfterForward",sendCommentAfterForward = !sendCommentAfterForward).apply();
}
}

View File

@ -71,6 +71,7 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
private int confirmAVRow;
private int useChatAttachMediaMenuRow;
private int disableLinkPreviewByDefaultRow;
private int sendCommentAfterForwardRow;
private int disableProximityEventsRow;
private int mapPreviewRow;
@ -234,6 +235,11 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.disableLinkPreviewByDefault);
}
} else if (position == sendCommentAfterForwardRow) {
NekoConfig.toggleSendCommentAfterForward();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.sendCommentAfterForward);
}
} else if (position == disableVibrationRow) {
NekoConfig.toggleDisableVibration();
if (view instanceof TextCheckCell) {
@ -279,6 +285,7 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
confirmAVRow = rowCount++;
useChatAttachMediaMenuRow = rowCount ++;
disableLinkPreviewByDefaultRow = rowCount ++;
sendCommentAfterForwardRow = rowCount ++;
disableProximityEventsRow = rowCount ++;
mapPreviewRow = rowCount++;
messageMenuRow = rowCount++;
@ -613,6 +620,8 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
textCell.setTextAndValueAndCheck(LocaleController.getString("UseChatAttachEnterMenu", R.string.UseChatAttachEnterMenu), LocaleController.getString("UseChatAttachEnterMenuNotice", R.string.UseChatAttachEnterMenuNotice), NekoConfig.useChatAttachMediaMenu, true, true);
} else if (position == disableLinkPreviewByDefaultRow) {
textCell.setTextAndValueAndCheck(LocaleController.getString("DisableLinkPreviewByDefault", R.string.DisableLinkPreviewByDefault), LocaleController.getString("DisableLinkPreviewByDefaultNotice", R.string.DisableLinkPreviewByDefaultNotice), NekoConfig.disableLinkPreviewByDefault, true, true);
} else if (position == sendCommentAfterForwardRow) {
textCell.setTextAndCheck(LocaleController.getString("SendCommentAfterForward", R.string.SendCommentAfterForward), NekoConfig.sendCommentAfterForward, true);
} else if (position == disableVibrationRow) {
textCell.setTextAndCheck(LocaleController.getString("DisableVibration", R.string.DisableVibration), NekoConfig.disableVibration, true);
} else if (position == disableProximityEventsRow) {

View File

@ -245,8 +245,9 @@
<string name="ShareMyKey">Share My Public Key</string>
<string name="DisableVibration">Disable Vibration</string>
<string name="IgnoreContentRestrictions">Ignore Content Restrictions</string>
<string name="IgnoreContentRestrictions">Ignore content restrictions</string>
<string name="IgnoreContentRestrictionsNotice">Ignores android restrictions on messages locally. This may be banned by the server in the future, and you will need to evaluate the local legality of this option yourself.</string>
<string name="SendCommentAfterForward">Send comment after forwarding</string>
</resources>