mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
ios extended entry options. next button actions for add site page
This commit is contained in:
parent
8e8272c6fd
commit
7ce1eec96d
6 changed files with 72 additions and 13 deletions
|
@ -60,6 +60,7 @@
|
|||
<Compile Include="Controls\LabeledValueCell.cs" />
|
||||
<Compile Include="Controls\FormPickerCell.cs" />
|
||||
<Compile Include="Controls\FormEntryCell.cs" />
|
||||
<Compile Include="Enums\ReturnType.cs" />
|
||||
<Compile Include="Models\Api\ApiError.cs" />
|
||||
<Compile Include="Models\Api\ApiResult.cs" />
|
||||
<Compile Include="Models\Api\Request\FolderRequest.cs" />
|
||||
|
@ -221,9 +222,7 @@
|
|||
<LastGenOutput>AppResources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Enums\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<Import Project="..\..\packages\Xamarin.Forms.2.2.0.31\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.2.0.31\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Bit.App.Enums;
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
|
@ -40,5 +41,9 @@ namespace Bit.App.Controls
|
|||
get { return (int)GetValue(MaxLengthProperty); }
|
||||
set { SetValue(MaxLengthProperty, value); }
|
||||
}
|
||||
|
||||
public ReturnType? ReturnType { get; set; }
|
||||
public bool? Autocorrect { get; set; }
|
||||
public bool DisableAutocapitalize { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
using Xamarin.Forms;
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class FormEntryCell : ExtendedViewCell
|
||||
{
|
||||
public FormEntryCell(string labelText, Keyboard entryKeyboard = null, bool IsPassword = false)
|
||||
public FormEntryCell(string labelText, Keyboard entryKeyboard = null, bool IsPassword = false, VisualElement nextElement = null)
|
||||
{
|
||||
Label = new Label
|
||||
{
|
||||
|
@ -18,9 +19,17 @@ namespace Bit.App.Controls
|
|||
{
|
||||
Keyboard = entryKeyboard,
|
||||
HasBorder = false,
|
||||
VerticalOptions = LayoutOptions.CenterAndExpand
|
||||
VerticalOptions = LayoutOptions.CenterAndExpand,
|
||||
IsPassword = IsPassword,
|
||||
TextColor = Color.FromHex("333333")
|
||||
};
|
||||
|
||||
if(nextElement != null)
|
||||
{
|
||||
Entry.ReturnType = Enums.ReturnType.Next;
|
||||
Entry.Completed += (object sender, EventArgs e) => { nextElement.Focus(); };
|
||||
}
|
||||
|
||||
var stackLayout = new StackLayout
|
||||
{
|
||||
Padding = new Thickness(15)
|
||||
|
|
11
src/App/Enums/ReturnType.cs
Normal file
11
src/App/Enums/ReturnType.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Bit.App.Enums
|
||||
{
|
||||
public enum ReturnType
|
||||
{
|
||||
Return,
|
||||
Done,
|
||||
Go,
|
||||
Next,
|
||||
Search
|
||||
}
|
||||
}
|
|
@ -31,10 +31,13 @@ namespace Bit.App.Pages
|
|||
|
||||
private void Init()
|
||||
{
|
||||
var uriCell = new FormEntryCell(AppResources.URI, Keyboard.Url);
|
||||
var nameCell = new FormEntryCell(AppResources.Name);
|
||||
var usernameCell = new FormEntryCell(AppResources.Username);
|
||||
var passwordCell = new FormEntryCell(AppResources.Password, IsPassword: true);
|
||||
var notesCell = new FormEditorCell(height: 90);
|
||||
var passwordCell = new FormEntryCell(AppResources.Password, IsPassword: true, nextElement: notesCell.Editor);
|
||||
var usernameCell = new FormEntryCell(AppResources.Username, nextElement: passwordCell.Entry);
|
||||
usernameCell.Entry.DisableAutocapitalize = true;
|
||||
usernameCell.Entry.Autocorrect = false;
|
||||
var uriCell = new FormEntryCell(AppResources.URI, Keyboard.Url, nextElement: usernameCell.Entry);
|
||||
var nameCell = new FormEntryCell(AppResources.Name, nextElement: uriCell.Entry);
|
||||
|
||||
var folderOptions = new List<string> { AppResources.FolderNone };
|
||||
var folders = _folderService.GetAllAsync().GetAwaiter().GetResult().OrderBy(f => f.Name?.Decrypt());
|
||||
|
@ -44,8 +47,6 @@ namespace Bit.App.Pages
|
|||
}
|
||||
var folderCell = new FormPickerCell(AppResources.Folder, folderOptions.ToArray());
|
||||
|
||||
var notesCell = new FormEditorCell(height: 90);
|
||||
|
||||
var mainTable = new ExtendedTableView
|
||||
{
|
||||
Intent = TableIntent.Settings,
|
||||
|
|
|
@ -23,6 +23,40 @@ namespace Bit.iOS.Controls
|
|||
{
|
||||
SetBorder(view);
|
||||
SetMaxLength(view);
|
||||
|
||||
if(view.DisableAutocapitalize)
|
||||
{
|
||||
Control.AutocapitalizationType = UITextAutocapitalizationType.None;
|
||||
}
|
||||
|
||||
if(view.Autocorrect.HasValue)
|
||||
{
|
||||
Control.AutocorrectionType = view.Autocorrect.Value ? UITextAutocorrectionType.Yes : UITextAutocorrectionType.No;
|
||||
}
|
||||
|
||||
if(view.ReturnType.HasValue)
|
||||
{
|
||||
switch(view.ReturnType.Value)
|
||||
{
|
||||
case App.Enums.ReturnType.Return:
|
||||
Control.ReturnKeyType = UIReturnKeyType.Default;
|
||||
break;
|
||||
case App.Enums.ReturnType.Done:
|
||||
Control.ReturnKeyType = UIReturnKeyType.Done;
|
||||
break;
|
||||
case App.Enums.ReturnType.Go:
|
||||
Control.ReturnKeyType = UIReturnKeyType.Go;
|
||||
break;
|
||||
case App.Enums.ReturnType.Next:
|
||||
Control.ReturnKeyType = UIReturnKeyType.Next;
|
||||
break;
|
||||
case App.Enums.ReturnType.Search:
|
||||
Control.ReturnKeyType = UIReturnKeyType.Search;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue