Add "Disable "Jump to next channel"

This commit is contained in:
qwq233
2022-02-06 03:37:32 +08:00
committed by immat0x1
parent 04ac433a66
commit 27ea1467dc
4 changed files with 27 additions and 5 deletions

View File

@@ -36,6 +36,7 @@ public class ExteraConfig {
public static boolean hideKeyboardOnScroll;
public static boolean disableReactions;
public static boolean disableGreetingSticker;
public static boolean disableJumpToNextChannel;
public static boolean archiveOnPull;
public static boolean dateOfForwardedMsg;
@@ -93,6 +94,7 @@ public class ExteraConfig {
hideSendAsChannel = preferences.getBoolean("hideSendAsChannel", false);
hideKeyboardOnScroll = preferences.getBoolean("hideKeyboardOnScroll", true);
disableReactions = preferences.getBoolean("disableReactions", false);
disableJumpToNextChannel = preferences.getBoolean("disableJumpToNextChannel", false);
disableGreetingSticker = preferences.getBoolean("disableGreetingSticker", false);
archiveOnPull = preferences.getBoolean("archiveOnPull", true);
dateOfForwardedMsg = preferences.getBoolean("dateOfForwardedMsg", false);
@@ -250,6 +252,14 @@ public class ExteraConfig {
editor.apply();
}
public static void toggleDisableJumpToNextChannel() {
disableJumpToNextChannel = !disableJumpToNextChannel;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("exteraconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("disableJumpToNextChannel", disableJumpToNextChannel);
editor.apply();
}
public static void toggleArchiveOnPull() {
archiveOnPull = !archiveOnPull;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("exteraconfig", Activity.MODE_PRIVATE);

View File

@@ -61,6 +61,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
private int hideKeyboardOnScrollRow;
private int disableReactionsRow;
private int disableGreetingStickerRow;
private int disableJumpToNextChannelRow;
private int archiveOnPullRow;
private int dateOfForwardedMsgRow;
private int chatDividerRow;
@@ -260,7 +261,14 @@ public class ChatsPreferencesEntry extends BaseFragment {
} else if (position == disableGreetingStickerRow) {
ExteraConfig.toggleDisableGreetingSticker();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(ExteraConfig.disableReactions);
((TextCheckCell) view).setChecked(ExteraConfig.disableGreetingSticker);
}
parentLayout.rebuildAllFragmentViews(false, false);
} else if (position == disableJumpToNextChannelRow) {
ExteraConfig.toggleDisableJumpToNextChannel();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(ExteraConfig.disableJumpToNextChannel);
}
parentLayout.rebuildAllFragmentViews(false, false);
@@ -316,6 +324,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
hideKeyboardOnScrollRow = rowCount++;
disableReactionsRow = rowCount++;
disableGreetingStickerRow = rowCount++;
disableJumpToNextChannelRow = rowCount++;
archiveOnPullRow = rowCount++;
dateOfForwardedMsgRow = rowCount++;
chatDividerRow = rowCount++;
@@ -391,6 +400,8 @@ public class ChatsPreferencesEntry extends BaseFragment {
textCheckCell.setTextAndCheck(LocaleController.getString("DisableReactions", R.string.DisableReactions), ExteraConfig.disableReactions, true);
} else if (position == disableGreetingStickerRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("DisableGreetingSticker", R.string.DisableGreetingSticker), ExteraConfig.disableGreetingSticker, true);
} else if (position == disableJumpToNextChannelRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("DisableJumpToNextChannel", R.string.DisableJumpToNextChannel), ExteraConfig.disableJumpToNextChannel, true);
} else if (position == rearVideoMessagesRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("RearVideoMessages", R.string.RearVideoMessages), ExteraConfig.rearVideoMessages, true);
} else if (position == disableCameraRow) {
@@ -445,9 +456,9 @@ public class ChatsPreferencesEntry extends BaseFragment {
return 2;
} else if (position == hideStickerTimeRow || position == unlimitedRecentStickersRow || position == hideSendAsChannelRow ||
position == hideKeyboardOnScrollRow || position == archiveOnPullRow || position == dateOfForwardedMsgRow ||
position == disableReactionsRow || position == disableGreetingStickerRow || position == rearVideoMessagesRow ||
position == disableCameraRow || position == disableProximityEventsRow || position == pauseOnMinimizeRow ||
position == disablePlaybackRow) {
position == disableReactionsRow || position == disableGreetingStickerRow || position = disableJumpToNextChannelRow ||
position == rearVideoMessagesRow || position == disableCameraRow || position == disableProximityEventsRow ||
position == pauseOnMinimizeRow || position == disablePlaybackRow) {
return 3;
} else if (position == stickerSizeRow) {
return 4;

View File

@@ -5693,7 +5693,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (!foundTopView) {
scrolled = super.scrollVerticallyBy(dy, recycler, state);
}
if (dy > 0 && scrolled == 0 && ChatObject.isChannel(currentChat) && !currentChat.megagroup && chatListView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING && !chatListView.isFastScrollAnimationRunning() && !chatListView.isMultiselect() && reportType < 0) {
if (!ExteraConfig.disableJumpToNextChannel) && dy > 0 && scrolled == 0 && ChatObject.isChannel(currentChat) && !currentChat.megagroup && chatListView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING && !chatListView.isFastScrollAnimationRunning() && !chatListView.isMultiselect() && reportType < 0) {
if (pullingDownOffset == 0 && pullingDownDrawable != null) {
pullingDownDrawable.updateDialog();
}

View File

@@ -46,6 +46,7 @@
<string name="HideKeyboardOnScroll">Hide keyboard on scrolling</string>
<string name="DisableReactions">Disable reactions</string>
<string name="DisableGreetingSticker">Disable greeting sticker</string>
<string name="DisableJumpToNextChannel">Disable \"Jump to next channel\"</string>
<string name="ArchiveOnPull">Open archive on pulldown</string>
<string name="DateOfForwardedMsg">Show date of forwarded message</string>