Exemplo n.º 1
0
        public override void Present(GlassService service)
        {
            base.Present(service);

            if (service.GetType() == typeof (StopwatchService))
            {
                if (_card == null)
                {
                    _card = new LiveCard(service, service.GetType().FullName);
                    _renderer = new ChronometerRenderer(service);
                    _card.SetDirectRenderingEnabled(true).SurfaceHolder.AddCallback(_renderer);

                    var mi = new Intent(service, typeof(MenuActivity));
                    var b = new Bundle();
                    b.PutInt("ResourceID", Resource.Menu.stopwatch);
                    mi.PutExtras(b);
                    mi.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);

                    _card.SetAction(PendingIntent.GetActivity(service, 0, mi, 0));
                    _card.Attach(service);

                    _card.Publish(LiveCard.PublishMode.Reveal);
                }
                else
                {
                    _card.Navigate();
                }
            }
        }
Exemplo n.º 2
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            if (_card == null)
            {
                _card = new LiveCard(this, "theCard");

                _view = new BasicView(this);

                _renderer = new LiveCardRenderer(this);
                _card.SetDirectRenderingEnabled(true).SurfaceHolder.AddCallback(_renderer);
                
                var mi = new Intent(this, typeof (MenuActivity));
                mi.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                _card.SetAction(PendingIntent.GetActivity(this, 0, mi, 0));
                _card.Attach(this);

                _card.Publish(LiveCard.PublishMode.Reveal);

                _renderer.start();
            }
            else
            {
                _card.Navigate();
            }

            return StartCommandResult.Sticky;
        }
Exemplo n.º 3
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            if (_card == null)
            {
                _card = new LiveCard(Application, "remoteviewservice");
                _remoteViews = new Android.Widget.RemoteViews(PackageName, Resource.Layout.MainLayout);
                _remoteViews.SetTextViewText(Resource.Id.LivecardContent, "HI From Remote View!");
                _card.SetViews(_remoteViews);

                var menuIntent = new Intent(this, typeof(MenuActivity));
                menuIntent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                _card.SetAction(PendingIntent.GetActivity(this, 0, menuIntent, 0));
                _card.Publish(LiveCard.PublishMode.Reveal);
            }

            return StartCommandResult.Sticky;

        }
Exemplo n.º 4
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            if (livecard == null)
            {
                livecard    = new LiveCard(Application, "beacon");
                remoteViews = new RemoteViews(PackageName, Resource.Layout.LiveCardBeacon);
                remoteViews.SetTextViewText(Resource.Id.LivecardContent, "Finding the monkey...");
                livecard.SetViews(remoteViews);

                // Set up the live card's action with a pending intent
                // to show a menu when tapped
                var menuIntent = new Intent(this, typeof(MenuActivity));
                menuIntent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                livecard.SetAction(PendingIntent.GetActivity(this, 0, menuIntent, 0));
                livecard.Publish(LiveCard.PublishMode.Reveal);
            }
            return(StartCommandResult.Sticky);
        }
Exemplo n.º 5
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            if (liveCard == null)
            {
                Log.Debug(TAG, "Publishing LiveCard");
                liveCard = timelineManager.CreateLiveCard(LIVE_CARD_ID);

                // Keep track of the callback to remove it before unpublishing.
                callback = new ChronometerDrawer(this);
                liveCard.SetDirectRenderingEnabled(true).SurfaceHolder.AddCallback(callback);

                Intent menuIntent = new Intent(this, typeof(MenuActivity));
                liveCard.SetAction(PendingIntent.GetActivity(this, 0, menuIntent, 0));

                liveCard.Publish(LiveCard.PublishMode.Reveal);
                Log.Debug(TAG, "Done publishing LiveCard");
            }
            else
            {
                // TODO(alainv): Jump to the LiveCard when API is available.
            }

            return(StartCommandResult.Sticky);
        }
Exemplo n.º 6
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            if (livecard == null)
            {
                livecard = new LiveCard (Application, "beacon");
                remoteViews = new RemoteViews (PackageName, Resource.Layout.LiveCardBeacon);
                remoteViews.SetTextViewText (Resource.Id.LivecardContent, "Finding the monkey...");
                livecard.SetViews (remoteViews);

                // Set up the live card's action with a pending intent
                // to show a menu when tapped
                var menuIntent = new Intent(this, typeof(MenuActivity));
                menuIntent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                livecard.SetAction(PendingIntent.GetActivity(this, 0, menuIntent, 0));
                livecard.Publish (LiveCard.PublishMode.Reveal);

            }
            return StartCommandResult.Sticky;
        }