protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            ActionBar.Tab mytab = ActionBar.NewTab();
            mytab.SetText(Resource.String.tab1_text);
            mytab.SetIcon(Resource.Drawable.images);
            mytab.TabSelected += Mytab_TabSelected;
            ActionBar.AddTab(mytab);

            mytab = ActionBar.NewTab();
            mytab.SetText(Resource.String.tab2_text);
            mytab.SetIcon(Resource.Drawable.download);
            mytab.TabReselected += Mytab_TabReselected;
            ActionBar.AddTab(mytab);
        }
示例#2
0
#pragma warning disable 618 // This may need to be updated to work with TabLayout/AppCompat
        ActionBar.Tab AddTab(Page page, int index)
#pragma warning restore 618
        {
            ActionBar  actionBar   = ((Activity)_context).ActionBar;
            TabbedPage currentTabs = CurrentTabbedPage;

            var atab = actionBar.NewTab();

            atab.SetText(page.Title);
            atab.TabSelected += (sender, e) =>
            {
                if (!_ignoreAndroidSelection)
                {
                    currentTabs.CurrentPage = page;
                }
            };
            actionBar.AddTab(atab, index);

            page.PropertyChanged += PagePropertyChanged;
            return(atab);
        }
示例#3
0
        void AddTab(string tabText, int iconResourceId, Fragment view)
        {
            var tab = ActionBar.NewTab();

            tab.SetText(tabText);
            //tab.SetIcon(iconResourceId);

            // must set event handler before adding tab
            tab.TabSelected += (sender, e) =>
            {
                var fragment = FragmentManager.FindFragmentById(Resource.Id.fragmentContainer);
                if (fragment != null)
                {
                    e.FragmentTransaction.Remove(fragment);
                }
                e.FragmentTransaction.Add(Resource.Id.fragmentContainer, view);
            };
            tab.TabUnselected += (sender, e) => e.FragmentTransaction.Remove(view);

            ActionBar.AddTab(tab);
        }
示例#4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            this.SetContentView(Resource.Layout.ThreeView);

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            ActionBar.Tab tab = ActionBar.NewTab();
            tab.SetText(Resources.GetString(Resource.String.Home));
            tab.SetIcon(Resource.Drawable.Icon);
            tab.SetTabListener(new TabListener <HomeFragment>(this, "Home"));
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText(Resources.GetString(Resource.String.Games));
            tab.SetIcon(Resource.Drawable.Icon);
            tab.SetTabListener(new TabListener <GamesFragment>(this, "Games"));

            ActionBar.AddTab(tab);
        }
        private void AddTab(string text, int resourceIconId, Fragment view)
        {
            var tab = ActionBar.NewTab();

            tab.SetText(text);
            tab.SetIcon(resourceIconId);

            tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                var fragment = FragmentManager.FindFragmentById(Resource.Id.fragmentContainer);
                if (fragment != null)
                {
                    e.FragmentTransaction.Remove(fragment);
                }
                e.FragmentTransaction.Add(Resource.Id.fragmentContainer, view);
            };
            tab.TabUnselected += delegate(object sender, ActionBar.TabEventArgs e) {
                e.FragmentTransaction.Remove(view);
            };
            ActionBar.AddTab(tab);
        }
示例#6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (savedInstanceState != null && savedInstanceState.GetInt("theme", -1) != -1)
            {
                mThemeId = savedInstanceState.GetInt("theme");
                this.SetTheme(mThemeId);
            }

            SetContentView(Resource.Layout.main);

            Directory.InitializeDirectory();

            ActionBar bar = ActionBar;

            int i;

            for (i = 0; i < Directory.CategoryCount; i++)
            {
                bar.AddTab(bar.NewTab().SetText(Directory.GetCategory(i).Name)
                           .SetTabListener(this));
            }

            mActionBarView = LayoutInflater.Inflate(
                Resource.Layout.action_bar_custom, null);

            bar.CustomView     = mActionBarView;
            bar.DisplayOptions = ActionBarDisplayOptions.ShowCustom | ActionBarDisplayOptions.UseLogo;
            bar.NavigationMode = ActionBarNavigationMode.Standard;
            bar.SetDisplayShowHomeEnabled(true);

            // If category is not saved to the savedInstanceState,
            // 0 is returned by default.
            if (savedInstanceState != null)
            {
                int category = savedInstanceState.GetInt("category");
                bar.SelectTab(bar.GetTabAt(category));
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.Tab tab = ActionBar.NewTab();
            tab.SetText(Resources.GetString(Resource.String.setting_tab_name));
            tab.SetIcon(Android.Resource.Drawable.IcMenuPreferences);
            tab.TabSelected += (sender, args) => {
                // Do something when tab is selected
            };
            this.ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText(Resources.GetString(Resource.String.company_tab_name));
            tab.SetIcon(Android.Resource.Drawable.IcMenuSave);
            tab.TabSelected += (sender, args) => {
                // Do something when tab is selected
            };
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText(Resources.GetString(Resource.String.order_tab_name));
            tab.SetIcon(Android.Resource.Drawable.IcMenuSearch);
            tab.TabSelected += (sender, args) => {
                // Do something when tab is selected
            };
            ActionBar.AddTab(tab);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format("{0} clicks!", count++);
            };
        }
