1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-11 14:37:51 +01:00

return type field focus on cipher add/edit

This commit is contained in:
Kyle Spearrin 2019-05-31 14:10:49 -04:00
parent 81b8c1716f
commit fc0d91d3e7
2 changed files with 86 additions and 0 deletions

View File

@ -68,6 +68,7 @@
Text="{u:I18n Name}" Text="{u:I18n Name}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_nameEntry"
Text="{Binding Cipher.Name}" Text="{Binding Cipher.Name}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -77,6 +78,7 @@
Text="{u:I18n Username}" Text="{u:I18n Username}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_loginUsernameEntry"
Text="{Binding Cipher.Login.Username}" Text="{Binding Cipher.Login.Username}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -97,6 +99,7 @@
Grid.Row="0" Grid.Row="0"
Grid.Column="0" /> Grid.Column="0" />
<controls:MonoEntry <controls:MonoEntry
x:Name="_loginPasswordEntry"
Text="{Binding Cipher.Login.Password}" Text="{Binding Cipher.Login.Password}"
StyleClass="box-value" StyleClass="box-value"
Grid.Row="1" Grid.Row="1"
@ -140,6 +143,7 @@
Grid.Row="0" Grid.Row="0"
Grid.Column="0" /> Grid.Column="0" />
<controls:MonoEntry <controls:MonoEntry
x:Name="_loginTotpEntry"
Text="{Binding Cipher.Login.Totp}" Text="{Binding Cipher.Login.Totp}"
StyleClass="box-value" StyleClass="box-value"
Grid.Row="1" Grid.Row="1"
@ -159,6 +163,7 @@
Text="{u:I18n CardholderName}" Text="{u:I18n CardholderName}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_cardholderNameEntry"
Text="{Binding Cipher.Card.CardholderName}" Text="{Binding Cipher.Card.CardholderName}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -167,6 +172,7 @@
Text="{u:I18n Number}" Text="{u:I18n Number}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_cardNumberEntry"
Text="{Binding Cipher.Card.Number}" Text="{Binding Cipher.Card.Number}"
StyleClass="box-value" StyleClass="box-value"
Keyboard="Numeric" /> Keyboard="Numeric" />
@ -196,6 +202,7 @@
Text="{u:I18n ExpirationYear}" Text="{u:I18n ExpirationYear}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_cardExpYearEntry"
Text="{Binding Cipher.Card.ExpYear}" Text="{Binding Cipher.Card.ExpYear}"
StyleClass="box-value" StyleClass="box-value"
Keyboard="Numeric" /> Keyboard="Numeric" />
@ -215,6 +222,7 @@
Grid.Row="0" Grid.Row="0"
Grid.Column="0" /> Grid.Column="0" />
<controls:MonoEntry <controls:MonoEntry
x:Name="_cardCodeEntry"
Text="{Binding Cipher.Card.Code}" Text="{Binding Cipher.Card.Code}"
StyleClass="box-value" StyleClass="box-value"
Grid.Row="1" Grid.Row="1"
@ -246,6 +254,7 @@
Text="{u:I18n FirstName}" Text="{u:I18n FirstName}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityFirstNameEntry"
Text="{Binding Cipher.Identity.FirstName}" Text="{Binding Cipher.Identity.FirstName}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -254,6 +263,7 @@
Text="{u:I18n MiddleName}" Text="{u:I18n MiddleName}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityMiddleNameEntry"
Text="{Binding Cipher.Identity.MiddleName}" Text="{Binding Cipher.Identity.MiddleName}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -262,6 +272,7 @@
Text="{u:I18n LastName}" Text="{u:I18n LastName}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityLastNameEntry"
Text="{Binding Cipher.Identity.LastName}" Text="{Binding Cipher.Identity.LastName}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -270,6 +281,7 @@
Text="{u:I18n Username}" Text="{u:I18n Username}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityUsernameEntry"
Text="{Binding Cipher.Identity.Username}" Text="{Binding Cipher.Identity.Username}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -278,6 +290,7 @@
Text="{u:I18n Company}" Text="{u:I18n Company}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityCompanyEntry"
Text="{Binding Cipher.Identity.Company}" Text="{Binding Cipher.Identity.Company}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -286,6 +299,7 @@
Text="{u:I18n SSN}" Text="{u:I18n SSN}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identitySsnEntry"
Text="{Binding Cipher.Identity.SSN}" Text="{Binding Cipher.Identity.SSN}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -294,6 +308,7 @@
Text="{u:I18n PassportNumber}" Text="{u:I18n PassportNumber}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityPassportNumberEntry"
Text="{Binding Cipher.Identity.PassportNumber}" Text="{Binding Cipher.Identity.PassportNumber}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -302,6 +317,7 @@
Text="{u:I18n LicenseNumber}" Text="{u:I18n LicenseNumber}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityLicenseNumberEntry"
Text="{Binding Cipher.Identity.LicenseNumber}" Text="{Binding Cipher.Identity.LicenseNumber}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -310,6 +326,7 @@
Text="{u:I18n Email}" Text="{u:I18n Email}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityEmailEntry"
Text="{Binding Cipher.Identity.Email}" Text="{Binding Cipher.Identity.Email}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -318,6 +335,7 @@
Text="{u:I18n Phone}" Text="{u:I18n Phone}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityPhoneEntry"
Text="{Binding Cipher.Identity.Phone}" Text="{Binding Cipher.Identity.Phone}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -326,6 +344,7 @@
Text="{u:I18n Address1}" Text="{u:I18n Address1}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityAddress1Entry"
Text="{Binding Cipher.Identity.Address1}" Text="{Binding Cipher.Identity.Address1}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -334,6 +353,7 @@
Text="{u:I18n Address2}" Text="{u:I18n Address2}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityAddress2Entry"
Text="{Binding Cipher.Identity.Address2}" Text="{Binding Cipher.Identity.Address2}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -342,6 +362,7 @@
Text="{u:I18n Address3}" Text="{u:I18n Address3}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityAddress3Entry"
Text="{Binding Cipher.Identity.Address3}" Text="{Binding Cipher.Identity.Address3}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -350,6 +371,7 @@
Text="{u:I18n CityTown}" Text="{u:I18n CityTown}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityCityEntry"
Text="{Binding Cipher.Identity.City}" Text="{Binding Cipher.Identity.City}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -358,6 +380,7 @@
Text="{u:I18n StateProvince}" Text="{u:I18n StateProvince}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityStateEntry"
Text="{Binding Cipher.Identity.State}" Text="{Binding Cipher.Identity.State}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -366,6 +389,7 @@
Text="{u:I18n ZipPostalCode}" Text="{u:I18n ZipPostalCode}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityPostalCodeEntry"
Text="{Binding Cipher.Identity.PostalCode}" Text="{Binding Cipher.Identity.PostalCode}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -374,6 +398,7 @@
Text="{u:I18n Country}" Text="{u:I18n Country}"
StyleClass="box-label" /> StyleClass="box-label" />
<Entry <Entry
x:Name="_identityCountryEntry"
Text="{Binding Cipher.Identity.Country}" Text="{Binding Cipher.Identity.Country}"
StyleClass="box-value" /> StyleClass="box-value" />
</StackLayout> </StackLayout>
@ -456,6 +481,7 @@
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row, box-row-input"> <StackLayout StyleClass="box-row, box-row-input">
<Editor <Editor
x:Name="_notesEditor"
Text="{Binding Cipher.Notes}" Text="{Binding Cipher.Notes}"
StyleClass="box-value" StyleClass="box-value"
HeightRequest="200" /> HeightRequest="200" />

