Ejemplo n.º 1
0
            /// <summary>
            /// Creates or updates a badge for a page
            /// </summary>
            /// <param name="page"></param>
            void CreateOrUpdateBadgeForPage (Page page) {
                    var pageIndex = Element.Children.IndexOf (page);
                    var badgeCount = BottomBarPageExtensions.GetBadgeCount (page);

                    BottomBarBadge badge;

                    // We'll have to keep track of our badges, otherwise we can't update
                    // and removing + inserting again gives a crappy user experience
                    if (_badges.ContainsKey (page)) {
                        badge = _badges[page];
                    } else {
                        // Don't need to create a badge when there's no badge to show
                        if (badgeCount == 0) return;

                        // BottomBarBadge does not allow us to set color after init. You could, but you'd have to
                        // do it manually because the circle background logic is hidden from us
                        var badgeColor = BottomBarPageExtensions.GetBadgeColor (page);
                        badge = _bottomBar.MakeBadgeForTabAt (pageIndex, badgeColor.ToAndroid (), badgeCount);
                        _badges.Add (page, badge);
                    }

                    // Let's assume that if the new badge count is zero the 
                    // default behavior will be to hide the badge
                    if (badgeCount == 0) {
                        badge.Hide ();
                    } else
Ejemplo n.º 2
0
 private void SetTabColors()
 {
     for (int tabPosition = 0; tabPosition < this.Element.Children.Count; ++tabPosition)
     {
         Xamarin.Forms.Color tabColor = BottomBarPageExtensions.GetTabColor((BindableObject)this.Element.Children[tabPosition]);
         if (tabColor != Xamarin.Forms.Color.Transparent)
         {
             this._bottomBar.MapColorForTab(tabPosition, tabColor.ToAndroid());
         }
     }
 }
Ejemplo n.º 3
0
            void SetTabColors () {
                for (int i = 0; i < Element.Children.Count; ++i) {
                    Page page = Element.Children[i];

                    Color tabColor = BottomBarPageExtensions.GetTabColor (page);

                    if (tabColor != Color.Transparent) {
                        _bottomBar.MapColorForTab (i, tabColor.ToAndroid ());
                    }
                }
            }
        public MainPage()
        {
            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                itemsPage = new NavigationPage(new ItemsPage())
                {
                    Title = "Errors"
                };

                aboutPage = new NavigationPage(new AboutPage())
                {
                    Title = "About"
                };

                sendPage = new NavigationPage(new NewItemPage())
                {
                    Title = "Send"
                };
                break;

            default:
                itemsPage = new ItemsPage()
                {
                    Title = "Errors"
                };

                aboutPage = new AboutPage()
                {
                    Title = "About"
                };

                sendPage = new NewItemPage()
                {
                    Title = "Send"
                };
                break;
            }
            itemsPage.Icon = (FileImageSource)ImageSource.FromFile("tab_feed.png");
            sendPage.Icon  = (FileImageSource)ImageSource.FromFile("tab_send.png");
            aboutPage.Icon = (FileImageSource)ImageSource.FromFile("tab_about.png");
            BottomBarPageExtensions.SetTabColor(itemsPage, Color.Blue);
            BottomBarPageExtensions.SetTabColor(sendPage, Color.Blue);
            BottomBarPageExtensions.SetTabColor(aboutPage, Color.Blue);

            Children.Add(itemsPage);
            Children.Add(sendPage);
            Children.Add(aboutPage);

            Title = Children[0].Title;
        }
Ejemplo n.º 5
0
        public BotttomTabPage()
        {
            //Move to create projects
            Title = "Details";
            Icon  = "ic_folder_selected.png";
            var AnalistView = new CreateProjectView()
            {
                Title = "Details",
                Icon  = "ic_folder_selected.png",
            };

            var messageView = new ContentPage()
            {
                Title = "Message",
                Icon  = "ic_folder_selected.png",
            };

            var MeustradesView = new ContentPage()
            {
                Title = "Times",
                Icon  = "ic_folder_selected.png",
            };

            var RepeateView = new ContentPage()
            {
                Title = "Repeate",
                Icon  = "ic_folder_selected.png"
            };

            if (Device.RuntimePlatform.Equals(Device.iOS))
            {
                this.BarBackgroundColor = Color.FromHex("#000000");
            }

            BarTheme     = BottomBarPage.BarThemeTypes.DarkWithAlpha;
            BarTextColor = Color.FromHex("#FFFFFF");
            FixedMode    = false;

            BottomBarPageExtensions.SetTabColor(AnalistView, Color.FromHex("#FFFFFF"));
            this.Children.Add(AnalistView);

            BottomBarPageExtensions.SetTabColor(messageView, Color.FromHex("#FFFFFF"));
            this.Children.Add(messageView);

            BottomBarPageExtensions.SetTabColor(MeustradesView, Color.FromHex("#FFFFFF"));
            this.Children.Add(MeustradesView);

            BottomBarPageExtensions.SetTabColor(RepeateView, Color.FromHex("#FFFFFF"));
            this.Children.Add(RepeateView);
            CurrentPageChanged += BotttomTabPage_CurrentPageChanged;
        }
