options expander for send (#1265)

This commit is contained in:
Matt Portune 2021-02-16 15:24:51 -05:00 committed by GitHub
parent 7cf64ff088
commit 233319a0a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 287 additions and 219 deletions

View file

@ -89,17 +89,22 @@
StyleClass="box-footer-label"
Margin="0,5,0,0" />
</StackLayout>
<StackLayout StyleClass="box-row"
<StackLayout
StyleClass="box-row"
IsVisible="{Binding EditMode, Converter={StaticResource inverseBool}}">
<Label
Text="{u:I18n Type}"
StyleClass="box-label" />
<Grid RowSpacing="0" ColumnSpacing="0" Margin="{Binding SegmentedButtonMargins}">
<Grid
RowSpacing="0"
ColumnSpacing="0"
Margin="{Binding SegmentedButtonMargins}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Text="{u:I18n TypeFile}"
<Button
Text="{u:I18n TypeFile}"
IsEnabled="{Binding IsText}"
Clicked="FileType_Clicked"
AutomationProperties.IsInAccessibleTree="True"
@ -124,7 +129,8 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Button>
<Button Text="{u:I18n TypeText}"
<Button
Text="{u:I18n TypeText}"
IsEnabled="{Binding IsFile}"
Clicked="TextType_Clicked"
AutomationProperties.IsInAccessibleTree="True"
@ -151,35 +157,8 @@
</Button>
</Grid>
</StackLayout>
<StackLayout StyleClass="box-row"
IsVisible="{Binding IsText}">
<Label
Text="{u:I18n TypeText}"
StyleClass="box-label" />
<Editor
x:Name="_textEditor"
AutoSize="TextChanges"
Text="{Binding Send.Text.Text}"
StyleClass="box-value"
Margin="{Binding EditorMargins}" />
<BoxView StyleClass="box-row-separator" IsVisible="{Binding ShowEditorSeparators}" />
<Label
Text="{u:I18n TypeTextInfo}"
StyleClass="box-footer-label"
Margin="0,5,0,10" />
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n HideTextByDefault}"
StyleClass="box-label-regular"
VerticalOptions="Center"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding Send.Text.Hidden}"
HorizontalOptions="End"
Margin="10,0,0,0" />
</StackLayout>
</StackLayout>
<StackLayout StyleClass="box-row"
<StackLayout
StyleClass="box-row"
IsVisible="{Binding IsFile}">
<Label
Text="{u:I18n TypeFile}"
@ -205,7 +184,8 @@
StyleClass="text-sm, text-muted"
HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="Center" />
<Button Text="{u:I18n ChooseFile}"
<Button
Text="{u:I18n ChooseFile}"
StyleClass="box-button-row"
Clicked="ChooseFile_Clicked" />
<Label
@ -220,11 +200,76 @@
StyleClass="box-footer-label"
Margin="0,5,0,0" />
</StackLayout>
<StackLayout StyleClass="box-row-header">
<Label Text="{u:I18n Options, Header=True}"
StyleClass="box-header, box-header-platform" />
<StackLayout
StyleClass="box-row"
IsVisible="{Binding IsText}">
<Label
Text="{u:I18n TypeText}"
StyleClass="box-label" />
<Editor
x:Name="_textEditor"
AutoSize="TextChanges"
Text="{Binding Send.Text.Text}"
StyleClass="box-value"
Margin="{Binding EditorMargins}" />
<BoxView
StyleClass="box-row-separator"
IsVisible="{Binding ShowEditorSeparators}" />
<Label
Text="{u:I18n TypeTextInfo}"
StyleClass="box-footer-label"
Margin="0,5,0,10" />
<StackLayout
StyleClass="box-row, box-row-switch"
Margin="0,10,0,0">
<Label
Text="{u:I18n HideTextByDefault}"
StyleClass="box-label-regular"
VerticalOptions="Center"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding Send.Text.Hidden}"
HorizontalOptions="End"
Margin="10,0,0,0" />
</StackLayout>
<StackLayout StyleClass="box-row" Margin="0,10,0,0">
</StackLayout>
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n ShareOnSave}"
StyleClass="box-label-regular"
VerticalOptions="Center"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding ShareOnSave}"
HorizontalOptions="End"
Margin="10,0,0,0" />
</StackLayout>
<StackLayout
Orientation="Horizontal"
Spacing="0">
<Button
Text="{u:I18n Options}"
x:Name="_btnOptions"
StyleClass="box-row-button"
Margin="0"
Clicked="ToggleOptions_Clicked" />
<controls:FaButton
x:Name="_btnOptionsUp"
Text="&#xf077;"
StyleClass="box-row-button"
Clicked="ToggleOptions_Clicked"
IsVisible="{Binding ShowOptions}" />
<controls:FaButton
x:Name="_btnOptionsDown"
Text="&#xf078;"
StyleClass="box-row-button"
Clicked="ToggleOptions_Clicked"
IsVisible="{Binding ShowOptions, Converter={StaticResource inverseBool}}" />
</StackLayout>
<StackLayout IsVisible="{Binding ShowOptions}">
<StackLayout
StyleClass="box-row"
Margin="0,10,0,0">
<Label
Text="{u:I18n DeletionDate}"
StyleClass="box-label" />
@ -295,7 +340,9 @@
AutomationProperties.Name="{u:I18n ExpirationTime}"
Grid.Column="1" />
</Grid>
<StackLayout Orientation="Horizontal" Margin="0,5,0,0">
<StackLayout
Orientation="Horizontal"
Margin="0,5,0,0">
<Label
Text="{u:I18n ExpirationDateInfo}"
StyleClass="box-footer-label"
@ -310,11 +357,15 @@
Clicked="ClearExpirationDate_Clicked" />
</StackLayout>
</StackLayout>
<StackLayout StyleClass="box-row" Margin="0,5,0,0">
<StackLayout
StyleClass="box-row"
Margin="0,5,0,0">
<Label
Text="{u:I18n MaximumAccessCount}"
StyleClass="box-label" />
<StackLayout StyleClass="box-row" Orientation="Horizontal">
<StackLayout
StyleClass="box-row"
Orientation="Horizontal">
<Entry
Text="{Binding MaxAccessCount}"
StyleClass="box-value"
@ -349,7 +400,9 @@
VerticalTextAlignment="Center" />
</StackLayout>
</StackLayout>
<StackLayout StyleClass="box-row" Margin="0,5,0,0">
<StackLayout
StyleClass="box-row"
Margin="0,5,0,0">
<Label
Text="{u:I18n NewPassword}"
StyleClass="box-label" />
@ -374,7 +427,9 @@
StyleClass="box-footer-label"
Margin="0,5,0,0" />
</StackLayout>
<StackLayout StyleClass="box-row" Margin="0,5,0,0">
<StackLayout
StyleClass="box-row"
Margin="0,5,0,0">
<Label
Text="{u:I18n Notes}"
StyleClass="box-label" />
@ -383,13 +438,17 @@
Text="{Binding Send.Notes}"
StyleClass="box-value"
Margin="{Binding EditorMargins}" />
<BoxView StyleClass="box-row-separator" IsVisible="{Binding ShowEditorSeparators}" />
<BoxView
StyleClass="box-row-separator"
IsVisible="{Binding ShowEditorSeparators}" />
<Label
Text="{u:I18n NotesInfo}"
StyleClass="box-footer-label"
Margin="0,5,0,0" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-switch" Margin="0,5,0,0">
<StackLayout
StyleClass="box-row, box-row-switch"
Margin="0,5,0,0">
<Label
Text="{u:I18n DisableSend}"
StyleClass="box-label-regular"
@ -400,16 +459,6 @@
HorizontalOptions="End"
Margin="10,0,0,0" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n ShareOnSave}"
StyleClass="box-label-regular"
VerticalOptions="Center"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding ShareOnSave}"
HorizontalOptions="End"
Margin="10,0,0,0" />
</StackLayout>
</StackLayout>

