Moved cells from storyboard into being managed in controller code. new ios views for tableview cells.

This commit is contained in:
Kyle Spearrin 2016-07-09 01:07:02 -04:00
parent 3291a0d78d
commit 3a82653ae5
10 changed files with 395 additions and 364 deletions

View File

@ -279,7 +279,7 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\AppResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>AppResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

View File

@ -23,7 +23,7 @@ namespace Bit.App.Resources {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class AppResources {
public class AppResources {
private static global::System.Resources.ResourceManager resourceMan;
@ -37,7 +37,7 @@ namespace Bit.App.Resources {
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bit.App.Resources.AppResources", typeof(AppResources).GetTypeInfo().Assembly);
@ -52,7 +52,7 @@ namespace Bit.App.Resources {
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@ -64,7 +64,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Add.
/// </summary>
internal static string Add {
public static string Add {
get {
return ResourceManager.GetString("Add", resourceCulture);
}
@ -73,7 +73,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Add Site.
/// </summary>
internal static string AddSite {
public static string AddSite {
get {
return ResourceManager.GetString("AddSite", resourceCulture);
}
@ -82,7 +82,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to An error has occurred..
/// </summary>
internal static string AnErrorHasOccurred {
public static string AnErrorHasOccurred {
get {
return ResourceManager.GetString("AnErrorHasOccurred", resourceCulture);
}
@ -91,7 +91,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Back.
/// </summary>
internal static string Back {
public static string Back {
get {
return ResourceManager.GetString("Back", resourceCulture);
}
@ -100,7 +100,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to bitwarden.
/// </summary>
internal static string Bitwarden {
public static string Bitwarden {
get {
return ResourceManager.GetString("Bitwarden", resourceCulture);
}
@ -109,7 +109,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
internal static string Cancel {
public static string Cancel {
get {
return ResourceManager.GetString("Cancel", resourceCulture);
}
@ -118,7 +118,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Copy.
/// </summary>
internal static string Copy {
public static string Copy {
get {
return ResourceManager.GetString("Copy", resourceCulture);
}
@ -127,7 +127,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Copy Password.
/// </summary>
internal static string CopyPassword {
public static string CopyPassword {
get {
return ResourceManager.GetString("CopyPassword", resourceCulture);
}
@ -136,7 +136,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Copy Username.
/// </summary>
internal static string CopyUsername {
public static string CopyUsername {
get {
return ResourceManager.GetString("CopyUsername", resourceCulture);
}
@ -145,7 +145,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Delete.
/// </summary>
internal static string Delete {
public static string Delete {
get {
return ResourceManager.GetString("Delete", resourceCulture);
}
@ -154,7 +154,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Do you really want to delete? This cannot be undone..
/// </summary>
internal static string DoYouReallyWantToDelete {
public static string DoYouReallyWantToDelete {
get {
return ResourceManager.GetString("DoYouReallyWantToDelete", resourceCulture);
}
@ -163,7 +163,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Edit.
/// </summary>
internal static string Edit {
public static string Edit {
get {
return ResourceManager.GetString("Edit", resourceCulture);
}
@ -172,7 +172,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Email.
/// </summary>
internal static string Email {
public static string Email {
get {
return ResourceManager.GetString("Email", resourceCulture);
}
@ -181,7 +181,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Email Address.
/// </summary>
internal static string EmailAddress {
public static string EmailAddress {
get {
return ResourceManager.GetString("EmailAddress", resourceCulture);
}
@ -190,7 +190,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Favorites.
/// </summary>
internal static string Favorites {
public static string Favorites {
get {
return ResourceManager.GetString("Favorites", resourceCulture);
}
@ -199,7 +199,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Folder.
/// </summary>
internal static string Folder {
public static string Folder {
get {
return ResourceManager.GetString("Folder", resourceCulture);
}
@ -208,7 +208,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to (none).
/// </summary>
internal static string FolderNone {
public static string FolderNone {
get {
return ResourceManager.GetString("FolderNone", resourceCulture);
}
@ -217,7 +217,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Go To Website.
/// </summary>
internal static string GoToWebsite {
public static string GoToWebsite {
get {
return ResourceManager.GetString("GoToWebsite", resourceCulture);
}
@ -226,7 +226,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Hide.
/// </summary>
internal static string Hide {
public static string Hide {
get {
return ResourceManager.GetString("Hide", resourceCulture);
}
@ -235,7 +235,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Please connect to the internet before continuing..
/// </summary>
internal static string InternetConnectionRequiredMessage {
public static string InternetConnectionRequiredMessage {
get {
return ResourceManager.GetString("InternetConnectionRequiredMessage", resourceCulture);
}
@ -244,7 +244,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Internet Connection Required.
/// </summary>
internal static string InternetConnectionRequiredTitle {
public static string InternetConnectionRequiredTitle {
get {
return ResourceManager.GetString("InternetConnectionRequiredTitle", resourceCulture);
}
@ -253,7 +253,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Launch.
/// </summary>
internal static string Launch {
public static string Launch {
get {
return ResourceManager.GetString("Launch", resourceCulture);
}
@ -262,7 +262,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Log In.
/// </summary>
internal static string LogIn {
public static string LogIn {
get {
return ResourceManager.GetString("LogIn", resourceCulture);
}
@ -271,7 +271,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Login.
/// </summary>
internal static string LogInNoun {
public static string LogInNoun {
get {
return ResourceManager.GetString("LogInNoun", resourceCulture);
}
@ -280,7 +280,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Log Out.
/// </summary>
internal static string LogOut {
public static string LogOut {
get {
return ResourceManager.GetString("LogOut", resourceCulture);
}
@ -289,7 +289,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Master Password.
/// </summary>
internal static string MasterPassword {
public static string MasterPassword {
get {
return ResourceManager.GetString("MasterPassword", resourceCulture);
}
@ -298,7 +298,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to More.
/// </summary>
internal static string More {
public static string More {
get {
return ResourceManager.GetString("More", resourceCulture);
}
@ -307,7 +307,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to My Vault.
/// </summary>
internal static string MyVault {
public static string MyVault {
get {
return ResourceManager.GetString("MyVault", resourceCulture);
}
@ -316,7 +316,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Name.
/// </summary>
internal static string Name {
public static string Name {
get {
return ResourceManager.GetString("Name", resourceCulture);
}
@ -325,7 +325,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to No.
/// </summary>
internal static string No {
public static string No {
get {
return ResourceManager.GetString("No", resourceCulture);
}
@ -334,7 +334,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Notes.
/// </summary>
internal static string Notes {
public static string Notes {
get {
return ResourceManager.GetString("Notes", resourceCulture);
}
@ -343,7 +343,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Ok.
/// </summary>
internal static string Ok {
public static string Ok {
get {
return ResourceManager.GetString("Ok", resourceCulture);
}
@ -352,7 +352,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Password.
/// </summary>
internal static string Password {
public static string Password {
get {
return ResourceManager.GetString("Password", resourceCulture);
}
@ -361,7 +361,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Save.
/// </summary>
internal static string Save {
public static string Save {
get {
return ResourceManager.GetString("Save", resourceCulture);
}
@ -370,7 +370,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Settings.
/// </summary>
internal static string Settings {
public static string Settings {
get {
return ResourceManager.GetString("Settings", resourceCulture);
}
@ -379,7 +379,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Show.
/// </summary>
internal static string Show {
public static string Show {
get {
return ResourceManager.GetString("Show", resourceCulture);
}
@ -388,7 +388,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Site has been deleted..
/// </summary>
internal static string SiteDeleted {
public static string SiteDeleted {
get {
return ResourceManager.GetString("SiteDeleted", resourceCulture);
}
@ -397,7 +397,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to No Name.
/// </summary>
internal static string SiteNoName {
public static string SiteNoName {
get {
return ResourceManager.GetString("SiteNoName", resourceCulture);
}
@ -406,7 +406,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Sync.
/// </summary>
internal static string Sync {
public static string Sync {
get {
return ResourceManager.GetString("Sync", resourceCulture);
}
@ -415,7 +415,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Tools.
/// </summary>
internal static string Tools {
public static string Tools {
get {
return ResourceManager.GetString("Tools", resourceCulture);
}
@ -424,7 +424,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to URI.
/// </summary>
internal static string URI {
public static string URI {
get {
return ResourceManager.GetString("URI", resourceCulture);
}
@ -433,7 +433,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Username.
/// </summary>
internal static string Username {
public static string Username {
get {
return ResourceManager.GetString("Username", resourceCulture);
}
@ -442,7 +442,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to The {0} field is required..
/// </summary>
internal static string ValidationFieldRequired {
public static string ValidationFieldRequired {
get {
return ResourceManager.GetString("ValidationFieldRequired", resourceCulture);
}
@ -451,7 +451,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to {0} has been copied..
/// </summary>
internal static string ValueHasBeenCopied {
public static string ValueHasBeenCopied {
get {
return ResourceManager.GetString("ValueHasBeenCopied", resourceCulture);
}
@ -460,7 +460,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to View.
/// </summary>
internal static string View {
public static string View {
get {
return ResourceManager.GetString("View", resourceCulture);
}
@ -469,7 +469,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Website.
/// </summary>
internal static string Website {
public static string Website {
get {
return ResourceManager.GetString("Website", resourceCulture);
}
@ -478,7 +478,7 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to Yes.
/// </summary>
internal static string Yes {
public static string Yes {
get {
return ResourceManager.GetString("Yes", resourceCulture);
}

View File

@ -0,0 +1,111 @@
using System;
using UIKit;
namespace Bit.iOS.Core.Views
{
public class FormEntryTableViewCell : UITableViewCell
{
public FormEntryTableViewCell(
string labelName = null,
bool useTextView = false,
nfloat? height = null)
: base(UITableViewCellStyle.Default, nameof(FormEntryTableViewCell))
{
var descriptor = UIFontDescriptor.PreferredBody;
var pointSize = descriptor.PointSize;
if(labelName != null)
{
Label = new UILabel
{
Text = labelName,
TranslatesAutoresizingMaskIntoConstraints = false,
Font = UIFont.FromDescriptor(descriptor, 0.8f * pointSize),
TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f)
};
ContentView.Add(Label);
}
if(useTextView)
{
TextView = new UITextView
{
TranslatesAutoresizingMaskIntoConstraints = false,
Font = UIFont.FromDescriptor(descriptor, pointSize)
};
ContentView.Add(TextView);
ContentView.AddConstraints(new NSLayoutConstraint[] {
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, TextView, NSLayoutAttribute.Trailing, 1f, 15f),
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextView, NSLayoutAttribute.Bottom, 1f, 10f)
});
if(labelName != null)
{
ContentView.AddConstraint(
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Bottom, 1f, 10f));
}
else
{
ContentView.AddConstraint(
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f));
}
if(height.HasValue)
{
ContentView.AddConstraint(
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, height.Value));
}
}
else
{
TextField = new UITextField
{
TranslatesAutoresizingMaskIntoConstraints = false,
BorderStyle = UITextBorderStyle.None,
Font = UIFont.FromDescriptor(descriptor, pointSize),
ClearButtonMode = UITextFieldViewMode.WhileEditing
};
ContentView.Add(TextField);
ContentView.AddConstraints(new NSLayoutConstraint[] {
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Trailing, 1f, 15f),
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Bottom, 1f, 10f)
});
if(labelName != null)
{
ContentView.AddConstraint(
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Bottom, 1f, 10f));
}
else
{
ContentView.AddConstraint(
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f));
}
if(height.HasValue)
{
ContentView.AddConstraint(
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, height.Value));
}
}
if(labelName != null)
{
ContentView.AddConstraints(new NSLayoutConstraint[] {
NSLayoutConstraint.Create(Label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
NSLayoutConstraint.Create(Label, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f),
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Trailing, 1f, 15f)
});
}
}
public UILabel Label { get; set; }
public UITextField TextField { get; set; }
public UITextView TextView { get; set; }
}
}

View File

@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using UIKit;
namespace Bit.iOS.Core.Views
{
public class PickerTableViewCell : UITableViewCell
{
public PickerTableViewCell(string labelName)
: base(UITableViewCellStyle.Default, nameof(PickerTableViewCell))
{
TextLabel.Text = labelName;
var entry = new UITextField { BorderStyle = UITextBorderStyle.RoundedRect };
entry.Started += Entry_Started;
entry.Ended += Entry_Ended;
var width = (float)UIScreen.MainScreen.Bounds.Width;
var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44))
{
BarStyle = UIBarStyle.Default,
Translucent = true
};
var spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (o, a) =>
{
var s = (PickerSource)Picker.Model;
if(s.SelectedIndex == -1 && Items != null && Items.Count > 0)
{
}
entry.ResignFirstResponder();
});
toolbar.SetItems(new[] { spacer, doneButton }, false);
entry.InputView = Picker;
entry.InputAccessoryView = toolbar;
}
public UIPickerView Picker { get; set; } = new UIPickerView();
public int MyProperty { get; set; }
public List<string> Items { get; set; } = new List<string>();
public int SelectedIndex { get; set; }
private void Entry_Ended(object sender, EventArgs e)
{
//throw new NotImplementedException();
}
private void Entry_Started(object sender, EventArgs e)
{
//throw new NotImplementedException();
}
private class PickerSource : UIPickerViewModel
{
readonly PickerTableViewCell _cell;
public PickerSource(PickerTableViewCell cell)
{
_cell = cell;
}
public int SelectedIndex { get; internal set; }
public string SelectedItem { get; internal set; }
public override nint GetComponentCount(UIPickerView picker)
{
return 1;
}
public override nint GetRowsInComponent(UIPickerView pickerView, nint component)
{
return _cell.Items != null ? _cell.Items.Count : 0;
}
public override string GetTitle(UIPickerView picker, nint row, nint component)
{
return _cell.Items[(int)row];
}
public override void Selected(UIPickerView picker, nint row, nint component)
{
if(_cell.Items.Count == 0)
{
SelectedItem = null;
SelectedIndex = -1;
}
else
{
SelectedItem = _cell.Items[(int)row];
SelectedIndex = (int)row;
}
//_renderer.UpdatePickerFromModel(this);
}
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using UIKit;
namespace Bit.iOS.Core.Views
{
public class SwitchTableViewCell : UITableViewCell
{
public SwitchTableViewCell(string labelName)
: base(UITableViewCellStyle.Default, nameof(SwitchTableViewCell))
{
TextLabel.Text = labelName;
AccessoryView = Switch;
}
public UISwitch Switch { get; set; } = new UISwitch();
}
}

View File

@ -67,6 +67,9 @@
<Compile Include="Services\KeyChainStorageService.cs" />
<Compile Include="Services\Settings.cs" />
<Compile Include="Services\SqlService.cs" />
<Compile Include="Views\PickerTableViewCell.cs" />
<Compile Include="Views\SwitchTableViewCell.cs" />
<Compile Include="Views\FormEntryTableViewCell.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />

View File

@ -4,13 +4,11 @@ using System.Diagnostics;
using System.Linq;
using Bit.App.Abstractions;
using Bit.App.Models;
using Bit.iOS.Core;
using Bit.App.Resources;
using Bit.iOS.Core.Views;
using Bit.iOS.Extension.Models;
using Foundation;
using MobileCoreServices;
using Newtonsoft.Json;
using UIKit;
using XLabs.Ioc;
namespace Bit.iOS.Extension
{
@ -20,35 +18,71 @@ namespace Bit.iOS.Extension
{ }
public Context Context { get; set; }
public FormEntryTableViewCell NameCell { get; set; } = new FormEntryTableViewCell(AppResources.Name);
public FormEntryTableViewCell UriCell { get; set; } = new FormEntryTableViewCell(AppResources.URI);
public FormEntryTableViewCell UsernameCell { get; set; } = new FormEntryTableViewCell(AppResources.Username);
public FormEntryTableViewCell PasswordCell { get; set; } = new FormEntryTableViewCell(AppResources.Password);
public UITableViewCell GeneratePasswordCell { get; set; } = new UITableViewCell(UITableViewCellStyle.Subtitle, "GeneratePasswordCell");
public SwitchTableViewCell FavoriteCell { get; set; } = new SwitchTableViewCell("Favorite");
public FormEntryTableViewCell NotesCell { get; set; } = new FormEntryTableViewCell(useTextView: true, height: 90);
public override void ViewWillAppear(bool animated)
{
UINavigationBar.Appearance.ShadowImage = new UIImage();
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
base.ViewWillAppear(animated);
}
public override void ViewDidLoad()
{
View.BackgroundColor = new UIColor(red: 0.93f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
nameField.Text = Context.Url.Host;
uriField.Text = Context.Url.ToString();
NameCell.TextField.Text = Context.Url.Host;
NameCell.TextField.ReturnKeyType = UIReturnKeyType.Next;
NameCell.TextField.ShouldReturn += (UITextField tf) =>
{
UriCell.TextField.BecomeFirstResponder();
return true;
};
UriCell.TextField.Text = Context.Url.ToString();
UriCell.TextField.KeyboardType = UIKeyboardType.Url;
UriCell.TextField.ReturnKeyType = UIReturnKeyType.Next;
UriCell.TextField.ShouldReturn += (UITextField tf) =>
{
UsernameCell.TextField.BecomeFirstResponder();
return true;
};
UsernameCell.TextField.BecomeFirstResponder();
UsernameCell.TextField.AutocapitalizationType = UITextAutocapitalizationType.None;
UsernameCell.TextField.AutocorrectionType = UITextAutocorrectionType.No;
UsernameCell.TextField.SpellCheckingType = UITextSpellCheckingType.No;
UsernameCell.TextField.ReturnKeyType = UIReturnKeyType.Next;
UsernameCell.TextField.ShouldReturn += (UITextField tf) =>
{
PasswordCell.TextField.BecomeFirstResponder();
return true;
};
PasswordCell.TextField.SecureTextEntry = true;
PasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Next;
PasswordCell.TextField.ShouldReturn += (UITextField tf) =>
{
NotesCell.TextView.BecomeFirstResponder();
return true;
};
GeneratePasswordCell.TextLabel.Text = "Generate Password";
GeneratePasswordCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
tableView.RowHeight = UITableView.AutomaticDimension;
tableView.EstimatedRowHeight = 44;
tableView.Source = new TableSource (this);
tableView.EstimatedRowHeight = 70;
tableView.Source = new TableSource(this);
base.ViewDidLoad();
}
public override void ViewDidAppear(bool animated)
{
usernameCell.BecomeFirstResponder();
base.ViewDidAppear(animated);
}
partial void UIBarButtonItem2289_Activated(UIBarButtonItem sender)
{
DismissViewController(true, null);
@ -63,58 +97,94 @@ namespace Bit.iOS.Extension
{
private AddSiteViewController _controller;
public TableSource (AddSiteViewController controller)
public TableSource(AddSiteViewController controller)
{
_controller = controller;
}
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
if (indexPath.Row == 0) {
return _controller.nameCell;
} else if (indexPath.Row == 1) {
return _controller.uriCell;
} else if (indexPath.Row == 2) {
return _controller.usernameCell;
} else if (indexPath.Row == 3) {
return _controller.passwordCell;
} else if (indexPath.Row == 4) {
return _controller.generatePasswordCell;
if(indexPath.Section == 0)
{
if(indexPath.Row == 0)
{
return _controller.NameCell;
}
else if(indexPath.Row == 1)
{
return _controller.UriCell;
}
else if(indexPath.Row == 2)
{
return _controller.UsernameCell;
}
else if(indexPath.Row == 3)
{
return _controller.PasswordCell;
}
else if(indexPath.Row == 4)
{
return _controller.GeneratePasswordCell;
}
}
else if(indexPath.Section == 1)
{
if(indexPath.Row == 1)
{
return _controller.FavoriteCell;
}
}
else if(indexPath.Section == 2)
{
return _controller.NotesCell;
}
return new UITableViewCell();
}
public override nfloat GetHeightForRow (UITableView tableView, NSIndexPath indexPath)
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return UITableView.AutomaticDimension;
}
public override nint RowsInSection (UITableView tableview, nint section)
public override nint NumberOfSections(UITableView tableView)
{
if (section == 0) {
return 3;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
if(section == 0)
{
return 5;
} else if (section == 1) {
}
else if(section == 1)
{
return 2;
} else {
}
else
{
return 1;
}
}
public override nfloat GetHeightForHeader (UITableView tableView, nint section)
public override nfloat GetHeightForHeader(UITableView tableView, nint section)
{
return UITableView.AutomaticDimension;
}
}
public override string TitleForHeader (UITableView tableView, nint section)
public override string TitleForHeader(UITableView tableView, nint section)
{
if (section == 0) {
if(section == 0)
{
return "Site Information";
} else if (section == 2) {
}
else if(section == 2)
{
return "Notes";
}
return " ";
return null;
}
}
}

View File

@ -14,50 +14,10 @@ namespace Bit.iOS.Extension
[Register ("AddSiteViewController")]
partial class AddSiteViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITableViewCell generatePasswordCell { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITableViewCell nameCell { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITextField nameField { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UILabel nameLabel { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITableViewCell passwordCell { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITextField passwordField { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITableView tableView { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITableViewCell uriCell { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITextField uriField { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITableViewCell usernameCell { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UITextField usernameField { get; set; }
[Action ("UIBarButtonItem2289_Activated:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void UIBarButtonItem2289_Activated (UIBarButtonItem sender);
@ -68,50 +28,10 @@ namespace Bit.iOS.Extension
void ReleaseDesignerOutlets ()
{
if (generatePasswordCell != null) {
generatePasswordCell.Dispose ();
generatePasswordCell = null;
}
if (nameCell != null) {
nameCell.Dispose ();
nameCell = null;
}
if (nameField != null) {
nameField.Dispose ();
nameField = null;
}
if (nameLabel != null) {
nameLabel.Dispose ();
nameLabel = null;
}
if (passwordCell != null) {
passwordCell.Dispose ();
passwordCell = null;
}
if (passwordField != null) {
passwordField.Dispose ();
passwordField = null;
}
if (tableView != null) {
tableView.Dispose ();
tableView = null;
}
if (uriCell != null) {
uriCell.Dispose ();
uriCell = null;
}
if (uriField != null) {
uriField.Dispose ();
uriField = null;
}
if (usernameCell != null) {
usernameCell.Dispose ();
usernameCell = null;
}
if (usernameField != null) {
usernameField.Dispose ();
usernameField = null;
}
}
}
}

View File

@ -30,7 +30,7 @@ namespace Bit.iOS.Extension
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.BackgroundColor = new UIColor(red: 0.93f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
_context.ExtContext = ExtensionContext;
if(!Resolver.IsSet)

View File

@ -200,189 +200,7 @@
<outlet property="dataSource" destination="2087" id="2089"/>
<outlet property="delegate" destination="2087" id="2090"/>
</connections>
<sections>
<tableViewSection headerTitle="Site Information" id="2266" footerTitle=" ">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2267" rowHeight="80">
<rect key="frame" x="0.0" y="55.5" width="600" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2267" id="2268">
<rect key="frame" x="0.0" y="0.0" width="600" height="79.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Name" lineBreakMode="tailTruncation" minimumFontSize="10" id="2316" translatesAutoresizingMaskIntoConstraints="NO">
<rect key="frame" x="15" y="10" width="570" height="21"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" id="2317" translatesAutoresizingMaskIntoConstraints="NO" preservesSuperviewLayoutMargins="YES" clearButtonMode="whileEditing">
<rect key="frame" x="15" y="41" width="570" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
<constraints>
<constraint id="2318" firstItem="2317" firstAttribute="leading" secondItem="2268" secondAttribute="leading" constant="15"/>
<constraint id="2319" firstItem="2268" firstAttribute="trailing" secondItem="2317" secondAttribute="trailing" constant="15"/>
<constraint id="2320" firstItem="2268" firstAttribute="bottom" secondItem="2317" secondAttribute="bottom" constant="10"/>
<constraint id="2323" firstItem="2268" firstAttribute="trailing" secondItem="2316" secondAttribute="trailing" constant="15"/>
<constraint id="2325" firstItem="2316" firstAttribute="leading" secondItem="2268" secondAttribute="leading" constant="15"/>
<constraint id="2326" firstItem="2316" firstAttribute="top" secondItem="2268" secondAttribute="top" constant="10"/>
<constraint id="2328" firstItem="2317" firstAttribute="top" secondItem="2316" secondAttribute="bottom" constant="10"/>
</constraints>
</tableViewCellContentView>
<edgeInsets key="layoutMargins" top="10" left="15" bottom="10" right="15"/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2351" rowHeight="80">
<rect key="frame" x="0.0" y="135.5" width="600" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2351" id="2352">
<rect key="frame" x="0.0" y="0.0" width="600" height="79.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="URI" lineBreakMode="tailTruncation" minimumFontSize="10" id="2353" translatesAutoresizingMaskIntoConstraints="NO">
<rect key="frame" x="15" y="10" width="570" height="21"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" id="2354" translatesAutoresizingMaskIntoConstraints="NO" preservesSuperviewLayoutMargins="YES" clearButtonMode="whileEditing">
<rect key="frame" x="15" y="41" width="570" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
<constraints>
<constraint id="2355" firstItem="2354" firstAttribute="leading" secondItem="2352" secondAttribute="leading" constant="15"/>
<constraint id="2356" firstItem="2352" firstAttribute="trailing" secondItem="2354" secondAttribute="trailing" constant="15"/>
<constraint id="2357" firstItem="2352" firstAttribute="bottom" secondItem="2354" secondAttribute="bottom" constant="10"/>
<constraint id="2358" firstItem="2352" firstAttribute="trailing" secondItem="2353" secondAttribute="trailing" constant="15"/>
<constraint id="2359" firstItem="2353" firstAttribute="leading" secondItem="2352" secondAttribute="leading" constant="15"/>
<constraint id="2360" firstItem="2353" firstAttribute="top" secondItem="2352" secondAttribute="top" constant="10"/>
<constraint id="2361" firstItem="2354" firstAttribute="top" secondItem="2353" secondAttribute="bottom" constant="10"/>
</constraints>
</tableViewCellContentView>
<edgeInsets key="layoutMargins" top="10" left="15" bottom="10" right="15"/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2362" rowHeight="80">
<rect key="frame" x="0.0" y="215.5" width="600" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2362" id="2363">
<rect key="frame" x="0.0" y="0.0" width="600" height="79.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Username" lineBreakMode="tailTruncation" minimumFontSize="10" id="2364" translatesAutoresizingMaskIntoConstraints="NO">
<rect key="frame" x="15" y="10" width="570" height="21"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" id="2365" translatesAutoresizingMaskIntoConstraints="NO" preservesSuperviewLayoutMargins="YES" clearButtonMode="whileEditing">
<rect key="frame" x="15" y="41" width="570" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
<constraints>
<constraint id="2366" firstItem="2365" firstAttribute="leading" secondItem="2363" secondAttribute="leading" constant="15"/>
<constraint id="2367" firstItem="2363" firstAttribute="trailing" secondItem="2365" secondAttribute="trailing" constant="15"/>
<constraint id="2368" firstItem="2363" firstAttribute="bottom" secondItem="2365" secondAttribute="bottom" constant="10"/>
<constraint id="2369" firstItem="2363" firstAttribute="trailing" secondItem="2364" secondAttribute="trailing" constant="15"/>
<constraint id="2370" firstItem="2364" firstAttribute="leading" secondItem="2363" secondAttribute="leading" constant="15"/>
<constraint id="2371" firstItem="2364" firstAttribute="top" secondItem="2363" secondAttribute="top" constant="10"/>
<constraint id="2372" firstItem="2365" firstAttribute="top" secondItem="2364" secondAttribute="bottom" constant="10"/>
</constraints>
</tableViewCellContentView>
<edgeInsets key="layoutMargins" top="10" left="15" bottom="10" right="15"/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2373" rowHeight="80">
<rect key="frame" x="0.0" y="295.5" width="600" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2373" id="2374">
<rect key="frame" x="0.0" y="0.0" width="600" height="79.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Password" lineBreakMode="tailTruncation" minimumFontSize="10" id="2375" translatesAutoresizingMaskIntoConstraints="NO">
<rect key="frame" x="15" y="10" width="570" height="21"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" id="2376" translatesAutoresizingMaskIntoConstraints="NO" preservesSuperviewLayoutMargins="YES" clearButtonMode="whileEditing">
<rect key="frame" x="15" y="41" width="570" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
<constraints>
<constraint id="2377" firstItem="2376" firstAttribute="leading" secondItem="2374" secondAttribute="leading" constant="15"/>
<constraint id="2378" firstItem="2374" firstAttribute="trailing" secondItem="2376" secondAttribute="trailing" constant="15"/>
<constraint id="2379" firstItem="2374" firstAttribute="bottom" secondItem="2376" secondAttribute="bottom" constant="10"/>
<constraint id="2380" firstItem="2374" firstAttribute="trailing" secondItem="2375" secondAttribute="trailing" constant="15"/>
<constraint id="2381" firstItem="2375" firstAttribute="leading" secondItem="2374" secondAttribute="leading" constant="15"/>
<constraint id="2382" firstItem="2375" firstAttribute="top" secondItem="2374" secondAttribute="top" constant="10"/>
<constraint id="2383" firstItem="2376" firstAttribute="top" secondItem="2375" secondAttribute="bottom" constant="10"/>
</constraints>
</tableViewCellContentView>
<edgeInsets key="layoutMargins" top="10" left="15" bottom="10" right="15"/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2305" rowHeight="44" style="IBUITableViewCellStyleDefault" textLabel="2307" accessoryType="disclosureIndicator">
<rect key="frame" x="0.0" y="375.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2305" id="2306">
<rect key="frame" x="0.0" y="0.0" width="562" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Generate Password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2307">
<rect key="frame" x="20" y="0.0" width="542" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection id="2273" headerTitle=" " footerTitle=" ">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2274" rowHeight="44">
<rect key="frame" x="0.0" y="944.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2274" id="2275">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2276" rowHeight="44">
<rect key="frame" x="0.0" y="988.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2276" id="2277">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="Notes" id="2282" footerTitle=" ">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2283" rowHeight="44">
<rect key="frame" x="0.0" y="1271.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2283" id="2284">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<sections/>
<color key="sectionIndexBackgroundColor" colorSpace="calibratedWhite" white="0" alpha="0"/>
</tableView>
<navigationItem title="Add Site" id="2252" key="navigationItem">
@ -401,16 +219,6 @@
</navigationItem>
<connections>
<outlet property="tableView" destination="2088" id="name-outlet-2088"/>
<outlet property="nameField" destination="2317" id="name-outlet-2317"/>
<outlet property="nameLabel" destination="2316" id="name-outlet-2316"/>
<outlet property="nameCell" destination="2267" id="name-outlet-2267"/>
<outlet property="uriCell" destination="2351" id="name-outlet-2351"/>
<outlet property="usernameCell" destination="2362" id="name-outlet-2362"/>
<outlet property="passwordCell" destination="2373" id="name-outlet-2373"/>
<outlet property="generatePasswordCell" destination="2305" id="name-outlet-2305"/>
<outlet property="uriField" destination="2354" id="name-outlet-2354"/>
<outlet property="usernameField" destination="2365" id="name-outlet-2365"/>
<outlet property="passwordField" destination="2376" id="name-outlet-2376"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2093" userLabel="First Responder" sceneMemberID="firstResponder"/>