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

Commit 919e0987 authored by James Lemieux's avatar James Lemieux
Browse files

Allow "Night mode" menu item in all tabs of the app

In order to sidestep b/25872174 it was agreed that code attempting
to show the "Night mode" menu item on just the clock tab would be
removed.

Change-Id: I842b093c7d206dc8e42a6a85bbd487dd9a235942
parent 9951f6f4
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.