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

Commit 197051b0 authored by James Lemieux's avatar James Lemieux Committed by Android (Google) Code Review
Browse files

Merge "Allow "Night mode" menu item in all tabs of the app" into ub-deskclock-dazzle

parents 78e2ecd5 919e0987
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import android.widget.ImageButton;
import android.widget.ImageView;

import com.android.deskclock.actionbarmenu.ActionBarMenuManager;
import com.android.deskclock.actionbarmenu.MenuItemController;
import com.android.deskclock.actionbarmenu.MenuItemControllerFactory;
import com.android.deskclock.actionbarmenu.NightModeMenuItemController;
import com.android.deskclock.actionbarmenu.SettingMenuItemController;
@@ -74,8 +73,6 @@ public class DeskClock extends BaseActivity
    public static final int STOPWATCH_TAB_INDEX = 3;

    private final ActionBarMenuManager mActionBarMenuManager = new ActionBarMenuManager(this);
    private final MenuItemController nightModeMenuItemController =
            new NightModeMenuItemController(this);

    private TabLayout mTabLayout;
    private RtlViewPager mViewPager;
@@ -198,10 +195,11 @@ public class DeskClock extends BaseActivity
        });

        // Configure the menu item controllers.
        mActionBarMenuManager.addMenuItemController(new SettingMenuItemController(this))
        mActionBarMenuManager
                .addMenuItemController(new SettingMenuItemController(this))
                .addMenuItemController(new NightModeMenuItemController(this))
                .addMenuItemController(MenuItemControllerFactory.getInstance()
                        .buildMenuItemControllers(this))
                .addMenuItemController(nightModeMenuItemController);
                        .buildMenuItemControllers(this));

        // Inflate the menu during creation to avoid a double layout pass. Otherwise, the menu
        // inflation occurs *after* the initial draw and a second layout pass adds in the menu.
@@ -381,7 +379,6 @@ public class DeskClock extends BaseActivity
            notifyPageChanged(position);

            mSelectedTab = position;
            nightModeMenuItemController.setEnabled(mSelectedTab == CLOCK_TAB_INDEX);

            // Avoid sending events for the initial tab selection on launch and the reselecting a
            // tab after a configuration change.