Skip to content

Commit 5ceb870

Browse files
sharpninjaCopilot
andcommitted
Fix Android Enter-to-send, icon-only Send button, compact button padding
- Use EditorAction + ImeAction.Send instead of KeyPress (soft keyboard does not fire KeyPress events on Android) - Send button now uses FontImageSource icon instead of text - Reduced global Button padding from 24,12 to 12,6 and min height from 48 to 36 for a more compact mobile UI Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6384ba0 commit 5ceb870

4 files changed

Lines changed: 22 additions & 14 deletions

File tree

GitVersion.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# See https://gitversion.net/docs/reference/configuration
33
workflow: GitHubFlow/v1
44
# Start at 1.0.0 when no version tag exists yet
5-
next-version: 0.1.18
5+
next-version: 0.1.19
6+
67

78

89

src/RemoteAgent.App/MainPage.xaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,16 @@
275275
PlaceholderColor="{StaticResource OnSurfaceVariantBrush}"
276276
VerticalOptions="Center" />
277277
<HorizontalStackLayout Spacing="4" VerticalOptions="Center">
278-
<Button x:Name="AttachBtn" Command="{Binding AttachCommand}">
278+
<Button x:Name="AttachBtn" Command="{Binding AttachCommand}" Padding="8" MinimumHeightRequest="36" MinimumWidthRequest="36">
279279
<Button.ImageSource>
280-
<FontImageSource FontFamily="fa-solid-900" Glyph="{StaticResource IconPaperclip}" Color="{StaticResource OnPrimaryBrush}" Size="18"/>
280+
<FontImageSource FontFamily="fa-solid-900" Glyph="{StaticResource IconPaperclip}" Color="{StaticResource OnPrimaryBrush}" Size="16"/>
281+
</Button.ImageSource>
282+
</Button>
283+
<Button x:Name="SendBtn" Command="{Binding SendMessageCommand}" Padding="8" MinimumHeightRequest="36" MinimumWidthRequest="36">
284+
<Button.ImageSource>
285+
<FontImageSource FontFamily="fa-solid-900" Glyph="{StaticResource IconPaperPlane}" Color="{StaticResource OnPrimaryBrush}" Size="16"/>
281286
</Button.ImageSource>
282287
</Button>
283-
<Label Style="{StaticResource IconLabel}" Text="{StaticResource IconPaperPlane}"
284-
TextColor="{StaticResource OnPrimaryBrush}" VerticalOptions="Center" />
285-
<Button x:Name="SendBtn" Text="Send" Command="{Binding SendMessageCommand}" />
286288
</HorizontalStackLayout>
287289
</HorizontalStackLayout>
288290
</Border>

src/RemoteAgent.App/MainPage.xaml.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Windows.UI.Core;
88
#endif
99
#if ANDROID
10-
using Android.Views;
1110
using AndroidX.AppCompat.Widget;
1211
#endif
1312

@@ -79,16 +78,22 @@ private void OnMessageTextBoxKeyDown(object sender, KeyRoutedEventArgs e)
7978
private void OnMessageEditorHandlerChangedAndroid(object? sender, EventArgs e)
8079
{
8180
if (_androidEditText != null)
82-
_androidEditText.KeyPress -= OnAndroidEditorKeyPress;
81+
_androidEditText.EditorAction -= OnAndroidEditorAction;
8382

8483
_androidEditText = MessageEditor?.Handler?.PlatformView as AppCompatEditText;
8584
if (_androidEditText != null)
86-
_androidEditText.KeyPress += OnAndroidEditorKeyPress;
85+
{
86+
_androidEditText.ImeOptions = Android.Views.InputMethods.ImeAction.Send;
87+
_androidEditText.SetImeActionLabel("Send", Android.Views.InputMethods.ImeAction.Send);
88+
_androidEditText.EditorAction += OnAndroidEditorAction;
89+
}
8790
}
8891

89-
private void OnAndroidEditorKeyPress(object? sender, Android.Views.View.KeyEventArgs e)
92+
private void OnAndroidEditorAction(object? sender, Android.Widget.TextView.EditorActionEventArgs e)
9093
{
91-
if (e.KeyCode == Keycode.Enter && e.Event?.Action == KeyEventActions.Down)
94+
if (e.ActionId == Android.Views.InputMethods.ImeAction.Send ||
95+
e.ActionId == Android.Views.InputMethods.ImeAction.Done ||
96+
e.ActionId == Android.Views.InputMethods.ImeAction.Unspecified)
9297
{
9398
e.Handled = true;
9499
if (_vm.SendMessageCommand.CanExecute(null))

src/RemoteAgent.App/Resources/Styles/Styles.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
<Setter Property="FontAttributes" Value="Bold"/>
4545
<Setter Property="BorderWidth" Value="0"/>
4646
<Setter Property="CornerRadius" Value="20"/>
47-
<Setter Property="Padding" Value="24,12"/>
48-
<Setter Property="MinimumHeightRequest" Value="48"/>
49-
<Setter Property="MinimumWidthRequest" Value="48"/>
47+
<Setter Property="Padding" Value="12,6"/>
48+
<Setter Property="MinimumHeightRequest" Value="36"/>
49+
<Setter Property="MinimumWidthRequest" Value="36"/>
5050
<Setter Property="VisualStateManager.VisualStateGroups">
5151
<VisualStateGroupList>
5252
<VisualStateGroup x:Name="CommonStates">

0 commit comments

Comments
 (0)