From 49aa5bf33be8b96d6409168cddbb819bc7539fab Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Thu, 10 Sep 2015 15:53:43 -0700 Subject: Improve jump to tab via intent logic Respect the EXTRA_CALL_FILTER_TYPE extra if provided in an intent extra Fix bug where trying to jump to the voicemail tab for the first time before active voicemail sources were detected would not work. Bug: 23947505 Bug: 23388120 Change-Id: Ib4fcaf486ae01d023f21fd2fc3bfc78f1a0cf609 --- src/com/android/dialer/DialtactsActivity.java | 14 +++++++++++--- src/com/android/dialer/list/ListsFragment.java | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 4ade04af1..2589956bc 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -536,13 +536,21 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mDialerDatabaseHelper.startSmartDialUpdateThread(); mFloatingActionButtonController.align(getFabAlignment(), false /* animate */); - if (getIntent().hasExtra(EXTRA_SHOW_TAB)) { + if (Calls.CONTENT_TYPE.equals(getIntent().getType())) { + // Externally specified extras take precedence to EXTRA_SHOW_TAB, which is only + // used internally. + final Bundle extras = getIntent().getExtras(); + if (extras != null + && extras.getInt(Calls.EXTRA_CALL_TYPE_FILTER) == Calls.VOICEMAIL_TYPE) { + mListsFragment.showTab(ListsFragment.TAB_INDEX_VOICEMAIL); + } else { + mListsFragment.showTab(ListsFragment.TAB_INDEX_HISTORY); + } + } else if (getIntent().hasExtra(EXTRA_SHOW_TAB)) { int index = getIntent().getIntExtra(EXTRA_SHOW_TAB, ListsFragment.TAB_INDEX_SPEED_DIAL); if (index < mListsFragment.getTabCount()) { mListsFragment.showTab(index); } - } else if (Calls.CONTENT_TYPE.equals(getIntent().getType())) { - mListsFragment.showTab(ListsFragment.TAB_INDEX_HISTORY); } setSearchBoxHint(); diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 09a4cb21e..7ae202f35 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -265,7 +265,7 @@ public class ListsFragment extends Fragment // Try to show the voicemail tab after the voicemail status returns. mShowVoicemailTabAfterVoicemailStatusIsFetched = true; } - } else { + } else if (index < getTabCount()){ mViewPager.setCurrentItem(getRtlPosition(index)); } } -- cgit v1.2.3