Skip to content

Commit

Permalink
T1421 Archiving the first chat of the chat list makes the Archived Ch…
Browse files Browse the repository at this point in the history
…ats folder to be unhidden
  • Loading branch information
kuelye committed Feb 10, 2021
1 parent 9824008 commit 4e6a5c7
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1184,15 +1184,16 @@ protected void onMeasure(int widthSpec, int heightSpec) {
}
}

int pos = parentPage.layoutManager.findFirstVisibleItemPosition();
if (pos != RecyclerView.NO_POSITION) {
RecyclerView.ViewHolder holder = parentPage.listView.findViewHolderForAdapterPosition(pos);
if (holder != null) {
int top = holder.itemView.getTop();

ignoreLayout = true;
parentPage.layoutManager.scrollToPositionWithOffset(pos, (int) (top - lastListPadding + scrollAdditionalOffset));
ignoreLayout = false;
if (!isDialogOperationActive()) {
int pos = parentPage.layoutManager.findFirstVisibleItemPosition();
if (pos != RecyclerView.NO_POSITION) {
RecyclerView.ViewHolder holder = parentPage.listView.findViewHolderForAdapterPosition(pos);
if (holder != null) {
int top = holder.itemView.getTop();
ignoreLayout = true;
parentPage.layoutManager.scrollToPositionWithOffset(pos, (int) (top - lastListPadding + scrollAdditionalOffset));
ignoreLayout = false;
}
}
}
if (!onlySelect) {
Expand Down Expand Up @@ -1233,7 +1234,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
lastTop = t;
scrollAdditionalOffset = 0;

if ((dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) && !parentPage.dialogsItemAnimator.isRunning()) {
if (isDialogOperationActive() && !parentPage.dialogsItemAnimator.isRunning()) {
onDialogAnimationFinished();
}
}
Expand Down Expand Up @@ -1279,7 +1280,7 @@ private void updatePullState() {

@Override
public boolean onTouchEvent(MotionEvent e) {
if (fastScrollAnimationRunning || waitingForScrollFinished || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) {
if (fastScrollAnimationRunning || waitingForScrollFinished || isDialogOperationActive()) {
return false;
}
int action = e.getAction();
Expand Down Expand Up @@ -1351,7 +1352,7 @@ public void onAnimationEnd(Animator animation) {

@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
if (fastScrollAnimationRunning || waitingForScrollFinished || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) {
if (fastScrollAnimationRunning || waitingForScrollFinished || isDialogOperationActive()) {
return false;
}
if (e.getAction() == MotionEvent.ACTION_DOWN) {
Expand Down Expand Up @@ -4637,7 +4638,7 @@ private boolean hasHiddenArchive() {
}

private boolean waitingForDialogsAnimationEnd(ViewPage viewPage) {
return viewPage.dialogsItemAnimator.isRunning() || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0;
return viewPage.dialogsItemAnimator.isRunning() || isDialogOperationActive();
}

private void onDialogAnimationFinished() {
Expand All @@ -4657,6 +4658,10 @@ private void onDialogAnimationFinished() {
});
}

private boolean isDialogOperationActive() {
return dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0;
}

private void setScrollY(float value) {
if (scrimView != null) {
scrimView.getLocationInWindow(scrimViewLocation);
Expand Down

0 comments on commit 4e6a5c7

Please sign in to comment.