Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68ca6aa9 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa
Browse files

Hide unnecessary menus when launched via DIAL intent

ViewPager#getCurrentItem() returns "tabIndex" after
ViewPager#setCurrentItem(tabIndex, false), so we need to preserve
the previous value.

TESTED (using phone devices with/without a hard menu key)
- swipe actions do not corrupt menus
- tab clicks do not corrupt menus
- DIAL intent corretly shows/hides menus
- Menus aren't corrupted in Dialpad Chooser

Bug: 5118757
Change-Id: Id857a2d7ac5a007db65b20f80270a07ea527ba7f
parent 32dc8e1c
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -568,13 +568,14 @@ public class DialtactsActivity extends Activity {
        } else {
            tabIndex = mLastManuallySelectedFragment;
        }

        final int previousItemIndex = mViewPager.getCurrentItem();
        mViewPager.setCurrentItem(tabIndex, false /* smoothScroll */);
        if (mViewPager.getCurrentItem() == tabIndex) {
        if (previousItemIndex != tabIndex) {
            sendFragmentVisibilityChange(previousItemIndex, false);
        }
        mPageChangeListener.setCurrentPosition(tabIndex);
        sendFragmentVisibilityChange(tabIndex, true);
        } else {
            getActionBar().selectTab(getActionBar().getTabAt(tabIndex));
        }

        // Restore to the previous manual selection
        mLastManuallySelectedFragment = savedTabIndex;