Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.MainTab);
            Console.WriteLine("MainTabActivity");

            if (Globals.IsLoggedIn())
            {
                CreateTab(typeof(NewsGroupActivity), "news", "News", Resource.Drawable.news_state);
            }
            else
            {
                CreateTab(typeof(NewsActivity), "news", "News", Resource.Drawable.news_state);
            }
            CreateTab(typeof(PictureGroupActivity), "pictures", "Pictures", Resource.Drawable.pictures_state);
            CreateTab(typeof(VideoActivity), "video", "Video", Resource.Drawable.video_state);
            CreateTab(typeof(TodayLiveScoreActivity), "livescore", "LiveScore", Resource.Drawable.livescore_state);
            this.localWebView = FindViewById <ImageView> (Resource.Id.AdWebView);
            getAdView();


            TabHost.TabWidget.GetChildAt(0).Click += (object sender, EventArgs e) => {
                getAdView();
                isSelected(0);
                setColor(TabHost);
                TabHost.SetCurrentTabByTag("news");
            };

            TabHost.TabWidget.GetChildAt(1).Click += (object sender, EventArgs e) => {
                getAdView();
                isSelected(1);
                setColor(TabHost);
                TabHost.SetCurrentTabByTag("pictures");
            };

            TabHost.TabWidget.GetChildAt(2).Click += (object sender, EventArgs e) => {
                getAdView();
                isSelected(2);
                setColor(TabHost);
                TabHost.SetCurrentTabByTag("video");
            };

            TabHost.TabWidget.GetChildAt(3).Click += (object sender, EventArgs e) => {
                getAdView();
                isSelected(3);
                setColor(TabHost);
                TabHost.SetCurrentTabByTag("livescore");
            };

            localWebView.Click += (s, arg) => {
                var uri    = Android.Net.Uri.Parse(this.model.Impression);
                var intent = new Intent(Intent.ActionView, uri);
                StartActivity(intent);
            };
        }
Exemplo n.º 2
0
 public static string News()
 {
     if (Globals.IsLoggedIn())
     {
         return("http://www.sport.net/api/View/News/{0}/{1}?user="******"http://www.sport.net/api/View/News/{0}/{1}");
     }
 }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.NewsScreen);
            Console.WriteLine("NewsActivity");

            TextView title = FindViewById <TextView> (Resource.Id.ActionBarTitle);

            title.Visibility = ViewStates.Invisible;
            title.Text       = Intent.GetStringExtra("SportName") ?? "SportNet";


            ImageView logo = FindViewById <ImageView> (Resource.Id.ActionBarLogo);

            logo.Visibility = ViewStates.Visible;

            Button back = FindViewById <Button> (Resource.Id.ActionBarBack);

            back.Click += (sender, args) => {
                var parent = (NewsGroupActivity)Parent;
                parent.OnBackPressed();
                //Finish();
            };

            newsList = FindViewById <ListView>(Resource.Id.NewsList);
            menuList = FindViewById <ListView> (Resource.Id.MenuMenu);

            ImageButton menu = FindViewById <ImageButton> (Resource.Id.ActionBarMenu);

            if (Globals.IsLoggedIn())
            {
                menu.Visibility  = ViewStates.Invisible;
                back.Visibility  = ViewStates.Visible;
                logo.Visibility  = ViewStates.Invisible;
                title.Visibility = ViewStates.Visible;
            }
            else
            {
                menu.Visibility  = ViewStates.Visible;
                back.Visibility  = ViewStates.Invisible;
                logo.Visibility  = ViewStates.Visible;
                title.Visibility = ViewStates.Invisible;
            }

            this.returnMenu            = FindViewById <RelativeLayout> (Resource.Id.returnMenu);
            this.returnMenu.Visibility = ViewStates.Invisible;

            this.returnMenu.Click += (s, arg) => {
                RestoreMainViewObject();
            };


            //----------------------------------------------------------------------------------------------
            this.category = Intent.GetIntExtra("Category", 0);
            getData(this.category, 0, true, true);
            this.page = 1;
            //----------------------------------------------------------------------------------------------

            newsList.ItemClick += (s, arg) => {
                if (!_menuLeftOut)
                {
                    var    newsDetail = new Intent(this, typeof(NewsDetailActivity));
                    string url        = string.Format(RequestConfig.Article, model.News[arg.Position + 3].SmallId);
                    newsDetail.PutExtra("MyCategory", model.News[arg.Position + 3].Category);
                    newsDetail.PutExtra("MySource", url);
                    StartActivity(newsDetail);
                }
                else
                {
                    RestoreMainViewObject();
                }
            };

            menuList.ItemClick += (s, arg) => {
                getData(categories[arg.Position].Link, 0, true, true);
                this.category = categories[arg.Position].Link;
                this.page     = 1;
            };

            newsList.Scroll += (object sender, AbsListView.ScrollEventArgs e) => {
                Console.WriteLine("{0}....", newsList.FirstVisiblePosition);
                if (loader)
                {
                    return;
                }
                if (newsList.FirstVisiblePosition == this.pagingPosition)
                {
                    //load new data here
                    getPagedData(this.category, this.page);
                    this.page++;
                    this.pagingPosition += 25;
                }
            };

            _context = ApplicationContext;

            Globals.SetUserInfo(this);

            /*TextView menuName = FindViewById<TextView> (Resource.Id.MenuName);
             * menuName.Text = string.Format("{0} {1}",Globals.firstName ,Globals.lastName);
             *
             * ImageView menuImage = FindViewById<ImageView> (Resource.Id.menuImage);
             *
             * Button settings = FindViewById<Button> (Resource.Id.Settings);
             * settings.Click += delegate {
             *      var accSettings = new Intent (this, typeof(AccountSettingsActivity));
             *      StartActivity (accSettings);
             * };
             *
             *
             * if (!Globals.IsLoggedIn ()) {
             *      addContent.Visibility = ViewStates.Visible;
             *
             * } else {
             *      addContent.Visibility = ViewStates.Invisible;
             *
             * }*/

            Button addContent = FindViewById <Button> (Resource.Id.AddContent);

            addContent.Click += delegate {
                var customizingSelection = new Intent(this, typeof(CustomizingSelectionActivity));
                StartActivity(customizingSelection);
            };

            DefineGui();
        }