1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-27 05:33:23 +00:00

select focus inputs in table cells. load folders into picker cell.

This commit is contained in:
Kyle Spearrin
2016-07-12 23:55:52 -04:00
parent 4723e6a101
commit ae79eb6a96
5 changed files with 58 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ using UIKit;
namespace Bit.iOS.Core.Views
{
public class FormEntryTableViewCell : UITableViewCell
public class FormEntryTableViewCell : UITableViewCell, ISelectable
{
public FormEntryTableViewCell(
string labelName = null,
@@ -107,5 +107,17 @@ namespace Bit.iOS.Core.Views
public UILabel Label { get; set; }
public UITextField TextField { get; set; }
public UITextView TextView { get; set; }
public void Select()
{
if(TextView != null)
{
TextView.BecomeFirstResponder();
}
else if(TextField != null)
{
TextField.BecomeFirstResponder();
}
}
}
}

View File

@@ -0,0 +1,7 @@
namespace Bit.iOS.Core.Views
{
public interface ISelectable
{
void Select();
}
}

View File

@@ -6,10 +6,10 @@ using UIKit;
namespace Bit.iOS.Core.Views
{
public class PickerTableViewCell : UITableViewCell
public class PickerTableViewCell : UITableViewCell, ISelectable
{
private List<string> _items = new List<string>();
private int _selectedIndex = -1;
private int _selectedIndex = 0;
public PickerTableViewCell(
string labelName,
@@ -35,8 +35,6 @@ namespace Bit.iOS.Core.Views
TranslatesAutoresizingMaskIntoConstraints = false,
Font = UIFont.FromDescriptor(descriptor, pointSize)
};
TextField.Started += Entry_Started;
TextField.Ended += Entry_Ended;
var width = (float)UIScreen.MainScreen.Bounds.Width;
var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44))
@@ -134,14 +132,9 @@ namespace Bit.iOS.Core.Views
Picker.Select(Math.Max(formsIndex, 0), 0, true);
}
private void Entry_Ended(object sender, EventArgs e)
public void Select()
{
//throw new NotImplementedException();
}
private void Entry_Started(object sender, EventArgs e)
{
//throw new NotImplementedException();
TextField?.BecomeFirstResponder();
}
private class NoCaretField : UITextField

View File

@@ -68,6 +68,7 @@
<Compile Include="Services\Settings.cs" />
<Compile Include="Services\SqlService.cs" />
<Compile Include="Utilities\Dialogs.cs" />
<Compile Include="Views\ISelectable.cs" />
<Compile Include="Views\PickerTableViewCell.cs" />
<Compile Include="Views\SwitchTableViewCell.cs" />
<Compile Include="Views\FormEntryTableViewCell.cs" />