mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
fixed memory leak
This commit is contained in:
parent
d5ee96dd46
commit
970f511dd5
3 changed files with 276 additions and 281 deletions
|
@ -80,10 +80,11 @@ public class AvatarPreviewer {
|
|||
private Layout layout;
|
||||
private boolean visible;
|
||||
|
||||
public void show(ViewGroup parentContainer, Data data, boolean accessibility,Callback callback) {
|
||||
Preconditions.checkNotNull(parentContainer);
|
||||
Preconditions.checkNotNull(data);
|
||||
Preconditions.checkNotNull(callback);
|
||||
public void show(ViewGroup parentContainer, Theme.ResourcesProvider resourcesProvider, Data data, Callback callback,boolean accessibility) {
|
||||
|
||||
Objects.requireNonNull(parentContainer);
|
||||
Objects.requireNonNull(data);
|
||||
Objects.requireNonNull(callback);
|
||||
|
||||
final Context context = parentContainer.getContext();
|
||||
|
||||
|
@ -130,12 +131,12 @@ public void show(ViewGroup parentContainer, Data data, boolean accessibility,Cal
|
|||
parentContainer.requestDisallowInterceptTouchEvent(true);
|
||||
visible = true;
|
||||
}
|
||||
else layout.showBottomSheet();
|
||||
else layout.showContextMenu();
|
||||
}
|
||||
}
|
||||
|
||||
public void show(ViewGroup parentContainer, Data data, Callback callback) {
|
||||
show(parentContainer,data,false,callback);
|
||||
public void show(ViewGroup parentContainer, Theme.ResourcesProvider resourcesProvider, Data data, Callback callback) {
|
||||
show(parentContainer,resourcesProvider,data,callback,false);
|
||||
}
|
||||
public void close() {
|
||||
if (visible) {
|
||||
|
|
|
@ -231,6 +231,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
private int CONTACT_VIEW = -1;
|
||||
private int CONTACT_ADD = -1;
|
||||
private int CONTACT_MESSAGE = -1;
|
||||
private boolean isInitializedNodes;
|
||||
private boolean touch; //To catch,whether was touch before clear_accessibility_focus action was performed.
|
||||
private int numberOfNodes =-1;
|
||||
|
||||
public boolean clipToGroupBounds;
|
||||
public boolean drawForBlur;
|
||||
|
@ -5464,7 +5467,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
FORWARD = -1;
|
||||
TRANSCRIBE = -1;
|
||||
CONTACT = -1;
|
||||
CONTACT_VIEW = -1;
|
||||
CONTACT_VIEW = -1;
|
||||
CONTACT_ADD = -1;
|
||||
CONTACT_MESSAGE = -1;
|
||||
if (drawCommentButton || useTranscribeButton || drawSideButton == 3 && !((hasDiscussion && messageObject.isLinkedToChat(linkedChatId) || isRepliesChat) && (currentPosition == null || currentPosition.siblingHeights == null && (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0 || currentPosition.siblingHeights != null && (currentPosition.flags & MessageObject.POSITION_FLAG_TOP) == 0))) {
|
||||
|
@ -5518,7 +5521,7 @@ CONTACT_VIEW = -1;
|
|||
}
|
||||
}
|
||||
if (chosenAnswer != null) {
|
||||
sendAccessibilityEventForVirtualView(MessageAccessibilityNodeProvider.POLL_BUTTONS_START + a, AccessibilityEvent.TYPE_VIEW_SELECTED, chosenAnswer.correct ? getString("AccDescrQuizCorrectAnswer", R.string.AccDescrQuizCorrectAnswer) : getString("AccDescrQuizIncorrectAnswer", R.string.AccDescrQuizIncorrectAnswer));
|
||||
sendAccessibilityEventForVirtualView(POLL_BUTTONS_START + a, AccessibilityEvent.TYPE_VIEW_SELECTED, chosenAnswer.correct ? getString("AccDescrQuizCorrectAnswer", R.string.AccDescrQuizCorrectAnswer) : getString("AccDescrQuizIncorrectAnswer", R.string.AccDescrQuizIncorrectAnswer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9410,6 +9413,14 @@ CONTACT_VIEW = -1;
|
|||
}
|
||||
if (drawPinnedBottom && drawPinnedTop) {
|
||||
totalHeight -= AndroidUtilities.dp(2);
|
||||
} else if (drawPinnedBottom) {
|
||||
totalHeight -= AndroidUtilities.dp(1);
|
||||
} else if (drawPinnedTop && pinnedBottom && currentPosition != null && currentPosition.siblingHeights == null) {
|
||||
totalHeight -= AndroidUtilities.dp(1);
|
||||
}
|
||||
if (!mediaBackground) {
|
||||
if (messageObject.type == MessageObject.TYPE_TEXT) {
|
||||
totalHeight -= AndroidUtilities.dp(2);
|
||||
}
|
||||
if (drawPinnedBottom) {
|
||||
totalHeight -= AndroidUtilities.dp(1);
|
||||
|
@ -9418,6 +9429,7 @@ CONTACT_VIEW = -1;
|
|||
totalHeight -= AndroidUtilities.dp(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (messageObject.type != MessageObject.TYPE_EMOJIS) {
|
||||
if (messageObject.isAnyKindOfSticker() && totalHeight < AndroidUtilities.dp(70)) {
|
||||
additionalTimeOffsetY = AndroidUtilities.dp(70) - totalHeight;
|
||||
|
@ -19275,6 +19287,7 @@ CONTACT_VIEW = -1;
|
|||
(int) buttonY,
|
||||
endX - AndroidUtilities.dp(14),
|
||||
layoutHeight - AndroidUtilities.dp(h) + 1
|
||||
);
|
||||
if (selectorDrawable[1] != null && selectorDrawableMaskType[1] == 2) {
|
||||
int count = canvas.getSaveCount();
|
||||
selectorDrawable[1].setBounds(commentButtonRect);
|
||||
|
@ -22106,7 +22119,7 @@ CONTACT_VIEW = -1;
|
|||
}
|
||||
if (lastPoll != null) {
|
||||
sb.append(", ");
|
||||
sb.append(lastPoll.question);
|
||||
sb.append(lastPoll.question.text);
|
||||
sb.append(", ");
|
||||
String title;
|
||||
if (pollClosed) {
|
||||
|
@ -22544,22 +22557,6 @@ CONTACT_VIEW = -1;
|
|||
private Path linkPath = new Path();
|
||||
private RectF rectF = new RectF();
|
||||
private Rect rect = new Rect();
|
||||
|
||||
private class ProfileSpan extends ClickableSpan {
|
||||
private TLRPC.User user;
|
||||
|
||||
public ProfileSpan(TLRPC.User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@NonNull View view) {
|
||||
if (delegate != null) {
|
||||
delegate.didPressUserAvatar(ChatMessageCell.this, user, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
|
||||
int[] pos = {0, 0};
|
||||
|
@ -22601,7 +22598,7 @@ CONTACT_VIEW = -1;
|
|||
actionLabel = LocaleController.getString("AccActionCancelDownload", R.string.AccActionCancelDownload);
|
||||
break;
|
||||
default:
|
||||
if ((currentMessageObject.type == MessageObject.TYPE_PHONE_CALL) {
|
||||
if (currentMessageObject.type == MessageObject.TYPE_PHONE_CALL) {
|
||||
actionLabel = LocaleController.getString("CallAgain", R.string.CallAgain);
|
||||
}
|
||||
}
|
||||
|
@ -22645,6 +22642,7 @@ CONTACT_VIEW = -1;
|
|||
info.addChild(ChatMessageCell.this, LINK_IDS_START + i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (currentMessageObject.caption instanceof Spannable && captionLayout != null) {
|
||||
Spannable buffer = (Spannable) currentMessageObject.caption;
|
||||
CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
|
||||
|
@ -22691,7 +22689,7 @@ CONTACT_VIEW = -1;
|
|||
}
|
||||
if (drawContact && contactRect != null && !contactRect.isEmpty()) {
|
||||
if (!isInitializedNodes) {
|
||||
contact = ++numberOfNodes;
|
||||
CONTACT = ++numberOfNodes;
|
||||
}
|
||||
info.addChild(ChatMessageCell.this, CONTACT);
|
||||
if (contactButtons != null && contactButtons.size() > 1) {
|
||||
|
@ -22718,37 +22716,32 @@ CONTACT_VIEW = -1;
|
|||
}
|
||||
}
|
||||
if (commentLayout != null) {
|
||||
if(!isInitializedNodes) {
|
||||
if (!isInitializedNodes) {
|
||||
COMMENT = ++numberOfNodes;
|
||||
}
|
||||
info.addChild(ChatMessageCell.this, COMMENT);
|
||||
}
|
||||
if (drawSideButton == 1 || drawSideButton == 2) {
|
||||
if(!isInitializedNodes) {
|
||||
if (!isInitializedNodes) {
|
||||
SHARE = ++numberOfNodes;
|
||||
}
|
||||
info.addChild(ChatMessageCell.this, SHARE);
|
||||
}
|
||||
if (replyNameLayout != null) {
|
||||
if(!isInitializedNodes) {
|
||||
if (!isInitializedNodes) {
|
||||
REPLY = ++numberOfNodes;
|
||||
}
|
||||
info.addChild(ChatMessageCell.this, REPLY);
|
||||
}
|
||||
if (forwardedNameLayout[0] != null && forwardedNameLayout[1] != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_open_forwarded_origin, getString("AccActionOpenForwardedOrigin", R.string.AccActionOpenForwardedOrigin)));
|
||||
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_open_forwarded_origin, LocaleController.getString("AccActionOpenForwardedOrigin", R.string.AccActionOpenForwardedOrigin)));
|
||||
} else {
|
||||
if(!isInitializedNodes) {
|
||||
if (!isInitializedNodes) {
|
||||
FORWARD = ++numberOfNodes;
|
||||
}
|
||||
info.addChild(ChatMessageCell.this, FORWARD);
|
||||
}
|
||||
if (commentLayout != null) {
|
||||
if (!isInitializedNodes) {
|
||||
COMMENT = ++numberOfNodes;
|
||||
}
|
||||
info.addChild(ChatMessageCell.this, COMMENT);
|
||||
}
|
||||
if (drawSelectionBackground || getBackground() != null) {
|
||||
info.setSelected(true);
|
||||
|
@ -22879,7 +22872,7 @@ CONTACT_VIEW = -1;
|
|||
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
|
||||
instantButtonRect.round(rect);
|
||||
}
|
||||
else if (virtualViewId == CONTACT) {
|
||||
else if (virtualViewId == CONTACT) {
|
||||
info.setClassName("android.widget.Button");
|
||||
if (titleLayout != null) {
|
||||
info.setText(titleLayout.getText());
|
||||
|
@ -22912,7 +22905,7 @@ else if (virtualViewId == CONTACT) {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (virtualViewId == SHARE) {
|
||||
else if (virtualViewId == SHARE) {
|
||||
info.setClassName("android.widget.ImageButton");
|
||||
if (isOpenChatByShare(currentMessageObject)) {
|
||||
info.setContentDescription(getString("AccDescrOpenChat", R.string.AccDescrOpenChat));
|
||||
|
|
|
@ -6115,6 +6115,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
clearFragments();
|
||||
super.onDestroy();
|
||||
onFinish();
|
||||
FloatingDebugController.onDestroy();
|
||||
|
|
Loading…
Reference in a new issue