Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Console.WriteLine("Is Amazon FireTV: " + Settings.IsFireTV());

            RequestWindowFeature(WindowFeatures.NoTitle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            textDate    = FindViewById <TextView> (Resource.Id.textViewDate);
            textTime    = FindViewById <TextView> (Resource.Id.textViewTime);
            gridView    = FindViewById <GridView> (Resource.Id.gridView);
            frameTopBar = FindViewById <FrameLayout> (Resource.Id.frameTopBar);
            wallpaper   = FindViewById <ImageView> (Resource.Id.imageWallpaper);

            StartService(new Intent(this, typeof(ExcuseMeService)));

            adapter = new AppsAdapter()
            {
                Context = this
            };

            gridViewTopPadding = gridView.PaddingTop;

            gridView.ItemClick += (sender, e) => {
                var app = adapter[e.Position];

                // If we're launching home, tell the service that checks
                // for intercepting this that it's ok
                if (app.PackageName == Settings.HOME_PACKAGE_NAME)
                {
                    ExcuseMeService.AllowFireTVHome = true;
                }

                if (app.PackageName == "APP_SETTINGS")
                {
                    StartActivity(typeof(SettingsActivity));
                    return;
                }

                StartActivity(app.LaunchIntent);

                if (app.PackageName == Android.Provider.Settings.ActionSettings)
                {
                    Toast.MakeText(this, "You may need to press 'UP' on your remote", ToastLength.Long).Show();
                }
            };

            gridView.Adapter = adapter;

            timerUpdate = new Timer(state => Setup(true), null, Timeout.Infinite, Timeout.Infinite);

            RegisterForContextMenu(gridView);
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Console.WriteLine("Is Amazon FireTV: " + Settings.IsFireTV());

            RequestWindowFeature(WindowFeatures.NoTitle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            textDate    = FindViewById <TextView> (Resource.Id.textViewDate);
            textTime    = FindViewById <TextView> (Resource.Id.textViewTime);
            imageLogo   = FindViewById <ImageView> (Resource.Id.imageViewLogo);
            dividerLine = FindViewById <View> (Resource.Id.dividerLine);

            imageLogo.SetImageResource(Resource.Drawable.firedtv);

            gridView = FindViewById <GridView> (Resource.Id.gridView);


            StartService(new Intent(this, typeof(ExcuseMeService)));

            adapter = new AppsAdapter()
            {
                Context = this
            };

            gridView.ItemClick += (sender, e) => {
                var app = adapter[e.Position];

                // If we're launching home, tell the service that checks
                // for intercepting this that it's ok
                if (app.PackageName == Settings.HOME_PACKAGE_NAME)
                {
                    ExcuseMeService.AllowFireTVHome = true;
                }

                StartActivity(app.LaunchIntent);
            };

            gridView.Adapter = adapter;

            timerUpdate = new Timer(state => Setup(), null, Timeout.Infinite, Timeout.Infinite);

            RegisterForContextMenu(gridView);
        }