Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions BrickController2/BrickController2/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:BrickController2.UI.Controls"
xmlns:extensions="clr-namespace:BrickController2.UI.MarkupExtensions"
x:Class="BrickController2.App">

<Application.Resources>
Expand Down Expand Up @@ -232,6 +233,22 @@
</VisualStateGroupList>
</Setter>
</Style>
<Style x:Key="ExpandableFloatingActionButtonStyle" TargetType="controls:ExpandableFloatingActionButton">
<Setter Property="Icon" Value="menu"/>
<Setter Property="IconBackgroundColor" Value="{DynamicResource FloatingButtonColor}"/>
<Setter Property="IconColor" Value="{DynamicResource NavigationBarItemColor}"/>
<Setter Property="TooltipKey" Value="Expand"/>
<Style.Triggers>
<DataTrigger TargetType="controls:ExpandableFloatingActionButton"
Binding="{Binding Path=IsExpanded, Source={RelativeSource Self}}"
Value="True">
<Setter Property="Icon" Value="menu_open" />
<Setter Property="IconBackgroundColor" Value="{DynamicResource FloatingButtonExpandedColor}" />
<Setter Property="IconColor" Value="{DynamicResource NavigationBarItemColor}"/>
<Setter Property="TooltipKey" Value="Collapse" />
</DataTrigger>
</Style.Triggers>
</Style>

<!-- Misc -->

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -819,4 +819,22 @@
<data name="Repeatable" xml:space="preserve">
<value>Wiederholbar</value>
</data>
<data name="PressButton" xml:space="preserve">
<value>Drücken Sie eine Taste auf dem Controller.</value>
</data>
<data name="PressOrMoveJoy" xml:space="preserve">
<value>Bewegen Sie einen Joystick auf dem Controller.</value>
</data>
<data name="Expand" xml:space="preserve">
<value>Expandieren</value>
</data>
<data name="Collapse" xml:space="preserve">
<value>Einklappen</value>
</data>
<data name="AddControllerAxisEvent" xml:space="preserve">
<value>neues Controller-Achsenereignis erstellen</value>
</data>
<data name="AddControllerButtonEvent" xml:space="preserve">
<value>neues Controller-Tastenereignis erstellen</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -810,4 +810,22 @@
<data name="Repeatable" xml:space="preserve">
<value>Ismételhető</value>
</data>
<data name="PressButton" xml:space="preserve">
<value>Nyomj meg egy gombot a játékvezérlőn</value>
</data>
<data name="PressOrMoveJoy" xml:space="preserve">
<value>Mozgasd a joystickot a játékvezérlőn</value>
</data>
<data name="Expand" xml:space="preserve">
<value>Bontsa ki</value>
</data>
<data name="Collapse" xml:space="preserve">
<value>Csukja össze</value>
</data>
<data name="AddControllerAxisEvent" xml:space="preserve">
<value>Új vezérlőtengely esemény hozzáadása</value>
</data>
<data name="AddControllerButtonEvent" xml:space="preserve">
<value>Új kontrollergomb esemény hozzáadása</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -819,4 +819,22 @@
<data name="Repeatable" xml:space="preserve">
<value>Repeatable</value>
</data>
<data name="PressButton" xml:space="preserve">
<value>Press a button on the game controller</value>
</data>
<data name="PressOrMoveJoy" xml:space="preserve">
<value>Move a joystick on the game controller</value>
</data>
<data name="Expand" xml:space="preserve">
<value>Expand</value>
</data>
<data name="Collapse" xml:space="preserve">
<value>Collapse</value>
</data>
<data name="AddControllerAxisEvent" xml:space="preserve">
<value>Add a new controller axis event</value>
</data>
<data name="AddControllerButtonEvent" xml:space="preserve">
<value>Add a new controller button event</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void buttonHandler(object sender, EventArgs args)
}
}

public async Task<GameControllerEventDialogResult> ShowGameControllerEventDialogAsync(string title, string message, string cancelButtonText, CancellationToken token)
public async Task<GameControllerEventDialogResult> ShowGameControllerEventDialogAsync(string title, string message, string cancelButtonText, CancellationToken token, Func<InputDeviceEventType, string, bool>? eventFilter = null)
{
GameControllerEventDialogTitle.Text = title ?? string.Empty;
GameControllerEventDialogMessage.Text = message ?? string.Empty;
Expand Down Expand Up @@ -277,6 +277,11 @@ async void inputDeviceEventHandler(object sender, InputDeviceEventArgs args)

foreach (var controllerEvent in args.InputDeviceEvents)
{
if (eventFilter is not null && !eventFilter(controllerEvent.Key.EventType, controllerEvent.Key.EventCode))
{
continue;
}

if ((controllerEvent.Key.EventType == InputDeviceEventType.Axis && Math.Abs(controllerEvent.Value) > AXIS_PRESSED_THRESHOLD) ||
(controllerEvent.Key.EventType == InputDeviceEventType.Button && Math.Abs(controllerEvent.Value) < BUTTON_RELEASED_THRESHOLD))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:BrickController2.UI.Controls"
x:Class="BrickController2.UI.Controls.ExpandableFloatingActionButton"
x:Name="Root"
BackgroundColor="Transparent"
HorizontalOptions="End"
VerticalOptions="End">
<ContentView.Content>
<Grid x:Name="RootGrid" BackgroundColor="Transparent">

<BoxView x:Name="Overlay" BackgroundColor="Transparent" IsVisible="False">
<BoxView.GestureRecognizers>
<TapGestureRecognizer Tapped="OnOverlayTapped" />
</BoxView.GestureRecognizers>
Comment thread
vicocz marked this conversation as resolved.
</BoxView>

<Grid VerticalOptions="End"
HorizontalOptions="End"
Margin="16,0,16,0"
ColumnDefinitions="Auto, Auto">

<HorizontalStackLayout x:Name="SecondaryContainer"
Grid.Column="0"
Spacing="8"
Opacity="0"
TranslationX="20"
Margin="0,0,8,0"
VerticalOptions="Center"
IsVisible="False" />

<ImageButton Grid.Column="1" x:Name="Button" Clicked="OnFabClicked"
Aspect="Center" CornerRadius="25" Padding="0"
HeightRequest="50" WidthRequest="50">
<ImageButton.Source>
<FontImageSource x:Name="ImageSource" FontFamily="Icons" />
</ImageButton.Source>
</ImageButton>
</Grid>
</Grid>
</ContentView.Content>
</ContentView>
Loading