示例#1
0
        public void SetTabStyle()
        {
            try
            {
                Models.Clear();

                if (Models != null && Models.Count <= 0)
                {
                    Models.Add(new NavigationTabBar.Model.Builder(
                                   ContextCompat.GetDrawable(this, Resource.Drawable.ic_tab_home), Color.ParseColor("#ffffff"))
                               .Title(GetText(Resource.String.Lbl_News_Feed)).Build());
                    Models.Add(new NavigationTabBar.Model.Builder(
                                   ContextCompat.GetDrawable(this, Resource.Drawable.ic_action_notification),
                                   Color.ParseColor("#ffffff")).Title(GetText(Resource.String.Lbl_Notifcations)).Build());
                    Models.Add(new NavigationTabBar.Model.Builder(
                                   ContextCompat.GetDrawable(this, Resource.Drawable.ic_action_trending),
                                   Color.ParseColor("#ffffff")).Title(GetText(Resource.String.Lbl_Trending)).Build());
                    Models.Add(new NavigationTabBar.Model.Builder(
                                   ContextCompat.GetDrawable(this, Resource.Drawable.ic_tab_more), Color.ParseColor("#ffffff"))
                               .Title(GetText(Resource.String.Lbl_More)).Build());

                    if (Settings.SetTabColoredTheme)
                    {
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_News_Feed)).Color =
                            Color.ParseColor(Settings.TabColoredColor);
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_Notifcations)).Color =
                            Color.ParseColor(Settings.TabColoredColor);
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_Trending)).Color =
                            Color.ParseColor(Settings.TabColoredColor);
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_More)).Color =
                            Color.ParseColor(Settings.TabColoredColor);

                        navigationTabBar.BgColor       = Color.ParseColor(Settings.MainColor);
                        navigationTabBar.ActiveColor   = Color.White;
                        navigationTabBar.InactiveColor = Color.White;
                    }
                    else if (Settings.SetTabDarkTheme)
                    {
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_News_Feed)).Color =
                            Color.ParseColor("#444444");
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_Notifcations)).Color =
                            Color.ParseColor("#444444");
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_Trending)).Color =
                            Color.ParseColor("#444444");
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_More)).Color =
                            Color.ParseColor("#444444");

                        navigationTabBar.BgColor       = Color.ParseColor("#282828");
                        navigationTabBar.ActiveColor   = Color.White;
                        navigationTabBar.InactiveColor = Color.White;
                    }

                    navigationTabBar.Models = Models;
                    navigationTabBar.SetViewPager(viewPager, 0);
                    navigationTabBar.IsScaled         = false;
                    navigationTabBar.IconSizeFraction = (float)0.450;
                    //navigationTabBar.SetBadgePosition(NavigationTabBar.BadgePosition.Center);
                    if (Settings.SetTabIsTitledWithText)
                    {
                        navigationTabBar.SetTitleMode(NavigationTabBar.TitleMode.All);
                        navigationTabBar.IsTitled = true;
                    }

                    if (!Settings.SetTabOnButton)
                    {
                        //var eee = NavigationTabBar.BadgeGravity.TopIndex = 2;
                        // navigationTabBar.SetBadgeGravity( );
                        navigationTabBar.SetBadgePosition(NavigationTabBar.BadgePosition.Center);

                        var parasms = (CoordinatorLayout.LayoutParams)navigationTabBar.LayoutParameters;
                        parasms.Gravity = (int)GravityFlags.Top;

                        // Check if we're running on Android 5.0 or higher
                        if ((int)Build.VERSION.SdkInt < 23)
                        {
                            parasms.TopMargin = 70;
                        }
                        else
                        {
                            parasms.TopMargin = 115;
                        }

                        navigationTabBar.LayoutParameters = parasms;

                        var parasms2 = (CoordinatorLayout.LayoutParams)FloatingActionButton.LayoutParameters;

                        // Check if we're running on Android 5.0 or higher
                        if ((int)Build.VERSION.SdkInt < 23)
                        {
                            parasms2.BottomMargin = 48;
                        }
                        else
                        {
                            parasms2.BottomMargin = 68;
                        }

                        FloatingActionButton.LayoutParameters = parasms2;
                    }
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
        public void SetupNavigation(NavigationTabBar navigationTabBar)
        {
            try
            {
                Models = new JavaList <NavigationTabBar.Model>
                {
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_feed), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Feed)).Build(),
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_playlist), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Playlist)).Build(),
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_browse), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Browse)).Build(),
                };

                if (UserDetails.IsLogin)
                {
                    Models.Add(new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_library), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Library)).Build());
                    Models.Add(new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_profile), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Profile)).Build());
                }

                var eee = NavigationTabBar.BadgeGravity.Top;
                navigationTabBar.SetBadgeGravity(eee);
                navigationTabBar.BadgeBgColor    = Color.ParseColor(AppSettings.MainColor);
                navigationTabBar.BadgeTitleColor = Color.White;

                if (AppSettings.SetTabColoredTheme)
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Feed)).Color     = Color.ParseColor(AppSettings.TabColoredColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Playlist)).Color = Color.ParseColor(AppSettings.TabColoredColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Browse)).Color   = Color.ParseColor(AppSettings.TabColoredColor);

                    if (UserDetails.IsLogin)
                    {
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Library)).Color = Color.ParseColor(AppSettings.TabColoredColor);
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Profile)).Color = Color.ParseColor(AppSettings.TabColoredColor);
                    }
                    navigationTabBar.BgColor       = Color.ParseColor(AppSettings.MainColor);
                    navigationTabBar.ActiveColor   = Color.White;
                    navigationTabBar.InactiveColor = Color.White;
                }
                else if (AppSettings.SetTabDarkTheme)
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Feed)).Color     = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Playlist)).Color = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Browse)).Color   = Color.ParseColor(AppSettings.MainColor);
                    if (UserDetails.IsLogin)
                    {
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Library)).Color = Color.ParseColor(AppSettings.MainColor);
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Profile)).Color = Color.ParseColor(AppSettings.MainColor);
                    }

                    navigationTabBar.BgColor       = Color.ParseColor("#000000");
                    navigationTabBar.ActiveColor   = Color.White;
                    navigationTabBar.InactiveColor = Color.White;
                }
                else
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Feed)).Color     = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Playlist)).Color = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Browse)).Color   = Color.ParseColor("#ffffff");;
                    if (UserDetails.IsLogin)
                    {
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Library)).Color = Color.ParseColor("#ffffff");
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Profile)).Color = Color.ParseColor("#ffffff");
                    }

                    navigationTabBar.BgColor       = Color.White;
                    navigationTabBar.ActiveColor   = Color.ParseColor(AppSettings.MainColor);
                    navigationTabBar.InactiveColor = Color.ParseColor("#bfbfbf");
                }

                navigationTabBar.Models = Models;

                navigationTabBar.IsScaled         = false;
                navigationTabBar.IconSizeFraction = (float)0.450;
                navigationTabBar.BehaviorEnabled  = true;

                //navigationTabBar.SetBadgePosition(NavigationTabBar.BadgePosition.Center);
                if (AppSettings.SetTabIsTitledWithText)
                {
                    navigationTabBar.SetTitleMode(NavigationTabBar.TitleMode.All);
                    navigationTabBar.IsTitled = true;
                }

                navigationTabBar.StartTabSelected += NavigationTabBarOnStartTabSelected;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#3
