コード例 #1
0
ファイル: MainActivity.cs プロジェクト: tamifist/KinderChat
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            adapter = new MyPagerAdapter(this, SupportFragmentManager);
            pager   = FindViewById <ViewPager>(Resource.Id.pager);
            tabs    = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
            tabs.SetBackgroundResource(Settings.AppTheme == AppTheme.Red ? Resource.Drawable.red_gradient : Resource.Drawable.blue_gradient);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);
            tabs.OnPageChangeListener = this;
            var pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);

            pager.PageMargin         = pageMargin;
            pager.OffscreenPageLimit = 4;
            if (Settings.FirstRun)
            {
                pager.CurrentItem = 2;
                App.MessageDialog.SendMessage(Resources.GetString(Resource.String.get_started_welcome),
                                              Resources.GetString(Resource.String.welcome_to_kinderchat));
            }
            else
            {
                pager.CurrentItem = 0;
            }

            //IntentFilter connectivityIntentFilter = new IntentFilter();
            //connectivityIntentFilter.AddAction(Android.Net.ConnectivityManager.ConnectivityAction);
            //RegisterReceiver(new NetworkChangeReceiver(), connectivityIntentFilter);

            // Register for GCM
            KinderGcmService.Register(this);

            App.ConnectionManager.TryKeepConnectionAsync();
        }