示例#8
0
        private void SetupTabs(SqliteConnection conn, Model.ModelLifeCounter model)
        {
            ActionBar.Tab tab = ActionBar.NewTab();
            tab.SetText("Life");

            tab.TabSelected += (sender, args) =>
            {
                conn.UpdateLifeCounter(Translate(mainActivityModel));
                SetContentView(Resource.Layout.LifeCounter);
                model = conn.GetLatestEntry();
                SetupLifeMainView(Translate(model));
            };
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("Poison");

            tab.TabSelected += (sender, args) =>
            {
                conn.UpdateLifeCounter(Translate(mainActivityModel));
                SetContentView(Resource.Layout.layPoison);
                model = conn.GetLatestEntry();
                SetupLifeMainView(Translate(model));
            };
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();

            tab.SetText("Commander");

            tab.TabSelected += (sender, args) =>
            {
                conn.UpdateLifeCounter(Translate(mainActivityModel));
                SetContentView(Resource.Layout.layCommander);
                model = conn.GetLatestEntry();
                SetupLifeMainView(Translate(model));
            };
            ActionBar.AddTab(tab);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; // create an Action bar
            SetContentView(Resource.Layout.TabLayout_Layout);        // set out layout

            ActionBar.Tab t1 = ActionBar.NewTab();
            t1.SetText("One");
            t1.TabSelected += T1_TabSelected;
            ActionBar.AddTab(t1);

            ActionBar.Tab t2 = ActionBar.NewTab();
            t2.SetText("Two");
            t2.TabSelected += T2_TabSelected;
            ActionBar.AddTab(t2);

            ActionBar.Tab t3 = ActionBar.NewTab();
            t3.SetText("Three");
            t3.TabSelected += T3_TabSelected;
            ActionBar.AddTab(t3);
        }
示例#10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            firstCreate = true;
            handler     = new Handler();
            prefs       = new PreferenceManager(this);

            circlesFragment = new CirclesFragment();
            statsFragment   = new StatsFragment();

            SetContentView(Resource.Layout.Main);

            pager         = FindViewById <Android.Support.V4.View.ViewPager> (Resource.Id.mainPager);
            pager.Adapter = new StaticFragmentPagerAdapter(SupportFragmentManager, circlesFragment, statsFragment);

            background = new DynamicGradientDrawable(Resources.GetColor(Resource.Color.top_shade_1),
                                                     Resources.GetColor(Resource.Color.bottom_shade_1),
                                                     Resources.GetColor(Resource.Color.top_shade_2),
                                                     Resources.GetColor(Resource.Color.bottom_shade_2));
            pager.SetBackgroundDrawable(background);
            pager.PageScrolled  += HandlePageScrolled;
            pager.OverScrollMode = OverScrollMode.Never;
            if (prefs.FirstTimeAround)
            {
                pager.Touch += DiscardTouchEventHandler;
            }

            circlesTab              = ActionBar.NewTab().SetIcon(Resource.Drawable.ic_tab_circles);
            statsTab                = ActionBar.NewTab().SetIcon(Resource.Drawable.ic_tab_stats);
            circlesTab.TabSelected += (sender, e) => pager.SetCurrentItem(0, true);
            statsTab.TabSelected   += (sender, e) => pager.SetCurrentItem(1, true);
            ActionBar.AddTab(circlesTab);
            ActionBar.AddTab(statsTab);
            pager.PageSelected += (sender, e) => ActionBar.SetSelectedNavigationItem(e.Position);

            circlesFragment.CirclesReady += OnCirclesReady;
        }
示例#11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.tablayout);
            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.SetDisplayShowTitleEnabled(false);
            ActionBar.Tab tab = ActionBar.NewTab();
            tab.SetText("PieChart Stolen Brands");
            tab.SetIcon(Resource.Drawable.piefix);
            tab.TabSelected += (sender, args) =>
            {
                SetContentView(Resource.Layout.barChart);
                PlotView       view     = FindViewById <PlotView>(Resource.Id.plot_view_bar);
                CreatePieChart barchart = new CreatePieChart();
                view.Model = barchart.CreatePlotModel();
            };
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("Favorite Stolen Bike Colors");
            tab.SetIcon(Resource.Drawable.piefix);
            tab.TabSelected += (sender, args) =>
            {
                SetContentView(Resource.Layout.barChart);
                PlotView        view     = FindViewById <PlotView>(Resource.Id.plot_view_bar);
                CreatePieChart2 pieChart = new CreatePieChart2();
                view.Model = pieChart.CreatePlotModel();
            };
            ActionBar.AddTab(tab);
            tab = ActionBar.NewTab();
            tab.SetText("List for piecharts");
            tab.TabSelected += (sender, args) =>
            {
                var intent = new Intent(this, typeof(pielist));
                StartActivity(intent);
            };
            ActionBar.AddTab(tab);
        }
示例#12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            SetContentView(Resource.Layout.ReportsView);

            ActionBar.Tab tab = ActionBar.NewTab();
            tab.SetText("Wydatki");

            tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                e.FragmentTransaction.Replace(Resource.Id.showHost,
                                              new ShowExpensesFragment());
            };

            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("Przychody");

            tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                e.FragmentTransaction.Replace(Resource.Id.showHost,
                                              new ShowIncomesFragment());
            };

            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("Raport");

            tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                e.FragmentTransaction.Replace(Resource.Id.showHost,
                                              new ShowReportFragment());
            };
            ActionBar.AddTab(tab);
        }
        private void SetTabs()
        {
            var pager = FindViewById <Android.Support.V4.View.ViewPager>(Resource.Id.pager);

            pager.AddOnPageChangeListener(new ViewPageListenerForActionBar(ActionBar));

            // Create tabs on top to navigate
            ActionBar.AddTab(pager.GetViewPageTab(ActionBar, "Dashboard", Resource.Drawable.dashboard));
            ActionBar.AddTab(pager.GetViewPageTab(ActionBar, "New", Resource.Drawable.Grey));
            ActionBar.AddTab(pager.GetViewPageTab(ActionBar, "In Progress", Resource.Drawable.Yellow));
            ActionBar.AddTab(pager.GetViewPageTab(ActionBar, "Done", Resource.Drawable.Green));

            // Add Tab Fragments
            var adaptor = new GenericFragmentPagerAdaptor(SupportFragmentManager);

            adaptor.AddFragment(new DashboardTasksFragment(this.TargetId));
            adaptor.AddFragment(new ToDoTasksFragment(this.TargetId));
            adaptor.AddFragment(new InProgressTasksFragment(this.TargetId));
            adaptor.AddFragment(new DoneTasksFragment(this.TargetId));

            // Set adapter
            pager.Adapter = adaptor;
        }
