Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java

Issue 2614753002: 📰 Check we are on the NTP after dismissal animation. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java
index 525d1012f8e008cec76371f8536bbc01e3d5e9fa..5a8c9c0df7e227113e632ac53736f7e54a2e2da7 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java
@@ -12,6 +12,7 @@
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Region;
+import android.support.v4.view.ViewCompat;
import android.support.v4.view.animation.FastOutLinearInInterpolator;
import android.support.v4.view.animation.LinearOutSlowInInterpolator;
import android.support.v7.widget.LinearLayoutManager;
@@ -541,6 +542,10 @@ public void onAnimationStart(Animator animation) {
@Override
public void onAnimationEnd(Animator animation) {
+ // It is possible that by the time the animation ends, we navigated away from the
+ // container and it got destroyed. In that case, abort. (https://crbug.com/668945)
+ if (!ViewCompat.isAttachedToWindow(viewHolder.itemView)) return;
+
dismissItemInternal(viewHolder);
NewTabPageRecyclerView.this.onItemDismissFinished(viewHolder);
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698