View file

@ -42,6 +42,9 @@ namespace Bit.App.Pages
_vm.SegmentedButtonFontSize = 13;
_vm.SegmentedButtonMargins = new Thickness(0, 10, 0, 0);
_vm.EditorMargins = new Thickness(0, 5, 0, 0);
_btnOptions.WidthRequest = 62;
_btnOptionsDown.WidthRequest = 30;
_btnOptionsUp.WidthRequest = 30;
}
else if (Device.RuntimePlatform == Device.iOS)
{
@ -153,6 +156,11 @@ namespace Bit.App.Pages
}
}
private void ToggleOptions_Clicked(object sender, EventArgs e)
{
_vm.ToggleOptions();
}
private void ClearExpirationDate_Clicked(object sender, EventArgs e)
{
if (DoOnce())

View file

@ -22,6 +22,7 @@ namespace Bit.App.Pages
private bool _canAccessPremium;
private SendView _send;
private string _fileName;
private bool _showOptions;
private bool _showPassword;
private int _deletionDateTypeSelectedIndex;
private int _expirationDateTypeSelectedIndex;
@ -107,6 +108,11 @@ namespace Bit.App.Pages
get => _deletionTime;
set => SetProperty(ref _deletionTime, value);
}
public bool ShowOptions
{
get => _showOptions;
set => SetProperty(ref _showOptions, value);
}
public int ExpirationDateTypeSelectedIndex
{
get => _expirationDateTypeSelectedIndex;
@ -397,6 +403,11 @@ namespace Bit.App.Pages
}
}
public void ToggleOptions()
{
ShowOptions = !ShowOptions;
}
private void DeletionTypeChanged()
{
if (Send != null && DeletionDateTypeSelectedIndex > -1)