Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //socket.Connect().Emit("new user", "Akomaister");

            base.OnCreate(savedInstanceState);

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

            var    house_name = Intent.GetStringExtra("House_name");
            string house_id   = Intent.GetStringExtra("House_id");


            var tabLayout = FindViewById <TabLayout>(Resource.Id.sliding_tabs);
            var pager     = FindViewById <ViewPager>(Resource.Id.pager);
            var toolbar   = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar1);
            var adapter   = new CustomPagerAdapter(this, SupportFragmentManager, house_name, house_id, socket);

            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar(toolbar);

            if (house_name == "" || house_name == null)
            {
                SupportActionBar.Title = "Id: " + house_id;
            }
            else
            {
                SupportActionBar.Title = house_name;
            }
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            toolbar.SetTitleTextAppearance(this, Resource.Style.ActionBarTitle);

            adapter.SetTabTitles("Devices", "Statistics");
            adapter.SetTabIcons(Resource.Drawable.selector_devices, Resource.Drawable.selector_statistics);

            pager.Adapter = adapter;
            pager.SetCurrentItem(1, true);
            // Setup tablayout with view pager

            tabLayout.SetupWithViewPager(pager);

            // Iterate over all tabs and set the custom view

            TabLayout.Tab tab1 = tabLayout.GetTabAt(0);
            tab1.SetCustomView(adapter.GetTabView(0));
            tabLayout.GetTabAt(0).Select();
            TabLayout.Tab tab2 = tabLayout.GetTabAt(1);
            tab2.SetCustomView(adapter.GetTabView(1));

            tabLayout.TabSelected += delegate
            {
                int pos = tabLayout.SelectedTabPosition;
                pager.SetCurrentItem(pos, true);
                adapter.StartThreads(pos);
                adapter.StopThreads((pos + 1) % 2);
            };
        }
Esempio n. 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view      = inflater.Inflate(Resource.Layout.Home, container, false);
            var  pager     = view.FindViewById <ViewPager>(Resource.Id.pager);
            var  tabLayout = view.FindViewById <TabLayout>(Resource.Id.tabs);
            var  adapter   = new CustomPagerAdapter(this.Context, Activity.SupportFragmentManager, new String[] { "My Shindigs", "My Hosted Events" }, 2);

            pager.Adapter = adapter;
            tabLayout.SetupWithViewPager(pager);
            for (int i = 0; i < tabLayout.TabCount; i++)
            {
                TabLayout.Tab tab = tabLayout.GetTabAt(i);
                tab.SetCustomView(adapter.GetTabView(i));
            }
            return(view);
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            CurrentPlatform.Init();

            byDateFilter   = false;
            byAuthorFilter = false;

            // Set our view from the "main" layout resource
            base.SetContentView(PlanYourJourney.Resource.Layout.Main);
            List = new List <Arrangement>();
            UpdateData();

            ISharedPreferences settings = GetSharedPreferences("MyPrefsFile", 0);

            MyUsername = settings.GetString("author", "");

            // Find views
            _pager     = FindViewById <ViewPager>(PlanYourJourney.Resource.Id.pager);
            _tabLayout = FindViewById <TabLayout>(PlanYourJourney.Resource.Id.sliding_tabs);
            _adapter   = new CustomPagerAdapter(this, SupportFragmentManager);
            _toolbar   = FindViewById <Toolbar>(PlanYourJourney.Resource.Id.my_toolbar);

            // Setup Toolbar
            SetSupportActionBar(_toolbar);
            base.SupportActionBar.Title = GetString(PlanYourJourney.Resource.String.app_name);

            // Set adapter to view pager
            _pager.Adapter = _adapter;

            // Setup tablayout with view pager
            _tabLayout.SetupWithViewPager(_pager);

            // Iterate over all tabs and set the custom view
            for (int i = 0; i < 3; i++)
            {
                TabLayout.Tab tab = _tabLayout.GetTabAt(i);
                tab.SetCustomView(_adapter.GetTabView(i));
            }
        }