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

Commit 2f0af01e authored by Budi Kusmiantoro's avatar Budi Kusmiantoro Committed by Android (Google) Code Review
Browse files

Merge "Correctly identify Clock tab at first launch on RTL" into lmp-mr1-dev

parents 0d225c45 910f5f57
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -543,10 +543,12 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe

        @Override
        public void onTabSelected(Tab tab, FragmentTransaction ft) {
            TabInfo info = (TabInfo) tab.getTag();
            int position = info.getPosition();
            final TabInfo info = (TabInfo) tab.getTag();
            final int position = info.getPosition();
            final int rtlSafePosition = getRtlPosition(position);
            mSelectedTab = position;
            if (mIsFirstLaunch && getRtlPosition(position) == CLOCK_TAB_INDEX) {

            if (mIsFirstLaunch && isClockTab(rtlSafePosition)) {
                mLeftButton.setVisibility(View.INVISIBLE);
                mRightButton.setVisibility(View.INVISIBLE);
                mFab.setVisibility(View.VISIBLE);
@@ -554,11 +556,11 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
                mFab.setContentDescription(getString(R.string.button_cities));
                mIsFirstLaunch = false;
            } else {
                DeskClockFragment f = (DeskClockFragment) getItem(getRtlPosition(position));
                DeskClockFragment f = (DeskClockFragment) getItem(rtlSafePosition);
                f.setFabAppearance(mFab);
                f.setLeftRightButtonAppearance(mLeftButton, mRightButton);
            }
            mPager.setCurrentItem(getRtlPosition(position));
            mPager.setCurrentItem(rtlSafePosition);
        }

        @Override
@@ -566,6 +568,11 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
            // Do nothing
        }

        private boolean isClockTab(int rtlSafePosition) {
            final int clockTabIndex = isRtl() ? RTL_CLOCK_TAB_INDEX : CLOCK_TAB_INDEX;
            return rtlSafePosition == clockTabIndex;
        }

        public void notifySelectedPage(int page) {
            notifyPageChanged(page);
        }