示例#14
0
        private void AddTab(string tabTitle, Fragment fragment)
        {
            var tab = ActionBar.NewTab();

            tab.SetText(tabTitle);

            tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                var previousFragment = FragmentManager.FindFragmentById(Resource.Id.newsListFragmentContainer);
                if (previousFragment != null)
                {
                    e.FragmentTransaction.Remove(previousFragment);
                }
                e.FragmentTransaction.Add(Resource.Id.newsListFragmentContainer, fragment);
            };

            tab.TabUnselected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                e.FragmentTransaction.Remove(fragment);
            };

            ActionBar.AddTab(tab);
        }
示例#15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            activity = this;

            /*Creation of tabs.*/

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.Tab tab = ActionBar.NewTab();

            //Tab for list of cigarettes.
            tab.SetText(Resource.String.tab_ListCigarettes);
            tab.TabSelected += Tab_TabSelectedList;
            ActionBar.AddTab(tab);

            //Tab for cigarettes calendar.
            tab = ActionBar.NewTab();
            tab.SetText(Resource.String.tab_CalendarCigarettes);
            tab.TabSelected += Tab_TabSelectedCalendar;
            ActionBar.AddTab(tab);

            //Going to selected tab.
            SetContentView(Resource.Layout.helpform_CigarettesConnector);
        }
示例#16
0
        private void InitializeTabs(Bundle savedInstanceState)
        {
            var summaryTab = ActionBar.NewTab()
                             .SetText(Resource.String.Summary);

            var expensesTab = ActionBar.NewTab()
                              .SetText(Resource.String.Expenses);

            var scheduleTab = ActionBar.NewTab()
                              .SetText(Resource.String.Schedule);

            summaryTab.TabSelected  += OnSummaryTabSelected;
            expensesTab.TabSelected += OnExpensesTabSelected;
            scheduleTab.TabSelected += OnScheduleTabSelected;

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.AddTab(summaryTab);
            ActionBar.AddTab(expensesTab);
            ActionBar.AddTab(scheduleTab);

            int selectedTabIndex = Math.Max(0, Math.Min(ActionBar.TabCount - 1, savedInstanceState?.GetInt(SelectedTabIndexKey) ?? 0));

            ActionBar.SelectTab(ActionBar.GetTabAt(selectedTabIndex));
        }
示例#17
0
        private void AddTab(string tabText, int iconResourceId, Fragment view)
        {
            var tab = ActionBar.NewTab();

            tab.SetText(tabText);
            tab.SetIcon(iconResourceId);

            tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                // Check for existing Fragment in the container.
                var fragment = FragmentManager.FindFragmentById(Resource.Id.fragmentContainer);
                // Remove the existing Fragment if it exists.
                if (fragment != null)
                {
                    e.FragmentTransaction.Remove(fragment);
                }
                // Add the Fragment that should be added.
                e.FragmentTransaction.Add(Resource.Id.fragmentContainer, view);
            };

            tab.TabUnselected += (sender, e) => e.FragmentTransaction.Remove(view);

            ActionBar.AddTab(tab);
        }
示例#18
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            m_Pager         = FindViewById <ViewPager>(Resource.Id.pager);
            m_Adapter       = new MainPagerAdapter(SupportFragmentManager);
            m_Pager.Adapter = m_Adapter;

#if __ANDROID_11__
            m_Pager.SetOnPageChangeListener(this);
            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            var tab = ActionBar.NewTab();
            tab.SetText("1");
            tab.SetTabListener(this);

            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("2");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("3");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("4");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab);
#endif
        }
示例#19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            activity = this;

            /*Creation of tabs.*/

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.Tab tab = ActionBar.NewTab();

            //Tab for ProtsFatsCarbs.
            tab.SetText(Resource.String.tab_ProtsFatsCarbs);
            tab.TabSelected += Tab_TabSelectedProtsFatsCarbs;
            ActionBar.AddTab(tab);

            //Tab for WaterCcals.
            tab = ActionBar.NewTab();
            tab.SetText(Resource.String.tab_WaterCcals);
            tab.TabSelected += Tab_TabSelectedWaterCcals;
            ActionBar.AddTab(tab);

            //Going to selected tab.
            SetContentView(Resource.Layout.helpform_ParametersConnector);
        }
示例#20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            SetContentView(Resource.Layout.MainInterface);

            //Create tabs for the interface:
            ActionBar.Tab tab1 = ActionBar.NewTab();
            tab1.SetText(Resources.GetString(Resource.String.tab_1));
            tab1.TabSelected += (sender, args) => {
                //textLocation = FindViewById<TextView> (Resource.Id.textAddress);
                //textLocation.Text = "You are NOWHERE!!!!! YOU DON'T EXIST!";
            };

            ActionBar.AddTab(tab1);

            ActionBar.Tab tab2 = ActionBar.NewTab();
            tab2.SetText(Resources.GetString(Resource.String.tab_2));
            tab2.TabSelected += (sender, args) => {
            };

            ActionBar.AddTab(tab2);
        }
示例#21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            activity = this;

            /*Creation of tabs.*/

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.Tab tab = ActionBar.NewTab();

            //Tab for ñcals.
            tab.SetText(Resource.String.tab_ListAlcohol);
            tab.TabSelected += Tab_TabSelectedListAlcohol;
            ActionBar.AddTab(tab);

            //Tab for alcohol calendar.
            tab = ActionBar.NewTab();
            tab.SetText(Resource.String.tab_CalendarAlcohol);
            tab.TabSelected += Tab_TabSelectedCalendarAlcohol;
            ActionBar.AddTab(tab);

            //Going to selected tab.
            SetContentView(Resource.Layout.helpform_ParametersConnector);
        }
        private void AddTab(string tituloTab, Fragment fragmento)
        {
            var tab = ActionBar.NewTab();

            tab.SetText(tituloTab);

            tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                var fragmentoAnterior = FragmentManager.FindFragmentById(Resource.Id.listaDeNoticiaFragmentContainer);

                if (fragmentoAnterior != null)
                {
                    e.FragmentTransaction.Remove(fragmentoAnterior);
                }
                e.FragmentTransaction.Add(Resource.Id.listaDeNoticiaFragmentContainer, fragmento);
            };

            tab.TabUnselected += delegate(object sender, ActionBar.TabEventArgs e)
            {
                e.FragmentTransaction.Remove(fragmento);
            };

            ActionBar.AddTab(tab);
        }
