Beispiel #1
0
        public override void OnReceive(Context context, Intent intent)
        {
            if (intent.Action == AppWidgetManager.ActionAppwidgetUpdate)
            {
                AppWidgetManager appWidgetManager = AppWidgetManager.GetInstance(context);
                int[]            appWidgetIds     = intent.GetIntArrayExtra(AppWidgetManager.ExtraAppwidgetIds);

                // Service update
                if (appWidgetIds == null)
                {
                    WidgetUpdateService.Start(context);
                    Update(context, appWidgetManager);
                }

                // System update
                else
                {
                    Update(context, appWidgetManager, appWidgetIds);
                }
            }
            else
            {
                base.OnReceive(context, intent);
            }
        }
Beispiel #2
0
 public override void OnEnabled(Context context)
 {
     if (TramUrWayApplication.Config.EnableWidgetRefresh)
     {
         WidgetUpdateService.Start(context, true);
     }
 }
 public override void OnReceive(Context context, Intent intent)
 {
     if (intent.Action == Intent.ActionScreenOn)
     {
         WidgetUpdateService.Start(context);
     }
     else if (intent.Action == Intent.ActionScreenOff)
     {
         WidgetUpdateService.Stop(context);
     }
 }
Beispiel #4
0
        public override void OnDisabled(Context context)
        {
            ComponentName widgetComponent = GetComponentName(context);

            AppWidgetManager appWidgetManager = AppWidgetManager.GetInstance(context);

            int[] appWidgetIds = appWidgetManager.GetAppWidgetIds(widgetComponent);

            if (appWidgetIds.Length == 0 && TramUrWayApplication.Config.EnableWidgetRefresh)
            {
                WidgetUpdateService.Stop(context);
            }
        }
Beispiel #5
0
        public override void OnCreate()
        {
            base.OnCreate();

            // Load data
            Config  = new Config(this);
            Assets  = new Assets(this);
            Service = new WebService();

#if DEBUG
            // Force load lines
            Lines.First(l => l.Number == 1).Loaded.WaitOne();
            Lines.First(l => l.Number == 2).Loaded.WaitOne();

            // Enable experimental features on debug builds
            Config.ExperimentalFeatures = true;
            Config.EnableWidgetRefresh  = true;
            Config.OfflineMode          = true;

            // Setup some favorites

            /*Config.FavoriteStops.Clear();
             * Config.FavoriteStops.Add(Lines.First(l => l.Number == 1).Stops.First(s => s.Name == "Odysseum"));
             * Config.FavoriteStops.Add(Lines.First(l => l.Number == 2).Stops.First(s => s.Name == "Saint-Lazare"));
             * Config.FavoriteStops.Add(Lines.First(l => l.Number == 2).Stops.First(s => s.Name == "Gare Saint-Roch"));*/
#endif

            // Trigger widgets update
            AppWidgetManager appWidgetManager = AppWidgetManager.GetInstance(this);
            StepWidget.Update(this, appWidgetManager);

            if (Config.EnableWidgetRefresh)
            {
                WidgetUpdateService.Start(this);
            }
        }