1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-26 12:16:07 +01:00

PM-3349 PM-3350 Migrated IconLabelButton Frames to Borders to fix issue with TapGestureRecognizer in Android

Also fixed some minor "styles" for normal Button and IconLabelButton (both Android and iOS)
This commit is contained in:
Dinis Vieira 2023-11-04 17:48:59 +00:00
parent 946c465f0c
commit c6309173ba
No known key found for this signature in database
GPG Key ID: 9389160FF6C295F3
4 changed files with 47 additions and 49 deletions

View File

@ -1,42 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<Frame xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Controls.IconLabelButton"
xmlns:controls="clr-namespace:Bit.App.Controls"
x:Name="_iconLabelButton"
HeightRequest="45"
Padding="1"
StyleClass="btn-icon-secondary"
BackgroundColor="{Binding IconLabelBorderColor, Source={x:Reference _iconLabelButton}}"
BorderColor="Transparent"
HasShadow="False">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ButtonCommand, Source={x:Reference _iconLabelButton}}" />
</Frame.GestureRecognizers>
<Frame
Margin="0"
Padding="0"
CornerRadius="{Binding CornerRadius, Source={x:Reference _iconLabelButton}}"
BackgroundColor="{Binding IconLabelBackgroundColor, Source={x:Reference _iconLabelButton}}"
BorderColor="Transparent"
IsClippedToBounds="True"
HasShadow="False">
<StackLayout
Orientation="Horizontal"
HorizontalOptions="Center">
<controls:IconLabel
VerticalOptions="Center"
HorizontalTextAlignment="Center"
FontSize="Large"
TextColor="{Binding IconLabelColor, Source={x:Reference _iconLabelButton}}"
Text="{Binding Icon, Source={x:Reference _iconLabelButton}}">
</controls:IconLabel>
<Label
VerticalOptions="Center"
HorizontalTextAlignment="Center"
TextColor="{Binding IconLabelColor, Source={x:Reference _iconLabelButton}}"
FontSize="Medium"
Text="{Binding Label, Source={x:Reference _iconLabelButton}}"/>
</StackLayout>
</Frame>
</Frame>
StyleClass="btn-icon-secondary">
<Border StrokeThickness="2" BackgroundColor="{Binding IconLabelBackgroundColor, Source={x:Reference _iconLabelButton}}" Stroke="{Binding IconLabelBorderColor, Source={x:Reference _iconLabelButton}}">
<Border.StrokeShape>
<RoundRectangle CornerRadius="{Binding CornerRadius, Source={x:Reference _iconLabelButton}}" />
</Border.StrokeShape>
<Grid>
<StackLayout
Spacing="6"
Orientation="Horizontal"
HorizontalOptions="Center">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ButtonCommand, Source={x:Reference _iconLabelButton}}" />
</StackLayout.GestureRecognizers>
<controls:IconLabel
VerticalOptions="Center"
HorizontalTextAlignment="Center"
FontSize="Large"
TextColor="{Binding IconLabelColor, Source={x:Reference _iconLabelButton}}"
Text="{Binding Icon, Source={x:Reference _iconLabelButton}}">
</controls:IconLabel>
<Label
VerticalOptions="Center"
HorizontalTextAlignment="Center"
TextColor="{Binding IconLabelColor, Source={x:Reference _iconLabelButton}}"
FontSize="Medium"
Text="{Binding Label, Source={x:Reference _iconLabelButton}}" />
</StackLayout>
</Grid>
</Border>
</ContentView>

View File

@ -1,18 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Bit.Core.Models.Domain;
using Microsoft.Maui.Controls.Xaml;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Controls;
using Microsoft.Maui;
using System.Windows.Input;
namespace Bit.App.Controls
{
public partial class IconLabelButton : Frame
public partial class IconLabelButton : ContentView
{
public static readonly BindableProperty IconProperty = BindableProperty.Create(
nameof(Icon), typeof(string), typeof(IconLabelButton));
@ -32,6 +22,9 @@ namespace Bit.App.Controls
public static readonly BindableProperty IconLabelBorderColorProperty = BindableProperty.Create(
nameof(IconLabelBorderColor), typeof(Color), typeof(IconLabelButton), Colors.White);
public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(
nameof(CornerRadius), typeof(CornerRadius), typeof(IconLabelButton));
public IconLabelButton()
{
InitializeComponent();
@ -72,6 +65,12 @@ namespace Bit.App.Controls
get { return (Color)GetValue(IconLabelBorderColorProperty); }
set { SetValue(IconLabelBorderColorProperty, value); }
}
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}
}
}

View File

@ -107,7 +107,7 @@
</Label>
</Grid>
</StackLayout>
<StackLayout Padding="10, 10">
<StackLayout Padding="10, 10" Spacing="6">
<Button x:Name="_loginWithMasterPassword"
Text="{u:I18n LogInWithMasterPassword}"
StyleClass="btn-primary"

View File

@ -175,6 +175,10 @@
Value="Bold" />
<Setter Property="Margin"
Value="0, 5, 0, 0" />
<Setter Property="CornerRadius"
Value="5" />
<Setter Property="MinimumHeightRequest"
Value="45" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">