示例#23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            var tab = ActionBar.NewTab().SetText("View");

            tab.TabSelected += (_, e) => {
                if (viewFragment == null)
                {
                    viewFragment = Fragment.Instantiate(this,
                                                        Class.FromType(typeof(ViewAnimationFragment)).Name);
                    e.FragmentTransaction.Add(Android.Resource.Id.Content, viewFragment, "view-tab");
                }
                else
                {
                    e.FragmentTransaction.Attach(viewFragment);
                }
            };
            tab.TabUnselected += (_, e) => {
                if (viewFragment != null)
                {
                    e.FragmentTransaction.Detach(viewFragment);
                }
            };
            ActionBar.AddTab(tab);

            tab              = ActionBar.NewTab().SetText("Property");
            tab.TabSelected += (_, e) => {
                if (propertyFragment == null)
                {
                    propertyFragment = Fragment.Instantiate(this,
                                                            Class.FromType(typeof(PropertyAnimationFragment)).Name);
                    e.FragmentTransaction.Add(Android.Resource.Id.Content, propertyFragment, "property-tab");
                }
                else
                {
                    e.FragmentTransaction.Attach(propertyFragment);
                }
            };
            tab.TabUnselected += (_, e) => {
                if (propertyFragment != null)
                {
                    e.FragmentTransaction.Detach(propertyFragment);
                }
            };
            ActionBar.AddTab(tab);

            tab              = ActionBar.NewTab().SetText("Layout");
            tab.TabSelected += (_, e) => {
                if (layoutFragment == null)
                {
                    layoutFragment = Fragment.Instantiate(this,
                                                          Class.FromType(typeof(LayoutAnimationFragment)).Name);
                    e.FragmentTransaction.Add(Android.Resource.Id.Content, layoutFragment, "layout-tab");
                }
                else
                {
                    e.FragmentTransaction.Attach(layoutFragment);
                }
            };
            tab.TabUnselected += (_, e) => {
                if (layoutFragment != null)
                {
                    e.FragmentTransaction.Detach(layoutFragment);
                }
            };
            ActionBar.AddTab(tab);
        }
示例#24
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            /*CNP.RequestReceived += (sender, e) =>
             * {
             *  using (var ewh = new EventWaitHandle(false, EventResetMode.ManualReset))
             *  {
             *      var go = false;
             *      RunOnUiThread(() =>
             *      {
             *          try
             *          {
             *              var b = new AlertDialog.Builder(BaseContext);
             *              b.SetCancelable(true);
             *              b.SetIcon(Resource.Drawable.Icon);
             *              b.SetMessage($"{e.Address} has sent you a contact request, would you like to accept? The connection PIN is {e.PIN}.");
             *              b.SetTitle("Incoming Contact Request");
             *              b.SetPositiveButton("Yes", (_sender, _e) =>
             *              {
             *                  go = true;
             *                  ewh.Set();
             *                  var _b = new Bundle(1);
             *                  _b.PutByteArray("address", e.Address.Serialize());
             *                  StartActivity(typeof(AddContactActivity));
             *              });
             *              b.SetNegativeButton("No", (_sender, _e) => ewh.Set());
             *              b.Create().Show();
             *          }
             *          catch (Exception ex)
             *          {
             *              Log.RecordEvent(this, $"handler failed with message {ex.Message}", LogEntrySeverity.Error);
             *          }
             *      });
             *      ewh.WaitOne();
             *      if (go)
             *          e.Accept();
             *  }
             * };*/
            CNP.RequestReceived     += (sender, e) => e.Accept();
            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            a = new ContactAdapter(Configuration.Contacts);
            var list = new ListView(BaseContext)
            {
                Adapter = a
            };

            SetContentView(list);
            var all = ActionBar.NewTab();

            all.SetText("All");
            all.TabSelected   += All_TabSelected;
            all.TabReselected += All_TabSelected;
            ActionBar.AddTab(all);
            var online = ActionBar.NewTab();

            online.SetText("Online");
            online.TabSelected   += All_TabSelected;
            online.TabReselected += All_TabSelected;
            ActionBar.AddTab(online);
            var recent = ActionBar.NewTab();

            recent.SetText("Recent");
            recent.TabSelected   += Recent_TabSelected;
            recent.TabReselected += Recent_TabSelected;
            ActionBar.AddTab(recent);
            ActionBar.SetLogo(Resource.Drawable.Icon);
        }