0
        public void SetupNavigation(NavigationTabBar navigationTabBar)
        {
            try
            {
                Models = new JavaList <NavigationTabBar.Model>
                {
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_cards), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Cards)).Build()
                };

                if (AppSettings.ShowTrending)
                {
                    Models.Add(new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_trending), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Trending)).Build());
                }

                Models.Add(new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_notification), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Notifications)).Build());
                Models.Add(new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_messages), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_messages)).Build());
                Models.Add(new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_profile), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Profile)).Build());


                var eee = NavigationTabBar.BadgeGravity.Top;
                navigationTabBar.SetBadgeGravity(eee);
                navigationTabBar.BadgeBgColor    = Color.ParseColor(AppSettings.MainColor);
                navigationTabBar.BadgeTitleColor = Color.White;


                if (AppSettings.SetTabColoredTheme)
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Cards)).Color = Color.ParseColor(AppSettings.TabColoredColor);

                    if (AppSettings.ShowTrending)
                    {
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Trending)).Color = Color.ParseColor(AppSettings.TabColoredColor);
                    }

                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Notifications)).Color = Color.ParseColor(AppSettings.TabColoredColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_messages)).Color      = Color.ParseColor(AppSettings.TabColoredColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Profile)).Color       = Color.ParseColor(AppSettings.TabColoredColor);

                    navigationTabBar.BgColor       = Color.ParseColor(AppSettings.MainColor);
                    navigationTabBar.ActiveColor   = Color.White;
                    navigationTabBar.InactiveColor = Color.White;
                }
                else if (AppSettings.SetTabDarkTheme)
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Cards)).Color = Color.ParseColor(AppSettings.MainColor);

                    if (AppSettings.ShowTrending)
                    {
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Trending)).Color = Color.ParseColor(AppSettings.MainColor);
                    }

                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Notifications)).Color = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_messages)).Color      = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Profile)).Color       = Color.ParseColor(AppSettings.MainColor);

                    navigationTabBar.BgColor       = Color.ParseColor("#000000");
                    navigationTabBar.ActiveColor   = Color.White;
                    navigationTabBar.InactiveColor = Color.White;
                }
                else
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Cards)).Color = Color.ParseColor("#ffffff");

                    if (AppSettings.ShowTrending)
                    {
                        Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Trending)).Color = Color.ParseColor("#ffffff");
                    }

                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Notifications)).Color = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_messages)).Color      = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Profile)).Color       = Color.ParseColor("#ffffff");

                    navigationTabBar.BgColor       = Color.White;
                    navigationTabBar.ActiveColor   = Color.ParseColor(AppSettings.MainColor);
                    navigationTabBar.InactiveColor = Color.ParseColor("#bfbfbf");
                }

                navigationTabBar.Models = Models;


                navigationTabBar.IsScaled         = false;
                navigationTabBar.IconSizeFraction = (float)0.450;

                //navigationTabBar.SetBadgePosition(NavigationTabBar.BadgePosition.Center);
                if (AppSettings.SetTabIsTitledWithText)
                {
                    navigationTabBar.SetTitleMode(NavigationTabBar.TitleMode.All);
                    navigationTabBar.IsTitled = true;
                }

                navigationTabBar.StartTabSelected += NavigationTabBarOnStartTabSelected;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#4
