Skip to content
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

Specify type of text input in most TextBox usages #30495

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions osu.Game/Graphics/UserInterface/OsuNumberBox.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Input;

namespace osu.Game.Graphics.UserInterface
{
public partial class OsuNumberBox : OsuTextBox
{
protected override bool AllowIme => false;

public OsuNumberBox()
{
InputProperties = new TextInputProperties(TextInputType.Number, false);

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The name 'InputProperties' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The name 'TextInputType' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The name 'InputProperties' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The name 'TextInputType' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The name 'InputProperties' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The name 'InputProperties' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The name 'TextInputType' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The name 'InputProperties' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The name 'TextInputType' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The name 'InputProperties' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The name 'TextInputType' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The name 'InputProperties' does not exist in the current context

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 12 in osu.Game/Graphics/UserInterface/OsuNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The name 'TextInputType' does not exist in the current context
SelectAllOnFocus = true;
}

protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character);
}
}
10 changes: 3 additions & 7 deletions osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace osu.Game.Graphics.UserInterface
{
public partial class OsuPasswordTextBox : OsuTextBox, ISuppressKeyEventLogging
public partial class OsuPasswordTextBox : OsuTextBox
{
protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
{
Expand All @@ -28,19 +28,15 @@

protected override bool AllowUniqueCharacterSamples => false;

protected override bool AllowClipboardExport => false;

protected override bool AllowWordNavigation => false;

protected override bool AllowIme => false;

private readonly CapsWarning warning;

[Resolved]
private GameHost host { get; set; } = null!;

public OsuPasswordTextBox()
{
InputProperties = new TextInputProperties(TextInputType.Password, false);

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The name 'InputProperties' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The name 'TextInputType' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The name 'InputProperties' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The name 'InputProperties' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The name 'TextInputType' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The name 'InputProperties' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The name 'TextInputType' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The name 'InputProperties' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The name 'TextInputType' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The name 'InputProperties' does not exist in the current context

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 38 in osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The name 'TextInputType' does not exist in the current context

Add(warning = new CapsWarning
{
Size = new Vector2(20),
Expand Down
6 changes: 6 additions & 0 deletions osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.

using System.Globalization;
using osu.Framework.Input;

namespace osu.Game.Graphics.UserInterfaceV2
{
Expand All @@ -19,6 +20,11 @@
{
public bool AllowDecimals { get; init; }

public InnerNumberBox()
{
InputProperties = new TextInputProperties(TextInputType.Number, false);

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The name 'InputProperties' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

The name 'TextInputType' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The name 'InputProperties' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The name 'TextInputType' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The name 'InputProperties' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The name 'TextInputType' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The name 'InputProperties' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The name 'TextInputType' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The name 'InputProperties' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The name 'TextInputType' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The name 'InputProperties' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The name 'InputProperties' does not exist in the current context

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 25 in osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The name 'TextInputType' does not exist in the current context
}

protected override bool CanAddCharacter(char character)
=> char.IsAsciiDigit(character) || (AllowDecimals && CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator.Contains(character));
}
Expand Down
2 changes: 2 additions & 0 deletions osu.Game/Overlays/Login/LoginForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osu.Game.Graphics;
Expand Down Expand Up @@ -63,6 +64,7 @@
},
username = new OsuTextBox
{
InputProperties = new TextInputProperties(TextInputType.Username, false),

Check failure on line 67 in osu.Game/Overlays/Login/LoginForm.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)

'OsuTextBox' does not contain a definition for 'InputProperties'

Check failure on line 67 in osu.Game/Overlays/Login/LoginForm.cs

View workflow job for this annotation

GitHub Actions / Code Quality

'OsuTextBox' does not contain a definition for 'InputProperties'

Check failure on line 67 in osu.Game/Overlays/Login/LoginForm.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 67 in osu.Game/Overlays/Login/LoginForm.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The name 'TextInputType' does not exist in the current context
PlaceholderText = UsersStrings.LoginUsername.ToLower(),
RelativeSizeAxes = Axes.X,
Text = api.ProvidedUsername,
Expand Down
6 changes: 5 additions & 1 deletion osu.Game/Overlays/Settings/SettingsNumberBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;

namespace osu.Game.Overlays.Settings
{
Expand Down Expand Up @@ -66,7 +67,10 @@

private partial class OutlinedNumberBox : OutlinedTextBox
{
protected override bool AllowIme => false;
public OutlinedNumberBox()
{
InputProperties = new TextInputProperties(TextInputType.Number, false);

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The name 'InputProperties' does not exist in the current context

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)

The name 'TextInputType' does not exist in the current context

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The name 'InputProperties' does not exist in the current context

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Code Quality

The name 'TextInputType' does not exist in the current context

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (iOS)

The name 'InputProperties' does not exist in the current context

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, MultiThreaded)

The name 'InputProperties' does not exist in the current context

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The name 'InputProperties' does not exist in the current context

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The type or namespace name 'TextInputProperties' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest, SingleThread)

The name 'TextInputType' does not exist in the current context

Check failure on line 72 in osu.Game/Overlays/Settings/SettingsNumberBox.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

The name 'InputProperties' does not exist in the current context
}

protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character);

Expand Down
6 changes: 5 additions & 1 deletion osu.Game/Screens/Edit/Setup/MetadataSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterfaceV2;
Expand Down Expand Up @@ -119,7 +120,10 @@ private partial class FormRomanisedTextBox : FormTextBox

private partial class RomanisedTextBox : InnerTextBox
{
protected override bool AllowIme => false;
public RomanisedTextBox()
{
InputProperties = new TextInputProperties(TextInputType.Text, false);
}

protected override bool CanAddCharacter(char character)
=> MetadataUtils.IsRomanised(character);
Expand Down
Loading