示例#25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            SetContentView(Resource.Layout.Main);

            ActionBar.Tab tabSettings = ActionBar.NewTab();
            ActionBar.Tab tabCalendar = ActionBar.NewTab();
            ActionBar.Tab tabSchedule = ActionBar.NewTab();
            ActionBar.Tab tabEdit     = ActionBar.NewTab();

            tabSettings.SetText("Settings");
            //tab.SetIcon(Resource.Drawable.settingssmall);
            tabSettings.TabSelected += (sender, args) => {
                SetContentView(Resource.Layout.Settings);

                Button   btn_ok;
                EditText text_name;
                EditText text_second_name;
                EditText text_middle_name;
                EditText text_group;

                btn_ok           = FindViewById <Button> (Resource.Id.buttonOk);
                text_name        = FindViewById <EditText> (Resource.Id.editTextName);
                text_second_name = FindViewById <EditText> (Resource.Id.editTextSecondName);
                text_middle_name = FindViewById <EditText> (Resource.Id.editTextMiddleName);
                text_group       = FindViewById <EditText> (Resource.Id.editTextGroup);

                btn_ok.Click += delegate {
                    var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                    var filePath      = System.IO.Path.Combine(documentsPath, "private.txt");

                    System.IO.File.WriteAllText(filePath, text_name.Text + "\n" + text_second_name.Text + "\n" + text_middle_name.Text + "\n" + text_group.Text);

                    data = new PersonalData(text_name.Text, text_second_name.Text, text_middle_name.Text, text_group.Text);

                    stream_schedule = new List <ApiInteractionMember> ();

                    tabSchedule.Select();
                };
            };

            ActionBar.AddTab(tabSettings);

            tabCalendar.SetText("Calendar");
            //tab.SetIcon(Resource.Drawable.calendarsmall);
            tabCalendar.TabSelected += (sender, args) => {
                SetContentView(Resource.Layout.Calendar);

                CalendarView calendar = FindViewById <CalendarView> (Resource.Id.calendarView1);

                calendar.DateChange += (object sender_calendar, CalendarView.DateChangeEventArgs e_calendar) =>
                {
                    var day_of_month = e_calendar.DayOfMonth;
                    var current_day  = DateTime.Now.Day;

                    var month         = e_calendar.Month;
                    var current_month = DateTime.Now.Month;

                    addedDays   = day_of_month - current_day;
                    addedMonths = month - current_month;

                    tabSchedule.Select();
                };
            };

            ActionBar.AddTab(tabCalendar);

            tabSchedule.SetText("My Schedule");
            //tab.SetIcon(Resource.Drawable.thirdsmall);
            tabSchedule.TabSelected += (sender, args) => {
                data = getPersonalData();

                SetContentView(Resource.Layout.Schedule);

                ListView listView;

                listView = FindViewById <ListView> (Resource.Id.listView1);

                DateTime current_date = DateTime.Now.AddDays(addedDays);
                string   date         = current_date.Year.ToString() + ".";

                if (current_date.Month.ToString().Length == 1)
                {
                    date += "0" + current_date.Month.ToString() + ".";
                }
                else
                {
                    date += current_date.Month.ToString() + ".";
                }

                if (current_date.Day.ToString().Length == 1)
                {
                    date += "0" + current_date.Day.ToString("");
                }
                else
                {
                    date += current_date.Day.ToString();
                }

                if (stream_schedule.Count == 0)
                {
                    ApiInteraction api = new ApiInteraction(this.Assets);

                    var full_schedule = api.GetListOfApiMembers();

                    foreach (var item in full_schedule)
                    {
                        if (item.subGroup != null && item.subGroup.Contains(data.GetGroup()))
                        {
                            stream_schedule.Add(item);
                        }
                        else if (item.stream != null && item.stream.Contains(data.GetGroup()))
                        {
                            stream_schedule.Add(item);
                        }
                    }
                }

                today_schedule_for_list = new List <string>();
                today_schedule          = new List <ApiInteractionMember>();

                foreach (var item in stream_schedule)
                {
                    if (item.date == date)
                    {
                        today_schedule_for_list.Add(item.beginLesson + "-" + item.endLesson + " " + item.discipline + " " + item.auditorium);
                        today_schedule.Add(item);
                    }
                }

                foreach (var item in added_events)
                {
                    if (item.date == date)
                    {
                        today_schedule_for_list.Add(item.beginLesson + " " + item.discipline);
                        today_schedule.Add(item);
                    }
                }

                today_schedule = today_schedule.OrderBy(o => o.beginLesson).ToList();
                today_schedule_for_list.Sort();


                string[] items = today_schedule_for_list.ToArray();

                listView.Adapter = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleListItem1, items);

                listView.ItemClick += (object senderlist, ListView.ItemClickEventArgs e_list) =>
                {
                    string message = "";

                    if (today_schedule[e_list.Position].auditorium != null)
                    {
                        message += "Auditorium: " + today_schedule[e_list.Position].auditorium;
                    }
                    if (today_schedule[e_list.Position].beginLesson != null)
                    {
                        message += "\n\nBegin Lesson: " + today_schedule[e_list.Position].beginLesson;
                    }
                    if (today_schedule[e_list.Position].endLesson != null)
                    {
                        message += "\n\nEnd Lesson: " + today_schedule[e_list.Position].endLesson;
                    }
                    if (today_schedule[e_list.Position].discipline != null)
                    {
                        message += "\n\nDiscipline: " + today_schedule[e_list.Position].discipline;
                    }
                    if (today_schedule[e_list.Position].lecturer != null)
                    {
                        message += "\n\nLecturer: " + today_schedule[e_list.Position].lecturer;
                    }
                    if (today_schedule[e_list.Position].kindOfWork != null)
                    {
                        message += "\n\nKind Of Work: " + today_schedule[e_list.Position].kindOfWork;
                    }
                    if (today_schedule[e_list.Position].building != null)
                    {
                        message += "\n\nBuilding: " + today_schedule[e_list.Position].building;
                    }
                    if (today_schedule[e_list.Position].dayOfWeekString != null)
                    {
                        message += "\n\nDay Of Week: " + today_schedule[e_list.Position].dayOfWeekString;
                    }
                    if (today_schedule[e_list.Position].group != null)
                    {
                        message += "\n\nGroup: " + today_schedule[e_list.Position].group;
                    }
                    if (today_schedule[e_list.Position].subGroup != null)
                    {
                        message += "\n\nSubgroup: " + today_schedule[e_list.Position].subGroup;
                    }
                    if (today_schedule[e_list.Position].stream != null)
                    {
                        message += "\n\nStream: " + today_schedule[e_list.Position].stream;
                    }

                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.SetTitle("Schedule");
                    builder.SetMessage(message);
                    builder.SetPositiveButton("Ok", (sender1, args1) => {
                        builder.Dispose();
                    });

                    builder.SetNegativeButton("Delete this item", (sender1, args1) => {
                        int index = e_list.Position;
                        //today_schedule.RemoveAt(index);
                        var item_need_to_delete = today_schedule[index];

                        bool isFound = false;
                        int i        = 0;
                        while (!isFound && i < added_events.Count)
                        {
                            if ((added_events[i].discipline == item_need_to_delete.discipline) && (added_events[i].beginLesson == item_need_to_delete.beginLesson) && (added_events[i].date == item_need_to_delete.date))
                            {
                                added_events.RemoveAt(i);

                                isFound = true;
                            }
                            else
                            {
                                i++;
                            }
                        }

                        i       = 0;
                        isFound = false;
                        while (!isFound && i < stream_schedule.Count)
                        {
                            if ((stream_schedule[i].discipline == item_need_to_delete.discipline) && (stream_schedule[i].beginLesson == item_need_to_delete.beginLesson) && (stream_schedule[i].endLesson == item_need_to_delete.endLesson) &&
                                (stream_schedule[i].date == item_need_to_delete.date))
                            {
                                stream_schedule.RemoveAt(i);

                                isFound = true;
                            }
                            else
                            {
                                i++;
                            }
                        }

                        tabSettings.Select();
                        tabSchedule.Select();
                    });

                    builder.Show();
                };

                TextView    textCurrentDay = FindViewById <TextView> (Resource.Id.textViewDate);
                ImageButton btn_prev;
                ImageButton btn_second;

                textCurrentDay.Text = DateTime.Now.AddDays(addedDays).ToString("yyyy-M-d dddd");

                btn_prev   = FindViewById <ImageButton> (Resource.Id.imageButtonPrev);
                btn_second = FindViewById <ImageButton> (Resource.Id.imageButtonSecond);

                btn_prev.Click += delegate {
                    addedDays -= 1;
                    tabSettings.Select();
                    tabSchedule.Select();
                };

                btn_second.Click += delegate {
                    addedDays += 1;
                    tabSettings.Select();
                    tabSchedule.Select();
                };
            };

            ActionBar.AddTab(tabSchedule);

            tabEdit.SetText("Edit Schedule");
            //tab.SetIcon(Resource.Drawable.editsmall);
            tabEdit.TabSelected += (sender, args) => {
                SetContentView(Resource.Layout.Edit);

                Button     btn_ok_add    = FindViewById <Button> (Resource.Id.buttonOkAdd);
                EditText   edit_text_add = FindViewById <EditText> (Resource.Id.editTextAdd);
                TimePicker time_picker   = FindViewById <TimePicker> (Resource.Id.timePicker1);
                time_picker.SetIs24HourView(Java.Lang.Boolean.True);

                btn_ok_add.Click += delegate {
                    var hour    = time_picker.CurrentHour;
                    var minutes = time_picker.CurrentMinute;

                    var text = edit_text_add.Text;

                    string time = "";

                    if (hour.ToString().Length == 1)
                    {
                        time += "0" + hour.ToString();
                    }
                    else
                    {
                        time += hour.ToString();
                    }

                    time += ":";

                    if (minutes.ToString().Length == 1)
                    {
                        time += "0" + minutes.ToString();
                    }
                    else
                    {
                        time += minutes.ToString();
                    }

                    DateTime current_date = DateTime.Now.AddDays(addedDays);
                    string   date         = current_date.Year.ToString() + ".";

                    if (current_date.Month.ToString().Length == 1)
                    {
                        date += "0" + current_date.Month.ToString() + ".";
                    }
                    else
                    {
                        date += current_date.Month.ToString() + ".";
                    }

                    if (current_date.Day.ToString().Length == 1)
                    {
                        date += "0" + current_date.Day.ToString("");
                    }
                    else
                    {
                        date += current_date.Day.ToString();
                    }
                    added_events.Add(new ApiInteractionMember("null", 0, time, "null", date, "null", 0, "null", text, "null", "null", 0, "null", "null", 0, "null", 0, "null", 0));

                    tabSchedule.Select();
                };
            };

            ActionBar.AddTab(tabEdit);

            // This event fires when the ServiceConnection lets the client (our App class) know that
            // the Service is connected. We use this event to start updating the UI with location
            // updates from the Service
            App.Current.LocationServiceConnected += (object sender, ServiceConnectedEventArgs e) => {
                //Log.Debug (logTag, "ServiceConnected Event Raised");
                // notifies us of location changes from the system
                App.Current.LocationService.LocationChanged += HandleLocationChanged;
                //notifies us of user changes to the location provider (ie the user disables or enables GPS)
                App.Current.LocationService.ProviderDisabled += HandleProviderDisabled;
                App.Current.LocationService.ProviderEnabled  += HandleProviderEnabled;
                // notifies us of the changing status of a provider (ie GPS no longer available)
                App.Current.LocationService.StatusChanged += HandleStatusChanged;
            };

            // Start the location service:
            App.StartLocationService();
        }
