From 615b93a78933dd89c7d25a7c4466aabb95d42a39 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 15 Jan 2024 16:31:55 +0800 Subject: [PATCH] feat: Dsiable Archive On Pull --- .../src/main/java/org/telegram/ui/DialogsActivity.java | 9 ++++++++- .../nekogram/settings/NekoGeneralSettingsActivity.java | 1 + .../src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt | 6 ++++++ TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml | 1 + TMessagesProj/src/main/res/values/strings_na.xml | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index 3d460d132e..1aad45bdd0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -3775,7 +3775,7 @@ public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerVi if (hasStories && !rightSlidingDialogContainer.hasFragment() && !fixScrollYAfterArchiveOpened) { pTop -= AndroidUtilities.dp(DialogStoriesCell.HEIGHT_IN_DP); } - boolean hasHidenArchive = !fixScrollYAfterArchiveOpened && viewPage.dialogsType == DIALOGS_TYPE_DEFAULT && !onlySelect && folderId == 0 && getMessagesController().hasHiddenArchive() && viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN; + boolean hasHidenArchive = !fixScrollYAfterArchiveOpened && viewPage.dialogsType == DIALOGS_TYPE_DEFAULT && !onlySelect && folderId == 0 && hasHiddenArchive() && viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN; if ((hasHidenArchive || (hasStories && !rightSlidingDialogContainer.hasFragment())) && dy < 0) { viewPage.listView.setOverScrollMode(View.OVER_SCROLL_ALWAYS); int currentPosition = viewPage.layoutManager.findFirstVisibleItemPosition(); @@ -8389,6 +8389,13 @@ private void updateStoriesPosting() { } private boolean hasHiddenArchive() { + return hasHiddenArchive(false); + } + + private boolean hasHiddenArchive(Boolean force) { + if (!force && !NaConfig.INSTANCE.getShowArchiveOnPull().Bool()) { + return false; + } return !onlySelect && initialDialogsType == DIALOGS_TYPE_DEFAULT && folderId == 0 && getMessagesController().hasHiddenArchive(); } diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoGeneralSettingsActivity.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoGeneralSettingsActivity.java index 7ee87b01c6..91d234f6bd 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoGeneralSettingsActivity.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoGeneralSettingsActivity.java @@ -135,6 +135,7 @@ public class NekoGeneralSettingsActivity extends BaseNekoXSettingsActivity { private final AbstractConfigCell headerFolder = cellGroup.appendCell(new ConfigCellHeader(LocaleController.getString("Folder"))); private final AbstractConfigCell hideAllTabRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.hideAllTab, LocaleController.getString("HideAllTabAbout"))); + private final AbstractConfigCell showArchiveOnPullRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowArchiveOnPull())); private final AbstractConfigCell openArchiveOnPullRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.openArchiveOnPull)); private final AbstractConfigCell ignoreMutedCountRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.ignoreMutedCount)); private final AbstractConfigCell ignoreFolderCountRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getIgnoreFolderCount())); diff --git a/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt b/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt index 21d225cb03..bfc2c5e087 100644 --- a/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt +++ b/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt @@ -466,6 +466,12 @@ object NaConfig { ConfigItem.configTypeBool, false ) + val showArchiveOnPull = + addConfig( + "ShowArchiveOnPull", + ConfigItem.configTypeBool, + true + ) private fun addConfig( k: String, diff --git a/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml b/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml index a8d246aa31..370e7b3c55 100644 --- a/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml +++ b/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml @@ -92,4 +92,5 @@ 隐藏文件夹中的\"全部取消静音\" 本地名称颜色 显示方形头像 + 显示下拉打开已归档对话 diff --git a/TMessagesProj/src/main/res/values/strings_na.xml b/TMessagesProj/src/main/res/values/strings_na.xml index 4c24e5acd5..14b5c50ea1 100644 --- a/TMessagesProj/src/main/res/values/strings_na.xml +++ b/TMessagesProj/src/main/res/values/strings_na.xml @@ -95,4 +95,5 @@ Hide filter mute all Use local quote color Show square avatar + Show archive on pull