2016-07-23 09:48:56 +03:00
|
|
|
|
using System;
|
|
|
|
|
using Bit.App.Controls;
|
|
|
|
|
using Xamarin.Forms;
|
2016-07-24 06:50:08 +03:00
|
|
|
|
using Bit.App.Abstractions;
|
|
|
|
|
using XLabs.Ioc;
|
2016-11-25 21:22:11 +03:00
|
|
|
|
using Bit.App.Resources;
|
2016-07-23 09:48:56 +03:00
|
|
|
|
|
|
|
|
|
namespace Bit.App.Pages
|
|
|
|
|
{
|
|
|
|
|
public class SettingsAboutPage : ExtendedContentPage
|
|
|
|
|
{
|
2016-07-24 06:50:08 +03:00
|
|
|
|
private readonly IAppInfoService _appInfoService;
|
|
|
|
|
|
2016-07-23 09:48:56 +03:00
|
|
|
|
public SettingsAboutPage()
|
|
|
|
|
{
|
2016-07-24 06:50:08 +03:00
|
|
|
|
_appInfoService = Resolver.Resolve<IAppInfoService>();
|
2016-07-23 09:48:56 +03:00
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
|
{
|
2016-07-24 06:50:08 +03:00
|
|
|
|
var logo = new Image
|
|
|
|
|
{
|
|
|
|
|
Source = "logo",
|
|
|
|
|
HorizontalOptions = LayoutOptions.Center
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var versionLabel = new Label
|
|
|
|
|
{
|
2016-08-23 01:59:15 +03:00
|
|
|
|
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Text = $@"{AppResources.Version} {_appInfoService.Version} ({_appInfoService.Build})
|
2016-07-24 06:50:08 +03:00
|
|
|
|
© 8bit Solutions LLC 2015-{DateTime.Now.Year}",
|
|
|
|
|
HorizontalTextAlignment = TextAlignment.Center
|
|
|
|
|
};
|
|
|
|
|
|
2016-07-26 05:24:40 +03:00
|
|
|
|
var logoVersionStackLayout = new StackLayout
|
|
|
|
|
{
|
|
|
|
|
Children = { logo, versionLabel },
|
|
|
|
|
Spacing = 20,
|
2016-07-30 07:16:40 +03:00
|
|
|
|
Padding = new Thickness(0, 40, 0, 0)
|
2016-07-26 05:24:40 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var creditsCell = new ExtendedTextCell
|
2016-07-24 06:50:08 +03:00
|
|
|
|
{
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Text = AppResources.Credits,
|
2016-07-26 05:24:40 +03:00
|
|
|
|
ShowDisclousure = true
|
|
|
|
|
};
|
|
|
|
|
creditsCell.Tapped += RateCell_Tapped;
|
|
|
|
|
|
|
|
|
|
var table = new ExtendedTableView
|
|
|
|
|
{
|
|
|
|
|
VerticalOptions = LayoutOptions.Start,
|
|
|
|
|
EnableScrolling = false,
|
2016-07-28 07:39:35 +03:00
|
|
|
|
Intent = TableIntent.Settings,
|
2016-07-26 05:24:40 +03:00
|
|
|
|
HasUnevenRows = true,
|
|
|
|
|
Root = new TableRoot
|
|
|
|
|
{
|
|
|
|
|
new TableSection
|
|
|
|
|
{
|
|
|
|
|
creditsCell
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-07-24 06:50:08 +03:00
|
|
|
|
};
|
2016-07-23 09:48:56 +03:00
|
|
|
|
|
2016-07-26 05:24:40 +03:00
|
|
|
|
if(Device.OS == TargetPlatform.iOS)
|
|
|
|
|
{
|
|
|
|
|
table.RowHeight = -1;
|
|
|
|
|
table.EstimatedRowHeight = 44;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-24 06:50:08 +03:00
|
|
|
|
var stackLayout = new StackLayout
|
|
|
|
|
{
|
2016-07-26 05:24:40 +03:00
|
|
|
|
Children = { logoVersionStackLayout, table },
|
|
|
|
|
Spacing = 0
|
2016-07-24 06:50:08 +03:00
|
|
|
|
};
|
2016-07-23 09:48:56 +03:00
|
|
|
|
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Title = AppResources.About;
|
2016-07-24 06:50:08 +03:00
|
|
|
|
Content = new ScrollView { Content = stackLayout };
|
2016-07-23 09:48:56 +03:00
|
|
|
|
}
|
2016-07-26 05:24:40 +03:00
|
|
|
|
|
|
|
|
|
private void RateCell_Tapped(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Navigation.PushAsync(new SettingsCreditsPage());
|
|
|
|
|
}
|
2016-07-23 09:48:56 +03:00
|
|
|
|
}
|
|
|
|
|
}
|