示例#26
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            string url = Intent.GetStringExtra("url");

            login(url);

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.Tab tab = ActionBar.NewTab();
            tab.SetText(Resources.GetString(Resource.String.All));

            //PRVI TAB*************************************************************************
            tab.TabSelected += (sender, args) =>
            {
                items = new List <BucketItem>();
                var relative = new RelativeLayout(this)
                {
                    LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                this.SetContentView(relative);

                //Kreiranje osnovnog scroll view-a
                var scrollView = new ScrollView(this)
                {
                    LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                relative.AddView(scrollView);

                //Kreiranje glavnog layouta (koji je dio scroll view-a)
                mainLayout = new LinearLayout(this)
                {
                    Orientation      = Orientation.Vertical,
                    LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                mainLayout.SetBackgroundColor(Color.WhiteSmoke);

                scrollView.AddView(mainLayout);

                // Dohvat podataka
                conn("http://ec2-34-249-76-120.eu-west-1.compute.amazonaws.com/api/items");
            };
            ActionBar.AddTab(tab);



            //DRUGI TAB*************************************************************************
            tab = ActionBar.NewTab();
            tab.SetText(Resources.GetString(Resource.String.Profile));
            tab.TabSelected += (sender, args) =>
            {
                items = new List <BucketItem>();
                var relative = new RelativeLayout(this)
                {
                    LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                this.SetContentView(relative);

                //Kreiranje osnovnog scroll view-a
                var scrollView = new ScrollView(this)
                {
                    LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                relative.AddView(scrollView);

                //Kreiranje glavnog layouta (koji je dio scroll view-a)
                mainLayout = new LinearLayout(this)
                {
                    Orientation      = Orientation.Vertical,
                    LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                mainLayout.SetBackgroundColor(Color.WhiteSmoke);

                scrollView.AddView(mainLayout);

                TextView imekorisnika = new TextView(this);
                LinearLayout.LayoutParams LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 120);
                imekorisnika.LayoutParameters = LayoutParameters;
                imekorisnika.Text             = user.imeprezime;
                imekorisnika.TextSize         = 25;
                imekorisnika.SetPadding(60, 10, 10, 10);
                imekorisnika.SetTextColor(Color.White);
                imekorisnika.SetBackgroundColor(Color.DarkGray);
                mainLayout.AddView(imekorisnika);


                // Dohvat podataka
                conn("http://ec2-34-249-76-120.eu-west-1.compute.amazonaws.com/api/items/" + user.id);
            };
            ActionBar.AddTab(tab);



            //TREĆI TAB*************************************************************************
            tab = ActionBar.NewTab();
            tab.SetText(Resources.GetString(Resource.String.Add));
            tab.TabSelected += (sender, args) =>
            {
                //Kreiranje osnovnog scroll view-a
                var scrollView = new ScrollView(this)
                {
                    LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                SetContentView(scrollView);

                //Kreiranje glavnog layouta (koji je dio scroll view-a)
                mainLayout = new LinearLayout(this)
                {
                    Orientation      = Orientation.Vertical,
                    LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                mainLayout.SetBackgroundColor(Color.White);
                mainLayout.SetPadding(30, 30, 30, 30);

                scrollView.AddView(mainLayout);

                EditText naziv = new EditText(this);
                naziv.Hint = "Naziv";
                mainLayout.AddView(naziv);

                pic = new ImageView(this);
                LinearLayout.LayoutParams LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                //LayoutParameters.SetMargins(30, 30, 30, 30);
                //pic.LayoutParameters = LayoutParameters;
                mainLayout.AddView(pic);

                Button picbutt = new Button(this);
                picbutt.Text = "Odaberi sliku";
                picbutt.SetPadding(20, 30, 20, 30);
                mainLayout.AddView(picbutt);

                picbutt.Click += delegate {
                    var imageIntent = new Intent();
                    imageIntent.SetType("image/*");
                    imageIntent.SetAction(Intent.ActionGetContent);
                    StartActivityForResult(
                        Intent.CreateChooser(imageIntent, "Select photo"), 0);
                };

                Spinner  spinner    = new Spinner(this);
                string[] kategorije = { "Travel", "Sport", "Education", "Fun", "Extreme", "Career", "Hobby", "Family", "Charity" };

                spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
                var adapter = ArrayAdapter.CreateFromResource(
                    this, Resource.Array.kategorija_array, Android.Resource.Layout.SimpleSpinnerItem);

                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                spinner.Adapter = adapter;

                mainLayout.AddView(spinner);

                EditText opis = new EditText(this);
                opis.Hint             = "Opis";
                LayoutParameters      = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                opis.InputType        = Android.Text.InputTypes.TextVariationLongMessage;
                opis.LayoutParameters = LayoutParameters;
                mainLayout.AddView(opis);

                Button spremi = new Button(this);
                spremi.SetPadding(20, 30, 20, 60);
                spremi.Text = "Spremi";
                mainLayout.AddView(spremi);

                //spremi.Click += (sender1, e) =>
                //{
                //    BucketItemModel bModel = new BucketItemModel();
                //    bModel.Ime = naziv.Text;
                //    bModel.KategorijaNaziv = kategorija;
                //    bModel.Opis = opis.Text;
                //    bModel.Ostvareno = false;
                //    bModel.Slika = slika;
                //};
            };
            ActionBar.AddTab(tab);
        }
示例#27
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);



            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            SetContentView(Resource.Layout.LocationsLayout);


            //Create tabs for the interface:
            ActionBar.Tab tab1 = ActionBar.NewTab();
            tab1.SetText(Resources.GetString(Resource.String.tab_1));
            tab1.TabSelected += (sender, args) => {
                SetContentView(Resource.Layout.LocationsLayout);
                //TextView textLocation =  FindViewById<TextView> (Resource.Id.textAddress);
                //textLocation.Text = "You are NOWHERE!? \n YOU DON'T EXIST!! \n HEATHEN!!! \n WITCH I TELL YOU, WITCH!";

                System.Console.WriteLine("Tab 1 is ticklish!");
            };

            ActionBar.AddTab(tab1);

            //ActionBar.Tab tab2 = ActionBar.NewTab();
            //tab2.SetText (Resources.GetString (Resource.String.tab_2));
            //tab2.TabSelected += (sender, args) => {

            //};

            //ActionBar.AddTab (tab2);

            ActionBar.Tab tab3 = ActionBar.NewTab();
            tab3.SetText(Resources.GetString(Resource.String.tab_3));
            tab3.TabSelected += (sender, args) => {
                //Set the view to the about layout:
                SetContentView(Resource.Layout.AboutLayout);
            };

            ActionBar.AddTab(tab3);

            //Begin button:
            Button beginButton = FindViewById <Button>(Resource.Id.buttonBegin);

            beginButton.Click += delegate(object sender, EventArgs e) {
                TextView location1 = FindViewById <TextView>(Resource.Id.textLocation1);
                TextView location2 = FindViewById <TextView>(Resource.Id.textLocation2);
                TextView location3 = FindViewById <TextView>(Resource.Id.textLocation3);
                TextView location4 = FindViewById <TextView>(Resource.Id.textLocation4);

                //System.Console.Out.WriteLine("<<<<<<<>>>>>>" + location1.Text);
                //System.Console.Out.WriteLine("<<<<<<<>>>>>>" + location2.Text);
                //System.Console.Out.WriteLine("<<<<<<<>>>>>>" + location3.Text);
                //System.Console.Out.WriteLine("<<<<<<<>>>>>>" + location4.Text);

                geocodeAddress(location1.Text);


                geocodeAddress(location2.Text);


                geocodeAddress(location3.Text);


                geocodeAddress(location4.Text);
            };


            //Start location:
            InitLocationManager();
        }
示例#28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Window.RequestFeature(WindowFeatures.ActionBar);
            SetContentView(Resource.Layout.action_bar_display_options);

            // Set up handlers for each of our buttons
            var home_as_up = FindViewById(Resource.Id.toggle_home_as_up);

            home_as_up.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.HomeAsUp); };

            var home_show_home = FindViewById(Resource.Id.toggle_show_home);

            home_show_home.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.ShowHome); };

            var home_use_logo = FindViewById(Resource.Id.toggle_use_logo);

            home_use_logo.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.UseLogo); };

            var home_show_title = FindViewById(Resource.Id.toggle_show_title);

            home_show_title.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.ShowTitle); };

            var home_show_custom = FindViewById(Resource.Id.toggle_show_custom);

            home_show_custom.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.ShowCustom); };

            var home_toggle_navigation = FindViewById(Resource.Id.toggle_navigation);

            home_toggle_navigation.Click += delegate {
                var mode = ActionBar.NavigationMode == ActionBarNavigationMode.Standard ? ActionBarNavigationMode.Tabs : ActionBarNavigationMode.Standard;
                ActionBar.NavigationMode = mode;
            };

            var cycle_gravity = FindViewById(Resource.Id.cycle_custom_gravity);

            cycle_gravity.Click += CycleGravity;

            var visibility = FindViewById(Resource.Id.toggle_visibility);

            visibility.Click += delegate {
                if (ActionBar.IsShowing)
                {
                    ActionBar.Hide();
                }
                else
                {
                    ActionBar.Show();
                }
            };

            var system_ui = FindViewById(Resource.Id.toggle_system_ui);

            system_ui.Click += delegate {
                if ((Window.DecorView.SystemUiVisibility & (StatusBarVisibility)SystemUiFlags.Fullscreen) != 0)
                {
                    Window.DecorView.SystemUiVisibility = 0;
                }
                else
                {
                    Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.Fullscreen;
                }
            };

            custom_view = LayoutInflater.Inflate(Resource.Layout.action_bar_display_options_custom, null);

            // Configure several action bar elements that will be toggled by display options.
            ActionBar.SetCustomView(custom_view, new ActionBar.LayoutParams(WindowManagerLayoutParams.WrapContent, WindowManagerLayoutParams.WrapContent));

            var tab1 = ActionBar.NewTab();

            tab1.SetText("Tab 1");
            tab1.SetTabListener(this);
            ActionBar.AddTab(tab1);

            var tab2 = ActionBar.NewTab();

            tab2.SetText("Tab 2");
            tab2.SetTabListener(this);
            ActionBar.AddTab(tab2);

            var tab3 = ActionBar.NewTab();

            tab3.SetText("Tab 3");
            tab3.SetTabListener(this);
            ActionBar.AddTab(tab3);
        }
