1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-30 15:13:24 +00:00

Extended controls

This commit is contained in:
Kyle Spearrin
2016-05-09 23:25:37 -04:00
parent b4144a393a
commit 3f251d0d12
14 changed files with 336 additions and 16 deletions

View File

@@ -44,6 +44,10 @@
<Compile Include="Behaviors\EmailValidationBehavior.cs" />
<Compile Include="Behaviors\ConnectivityBehavior.cs" />
<Compile Include="Behaviors\RequiredValidationBehavior.cs" />
<Compile Include="Controls\EntryLabel.cs" />
<Compile Include="Controls\BottomBorderEntry.cs" />
<Compile Include="Controls\ExtendedEntry.cs" />
<Compile Include="Controls\ExtendedTabbedPage.cs" />
<Compile Include="Models\Api\ApiError.cs" />
<Compile Include="Models\Api\ApiResult.cs" />
<Compile Include="Models\Api\Request\FolderRequest.cs" />

View File

@@ -0,0 +1,13 @@
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class BottomBorderEntry : ExtendedEntry
{
public BottomBorderEntry()
{
HasBorder = HasOnlyBottomBorder = true;
BorderColor = Color.FromHex("d2d6de");
}
}
}

View File

@@ -0,0 +1,13 @@
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class EntryLabel : Label
{
public EntryLabel()
{
FontSize = 14;
TextColor = Color.FromHex("777777");
}
}
}

View File

@@ -0,0 +1,53 @@
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class ExtendedEntry : Entry
{
public static readonly BindableProperty HasBorderProperty =
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEntry), true);
public static readonly BindableProperty HasOnlyBottomBorderProperty =
BindableProperty.Create(nameof(HasOnlyBottomBorder), typeof(bool), typeof(ExtendedEntry), false);
public static readonly BindableProperty BorderColorProperty =
BindableProperty.Create(nameof(BorderColor), typeof(Color), typeof(ExtendedEntry), Color.Default);
public static readonly BindableProperty PlaceholderTextColorProperty =
BindableProperty.Create(nameof(PlaceholderTextColor), typeof(Color), typeof(ExtendedEntry), Color.Default);
public static readonly BindableProperty MaxLengthProperty =
BindableProperty.Create(nameof(MaxLength), typeof(int), typeof(ExtendedEntry), int.MaxValue);
public bool HasBorder
{
get { return (bool)GetValue(HasBorderProperty); }
set { SetValue(HasBorderProperty, value); }
}
public bool HasOnlyBottomBorder
{
get { return (bool)GetValue(HasOnlyBottomBorderProperty); }
set { SetValue(HasOnlyBottomBorderProperty, value); }
}
public Color BorderColor
{
get { return (Color)GetValue(BorderColorProperty); }
set { SetValue(BorderColorProperty, value); }
}
public Color PlaceholderTextColor
{
get { return (Color)GetValue(PlaceholderTextColorProperty); }
set { SetValue(PlaceholderTextColorProperty, value); }
}
public int MaxLength
{
get { return (int)GetValue(MaxLengthProperty); }
set { SetValue(MaxLengthProperty, value); }
}
}
}

View File

@@ -0,0 +1,26 @@
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class ExtendedTabbedPage : TabbedPage
{
public static readonly BindableProperty TintColorProperty =
BindableProperty.Create(nameof(TintColor), typeof(Color), typeof(ExtendedTabbedPage), Color.White);
public static readonly BindableProperty BarTintColorProperty =
BindableProperty.Create(nameof(BarTintColor), typeof(Color), typeof(ExtendedTabbedPage), Color.White);
public Color TintColor
{
get { return (Color)GetValue(TintColorProperty); }
set { SetValue(TintColorProperty, value); }
}
public Color BarTintColor
{
get { return (Color)GetValue(BarTintColorProperty); }
set { SetValue(BarTintColorProperty, value); }
}
}
}

View File

@@ -1,13 +1,17 @@
using System;
using Bit.App.Controls;
using Bit.App.Resources;
using Xamarin.Forms;
namespace Bit.App.Pages
{
public class MainPage : TabbedPage
public class MainPage : ExtendedTabbedPage
{
public MainPage()
{
BarTintColor = Color.FromHex("222d32");
TintColor = Color.FromHex("ffffff");
var settingsNavigation = new NavigationPage(new SettingsPage());
var vaultNavigation = new NavigationPage(new VaultListPage());
var syncNavigation = new NavigationPage(new SyncPage());

View File

@@ -2,6 +2,7 @@
using System.Linq;
using Acr.UserDialogs;
using Bit.App.Abstractions;
using Bit.App.Controls;
using Bit.App.Models;
using Bit.App.Resources;
using Plugin.Connectivity.Abstractions;
@@ -31,8 +32,8 @@ namespace Bit.App.Pages
{
var folders = _folderService.GetAllAsync().GetAwaiter().GetResult().OrderBy(f => f.Name?.Decrypt());
var uriEntry = new Entry { Keyboard = Keyboard.Url };
var nameEntry = new Entry();
var uriEntry = new BottomBorderEntry { Keyboard = Keyboard.Url };
var nameEntry = new BottomBorderEntry();
var folderPicker = new Picker { Title = AppResources.Folder };
folderPicker.Items.Add(AppResources.FolderNone);
folderPicker.SelectedIndex = 0;
@@ -40,22 +41,22 @@ namespace Bit.App.Pages
{
folderPicker.Items.Add(folder.Name.Decrypt());
}
var usernameEntry = new Entry();
var passwordEntry = new Entry { IsPassword = true };
var usernameEntry = new BottomBorderEntry();
var passwordEntry = new BottomBorderEntry { IsPassword = true };
var notesEditor = new Editor();
var stackLayout = new StackLayout();
stackLayout.Children.Add(new Label { Text = AppResources.URI });
var stackLayout = new StackLayout { Padding = new Thickness(15) };
stackLayout.Children.Add(new EntryLabel { Text = AppResources.URI });
stackLayout.Children.Add(uriEntry);
stackLayout.Children.Add(new Label { Text = AppResources.Name });
stackLayout.Children.Add(new EntryLabel { Text = AppResources.Name });
stackLayout.Children.Add(nameEntry);
stackLayout.Children.Add(new Label { Text = AppResources.Folder });
stackLayout.Children.Add(new EntryLabel { Text = AppResources.Folder });
stackLayout.Children.Add(folderPicker);
stackLayout.Children.Add(new Label { Text = AppResources.Username });
stackLayout.Children.Add(new EntryLabel { Text = AppResources.Username });
stackLayout.Children.Add(usernameEntry);
stackLayout.Children.Add(new Label { Text = AppResources.Password });
stackLayout.Children.Add(new EntryLabel { Text = AppResources.Password });
stackLayout.Children.Add(passwordEntry);
stackLayout.Children.Add(new Label { Text = AppResources.Notes });
stackLayout.Children.Add(new EntryLabel { Text = AppResources.Notes });
stackLayout.Children.Add(notesEditor);
var scrollView = new ScrollView