From 0e567987d7883aa8997ac30c793aa6d5cd1aabbb Mon Sep 17 00:00:00 2001 From: Jake Wharton Date: Mon, 23 Apr 2012 22:02:32 -0700 Subject: [PATCH] Do not dispatch context selection events to non-visible fragments. When used in a `ViewPager`, fragments that are present on the adjacent, cached pages will receive context selection dispatches which, depending on your fragment contents, can be difficult to determine whether or not the event truly originated from your view. By using the visible hint we restrict dispatching to only those fragments which are marked as being visible. Since the fragment pager adapter updates this setting properly most implementations will be afforded this fix without any change required. If the user is implementing their own adapter they likely already understand the implications of these cached fragments and the reponsibility for updating the boolean falls to them. Mirrors support library change Ie6a72c1c82c2784774373670007b6f5948fe16da Change-Id: I1bc6f74e26660ef4a3c20419c077e37992412e94 --- core/java/android/app/FragmentManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 0519d3ebf1b5f..7e1daa49f049e 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -1890,7 +1890,7 @@ final class FragmentManagerImpl extends FragmentManager { if (mActive != null) { for (int i=0; i