bitwarden-android/src/App/Pages/TabsPage.cs

61 lines
2.2 KiB
C#
Raw Normal View History

2019-05-14 16:43:46 +03:00
using Bit.App.Resources;
using Xamarin.Forms;
namespace Bit.App.Pages
{
public class TabsPage : TabbedPage
{
public TabsPage()
{
2019-05-14 16:48:40 +03:00
var groupingsPage = new NavigationPage(new GroupingsPage(true))
2019-05-14 16:43:46 +03:00
{
Title = AppResources.MyVault,
Icon = "lock.png"
};
Children.Add(groupingsPage);
var generatorPage = new NavigationPage(new GeneratorPage(true, null))
{
Title = AppResources.Generator,
Icon = "refresh.png"
};
Children.Add(generatorPage);
var settingsPage = new NavigationPage(new SettingsPage())
{
Title = AppResources.Settings,
Icon = "cogs.png"
};
Children.Add(settingsPage);
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetToolbarPlacement(this,
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ToolbarPlacement.Bottom);
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetIsSwipePagingEnabled(this, false);
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetIsSmoothScrollEnabled(this, false);
2019-05-29 22:50:20 +03:00
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetBarSelectedItemColor(this,
(Color)Application.Current.Resources["TabBarSelectedItemColor"]);
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetBarItemColor(this,
(Color)Application.Current.Resources["TabBarItemColor"]);
2019-05-14 16:43:46 +03:00
}
protected async override void OnCurrentPageChanged()
{
if(CurrentPage is NavigationPage navPage)
{
2019-05-14 16:51:13 +03:00
if(navPage.RootPage is GroupingsPage groupingsPage)
{
// Load something?
}
else if(navPage.RootPage is GeneratorPage genPage)
2019-05-14 16:43:46 +03:00
{
await genPage.InitAsync();
}
2019-05-14 16:51:13 +03:00
else if(navPage.RootPage is SettingsPage settingsPage)
{
// Load something?
}
2019-05-14 16:43:46 +03:00
}
}
}
}