Exemple #1
0
        public void SwitchIfNeeded()
        {
            if (m_fLastSensorIlluminanceValue == -1 || !Settings.AutomaticDayNightMode)
            {
                return;
            }

            if ((Settings.NightMode && m_fLastSensorIlluminanceValue >= Settings.LuxLightToGoNightMode + Settings.LuxLightGap) || (!Settings.NightMode && m_fLastSensorIlluminanceValue < Settings.LuxLightToGoNightMode - Settings.LuxLightGap))
            {
                DynamicUIBuild_Utils.Switch_DayMode_NightMode(m_activity);

                Settings.NbMillisecondBeforeSwitchDayNightMode = Settings._NbMillisecondBeforeSwitchDayNightModeDefault;
            }
        }
        public static bool ManageDayNightModeMenuClick(IMenuItem item, Activity context)
        {
            bool bRes = false;

            switch (item.ItemId)
            {
            case Resource.Id.dashboardActivity_menu_dayMode:
                Settings.AutomaticDayNightMode = false;
                if (Settings.NightMode)
                {
                    DynamicUIBuild_Utils.Switch_DayMode_NightMode(context);
                }
                bRes = true;
                break;

            case Resource.Id.dashboardActivity_menu_nightMode:
                Settings.AutomaticDayNightMode = false;
                if (!Settings.NightMode)
                {
                    DynamicUIBuild_Utils.Switch_DayMode_NightMode(context);
                }
                bRes = true;
                break;

            case Resource.Id.dashboardActivity_menu_automaticNightMode:
                Settings.AutomaticDayNightMode = true;
                Settings.NbMillisecondBeforeSwitchDayNightMode = 1;
                bRes = true;
                break;
            }

            if (bRes)
            {
                context.InvalidateOptionsMenu();
            }

            return(bRes);
        }