Add "Hide "Send As Channel"

This commit is contained in:
Ivan K
2022-03-17 21:18:57 +03:00
parent 4a1900a613
commit 909979a2fc
4 changed files with 27 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ public class ExteraConfig {
public static float stickerSize = 14.0f;
public static boolean hideStickerTime;
public static boolean hideSendAsChannel;
public static boolean hideKeyboardOnScroll;
public static boolean archiveOnPull;
public static boolean dateOfForwardedMsg;
@@ -59,6 +60,7 @@ public class ExteraConfig {
stickerSize = preferences.getFloat("stickerSize", 14.0f);
hideStickerTime = preferences.getBoolean("hideStickerTime", false);
hideSendAsChannel = preferences.getBoolean("hideSendAsChannel", false);
hideKeyboardOnScroll = preferences.getBoolean("hideKeyboardOnScroll", true);
archiveOnPull = preferences.getBoolean("archiveOnPull", true);
dateOfForwardedMsg = preferences.getBoolean("dateOfForwardedMsg", false);
@@ -142,6 +144,14 @@ public class ExteraConfig {
editor.commit();
}
public static void toggleHideSendAsChannel() {
hideSendAsChannel = !hideSendAsChannel;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("exteraconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("hideSendAsChannel", hideSendAsChannel);
editor.commit();
}
public static void toggleHideKeyboardOnScroll() {
hideKeyboardOnScroll = !hideKeyboardOnScroll;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("exteraconfig", Activity.MODE_PRIVATE);

View File

@@ -29,6 +29,7 @@ import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.SeekBarView;
import org.telegram.ui.Components.UndoView;
import org.w3c.dom.Text;
import com.exteragram.messenger.ExteraConfig;
@@ -45,6 +46,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
private int stickersDividerRow;
private int chatHeaderRow;
private int hideSendAsChannelRow;
private int hideStickerTimeRow;
private int hideKeyboardOnScrollRow;
private int archiveOnPullRow;
@@ -156,6 +158,11 @@ public class ChatsPreferencesEntry extends BaseFragment {
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(ExteraConfig.hideStickerTime);
}
} else if (position == hideSendAsChannelRow) {
ExteraConfig.toggleHideSendAsChannel();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(ExteraConfig.hideSendAsChannel);
}
} else if (position == hideKeyboardOnScrollRow) {
ExteraConfig.toggleHideKeyboardOnScroll();
if (view instanceof TextCheckCell) {
@@ -193,6 +200,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
stickersDividerRow = rowCount++;
chatHeaderRow = rowCount++;
hideSendAsChannelRow = rowCount++;
hideStickerTimeRow = rowCount++;
hideKeyboardOnScrollRow = rowCount++;
archiveOnPullRow = rowCount++;
@@ -249,7 +257,9 @@ public class ChatsPreferencesEntry extends BaseFragment {
TextCheckCell textCheckCell = (TextCheckCell) holder.itemView;
textCheckCell.setEnabled(true, null);
if (position == hideStickerTimeRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("StickerTime", R.string.StickerTime), ExteraConfig.hideStickerTime, true);
textCheckCell.setTextAndCheck(LocaleController.getString("StickerTime", R.string.StickerTime), ExteraConfig.hideStickerTime, true);
} else if (position == hideSendAsChannelRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("HideSendAsChannel", R.string.HideSendAsChannel), ExteraConfig.hideSendAsChannel, true);
} else if (position == hideKeyboardOnScrollRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("HideKeyboardOnScroll", R.string.HideKeyboardOnScroll), ExteraConfig.hideKeyboardOnScroll, true);
} else if (position == archiveOnPullRow) {
@@ -300,8 +310,8 @@ public class ChatsPreferencesEntry extends BaseFragment {
return 1;
} else if (position == stickersHeaderRow || position == chatHeaderRow || position == mediaHeaderRow) {
return 2;
} else if (position == hideStickerTimeRow || position == hideKeyboardOnScrollRow || position == archiveOnPullRow ||
position == dateOfForwardedMsgRow || position == rearVideoMessagesRow) {
} else if (position == hideStickerTimeRow || position == hideSendAsChannelRow || position == hideKeyboardOnScrollRow ||
position == archiveOnPullRow || position == dateOfForwardedMsgRow || position == rearVideoMessagesRow) {
return 3;
} else if (position == stickerSizeRow) {
return 4;

View File

@@ -149,6 +149,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import com.exteragram.messenger.ExteraConfig;
public class ChatActivityEnterView extends BlurredFrameLayout implements NotificationCenter.NotificationCenterDelegate, SizeNotifierFrameLayout.SizeNotifierFrameLayoutDelegate, StickersAlert.StickersAlertDelegate {
public interface ChatActivityEnterViewDelegate {
@@ -6652,7 +6654,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
}
boolean wasVisible = senderSelectView.getVisibility() == View.VISIBLE;
boolean isVisible = delegate.getSendAsPeers() != null && defPeer != null && delegate.getSendAsPeers().peers.size() > 1 &&
!isEditingMessage() && !isRecordingAudioVideo() && recordedAudioPanel.getVisibility() != View.VISIBLE;
!isEditingMessage() && !isRecordingAudioVideo() && !ExteraConfig.hideSendAsChannel && recordedAudioPanel.getVisibility() != View.VISIBLE;
int pad = AndroidUtilities.dp(2);
MarginLayoutParams params = (MarginLayoutParams) senderSelectView.getLayoutParams();
float startAlpha = isVisible ? 0 : 1;

View File

@@ -36,6 +36,7 @@
<string name="StickerSize">Stickers size</string>
<string name="StickerTime">Hide time under stickers</string>
<string name="HideSendAsChannel">Hide \"Send as Channel\"</string>
<string name="HideKeyboardOnScroll">Hide Keyboard on Scrolling</string>
<string name="ArchiveOnPull">Open Archive on Pulldown</string>
<string name="DateOfForwardedMsg">Show date of forwarded message</string>