mirror of
https://github.com/bitwarden/android.git
synced 2024-11-01 07:35:52 +03:00
changes based on add/edit mode
This commit is contained in:
parent
74c0e52458
commit
253217cf20
3 changed files with 25 additions and 13 deletions
|
@ -16,8 +16,15 @@
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
<ContentPage.ToolbarItems>
|
||||||
<ToolbarItem Text="{u:I18n Save}" Clicked="Save_Clicked" Order="Primary" />
|
<ToolbarItem Text="{u:I18n Save}" Clicked="Save_Clicked" Order="Primary" />
|
||||||
<ToolbarItem Text="{u:I18n Attachments}" Clicked="Attachments_Clicked" Order="Secondary" />
|
<ToolbarItem Text="{u:I18n Attachments}"
|
||||||
<ToolbarItem Text="{u:I18n Delete}" Clicked="Delete_Clicked" Order="Secondary" IsDestructive="True" />
|
Clicked="Attachments_Clicked"
|
||||||
|
Order="Secondary"
|
||||||
|
x:Name="_attachmentsItem" />
|
||||||
|
<ToolbarItem Text="{u:I18n Delete}"
|
||||||
|
Clicked="Delete_Clicked"
|
||||||
|
Order="Secondary"
|
||||||
|
IsDestructive="True"
|
||||||
|
x:Name="_deleteItem" />
|
||||||
</ContentPage.ToolbarItems>
|
</ContentPage.ToolbarItems>
|
||||||
|
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
|
@ -512,7 +519,7 @@
|
||||||
<Button Text="{u:I18n NewCustomField}" StyleClass="box-button-row"
|
<Button Text="{u:I18n NewCustomField}" StyleClass="box-button-row"
|
||||||
Clicked="NewField_Clicked"></Button>
|
Clicked="NewField_Clicked"></Button>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout StyleClass="box">
|
<StackLayout StyleClass="box" IsVisible="{Binding EditMode, Converter={StaticResource inverseBool}}">
|
||||||
<StackLayout StyleClass="box-row-header">
|
<StackLayout StyleClass="box-row-header">
|
||||||
<Label Text="{u:I18n Ownership}"
|
<Label Text="{u:I18n Ownership}"
|
||||||
StyleClass="box-header, box-header-platform" />
|
StyleClass="box-header, box-header-platform" />
|
||||||
|
@ -528,14 +535,13 @@
|
||||||
StyleClass="box-value" />
|
StyleClass="box-value" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout StyleClass="box"
|
<StackLayout StyleClass="box" IsVisible="{Binding ShowCollections}">
|
||||||
IsVisible="{Binding Cipher.OrganizationId, Converter={StaticResource notNull}}">
|
|
||||||
<StackLayout StyleClass="box-row-header">
|
<StackLayout StyleClass="box-row-header">
|
||||||
<Label Text="{u:I18n Collections}"
|
<Label Text="{u:I18n Collections}"
|
||||||
StyleClass="box-header, box-header-platform" />
|
StyleClass="box-header, box-header-platform" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout Spacing="0" Padding="0"
|
<StackLayout Spacing="0" Padding="0"
|
||||||
IsVisible="{Binding HasCollections, Converter={StaticResource inverseBool}}">
|
IsVisible="{Binding HasCollections, Converter={StaticResource inverseBool}}">
|
||||||
<StackLayout StyleClass="box-row, box-row-switch">
|
<StackLayout StyleClass="box-row, box-row-switch">
|
||||||
<Label Text="{u:I18n NoCollectionsToList}" />
|
<Label Text="{u:I18n NoCollectionsToList}" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
|
@ -23,6 +23,11 @@ namespace Bit.App.Pages
|
||||||
_vm.Type = type;
|
_vm.Type = type;
|
||||||
_vm.Init();
|
_vm.Init();
|
||||||
SetActivityIndicator();
|
SetActivityIndicator();
|
||||||
|
if(!_vm.EditMode)
|
||||||
|
{
|
||||||
|
ToolbarItems.Remove(_attachmentsItem);
|
||||||
|
ToolbarItems.Remove(_deleteItem);
|
||||||
|
}
|
||||||
|
|
||||||
_typePicker.ItemDisplayBinding = new Binding("Key");
|
_typePicker.ItemDisplayBinding = new Binding("Key");
|
||||||
_cardBrandPicker.ItemDisplayBinding = new Binding("Key");
|
_cardBrandPicker.ItemDisplayBinding = new Binding("Key");
|
||||||
|
@ -36,7 +41,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
await LoadOnAppearedAsync(_scrollView, true, () => _vm.LoadAsync());
|
await LoadOnAppearedAsync(_scrollView, true, () => _vm.LoadAsync());
|
||||||
if(Device.RuntimePlatform == Device.Android)
|
if(_vm.EditMode && Device.RuntimePlatform == Device.Android)
|
||||||
{
|
{
|
||||||
if(_vm.Cipher.OrganizationId == null)
|
if(_vm.Cipher.OrganizationId == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Bit.App.Pages
|
||||||
nameof(IsSecureNote),
|
nameof(IsSecureNote),
|
||||||
nameof(ShowUris),
|
nameof(ShowUris),
|
||||||
nameof(ShowAttachments),
|
nameof(ShowAttachments),
|
||||||
nameof(ShowIdentityAddress),
|
nameof(ShowCollections),
|
||||||
};
|
};
|
||||||
private List<KeyValuePair<UriMatchType?, string>> _matchDetectionOptions =
|
private List<KeyValuePair<UriMatchType?, string>> _matchDetectionOptions =
|
||||||
new List<KeyValuePair<UriMatchType?, string>>
|
new List<KeyValuePair<UriMatchType?, string>>
|
||||||
|
@ -242,18 +242,19 @@ namespace Bit.App.Pages
|
||||||
public bool HasCollections
|
public bool HasCollections
|
||||||
{
|
{
|
||||||
get => _hasCollections;
|
get => _hasCollections;
|
||||||
set => SetProperty(ref _hasCollections, value);
|
set => SetProperty(ref _hasCollections, value,
|
||||||
|
additionalPropertyNames: new string[]
|
||||||
|
{
|
||||||
|
nameof(ShowCollections)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
public bool ShowCollections => !EditMode && Cipher.OrganizationId != null;
|
||||||
public bool EditMode => !string.IsNullOrWhiteSpace(CipherId);
|
public bool EditMode => !string.IsNullOrWhiteSpace(CipherId);
|
||||||
public bool IsLogin => Cipher?.Type == CipherType.Login;
|
public bool IsLogin => Cipher?.Type == CipherType.Login;
|
||||||
public bool IsIdentity => Cipher?.Type == CipherType.Identity;
|
public bool IsIdentity => Cipher?.Type == CipherType.Identity;
|
||||||
public bool IsCard => Cipher?.Type == CipherType.Card;
|
public bool IsCard => Cipher?.Type == CipherType.Card;
|
||||||
public bool IsSecureNote => Cipher?.Type == CipherType.SecureNote;
|
public bool IsSecureNote => Cipher?.Type == CipherType.SecureNote;
|
||||||
public bool ShowUris => IsLogin && Cipher.Login.HasUris;
|
public bool ShowUris => IsLogin && Cipher.Login.HasUris;
|
||||||
public bool ShowIdentityAddress => IsIdentity && (
|
|
||||||
!string.IsNullOrWhiteSpace(Cipher.Identity.Address1) ||
|
|
||||||
!string.IsNullOrWhiteSpace(Cipher.Identity.City) ||
|
|
||||||
!string.IsNullOrWhiteSpace(Cipher.Identity.Country));
|
|
||||||
public bool ShowAttachments => Cipher.HasAttachments;
|
public bool ShowAttachments => Cipher.HasAttachments;
|
||||||
public string ShowPasswordIcon => ShowPassword ? "" : "";
|
public string ShowPasswordIcon => ShowPassword ? "" : "";
|
||||||
public string ShowCardCodeIcon => ShowCardCode ? "" : "";
|
public string ShowCardCodeIcon => ShowCardCode ? "" : "";
|
||||||
|
|
Loading…
Reference in a new issue