mirror of https://github.com/NekoX-Dev/NekoX.git
feat: remember all clicked replies
This commit is contained in:
parent
fb3a2b88fd
commit
3c8ea5d10b
|
@ -260,6 +260,7 @@ import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Stack;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -660,6 +661,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private int startFromVideoMessageId;
|
private int startFromVideoMessageId;
|
||||||
private boolean needSelectFromMessageId;
|
private boolean needSelectFromMessageId;
|
||||||
private int returnToMessageId;
|
private int returnToMessageId;
|
||||||
|
private final Stack<Integer> returnToMessageIdsStack = new Stack<>();
|
||||||
private int returnToLoadIndex;
|
private int returnToLoadIndex;
|
||||||
private int createUnreadMessageAfterId;
|
private int createUnreadMessageAfterId;
|
||||||
private boolean createUnreadMessageAfterIdLoading;
|
private boolean createUnreadMessageAfterIdLoading;
|
||||||
|
@ -6041,7 +6043,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
textSelectionHelper.cancelTextSelectionRunnable();
|
textSelectionHelper.cancelTextSelectionRunnable();
|
||||||
if (createUnreadMessageAfterId != 0) {
|
if (createUnreadMessageAfterId != 0) {
|
||||||
scrollToMessageId(createUnreadMessageAfterId, 0, false, returnToLoadIndex, true, 0);
|
scrollToMessageId(createUnreadMessageAfterId, 0, false, returnToLoadIndex, true, 0);
|
||||||
} else if (returnToMessageId > 0) {
|
} else if (returnToMessageId > 0 || (NekomuraConfig.rememberAllBackMessages.Bool() && !returnToMessageIdsStack.empty())) {
|
||||||
|
returnToMessageId = returnToMessageIdsStack.pop();
|
||||||
scrollToMessageId(returnToMessageId, 0, true, returnToLoadIndex, true, 0);
|
scrollToMessageId(returnToMessageId, 0, true, returnToLoadIndex, true, 0);
|
||||||
} else {
|
} else {
|
||||||
scrollToLastMessage(false);
|
scrollToLastMessage(false);
|
||||||
|
@ -6051,6 +6054,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (NekomuraConfig.rememberAllBackMessages.Bool()) {
|
||||||
|
pagedownButton.setOnLongClickListener(view -> {
|
||||||
|
returnToMessageId = 0;
|
||||||
|
returnToMessageIdsStack.clear();
|
||||||
|
scrollToLastMessage(true);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
mentiondownButton = new FrameLayout(context);
|
mentiondownButton = new FrameLayout(context);
|
||||||
mentiondownButton.setVisibility(View.INVISIBLE);
|
mentiondownButton.setVisibility(View.INVISIBLE);
|
||||||
|
@ -12262,6 +12273,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
returnToMessageId = fromMessageId;
|
returnToMessageId = fromMessageId;
|
||||||
|
if (NekomuraConfig.rememberAllBackMessages.Bool() && fromMessageId > 0)
|
||||||
|
returnToMessageIdsStack.push(returnToMessageId);
|
||||||
returnToLoadIndex = loadIndex;
|
returnToLoadIndex = loadIndex;
|
||||||
needSelectFromMessageId = select;
|
needSelectFromMessageId = select;
|
||||||
}
|
}
|
||||||
|
@ -12325,6 +12338,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
returnToMessageId = 0;
|
returnToMessageId = 0;
|
||||||
|
returnToMessageIdsStack.clear();
|
||||||
newUnreadMessageCount = 0;
|
newUnreadMessageCount = 0;
|
||||||
if (pagedownButton.getTag() != null) {
|
if (pagedownButton.getTag() != null) {
|
||||||
pagedownButton.setTag(null);
|
pagedownButton.setTag(null);
|
||||||
|
@ -12386,6 +12400,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
returnToMessageId = 0;
|
returnToMessageId = 0;
|
||||||
|
returnToMessageIdsStack.clear();
|
||||||
if (mentiondownButton.getTag() != null) {
|
if (mentiondownButton.getTag() != null) {
|
||||||
mentiondownButton.setTag(null);
|
mentiondownButton.setTag(null);
|
||||||
if (mentiondownButtonAnimation != null) {
|
if (mentiondownButtonAnimation != null) {
|
||||||
|
|
|
@ -100,6 +100,7 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati
|
||||||
showMessageMenuAlert();
|
showMessageMenuAlert();
|
||||||
}));
|
}));
|
||||||
private final AbstractCell repeatConfirmRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.repeatConfirm));
|
private final AbstractCell repeatConfirmRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.repeatConfirm));
|
||||||
|
private final AbstractCell rememberAllBackMessagesRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.rememberAllBackMessages));
|
||||||
private final AbstractCell divider1 = cellGroup.appendCell(new NekomuraTGDivider());
|
private final AbstractCell divider1 = cellGroup.appendCell(new NekomuraTGDivider());
|
||||||
private final AbstractCell header2 = cellGroup.appendCell(new NekomuraTGHeader(LocaleController.getString("AutoDownload")));
|
private final AbstractCell header2 = cellGroup.appendCell(new NekomuraTGHeader(LocaleController.getString("AutoDownload")));
|
||||||
private final AbstractCell win32Row = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.disableAutoDownloadingWin32Executable));
|
private final AbstractCell win32Row = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.disableAutoDownloadingWin32Executable));
|
||||||
|
|
|
@ -163,6 +163,7 @@ public class NekomuraConfig {
|
||||||
public static ConfigItem disableChoosingSticker = addConfig("disableChoosingSticker", configTypeBool, false);
|
public static ConfigItem disableChoosingSticker = addConfig("disableChoosingSticker", configTypeBool, false);
|
||||||
public static ConfigItem hideGroupSticker = addConfig("hideGroupSticker", configTypeBool, false);
|
public static ConfigItem hideGroupSticker = addConfig("hideGroupSticker", configTypeBool, false);
|
||||||
public static ConfigItem hideSponsoredMessage = addConfig("hideSponsoredMessage", configTypeBool, false);
|
public static ConfigItem hideSponsoredMessage = addConfig("hideSponsoredMessage", configTypeBool, false);
|
||||||
|
public static ConfigItem rememberAllBackMessages = addConfig("rememberAllBackMessages", configTypeBool, false);
|
||||||
|
|
||||||
public static ConfigItem disableAutoDownloadingWin32Executable = addConfig("Win32ExecutableFiles", configTypeBool, true);
|
public static ConfigItem disableAutoDownloadingWin32Executable = addConfig("Win32ExecutableFiles", configTypeBool, true);
|
||||||
public static ConfigItem disableAutoDownloadingArchive = addConfig("ArchiveFiles", configTypeBool, true);
|
public static ConfigItem disableAutoDownloadingArchive = addConfig("ArchiveFiles", configTypeBool, true);
|
||||||
|
|
|
@ -261,4 +261,5 @@
|
||||||
|
|
||||||
<string name="valuesLargeAvatarInDrawer">Telegram Default\nAvatar as background\nBig avatar as background</string>
|
<string name="valuesLargeAvatarInDrawer">Telegram Default\nAvatar as background\nBig avatar as background</string>
|
||||||
<string name="hideSponsoredMessage">Hide sponsored messages</string>
|
<string name="hideSponsoredMessage">Hide sponsored messages</string>
|
||||||
|
<string name="rememberAllBackMessages">Remember all clicked replies</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue