Building out tools page options

This commit is contained in:
Kyle Spearrin 2016-07-01 00:03:54 -04:00
parent 94f7f715e6
commit a4e6f49959
21 changed files with 154 additions and 3 deletions

View file

@ -14,7 +14,7 @@ namespace Bit.App.Controls
BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White);
public static readonly BindableProperty ShowDisclousureProperty =
BindableProperty.Create(nameof(DisclousureImage), typeof(bool), typeof(ExtendedTextCell), false);
BindableProperty.Create(nameof(ShowDisclousure), typeof(bool), typeof(ExtendedTextCell), false);
public static readonly BindableProperty DisclousureImageProperty =
BindableProperty.Create(nameof(DisclousureImage), typeof(string), typeof(ExtendedTextCell), string.Empty);

View file

@ -8,10 +8,19 @@ namespace Bit.App.Controls
public static readonly BindableProperty BackgroundColorProperty =
BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White);
public static readonly BindableProperty ShowDisclousureProperty =
BindableProperty.Create(nameof(ShowDisclousure), typeof(bool), typeof(ExtendedTextCell), false);
public Color BackgroundColor
{
get { return (Color)GetValue(BackgroundColorProperty); }
set { SetValue(BackgroundColorProperty, value); }
}
public bool ShowDisclousure
{
get { return (bool)GetValue(ShowDisclousureProperty); }
set { SetValue(ShowDisclousureProperty, value); }
}
}
}

View file

@ -24,7 +24,7 @@ namespace Bit.App.Pages
vaultNavigation.Icon = "fa-lock";
toolsNavigation.Title = AppResources.Tools;
toolsNavigation.Icon = "fa-refresh";
toolsNavigation.Icon = "wrench";
settingsNavigation.Title = AppResources.Settings;
settingsNavigation.Icon = "cogs";

View file

@ -23,8 +23,101 @@ namespace Bit.App.Pages
public void Init()
{
var generatorCell = new ToolsViewCell("Password Generator", "Automatically generate strong, unique passwords for your logins.", "refresh");
var extensionCell = new ToolsViewCell("bitwarden App Extension", "Use bitwarden in Safari and other apps to auto-fill your logins.", "upload");
var webCell = new ToolsViewCell("bitwarden Web Vault", "Manage your logins from any web browser with the bitwarden web vault.", "globe");
webCell.Tapped += WebCell_Tapped;
var importCell = new ToolsViewCell("Import Logins", "Quickly bulk import your logins from other password management apps.", "cloudup");
importCell.Tapped += ImportCell_Tapped;
var table = new ExtendedTableView
{
EnableScrolling = true,
Intent = TableIntent.Menu,
HasUnevenRows = true,
Root = new TableRoot
{
new TableSection()
{
generatorCell,
extensionCell,
webCell,
importCell
}
}
};
if(Device.OS == TargetPlatform.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 100;
}
Title = AppResources.Tools;
Icon = "fa-refresh";
Content = table;
}
private void WebCell_Tapped(object sender, EventArgs e)
{
Device.OpenUri(new Uri("https://vault.bitwarden.com"));
}
private async void ImportCell_Tapped(object sender, EventArgs e)
{
if(!await _userDialogs.ConfirmAsync("You can bulk import logins from the bitwarden.com web vault. Do you want to visit the website now?", null, AppResources.Yes, AppResources.Cancel))
{
return;
}
Device.OpenUri(new Uri("https://vault.bitwarden.com"));
}
public class ToolsViewCell : ExtendedViewCell
{
public ToolsViewCell(string labelText, string detailText, string imageSource)
{
var label = new Label
{
VerticalOptions = LayoutOptions.CenterAndExpand,
LineBreakMode = LineBreakMode.TailTruncation,
Text = labelText
};
var detail = new Label
{
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
LineBreakMode = LineBreakMode.WordWrap,
VerticalOptions = LayoutOptions.End,
Style = (Style)Application.Current.Resources["text-muted"],
Text = detailText
};
var labelDetailStackLayout = new StackLayout
{
HorizontalOptions = LayoutOptions.StartAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Children = { label, detail },
Spacing = 0
};
var image = new Image
{
HorizontalOptions = LayoutOptions.Start,
VerticalOptions = LayoutOptions.FillAndExpand,
Source = imageSource,
Margin = new Thickness(0, 0, 10, 0)
};
var containerStackLayout = new StackLayout
{
Orientation = StackOrientation.Horizontal,
Children = { image, labelDetailStackLayout },
Padding = new Thickness(15, 25)
};
ShowDisclousure = true;
View = containerStackLayout;
}
}
}
}

View file

@ -17,6 +17,10 @@ namespace Bit.iOS.Controls
if(cell != null)
{
cell.BackgroundColor = extendedCell.BackgroundColor.ToUIColor();
if(extendedCell.ShowDisclousure)
{
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
}
}
return cell;

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/iOS/Resources/globe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,017 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 B

View file

@ -439,6 +439,51 @@
<ItemGroup>
<BundleResource Include="Resources\user%403x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\wrench%403x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\wrench%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\wrench.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\upload%403x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\upload%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\upload.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\refresh%403x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\refresh%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\refresh.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\cloudup%403x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\cloudup%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\cloudup.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\globe.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\globe%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\globe%403x.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>