Ejemplo n.º 6
0
        public MainPage()
        {
            this.BarTextColor       = Color.FromHex("#CF000F");
            this.BarBackgroundColor = Color.FromHex("#F8F8F8");
            this.FixedMode          = true;

            if (App.User.HasLoggedIn)
            {
                this.tabPages[4] = typeof(LoggedProfilePage);
            }

            for (int i = 0; i < MENU_COUNT; i++)
            {
                FileImageSource icon    = (FileImageSource)FileImageSource.FromFile(this.iconNames[i]);
                Page            tabPage = (Page)Activator.CreateInstance(this.tabPages[i]);

                switch (Device.RuntimePlatform)
                {
                case Device.iOS:
                    this.Children.Add(new NavigationPage(tabPage)
                    {
                        Icon  = icon,
                        Title = string.Empty
                    });
                    break;

                case Device.Android:
                    tabPage.Icon  = icon;
                    tabPage.Title = string.Empty;
                    this.Children.Add(tabPage);
                    break;
                }

                BottomBarPageExtensions.SetTabColor(tabPage, Color.FromHex("#F8F8F8"));
            }

            this.Title = this.titles[0];
        }
Ejemplo n.º 7
0
        public NavBar()
        {
            InitializeComponent();

            Application.Current.Properties["tabActual"] = 0;
            //this.BarBackgroundColor = Color.Blue;
            //this.BarTextColor = Color.White;
            //this.FixedMode = true;
            string[] tabTitles = { "Mis ctas", "Operaciones", "Ubícanos", "Más" };
            //0000FF
            //005eaa
            string[] tabColors = { "#0000FF", "#0000FF", "#0000FF", "#0000FF" };
            // int[] tabBadgeCounts = { 0, 1, 5, 3, 4 };
            //string[] tabBadgeColors = { "#000000", "#FF0000", "#000000", "#0000FF" };

            foreach (Page page in this.Children)
            {
                BottomBarPageExtensions.SetTabColor(page, Color.FromHex(tabColors[0]));
            }
            //Page[] paginas = { new NavigationPage(new CuentasView()), new NavigationPage(new OperacionesView()), new CuentasView(), new OtrasOpcionesView() };
            //string[] imagenes = { "ctas1_2.png", "ope2_2.png", "ic_nearby_2.png", "menu_2.png" };

            //((NavigationPage)paginas[0]).BarBackgroundColor = Color.Blue;
            //((NavigationPage)paginas[1]).BarBackgroundColor = Color.Blue;

            //for (int i = 0; i < tabTitles.Length; ++i)
            //{
            //    string title = tabTitles[i];
            //    string tabColor = tabColors[i];
            //    // int tabBadgeCount = tabBadgeCounts[i];
            //    //string tabBadgeColor = tabBadgeColors[i];

            //    FileImageSource icon = (FileImageSource)FileImageSource.FromFile(imagenes[i]);

            //    // create tab page
            //    paginas[i].Title = tabTitles[i];
            //    paginas[i].Icon = icon;

            //    // set tab color
            //    if (tabColor != null)
            //    {
            //        BottomBarPageExtensions.SetTabColor(paginas[i], Color.FromHex(tabColor));
            //    }

            //    // Set badges
            //    //BottomBarPageExtensions.SetBadgeCount(paginas[i], tabBadgeCount);
            //    //BottomBarPageExtensions.SetBadgeColor(paginas[i], Color.FromHex(tabBadgeColor));


            //    // add tab pag to tab control
            //    this.Children.Add(paginas[i]);
            //}

            this.CurrentPageChanged += (object sender, EventArgs e) => {
                int nuevaPagina = this.Children.IndexOf(this.CurrentPage);//nueva pagina
                int tabActual   = (int)Application.Current.Properties["tabActual"];
                if (tabActual < 2)
                {
                    navegarRoot(tabActual);
                }

                Application.Current.Properties["tabActual"] = nuevaPagina;
            };
        }