0
        public void SetupNavigation(NavigationTabBar navigationTabBar)
        {
            try
            {
                Models = new JavaList <NavigationTabBar.Model>
                {
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_home), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_News_Feed)).Build(),
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_explore_tool), Color.ParseColor("#ffffff")).Title(Context.GetString(Resource.String.Lbl_Explore)).Build(),
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_add), Color.ParseColor("#ffffff")).Title(Context.GetString(Resource.String.Lbl_Add_Post)).Build(),
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_action_notification), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_Notifications)).BadgeTitle("0").Build(),
                    new NavigationTabBar.Model.Builder(ContextCompat.GetDrawable(Context, Resource.Drawable.ic_tab_user_profile), Color.ParseColor("#ffffff")).Title(Context.GetText(Resource.String.Lbl_More)).Build()
                };

                var eee = NavigationTabBar.BadgeGravity.Top;
                navigationTabBar.SetBadgeGravity(eee);
                navigationTabBar.BadgeBgColor    = Color.ParseColor(AppSettings.MainColor);
                navigationTabBar.BadgeTitleColor = Color.White;

                if (AppSettings.SetTabColoredTheme)
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_News_Feed)).Color     = Color.ParseColor(AppSettings.TabColoredColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Explore)).Color       = Color.ParseColor(AppSettings.TabColoredColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Add_Post)).Color      = Color.ParseColor(AppSettings.TabColoredColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Notifications)).Color = Color.ParseColor(AppSettings.TabColoredColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_More)).Color          = Color.ParseColor(AppSettings.TabColoredColor);

                    navigationTabBar.BgColor       = Color.ParseColor(AppSettings.MainColor);
                    navigationTabBar.ActiveColor   = Color.White;
                    navigationTabBar.InactiveColor = Color.White;
                }
                else if (AppSettings.SetTabDarkTheme)
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_News_Feed)).Color     = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Explore)).Color       = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Add_Post)).Color      = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Notifications)).Color = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_More)).Color          = Color.ParseColor(AppSettings.MainColor);
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Add_Post)).Color      = Color.ParseColor(AppSettings.MainColor);

                    navigationTabBar.BgColor = Color.ParseColor("#000000");
                    //navigationTabBar.BgColor = Color.ParseColor("#282828");
                    navigationTabBar.ActiveColor   = Color.White;
                    navigationTabBar.InactiveColor = Color.White;
                }
                else
                {
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_News_Feed)).Color     = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Explore)).Color       = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Add_Post)).Color      = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Notifications)).Color = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_More)).Color          = Color.ParseColor("#ffffff");
                    Models.First(a => a.Title == Context.GetText(Resource.String.Lbl_Add_Post)).Color      = Color.ParseColor("#ffffff");


                    navigationTabBar.BgColor       = Color.White;
                    navigationTabBar.ActiveColor   = Color.ParseColor(AppSettings.MainColor);
                    navigationTabBar.InactiveColor = Color.ParseColor("#bfbfbf");
                }
                navigationTabBar.Models = Models;


                navigationTabBar.IsScaled         = false;
                navigationTabBar.IconSizeFraction = (float)0.450;
                navigationTabBar.BehaviorEnabled  = false;
                //navigationTabBar.SetBadgePosition(NavigationTabBar.BadgePosition.Center);
                if (AppSettings.SetTabIsTitledWithText)
                {
                    navigationTabBar.SetTitleMode(NavigationTabBar.TitleMode.All);
                    navigationTabBar.IsTitled = true;
                }

                navigationTabBar.StartTabSelected += NavigationTabBarOnStartTabSelected;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }