protected override void OnLayout(bool changed, int l, int t, int r, int b) { base.OnLayout(changed, l, t, r, b); BottomTabbedPage formsPage = (BottomTabbedPage)Element; if (!_bottomBarInit && !formsPage.Labels) { var childViews = ViewGroup.GetViewsByType(typeof(BottomNavigationItemView)); int dpAsPixels = 0; foreach (var childView in childViews) { if (dpAsPixels == 0) { var imageIcon = childView.FindViewById(Resource.Id.icon); var parentHeightHalf = ((ViewGroup)childView.Parent).MeasuredHeight / 2; var iconHeightHalf = imageIcon.MeasuredHeight / 2; var iconTop = imageIcon.Top; dpAsPixels = parentHeightHalf - iconHeightHalf - iconTop; } childView.SetPadding(childView.PaddingLeft, dpAsPixels, childView.PaddingRight, childView.PaddingBottom); } _bottomBarInit = true; } }
public DashboardViewModel(Page context, BottomTabbedPage tabbedContext) { _context = context; _tabbedContext = tabbedContext; Task.Run(async() => await InitConstructor()); }
public SettingsPage(BottomTabbedPage tabbedContext) { InitializeComponent(); BindingContext = ViewModel = new SettingsViewModel(this, tabbedContext); }
public Dashboard(BottomTabbedPage tabbedContext) { InitializeComponent(); BindingContext = ViewModel = new DashboardViewModel(this, tabbedContext); }
public App() { InitializeComponent(); var page = new BottomTabbedPage(); MainPage = new CustomNavigationPage(page) { BarTextColor = Color.FromHex("FFFFFF") }; }
public App() { InitializeComponent(); var tabs = new BottomTabbedPage(); tabs.Title = "信用卡笔记"; tabs.BackgroundColor = Color.White; tabs.BarBackgroundColor = Color.White; tabs.Children.Add(new MessageList()); tabs.Children.Add(new CreditCardList()); tabs.Children.Add(new OtherList()); MainPage = new NavigationPage(tabs); }
public App() { InitializeComponent(); restClient = new RestClient(); _connection = new SQLiteConnection(Connection.GetConnection()); #region i18n var getter = DependencyService.Get <IDependencyGetter>(); localizer = getter.Get <ILocalizer>(); localizeResProvider = getter.Get <ILocalizedResourceProvider>(); defaultCulture = localizer.GetCurrentCultureInfo(); localizer.SetLocale(defaultCulture); #endregion var icons = Plugin.Iconize.Iconize.Modules.FirstOrDefault()?.Keys.Take(5) ?? new string[0]; AuthenticationClient = new PublicClientApplication(Constants.ApplicationID); //Load json file ListReport = ReportQuestion.initReport(); ReportText = LoadResourceJson.GetJsonFile(); ListReportData = LoadResourceJson.GetBeforeDisater(); Reporter = new Reporter(); ReportTextReplace = ""; bottomTabbedPage = new BottomTabbedPage(); SetData(); MainPage = new NavigationPage(bottomTabbedPage) { BarBackgroundColor = Color.FromHex("#ce1e21"), BarTextColor = Color.White, }; //IsNavBack = true; IsConnectivity = CrossConnectivity.Current.IsConnected; if (_connection == null) { } if (IsConnectivity) { //SetContact(); ListContact = new List <Models.User>(); } AsyncEvent(); var repository = Get <UserRepository>(); UserLites = repository.GetAll(); CrossConnectivity.Current.ConnectivityChanged += Current_ConnectivityChanged; }
public App() { var host = MobileBlazorBindingsHost.CreateDefaultBuilder() .ConfigureServices((hostContext, services) => { // Register app-specific services //services.AddSingleton<AppState>(); }) .Build(); BottomTabbedPageControl = new BottomTabbedPage() { UnselectedTabColor = Color.White, BarTextColor = Color.White, BarBackgroundColor = AppResources.SoftBlackColor, SelectedTabColor = Color.White }; MainPage = BottomTabbedPageControl; host.AddComponent <SpotifyApp>(parent: MainPage); }
public App() { InitializeComponent(); Page startPage; if (Equals(Settings.Get(Settings.Key.IsLogged), true) && Equals(Settings.Get(Settings.Key.IsLockApp), true)) { var setting = new CommonPageSettings { HeaderText = "Enter your 4 digit pin", HasNavigation = false }; var page = new BottomTabbedPage(); startPage = new PinAuthPage( (sender, args) => { SetMainPage(page); }, valid => Equals(valid, Settings.Get(Settings.Key.Pin)), "The 4 Digit pin you entered is incorrect.\nPlease review your pin and try again.", setting, true); } else if (Equals(Settings.Get(Settings.Key.IsLogged), true)) { startPage = new BottomTabbedPage(); } else if (Equals(Settings.Get(Settings.Key.ResumePage), true)) { startPage = new CreateWalletPage(); } else if (!Equals(Settings.Get(Settings.Key.PinSetupPage), true)) { startPage = new PinAuthPage( async(sender1, args) => { var pin = args.EnteredPin; var setting = new CommonPageSettings { HasNavigation = true, Title = "Confirm Pin", HeaderText = "Create your 4 digit pin", HasBack = true }; await MainPage.Navigation.PushAsync( new PinAuthPage( (sender2, args2) => { Settings.Set(Settings.Key.Pin, pin); Settings.Set(Settings.Key.PinSetupPage, true); Settings.Set(Settings.Key.IsLockApp, false); Settings.Set(Settings.Key.IsNotification, true); SetMainPage(new GuapPage()); }, c => Equals(c, pin), "The 4 Digit pin you entered is incorrect.\nPlease review your pin and try again.", setting)); }, c => true, string.Empty, new CommonPageSettings { HasNavigation = false, HeaderText = "Create your 4 digit pin" }); } else { startPage = new GuapPage(); } SetMainPage(startPage); }
protected override void OnElementChanged(ElementChangedEventArgs <TabbedPage> e) { base.OnElementChanged(e); BottomTabbedPage formsPage = (BottomTabbedPage)Element; if (!formsPage.Labels) { var childViews = ViewGroup.GetViewsByType(typeof(BottomNavigationItemView)); foreach (var childView in childViews) { childView.FindAndRemoveById(Resource.Id.largeLabel); childView.FindAndRemoveById(Resource.Id.smallLabel); } } if (e.NewElement != null) { var relativeLayout = this.GetChildAt(0) as Android.Widget.RelativeLayout; if (relativeLayout != null) { var bottomNavigationView = relativeLayout.GetChildAt(1) as BottomNavigationView; bottomNavigationView.SetShiftMode(false, false); BottomNavigationMenuView bottomNavigationMenuView = (BottomNavigationMenuView)bottomNavigationView.GetChildAt(0); int tabCount = formsPage.Tabs.Count; for (int i = 0; i < tabCount; i++) { var tabData = formsPage.Tabs[0]; BottomNavigationItemView tabItemView = (BottomNavigationItemView)bottomNavigationMenuView.GetChildAt(i); if (tabData.BadgeCaption > 0) { if (_badgeId == 0) { _badgeId = Android.Views.View.GenerateViewId(); } TextView badgeTextView = new BadgeView(Context) { Id = _badgeId, BadgeCaption = tabData.BadgeCaption.ToString(), BadgeColor = tabData.BadgeColor.ToAndroid() }; tabData.PropertyChanged += (sender, args) => { TabData currentTabData = (TabData)sender; BottomNavigationItemView currentTabItemView = _tabViews[currentTabData]; BadgeView currentBadgeTextView = currentTabItemView.FindViewById(_badgeId) as BadgeView; if (currentBadgeTextView != null) { currentBadgeTextView.BadgeColor = currentTabData.BadgeColor.ToAndroid(); currentBadgeTextView.BadgeCaption = currentTabData.BadgeCaption > 0 ? currentTabData.BadgeCaption.ToString() : string.Empty; } }; tabItemView.AddView(badgeTextView); _tabViews.Add(tabData, tabItemView); } } } } }
public ActionSelectModalPage(BottomTabbedPage tabbedContext) { InitializeComponent(); _tabbedContext = tabbedContext; }