Layout fixes and Push fixes

- Layout und Kalender angepasst
- Push status meldung angepasst für Android
This commit is contained in:
2026-03-27 11:58:53 +01:00
parent d11f0e46c0
commit 7b824b6f0c
14 changed files with 780 additions and 609 deletions
+21 -74
View File
@@ -1,12 +1,9 @@
using cfs_tracker.Helpers;
using cfs_tracker.ViewModels;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;
using System;
using Microsoft.Maui.Layouts;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace cfs_tracker.Views;
@@ -103,8 +100,6 @@ public partial class OptionsPage : ContentPage
var normalizedHex = NormalizeHex(item.Value, item.Fallback);
item.Value = normalizedHex;
item.PreviewColor = ColorUtility.ParseColor(normalizedHex, item.Fallback);
var lastValidHex = normalizedHex;
var isUpdating = false;
var titleLabel = new Label
{
@@ -121,90 +116,42 @@ public partial class OptionsPage : ContentPage
};
defaultLabel.SetDynamicResource(Label.TextColorProperty, "TextMuted");
var hexEntry = new Entry
{
Placeholder = "#112233",
HorizontalOptions = LayoutOptions.Fill,
ClearButtonVisibility = ClearButtonVisibility.WhileEditing,
BindingContext = item
};
hexEntry.SetBinding(Entry.TextProperty, nameof(AppearanceColorItemViewModel.Value), mode: BindingMode.TwoWay);
var previewBox = new BoxView
{
WidthRequest = 64,
HeightRequest = 34,
CornerRadius = 6,
HorizontalOptions = LayoutOptions.Center,
WidthRequest = 84,
HeightRequest = 42,
CornerRadius = 8,
HorizontalOptions = LayoutOptions.Start,
VerticalOptions = LayoutOptions.Center,
BindingContext = item
BindingContext = item,
Margin = new Thickness(0, 0, 10, 10)
};
previewBox.SetBinding(BoxView.ColorProperty, nameof(AppearanceColorItemViewModel.PreviewColor));
var chooseButton = new Button
{
Text = "Farbe wählen"
Text = "Farbe wählen",
LineBreakMode = LineBreakMode.WordWrap,
HorizontalOptions = LayoutOptions.Start,
VerticalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 0, 0, 10)
};
chooseButton.SetDynamicResource(Button.BackgroundColorProperty, "ButtonSecondaryBackground");
chooseButton.SetDynamicResource(Button.TextColorProperty, "ButtonSecondaryText");
chooseButton.Clicked += (_, _) => OpenColorDialog(item);
var editorGrid = new Grid
var actionLayout = new FlexLayout
{
ColumnSpacing = 10,
RowSpacing = 10,
ColumnDefinitions = new ColumnDefinitionCollection
Direction = FlexDirection.Row,
Wrap = FlexWrap.Wrap,
AlignItems = FlexAlignItems.Center,
JustifyContent = FlexJustify.Start,
Children =
{
new ColumnDefinition { Width = GridLength.Star },
new ColumnDefinition { Width = new GridLength(80) },
new ColumnDefinition { Width = new GridLength(140) }
previewBox,
chooseButton
}
};
editorGrid.Add(hexEntry);
editorGrid.Add(previewBox, 1, 0);
editorGrid.Add(chooseButton, 2, 0);
if (item is INotifyPropertyChanged notify)
{
notify.PropertyChanged += (_, args) =>
{
if (args.PropertyName == nameof(AppearanceColorItemViewModel.Value))
lastValidHex = NormalizeHex(item.Value, item.Fallback);
};
}
hexEntry.TextChanged += (_, args) =>
{
if (isUpdating)
return;
var text = args.NewTextValue?.Trim() ?? string.Empty;
if (!HexColorRegex.IsMatch(text))
return;
lastValidHex = NormalizeHex(text, item.Fallback);
item.PreviewColor = ColorUtility.ParseColor(lastValidHex, item.Fallback);
};
hexEntry.Unfocused += (_, _) =>
{
var text = hexEntry.Text?.Trim() ?? string.Empty;
isUpdating = true;
if (HexColorRegex.IsMatch(text))
{
lastValidHex = NormalizeHex(text, item.Fallback);
item.Value = lastValidHex;
item.PreviewColor = ColorUtility.ParseColor(lastValidHex, item.Fallback);
}
else
{
item.Value = lastValidHex;
item.PreviewColor = ColorUtility.ParseColor(lastValidHex, item.Fallback);
}
isUpdating = false;
};
var content = new VerticalStackLayout
{
@@ -213,7 +160,7 @@ public partial class OptionsPage : ContentPage
{
titleLabel,
defaultLabel,
editorGrid
actionLayout
}
};