View File

@ -47,6 +47,62 @@ namespace Bit.App.Pages
_identityTitlePicker.ItemDisplayBinding = new Binding("Key"); _identityTitlePicker.ItemDisplayBinding = new Binding("Key");
_folderPicker.ItemDisplayBinding = new Binding("Key"); _folderPicker.ItemDisplayBinding = new Binding("Key");
_ownershipPicker.ItemDisplayBinding = new Binding("Key"); _ownershipPicker.ItemDisplayBinding = new Binding("Key");
_nameEntry.ReturnType = ReturnType.Next;
_nameEntry.ReturnCommand = new Command(() =>
{
if(_vm.Cipher.Type == CipherType.Login)
{
_loginUsernameEntry.Focus();
}
else if(_vm.Cipher.Type == CipherType.Card)
{
_cardholderNameEntry.Focus();
}
});
_loginUsernameEntry.ReturnType = ReturnType.Next;
_loginUsernameEntry.ReturnCommand = new Command(() => _loginPasswordEntry.Focus());
_loginPasswordEntry.ReturnType = ReturnType.Next;
_loginPasswordEntry.ReturnCommand = new Command(() => _loginTotpEntry.Focus());
_cardholderNameEntry.ReturnType = ReturnType.Next;
_cardholderNameEntry.ReturnCommand = new Command(() => _cardNumberEntry.Focus());
_cardExpYearEntry.ReturnType = ReturnType.Next;
_cardExpYearEntry.ReturnCommand = new Command(() => _cardCodeEntry.Focus());
_identityFirstNameEntry.ReturnType = ReturnType.Next;
_identityFirstNameEntry.ReturnCommand = new Command(() => _identityMiddleNameEntry.Focus());
_identityMiddleNameEntry.ReturnType = ReturnType.Next;
_identityMiddleNameEntry.ReturnCommand = new Command(() => _identityLastNameEntry.Focus());
_identityLastNameEntry.ReturnType = ReturnType.Next;
_identityLastNameEntry.ReturnCommand = new Command(() => _identityUsernameEntry.Focus());
_identityUsernameEntry.ReturnType = ReturnType.Next;
_identityUsernameEntry.ReturnCommand = new Command(() => _identityCompanyEntry.Focus());
_identityCompanyEntry.ReturnType = ReturnType.Next;
_identityCompanyEntry.ReturnCommand = new Command(() => _identitySsnEntry.Focus());
_identitySsnEntry.ReturnType = ReturnType.Next;
_identitySsnEntry.ReturnCommand = new Command(() => _identityPassportNumberEntry.Focus());
_identityPassportNumberEntry.ReturnType = ReturnType.Next;
_identityPassportNumberEntry.ReturnCommand = new Command(() => _identityLicenseNumberEntry.Focus());
_identityLicenseNumberEntry.ReturnType = ReturnType.Next;
_identityLicenseNumberEntry.ReturnCommand = new Command(() => _identityEmailEntry.Focus());
_identityEmailEntry.ReturnType = ReturnType.Next;
_identityEmailEntry.ReturnCommand = new Command(() => _identityPhoneEntry.Focus());
_identityPhoneEntry.ReturnType = ReturnType.Next;
_identityPhoneEntry.ReturnCommand = new Command(() => _identityAddress1Entry.Focus());
_identityAddress1Entry.ReturnType = ReturnType.Next;
_identityAddress1Entry.ReturnCommand = new Command(() => _identityAddress2Entry.Focus());
_identityAddress2Entry.ReturnType = ReturnType.Next;
_identityAddress2Entry.ReturnCommand = new Command(() => _identityAddress3Entry.Focus());
_identityAddress3Entry.ReturnType = ReturnType.Next;
_identityAddress3Entry.ReturnCommand = new Command(() => _identityCityEntry.Focus());
_identityCityEntry.ReturnType = ReturnType.Next;
_identityCityEntry.ReturnCommand = new Command(() => _identityStateEntry.Focus());
_identityStateEntry.ReturnType = ReturnType.Next;
_identityStateEntry.ReturnCommand = new Command(() => _identityPostalCodeEntry.Focus());
_identityPostalCodeEntry.ReturnType = ReturnType.Next;
_identityPostalCodeEntry.ReturnCommand = new Command(() => _identityCountryEntry.Focus());
} }
public bool FromAutofillFramework { get; set; } public bool FromAutofillFramework { get; set; }
@ -61,6 +117,10 @@ namespace Bit.App.Pages
{ {
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
else if(!_vm.EditMode)
{
RequestFocus(_nameEntry);
}
}); });
if(_vm.EditMode && Device.RuntimePlatform == Device.Android) if(_vm.EditMode && Device.RuntimePlatform == Device.Android)
{ {