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

Commit 4404dca3 authored by Nancy Chen's avatar Nancy Chen
Browse files

Add/remove voicemail tab accordingly when it is enabled/disabled.

Voicemail tab was not being updated correctly because it was being added
back when it should have been removed.

Bug: 25620191
Change-Id: Icd75db20f3068cfc4980d03014f283cd05e14bc6
parent 88e72785
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -236,16 +236,30 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
        }
    }

    /**
     * Remove a tab at a certain index.
     *
     * @param index The index of the tab view we wish to remove.
     */
    public void removeTab(int index) {
        View view = mTabStrip.getChildAt(index);
        if (view != null) {
            mTabStrip.removeView(view);
        }
    }

    /**
     * Refresh a tab at a certain index by removing it and reconstructing it.
     *
     * @param index The index of the tab view we wish to update.
     */
    public void updateTab(int index) {
        View view = mTabStrip.getChildAt(index);
        mTabStrip.removeView(view);
        removeTab(index);

        if (index < mPager.getAdapter().getCount()) {
            addTab(mPager.getAdapter().getPageTitle(index), index);
        }
    }

    @Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {