mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
more button on cipher listing
This commit is contained in:
parent
4a1bccd516
commit
5812dc7e7e
6 changed files with 54 additions and 9 deletions
|
@ -74,13 +74,14 @@
|
|||
Margin="5, 0, 0, 0"
|
||||
Text=""
|
||||
IsVisible="{Binding Cipher.HasAttachments, Mode=OneWay}" />
|
||||
|
||||
<Button WidthRequest="60"
|
||||
Grid.Column="4"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
BackgroundColor="Transparent" />
|
||||
|
||||
<ImageButton
|
||||
Source="more.png"
|
||||
StyleClass="list-button, list-button-platform"
|
||||
Clicked="ImageButton_Clicked"
|
||||
Grid.Column="4"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2" />
|
||||
</Grid>
|
||||
|
||||
</ViewCell.View>
|
||||
</ViewCell>
|
||||
|
|
|
@ -13,6 +13,9 @@ namespace Bit.App.Controls
|
|||
public static readonly BindableProperty CipherProperty = BindableProperty.Create(
|
||||
nameof(Cipher), typeof(CipherView), typeof(CipherViewCell), default(CipherView), BindingMode.OneWay);
|
||||
|
||||
public static readonly BindableProperty ButtonCommandProperty = BindableProperty.Create(
|
||||
nameof(ButtonCommand), typeof(Command<CipherView>), typeof(CipherViewCell));
|
||||
|
||||
private CipherViewCellViewModel _viewModel;
|
||||
|
||||
public CipherViewCell()
|
||||
|
@ -27,6 +30,12 @@ namespace Bit.App.Controls
|
|||
set => SetValue(CipherProperty, value);
|
||||
}
|
||||
|
||||
public Command<CipherView> ButtonCommand
|
||||
{
|
||||
get => GetValue(ButtonCommandProperty) as Command<CipherView>;
|
||||
set => SetValue(ButtonCommandProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(string propertyName = null)
|
||||
{
|
||||
base.OnPropertyChanged(propertyName);
|
||||
|
@ -118,5 +127,10 @@ namespace Bit.App.Controls
|
|||
}
|
||||
return new Tuple<string, string>(icon, image);
|
||||
}
|
||||
|
||||
private void ImageButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
ButtonCommand?.Execute(Cipher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
xmlns:u="clr-namespace:Bit.App.Utilities"
|
||||
xmlns:controls="clr-namespace:Bit.App.Controls"
|
||||
x:DataType="pages:GroupingsPageViewModel"
|
||||
Title="{Binding PageTitle}">
|
||||
Title="{Binding PageTitle}"
|
||||
x:Name="_page">
|
||||
|
||||
<ContentPage.BindingContext>
|
||||
<pages:GroupingsPageViewModel />
|
||||
|
@ -16,7 +17,9 @@
|
|||
<ResourceDictionary>
|
||||
<DataTemplate x:Key="cipherTemplate"
|
||||
x:DataType="pages:GroupingsPageListItem">
|
||||
<controls:CipherViewCell Cipher="{Binding Cipher}" />
|
||||
<controls:CipherViewCell
|
||||
Cipher="{Binding Cipher}"
|
||||
ButtonCommand="{Binding BindingContext.CipherOptionsCommand, Source={x:Reference _page}}" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="folderTemplate"
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Bit.App.Pages
|
|||
await LoadAsync();
|
||||
});
|
||||
AddCipherCommand = new Command(() => { /* TODO */ });
|
||||
CipherOptionsCommand = new Command<CipherView>(CipherOptionsAsync);
|
||||
}
|
||||
|
||||
public bool ShowFavorites { get; set; } = true;
|
||||
|
@ -99,6 +100,7 @@ namespace Bit.App.Pages
|
|||
public ExtendedObservableCollection<GroupingsPageListGroup> GroupedItems { get; set; }
|
||||
public Command RefreshCommand { get; set; }
|
||||
public Command AddCipherCommand { get; set; }
|
||||
public Command<CipherView> CipherOptionsCommand { get; set; }
|
||||
|
||||
public async Task LoadAsync()
|
||||
{
|
||||
|
@ -273,5 +275,15 @@ namespace Bit.App.Pages
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void CipherOptionsAsync(CipherView cipher)
|
||||
{
|
||||
var option = await Page.DisplayActionSheet(cipher.Name, AppResources.Cancel, null, "1", "2");
|
||||
if(option == AppResources.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// TODO: process options
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
<Style TargetType="Grid"
|
||||
Class="list-row-platform">
|
||||
</Style>
|
||||
<Style TargetType="ImageButton"
|
||||
Class="list-button-platform">
|
||||
</Style>
|
||||
|
||||
<!-- Box -->
|
||||
|
||||
|
|
|
@ -97,6 +97,18 @@
|
|||
<Setter Property="TextColor"
|
||||
Value="{StaticResource MutedColor}" />
|
||||
</Style>
|
||||
<Style TargetType="ImageButton"
|
||||
ApplyToDerivedTypes="True"
|
||||
Class="list-button">
|
||||
<Setter Property="BackgroundColor"
|
||||
Value="Transparent" />
|
||||
<Setter Property="Padding"
|
||||
Value="0" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="End" />
|
||||
<Setter Property="VerticalOptions"
|
||||
Value="CenterAndExpand" />
|
||||
</Style>
|
||||
|
||||
<!-- Box -->
|
||||
|
||||
|
|
Loading…
Reference in a new issue