示例#29
0
 void AddTabToActionBar(string text)
 {
     ActionBar.Tab tab = ActionBar.NewTab().SetText(text);
     tab.TabSelected += TabOnTabSelected;
     ActionBar.AddTab(tab);
 }
示例#30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.ActionBarDisplayOptions);

            // Set up handlers for each of our buttons
            var home_as_up = FindViewById(Resource.Id.toggle_home_as_up);

            home_as_up.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.HomeAsUp); };

            var home_show_home = FindViewById(Resource.Id.toggle_show_home);

            home_show_home.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.ShowHome); };

            var home_use_logo = FindViewById(Resource.Id.toggle_use_logo);

            home_use_logo.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.UseLogo); };

            var home_show_title = FindViewById(Resource.Id.toggle_show_title);

            home_show_title.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.ShowTitle); };

            var home_show_custom = FindViewById(Resource.Id.toggle_show_custom);

            home_show_custom.Click += delegate { AddActionBarFlag(ActionBarDisplayOptions.ShowCustom); };

            var home_toggle_navigation = FindViewById(Resource.Id.toggle_navigation);

            home_toggle_navigation.Click += delegate {
                var mode = ActionBar.NavigationMode == ActionBarNavigationMode.Standard ? ActionBarNavigationMode.Tabs : ActionBarNavigationMode.Standard;
                ActionBar.NavigationMode = mode;
            };

            var cycle_gravity = FindViewById(Resource.Id.cycle_custom_gravity);

            cycle_gravity.Click += CycleGravity;

            custom_view = LayoutInflater.Inflate(Resource.Layout.ActionBarDisplayOptionsCustom, null);

            // Configure several action bar elements that will be toggled by display options.
            ActionBar.SetCustomView(custom_view, new ActionBar.LayoutParams(WindowManagerLayoutParams.WrapContent, WindowManagerLayoutParams.WrapContent));

            var tab1 = ActionBar.NewTab();

            tab1.SetText("Tab 1");
            tab1.SetTabListener(this);
            ActionBar.AddTab(tab1);

            var tab2 = ActionBar.NewTab();

            tab2.SetText("Tab 2");
            tab2.SetTabListener(this);
            ActionBar.AddTab(tab2);

            var tab3 = ActionBar.NewTab();

            tab3.SetText("Tab 3");
            tab3.SetTabListener(this);
            ActionBar.AddTab(tab3);
        }