diff options
author | Yorke Lee <yorkelee@google.com> | 2014-09-27 15:18:11 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-09-27 15:19:25 -0700 |
commit | 56493453580bb0db9a7ebd90b3c9868c8e3a8a59 (patch) | |
tree | 9f7cb35c323ef46e6d491dc1a0a18976a51ddb3b | |
parent | 0230ec94a8e1ee7a3a75e9e00883aa6c0ceeae29 (diff) |
Fix another bug with RTL tabs
super.instantiateItem should continue being called with the
original unadjusted position (since getItem already adjusts it for
RTL).
Instead, override getItemId to return the RTL adjusted position,
so that if a fragment is being retrieved from the FragmentManager
instead of being created by getItem, the overriden getItemId will
ensure that FragmentPagerAdapter will construct the correct tag to
retrieve the correct fragment from the FragmentManager.
Bug: 17673059
Change-Id: I42a7ce3f0d8a17384fdb16c998e49254d3a734db
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 24177f73f..024e3d914 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -183,6 +183,11 @@ public class ListsFragment extends AnalyticsFragment implements CallLogQueryHand } @Override + public long getItemId(int position) { + return getRtlPosition(position); + } + + @Override public Fragment getItem(int position) { switch (getRtlPosition(position)) { case TAB_INDEX_SPEED_DIAL: @@ -206,7 +211,7 @@ public class ListsFragment extends AnalyticsFragment implements CallLogQueryHand // Copy the fragments that the FragmentManager finds so that we can store them in // instance variables for later. final Fragment fragment = - (Fragment) super.instantiateItem(container, getRtlPosition(position)); + (Fragment) super.instantiateItem(container, position); if (fragment instanceof SpeedDialFragment) { mSpeedDialFragment = (SpeedDialFragment) fragment; } else if (fragment instanceof CallLogFragment) { |