- ButtonHandler: Removed MapText/TextColor/Font (not in production), fixed namespace - LabelHandler: Added CharacterSpacing/LayoutAlignment/FormattedText, ConnectHandler gesture logic - EntryHandler: Added CharacterSpacing/ClearButtonVisibility/VerticalTextAlignment - EditorHandler: Created from decompiled (was missing) - SliderHandler: Fixed namespace, added ConnectHandler init calls - SwitchHandler: Added OffTrackColor logic, fixed namespace - CheckBoxHandler: Added VerticalLayoutAlignment/HorizontalLayoutAlignment - ProgressBarHandler: Added ConnectHandler/DisconnectHandler IsVisible tracking - PickerHandler: Created from decompiled with collection changed tracking - ActivityIndicatorHandler: Removed IsEnabled/BackgroundColor (not in production) - All handlers now use namespace Microsoft.Maui.Platform.Linux.Handlers - All handlers have proper null checks on PlatformView - Updated MERGE_TRACKING.md with accurate status 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
108 lines
3.3 KiB
C#
108 lines
3.3 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
using System.ComponentModel;
|
|
using Microsoft.Maui.Controls;
|
|
using Microsoft.Maui.Graphics;
|
|
using Microsoft.Maui.Handlers;
|
|
|
|
namespace Microsoft.Maui.Platform.Linux.Handlers;
|
|
|
|
/// <summary>
|
|
/// Linux handler for ProgressBar control.
|
|
/// </summary>
|
|
public class ProgressBarHandler : ViewHandler<IProgress, SkiaProgressBar>
|
|
{
|
|
public static IPropertyMapper<IProgress, ProgressBarHandler> Mapper = new PropertyMapper<IProgress, ProgressBarHandler>(ViewHandler.ViewMapper)
|
|
{
|
|
["Progress"] = MapProgress,
|
|
["ProgressColor"] = MapProgressColor,
|
|
["IsEnabled"] = MapIsEnabled,
|
|
["Background"] = MapBackground,
|
|
["BackgroundColor"] = MapBackgroundColor
|
|
};
|
|
|
|
public static CommandMapper<IProgress, ProgressBarHandler> CommandMapper = new(ViewHandler.ViewCommandMapper);
|
|
|
|
public ProgressBarHandler() : base(Mapper, CommandMapper)
|
|
{
|
|
}
|
|
|
|
protected override SkiaProgressBar CreatePlatformView()
|
|
{
|
|
return new SkiaProgressBar();
|
|
}
|
|
|
|
protected override void ConnectHandler(SkiaProgressBar platformView)
|
|
{
|
|
base.ConnectHandler(platformView);
|
|
|
|
if (VirtualView is BindableObject bindable)
|
|
{
|
|
bindable.PropertyChanged += OnVirtualViewPropertyChanged;
|
|
}
|
|
|
|
if (VirtualView is VisualElement ve)
|
|
{
|
|
platformView.IsVisible = ve.IsVisible;
|
|
}
|
|
}
|
|
|
|
protected override void DisconnectHandler(SkiaProgressBar platformView)
|
|
{
|
|
if (VirtualView is BindableObject bindable)
|
|
{
|
|
bindable.PropertyChanged -= OnVirtualViewPropertyChanged;
|
|
}
|
|
|
|
base.DisconnectHandler(platformView);
|
|
}
|
|
|
|
private void OnVirtualViewPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
|
{
|
|
if (VirtualView is VisualElement ve && e.PropertyName == "IsVisible")
|
|
{
|
|
PlatformView.IsVisible = ve.IsVisible;
|
|
PlatformView.Invalidate();
|
|
}
|
|
}
|
|
|
|
public static void MapProgress(ProgressBarHandler handler, IProgress progress)
|
|
{
|
|
handler.PlatformView.Progress = progress.Progress;
|
|
}
|
|
|
|
public static void MapProgressColor(ProgressBarHandler handler, IProgress progress)
|
|
{
|
|
if (progress.ProgressColor != null)
|
|
{
|
|
handler.PlatformView.ProgressColor = progress.ProgressColor.ToSKColor();
|
|
}
|
|
handler.PlatformView.Invalidate();
|
|
}
|
|
|
|
public static void MapIsEnabled(ProgressBarHandler handler, IProgress progress)
|
|
{
|
|
handler.PlatformView.IsEnabled = progress.IsEnabled;
|
|
handler.PlatformView.Invalidate();
|
|
}
|
|
|
|
public static void MapBackground(ProgressBarHandler handler, IProgress progress)
|
|
{
|
|
if (progress.Background is SolidPaint solidPaint && solidPaint.Color != null)
|
|
{
|
|
handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor();
|
|
handler.PlatformView.Invalidate();
|
|
}
|
|
}
|
|
|
|
public static void MapBackgroundColor(ProgressBarHandler handler, IProgress progress)
|
|
{
|
|
if (progress is VisualElement ve && ve.BackgroundColor != null)
|
|
{
|
|
handler.PlatformView.BackgroundColor = ve.BackgroundColor.ToSKColor();
|
|
handler.PlatformView.Invalidate();
|
|
}
|
|
}
|
|
}
|