diff options
author | Yorke Lee <yorkelee@google.com> | 2014-09-26 22:25:56 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-26 22:25:56 +0000 |
commit | b96184467a9d355e5d4a6062c7064c2ce723e9ab (patch) | |
tree | 81a09d36486923b16331fec87c53a571632e419e | |
parent | 3a6192bb102e718e401d8a5364ee223df2f753e3 (diff) | |
parent | 0230ec94a8e1ee7a3a75e9e00883aa6c0ceeae29 (diff) |
am 0230ec94: Fix crash when switching between LTR/RTL
* commit '0230ec94a8e1ee7a3a75e9e00883aa6c0ceeae29':
Fix crash when switching between LTR/RTL
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 2aa78a2d2..24177f73f 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -205,19 +205,16 @@ public class ListsFragment extends AnalyticsFragment implements CallLogQueryHand // On rotation the FragmentManager handles rotation. Therefore getItem() isn't called. // 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, position); - switch (getRtlPosition(position)) { - case TAB_INDEX_SPEED_DIAL: - mSpeedDialFragment = (SpeedDialFragment) fragment; - return mSpeedDialFragment; - case TAB_INDEX_RECENTS: - mRecentsFragment = (CallLogFragment) fragment; - return mRecentsFragment; - case TAB_INDEX_ALL_CONTACTS: - mAllContactsFragment = (AllContactsFragment) fragment; - return mAllContactsFragment; + final Fragment fragment = + (Fragment) super.instantiateItem(container, getRtlPosition(position)); + if (fragment instanceof SpeedDialFragment) { + mSpeedDialFragment = (SpeedDialFragment) fragment; + } else if (fragment instanceof CallLogFragment) { + mRecentsFragment = (CallLogFragment) fragment; + } else if (fragment instanceof AllContactsFragment) { + mAllContactsFragment = (AllContactsFragment) fragment; } - return super.instantiateItem(container, position); + return fragment; } @Override |