Ejemplo n.º 8
0
        public BottomTabbedPage()
        {
            var HomePage = new Home_Page()
            {
                Icon            = "Home.png",
                Title           = AppResources.Label_Home,
                BackgroundColor = Color.White,
            };

            var Trending_Page = new Trending_Page()
            {
                Icon            = "Trending.png",
                Title           = AppResources.Label_Trending,
                BackgroundColor = Color.White,
            };

            var WachLater_Page = new WachLater_Page()
            {
                Icon            = "T_WachLater.png",
                Title           = AppResources.Label_Watch_Later,
                BackgroundColor = Color.White,
            };

            var Subscriptions_Page = new Subscriptions_Page()
            {
                Icon            = "T_Category.png",
                Title           = AppResources.Label_Subscriptions,
                BackgroundColor = Color.White,
            };

            var Hamburg_Page = new Hamburg_Page()
            {
                Icon            = "T_Hamburg.png",
                Title           = AppResources.Label_More,
                BackgroundColor = Color.White,
            };

            if (Settings.DarkTheme)
            {
                BarTheme = BarThemeTypes.DarkWithoutAlpha;
            }

            if (Settings.LightTheme)
            {
                this.BarBackgroundColor = Color.FromHex("#f3f3f3");
                BottomBarPageExtensions.SetTabColor(HomePage, Color.FromHex("#f3f3f3"));
                BottomBarPageExtensions.SetTabColor(Trending_Page, Color.FromHex("#f3f3f3"));
                BottomBarPageExtensions.SetTabColor(WachLater_Page, Color.FromHex("#f3f3f3"));
                BottomBarPageExtensions.SetTabColor(Subscriptions_Page, Color.FromHex("#f3f3f3"));
                BottomBarPageExtensions.SetTabColor(Hamburg_Page, Color.FromHex("#f3f3f3"));
                BarTextColor = Color.Black;
                FixedMode    = true;
            }

            if (Settings.DefaultTheme)
            {
                BottomBarPageExtensions.SetTabColor(HomePage, Color.FromHex(Settings.MainColor));
                BottomBarPageExtensions.SetTabColor(Trending_Page, Color.FromHex(Settings.MainColor));
                BottomBarPageExtensions.SetTabColor(WachLater_Page, Color.FromHex(Settings.MainColor));
                BottomBarPageExtensions.SetTabColor(Subscriptions_Page, Color.FromHex(Settings.MainColor));
                BottomBarPageExtensions.SetTabColor(Hamburg_Page, Color.FromHex(Settings.MainColor));
            }

            Children.Add(HomePage);
            Children.Add(Trending_Page);
            Children.Add(WachLater_Page);
            Children.Add(Subscriptions_Page);
            Children.Add(Hamburg_Page);


            if (Settings.Show_Cutsom_Logo_And_Header_On_the_Top)
            {
                NavigationPage.SetHasNavigationBar(this, false);
            }

            //ToolbarItems.Add(new ToolbarItem()
            //{
            //    Text = "Something"
            //});
        }
Ejemplo n.º 9
0
        public App()
        {
            InitializeComponent();

            BottomBarPage bottomBarPage = new BottomBarPage();

            //bottomBarPage.BarBackgroundColor = Color.Pink;


            // You can only define the color for the active icon if you set the Bottombar to fixed mode
            // So if you want to try this, just uncomment the next two lines

            //bottomBarPage.BarTextColor = Color.Blue; // Setting Color of selected Text and Icon
            //bottomBarPage.FixedMode = true;

            // Whith BarTheme you can select between light and dark theming when using FixedMode
            // When using DarkTheme you can set the Background Color by adding a colors.xml to you Android.Resources.Values
            // with content
            //
            //  <color name="white">#ffffff</color>
            //  < color name = "bb_darkBackgroundColor" >#000000</color>
            //
            // by setting "white" you can select the color of the non selected items and texts in dark theme
            // The Difference between DarkThemeWithAlpha and DarkThemeWithoutAlpha is that WithAlpha will draw not selected items with halfe the
            // intensity instaed of solid "white" value
            //
            // Uncomment next line to use Dark Theme
            // bottomBarPage.BarTheme = BottomBarPage.BarThemeTypes.DarkWithAlpha;

            string[]  tabTitles = { "Favorites", "Friends", "Nearby", "Recents", "Restaurants" };
            string [] tabColors = { null, "#5D4037", "#7B1FA2", "#FF5252", "#FF9800" };

            for (int i = 0; i < tabTitles.Length; ++i)
            {
                string title    = tabTitles [i];
                string tabColor = tabColors [i];

                FileImageSource icon = (FileImageSource)FileImageSource.FromFile(string.Format("ic_{0}.png", title.ToLowerInvariant()));

                // create tab page
                var tabPage = new TabPage()
                {
                    Title = title,
                    Icon  = icon
                };

                // set tab color
                if (tabColor != null)
                {
                    BottomBarPageExtensions.SetTabColor(tabPage, Color.FromHex(tabColor));
                }

                // set label based on title
                tabPage.UpdateLabel();

                // add tab pag to tab control
                bottomBarPage.Children.Add(tabPage);
            }

            MainPage = bottomBarPage;
        }