Skip to content

Commit 808ab79

Browse files
committed
[TF][FEATURE] Hide pinned messages and livestream bars in chats
1 parent 6a6b5c7 commit 808ab79

4 files changed

Lines changed: 27 additions & 0 deletions

File tree

TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28156,6 +28156,10 @@ private void updatePinnedMessageView(boolean animated, int animateToNext) {
2815628156
if (currentEncryptedChat != null || chatMode != 0) {
2815728157
return;
2815828158
}
28159+
if (ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).getBoolean("hideTopChatBars", false) && dialog_id != getUserConfig().getClientUserId() && chatMode != MODE_SAVED) {
28160+
hidePinnedMessageView(animated);
28161+
return;
28162+
}
2815928163
int pinned_msg_id;
2816028164
boolean changed = false;
2816128165
MessageObject pinnedMessageObject;

TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import org.telegram.messenger.AccountInstance;
6161
import org.telegram.messenger.AndroidUtilities;
6262
import org.telegram.messenger.AnimationNotificationsLocker;
63+
import org.telegram.messenger.ApplicationLoader;
6364
import org.telegram.messenger.ChatObject;
6465
import org.telegram.messenger.ContactsController;
6566
import org.telegram.messenger.DialogObject;
@@ -2283,6 +2284,13 @@ public void checkCall(boolean create) {
22832284
if (visible && currentStyle == STYLE_IMPORTING_MESSAGES && (voIPService == null || voIPService.isHangingUp())) {
22842285
return;
22852286
}
2287+
if (ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).getBoolean("hideTopChatBars", false)) {
2288+
if ((currentStyle == STYLE_INACTIVE_GROUP_CALL || currentStyle == STYLE_ACTIVE_GROUP_CALL || currentStyle == STYLE_CONNECTING_GROUP_CALL) && visible) {
2289+
visible = false;
2290+
setVisibility(GONE);
2291+
}
2292+
return;
2293+
}
22862294
View fragmentView = fragment.getFragmentView();
22872295
if (!create && fragmentView != null) {
22882296
if (fragmentView.getParent() == null || ((View) fragmentView.getParent()).getVisibility() != VISIBLE) {

TMessagesProj/src/main/java/org/telegram/ui/GeneralSettingsActivity.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ private void fillItems(ArrayList<UItem> items, UniversalAdapter adapter) {
6363
mainConfig.getBoolean("displayExtraProfileInformation", false));
6464
displayExtraProfileInfo.subtext = getString(R.string.DisplayExtraProfileInformationInfo);
6565
items.add(displayExtraProfileInfo);
66+
67+
UItem hideTopChatBars = UItem.asCheck(2, getString(R.string.HideTopChatBars)).setChecked(
68+
mainConfig.getBoolean("hideTopChatBars", false));
69+
hideTopChatBars.subtext = getString(R.string.HideTopChatBarsInfo);
70+
items.add(hideTopChatBars);
6671
}
6772

6873
private void onClick(UItem item, View view, int position, float x, float y) {
@@ -85,6 +90,14 @@ private void onClick(UItem item, View view, int position, float x, float y) {
8590
((TextCheckCell) view).setChecked(newValue);
8691
}
8792
listView.adapter.update(false);
93+
} else if (item.id == 2) {
94+
SharedPreferences prefs = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
95+
boolean newValue = !prefs.getBoolean("hideTopChatBars", false);
96+
prefs.edit().putBoolean("hideTopChatBars", newValue).apply();
97+
if (view instanceof TextCheckCell) {
98+
((TextCheckCell) view).setChecked(newValue);
99+
}
100+
listView.adapter.update(false);
88101
}
89102
}
90103

TMessagesProj/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<string name="GhostModeInfo">Stay invisible to other users until you choose to interact with them.</string>
1717
<string name="DisplayExtraProfileInformation">Display extra profile information</string>
1818
<string name="DisplayExtraProfileInformationInfo">Show additional information about the user or chat on the profile page.</string>
19+
<string name="HideTopChatBars">Hide top chat bars</string>
20+
<string name="HideTopChatBarsInfo">Automatically hide the pinned messages and live stream bars at the top of chats.</string>
1921
<!--signin view-->
2022
<string name="YourPhone">Your Phone</string>
2123
<string name="StartText">Please confirm your country code and enter your phone number.</string>

0 commit comments

Comments
 (0)