Skip to content

Commit

Permalink
fix: unread Badge On BackButton
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Mar 30, 2024
1 parent a629253 commit 7db8afb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public MemberRequestCell(@NonNull Context context, OnClickListener clickListener

float dismissButtonWidth = dismissButton.getPaint().measureText(dismissButton.getText().toString()) + btnPadding * 2;
TextView banButton = new TextView(getContext());
banButton.setBackground(Theme.AdaptiveRipple.filledRect(Theme.key_featuredStickers_addButton, 4));
banButton.setBackground(Theme.AdaptiveRipple.filledRectByKey(Theme.key_featuredStickers_addButton, 4));
banButton.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
banButton.setMaxLines(1);
banButton.setPadding(btnPadding, 0, btnPadding, 0);
Expand Down
11 changes: 11 additions & 0 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2586,6 +2586,9 @@ public boolean onFragmentCreate() {

getNotificationCenter().addPostponeNotificationsCallback(postponeNotificationsWhileLoadingCallback);

// na: unread count
getNotificationCenter().addObserver(this, NotificationCenter.dialogsUnreadCounterChanged);

if (chatMode != MODE_SCHEDULED) {
if (threadMessageId == 0) {
getNotificationCenter().addObserver(this, NotificationCenter.screenshotTook);
Expand Down Expand Up @@ -2983,6 +2986,10 @@ public void onFragmentDestroy() {
AndroidUtilities.cancelRunOnUIThread(chatInviteRunnable);
chatInviteRunnable = null;
}

// na: unread count
getNotificationCenter().removeObserver(this, NotificationCenter.dialogsUnreadCounterChanged);

getNotificationCenter().removePostponeNotificationsCallback(postponeNotificationsWhileLoadingCallback);
getMessagesController().setLastCreatedDialogId(dialog_id, chatMode == MODE_SCHEDULED, false);
getNotificationCenter().removeObserver(this, NotificationCenter.messagesDidLoad);
Expand Down Expand Up @@ -33386,6 +33393,10 @@ public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
});
}
}
// na: unread count
if (actionBar != null) {
actionBar.unreadBadgeSetCount(getMessagesStorage().getMainUnreadCount());
}
}

int position = holder.getAdapterPosition();
Expand Down

0 comments on commit 7db8afb

Please sign in to comment.