forked from JoshMcCullough/SVG
-
Notifications
You must be signed in to change notification settings - Fork 2
#13435 - Android - Image annotation UX: text size not persisted, colo… #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
Svg.Editor.Avalonia.Forms/Dialog/Views/TextOptionsDialogContent.axaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <UserControl xmlns="https://github.com/avaloniaui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| xmlns:views="using:Svg.Editor.Avalon.Forms.Dialog.Views" | ||
| mc:Ignorable="d" d:DesignWidth="200" d:DesignHeight="250" | ||
| x:Class="Svg.Editor.Avalon.Forms.TextOptionsDialogContent" | ||
| x:DataType="views:TextOptionsDialogResultViewModel"> | ||
| <StackPanel Orientation="Vertical" Spacing="8"> | ||
| <ContentControl Content="{Binding Content}" IsVisible="{Binding !!Content}" /> | ||
| <TextBox Text="{Binding UserInput}" | ||
| AcceptsReturn="True" | ||
| Watermark="{Binding WatermarkText}" | ||
| AttachedToVisualTree="InputField_OnAttachedToVisualTree" /> | ||
| <ComboBox ItemsSource="{Binding Options}" | ||
| SelectedIndex="{Binding SelectedIndex}" | ||
| IsVisible="{Binding Options.Count}" | ||
|
Zeljko-Predjeskovic marked this conversation as resolved.
|
||
| HorizontalAlignment="Stretch" /> | ||
| </StackPanel></UserControl> | ||
26 changes: 26 additions & 0 deletions
26
Svg.Editor.Avalonia.Forms/Dialog/Views/TextOptionsDialogContent.axaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using Avalonia; | ||
| using Avalonia.Controls; | ||
| using Avalonia.Input; | ||
| using Avalonia.Markup.Xaml; | ||
| using Avalonia.Threading; | ||
|
|
||
| namespace Svg.Editor.Avalon.Forms; | ||
|
|
||
| public partial class TextOptionsDialogContent : UserControl | ||
| { | ||
| public TextOptionsDialogContent() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| private void InputField_OnAttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e) | ||
| { | ||
| if (sender is InputElement inputElement) | ||
| { | ||
| Dispatcher.UIThread.Post(() => | ||
| { | ||
| inputElement.Focus(NavigationMethod.Unspecified, KeyModifiers.None); | ||
| }); | ||
| } | ||
| } | ||
| } |
47 changes: 47 additions & 0 deletions
47
Svg.Editor.Avalonia.Forms/Dialog/Views/TextOptionsDialogResultViewModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace Svg.Editor.Avalon.Forms.Dialog.Views; | ||
|
|
||
| public record TextOptionsResult(string? Text, string? SelectedOption, int SelectedIndex); | ||
|
|
||
| public class TextOptionsDialogResultViewModel : ContentDialogResultViewModelBase<TextOptionsResult> | ||
| { | ||
| private string? _userInput; | ||
| public string? UserInput | ||
| { | ||
| get => _userInput; | ||
| set => SetField(ref _userInput, value); | ||
| } | ||
|
|
||
| private string? _watermarkText; | ||
| public string? WatermarkText | ||
| { | ||
| get => _watermarkText; | ||
| set => SetField(ref _watermarkText, value); | ||
| } | ||
|
|
||
| private IReadOnlyList<string> _options = Array.Empty<string>(); | ||
| public IReadOnlyList<string> Options | ||
| { | ||
| get => _options; | ||
| set => SetField(ref _options, value); | ||
| } | ||
|
|
||
| private int _selectedIndex; | ||
| public int SelectedIndex | ||
| { | ||
| get => _selectedIndex; | ||
| set => SetField(ref _selectedIndex, value); | ||
| } | ||
|
|
||
| public override TextOptionsResult? GetResult() | ||
| { | ||
| var selected = SelectedIndex >= 0 && SelectedIndex < Options.Count | ||
| ? Options[SelectedIndex] | ||
| : null; | ||
|
|
||
| return new TextOptionsResult(UserInput, selected, SelectedIndex); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using Avalonia.Media; | ||
|
|
||
| namespace Svg.Editor.Avalon.Forms.Services | ||
| { | ||
| public interface IColorPickerState | ||
| { | ||
| Color LastPickedColor { get; set; } | ||
| } | ||
|
|
||
| public class ColorPickerState : IColorPickerState | ||
| { | ||
| public Color LastPickedColor { get; set; } = Colors.Black; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.