Skip to content

Commit

Permalink
Merge branch 'net6.0'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
  • Loading branch information
rmarinho committed Jul 26, 2022
2 parents 4170251 + 9ea83b0 commit e3f8bd4
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 88 deletions.
13 changes: 7 additions & 6 deletions .nuspec/Microsoft.Maui.Resizetizer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,15 @@
</ItemGroup>

<!-- Tizen -->
<TizenSplashUpdater
Condition="'$(_ResizetizerIsTizenApp)' == 'True'"
IntermediateOutputPath="$(_MauiIntermediateSplashScreen)"
MauiSplashScreen="@(MauiSplashScreen)" />

<ItemGroup Condition="'$(_ResizetizerIsTizenApp)' == 'True'">
<MauiImage Include="@(MauiSplashScreen)" />
<_MauiSplashScreens Include="$(_MauiIntermediateSplashScreen)splash\*" />
<TizenTpkUserIncludeFiles Include="@(_MauiSplashScreens)" TizenTpkSubDir="shared\res\splash" />
</ItemGroup>

<!-- Stamp file for Outputs -->
Expand Down Expand Up @@ -528,12 +535,6 @@
Images="@(MauiImage->Distinct())">
</ResizetizeImages>

<!-- Tizen - Move splash images to a specific location -->
<TizenSplashUpdater
Condition="'$(_ResizetizerIsTizenApp)' == 'True' And '@(MauiSplashScreen)' != ''"
IntermediateOutputPath="$(_MauiIntermediateImages)"
MauiSplashScreen="@(MauiSplashScreen)" />

<ItemGroup>
<!-- Get Images that were generated -->
<!-- Either from the task, or if the task was skipped (up to date), use the wildcard lookup -->
Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.400-rtm.22364.21" CoherentParentDependency="Microsoft.Android.Sdk.Windows">
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.400-rtm.22371.2" CoherentParentDependency="Microsoft.Android.Sdk.Windows">
<Uri>https://github.com/dotnet/installer</Uri>
<Sha>7a5b36b4a4b0c72f2e14dfb4e950e2c118a4f346</Sha>
<Sha>55859829cd6c1ba18e7782630579e88df970a049</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="6.0.7" CoherentParentDependency="Microsoft.Android.Sdk.Windows">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>705ec75fc00dc5d62ffeae1b6d5439fd14ada9b4</Sha>
</Dependency>
<Dependency Name="Microsoft.Android.Sdk.Windows" Version="32.0.446">
<Dependency Name="Microsoft.Android.Sdk.Windows" Version="32.0.447">
<Uri>https://github.com/xamarin/xamarin-android</Uri>
<Sha>4506004286bfa3b44965ee8b69ffb9c1d8f580be</Sha>
<Sha>0b8d593a61bb49120fdf817e8dfdbc4b33937772</Sha>
</Dependency>
<Dependency Name="Microsoft.MacCatalyst.Sdk" Version="15.4.442">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project>
<PropertyGroup>
<!-- dotnet/installer -->
<MicrosoftDotnetSdkInternalPackageVersion>6.0.400-rtm.22364.21</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>6.0.400-rtm.22371.2</MicrosoftDotnetSdkInternalPackageVersion>
<!-- dotnet/runtime -->
<MicrosoftNETCoreAppRefPackageVersion>6.0.7</MicrosoftNETCoreAppRefPackageVersion>
<!-- NOTE: should eventually revert back to $(MicrosoftNETCoreAppRefPackageVersion) in .NET 7 -->
<MicrosoftExtensionsPackageVersion>6.0.0</MicrosoftExtensionsPackageVersion>
<MicrosoftExtensionsServicingPackageVersion>6.0.1</MicrosoftExtensionsServicingPackageVersion>
<SystemCodeDomPackageVersion>6.0.0</SystemCodeDomPackageVersion>
<!-- xamarin/xamarin-android -->
<MicrosoftAndroidSdkWindowsPackageVersion>32.0.446</MicrosoftAndroidSdkWindowsPackageVersion>
<MicrosoftAndroidSdkWindowsPackageVersion>32.0.447</MicrosoftAndroidSdkWindowsPackageVersion>
<!-- xamarin/xamarin-macios -->
<MicrosoftiOSSdkPackageVersion>15.4.442</MicrosoftiOSSdkPackageVersion>
<MicrosoftMacCatalystSdkPackageVersion>15.4.442</MicrosoftMacCatalystSdkPackageVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected override string[] KnownValues
"Start",
"End",
"SpaceBetween",
"SpaceAroun",
"SpaceAround",
"SpaceEvenly",
};
}
Expand Down
58 changes: 51 additions & 7 deletions src/Core/src/Handlers/Entry/EntryHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Microsoft.Maui.Handlers
public partial class EntryHandler : ViewHandler<IEntry, AppCompatEditText>
{
Drawable? _clearButtonDrawable;
bool _clearButtonVisible;
bool _set;

protected override AppCompatEditText CreatePlatformView()
Expand Down Expand Up @@ -127,21 +128,32 @@ public static void MapClearButtonVisibility(IEntryHandler handler, IEntry entry)
handler.PlatformView?.UpdateClearButtonVisibility(entry, platformHandler.GetClearButtonDrawable);
}

void OnTextChanged(object? sender, TextChangedEventArgs e) =>
VirtualView?.UpdateText(e);
void OnTextChanged(object? sender, TextChangedEventArgs e)
{
if (VirtualView == null)
{
return;
}

VirtualView.UpdateText(e);
MapClearButtonVisibility(this, VirtualView);
}

// This will eliminate additional native property setting if not required.
void OnFocusedChange(object? sender, FocusChangeEventArgs e)
{
if (VirtualView?.ClearButtonVisibility == ClearButtonVisibility.WhileEditing)
UpdateValue(nameof(IEntry.ClearButtonVisibility));
if (VirtualView == null)
{
return;
}

MapClearButtonVisibility(this, VirtualView);
}

// Check whether the touched position inbounds with clear button.
void OnTouch(object? sender, TouchEventArgs e) =>
e.Handled =
VirtualView?.ClearButtonVisibility == ClearButtonVisibility.WhileEditing &&
PlatformView.HandleClearButtonTouched(VirtualView.FlowDirection, e, GetClearButtonDrawable);
_clearButtonVisible && VirtualView != null &&
PlatformView.HandleClearButtonTouched(VirtualView.GetEffectiveFlowDirection(), e, GetClearButtonDrawable);

void OnEditorAction(object? sender, EditorActionEventArgs e)
{
Expand All @@ -166,5 +178,37 @@ private void OnSelectionChanged(object? sender, EventArgs e)
if (VirtualView.SelectionLength != selectedTextLength)
VirtualView.SelectionLength = selectedTextLength;
}

internal void ShowClearButton()
{
if (_clearButtonVisible)
{
return;
}

var drawable = GetClearButtonDrawable();

if (VirtualView.GetEffectiveFlowDirection() == FlowDirection.RightToLeft)
{
PlatformView.SetCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
}
else
{
PlatformView.SetCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
}

_clearButtonVisible = true;
}

internal void HideClearButton()
{
if (!_clearButtonVisible)
{
return;
}

PlatformView.SetCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
_clearButtonVisible = false;
}
}
}
30 changes: 9 additions & 21 deletions src/Core/src/Platform/Android/EditTextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public static class EditTextExtensions
{
public static void UpdateText(this EditText editText, IEntry entry)
{
var previousTextLength = editText.Length();

// Setting the text causes the cursor to reset to position zero
// Therefore if:
// User Types => VirtualView Updated => Triggers Native Update
Expand Down Expand Up @@ -170,30 +172,16 @@ public static void UpdateIsReadOnly(this EditText editText, IEditor editor)
editText.SetCursorVisible(isReadOnly);
}

// TODO: NET7 hartez - Remove this, nothing uses it
public static void UpdateClearButtonVisibility(this EditText editText, IEntry entry, Drawable? clearButtonDrawable) =>
UpdateClearButtonVisibility(editText, entry, () => clearButtonDrawable);

// TODO: NET7 hartez - Remove the getClearButtonDrawable parameter, nothing uses it
public static void UpdateClearButtonVisibility(this EditText editText, IEntry entry, Func<Drawable?>? getClearButtonDrawable)
{
// Places clear button drawable at the end or start of the EditText based on FlowDirection.
void ShowClearButton()
{
var drawable = getClearButtonDrawable?.Invoke();

if (entry.GetEffectiveFlowDirection() == FlowDirection.RightToLeft)
{
editText.SetCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
}
else
{
editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
}
}

// Hides clear button drawable from the control.
void HideClearButton()
if (entry?.Handler is not EntryHandler entryHandler)
{
editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
return;
}

bool isFocused = editText.IsFocused;
Expand All @@ -205,11 +193,11 @@ void HideClearButton()

if (shouldDisplayClearButton)
{
ShowClearButton();
entryHandler.ShowClearButton();
}
else
{
HideClearButton();
entryHandler.HideClearButton();
}
}

Expand Down Expand Up @@ -377,7 +365,7 @@ internal static bool HandleClearButtonTouched(this EditText? platformView, FlowD
if (motionEvent.Action != MotionEventActions.Up)
return false;

var x = motionEvent.GetX();
var x = motionEvent.RawX;
var y = motionEvent.GetY();

if ((flowDirection != FlowDirection.LeftToRight
Expand Down
12 changes: 1 addition & 11 deletions src/Core/src/Platform/Android/MauiDatePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,13 @@ public void OnClick(View? v)
ShowPicker?.Invoke();
}

protected override void OnFocusChanged(bool gainFocus, [GeneratedEnum] FocusSearchDirection direction, Android.Graphics.Rect? previouslyFocusedRect)
{
base.OnFocusChanged(gainFocus, direction, previouslyFocusedRect);

if (gainFocus)
{
if (Clickable)
CallOnClick();
}
}

void Initialize()
{
if (Background != null)
DrawableCompat.Wrap(Background);

Focusable = true;
FocusableInTouchMode = false;
Clickable = true;
InputType = InputTypes.Null;

Expand Down
12 changes: 1 addition & 11 deletions src/Core/src/Platform/Android/MauiTimePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,13 @@ public void OnClick(View? v)
ShowPicker?.Invoke();
}

protected override void OnFocusChanged(bool gainFocus, [GeneratedEnum] FocusSearchDirection direction, Android.Graphics.Rect? previouslyFocusedRect)
{
base.OnFocusChanged(gainFocus, direction, previouslyFocusedRect);

if (gainFocus)
{
if (Clickable)
CallOnClick();
}
}

void Initialize()
{
if (Background != null)
DrawableCompat.Wrap(Background);

Focusable = true;
FocusableInTouchMode = false;
Clickable = true;
InputType = InputTypes.Null;

Expand Down
2 changes: 0 additions & 2 deletions src/Core/src/PublicAPI/net-android/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,6 @@ override Microsoft.Maui.Platform.LocalizedDigitsKeyListener.FilterFormatted(Java
override Microsoft.Maui.Platform.LocalizedDigitsKeyListener.GetAcceptedChars() -> char[]!
override Microsoft.Maui.Platform.LocalizedDigitsKeyListener.InputType.get -> Android.Text.InputTypes
override Microsoft.Maui.Platform.MauiAccessibilityDelegateCompat.OnInitializeAccessibilityNodeInfo(Android.Views.View? host, AndroidX.Core.View.Accessibility.AccessibilityNodeInfoCompat? info) -> void
override Microsoft.Maui.Platform.MauiDatePicker.OnFocusChanged(bool gainFocus, Android.Views.FocusSearchDirection direction, Android.Graphics.Rect? previouslyFocusedRect) -> void
override Microsoft.Maui.Platform.MauiMaterialButton.OnLayout(bool changed, int left, int top, int right, int bottom) -> void
override Microsoft.Maui.Platform.MauiPicker.Dispose(bool disposing) -> void
override Microsoft.Maui.Platform.MauiPicker.OnFocusChanged(bool gainFocus, Android.Views.FocusSearchDirection direction, Android.Graphics.Rect? previouslyFocusedRect) -> void
Expand All @@ -2141,7 +2140,6 @@ override Microsoft.Maui.Platform.MauiSwipeView.OnAttachedToWindow() -> void
override Microsoft.Maui.Platform.MauiSwipeView.OnInterceptTouchEvent(Android.Views.MotionEvent? e) -> bool
override Microsoft.Maui.Platform.MauiSwipeView.OnTouchEvent(Android.Views.MotionEvent? e) -> bool
override Microsoft.Maui.Platform.MauiTextView.OnLayout(bool changed, int l, int t, int r, int b) -> void
override Microsoft.Maui.Platform.MauiTimePicker.OnFocusChanged(bool gainFocus, Android.Views.FocusSearchDirection direction, Android.Graphics.Rect? previouslyFocusedRect) -> void
override Microsoft.Maui.Platform.MauiWebChromeClient.Dispose(bool disposing) -> void
override Microsoft.Maui.Platform.MauiWebViewClient.Dispose(bool disposing) -> void
override Microsoft.Maui.Platform.MauiWebViewClient.OnPageFinished(Android.Webkit.WebView? view, string? url) -> void
Expand Down
5 changes: 4 additions & 1 deletion src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ virtual Microsoft.Maui.Handlers.EntryHandler.GetClearButtonDrawable() -> Android
*REMOVED*Microsoft.Maui.Platform.MauiDatePicker.MauiDatePicker(Android.Content.Context? context, Android.Util.IAttributeSet! attrs) -> void
*REMOVED*Microsoft.Maui.Platform.MauiDatePicker.MauiDatePicker(Android.Content.Context? context) -> void
virtual Microsoft.Maui.Platform.StackNavigationManager.OnDestinationChanged(AndroidX.Navigation.NavController! navController, AndroidX.Navigation.NavDestination! navDestination, Android.OS.Bundle? bundle) -> void
*REMOVED*virtual Microsoft.Maui.Platform.StackNavigationManager.OnDestinationChanged(AndroidX.Navigation.NavController! navController, AndroidX.Navigation.NavDestination! navDestination, Android.OS.Bundle! bundle) -> void
*REMOVED*virtual Microsoft.Maui.Platform.StackNavigationManager.OnDestinationChanged(AndroidX.Navigation.NavController! navController, AndroidX.Navigation.NavDestination! navDestination, Android.OS.Bundle! bundle) -> void
override Microsoft.Maui.Handlers.ScrollViewHandler.GetDesiredSize(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size
*REMOVED* override Microsoft.Maui.Platform.MauiDatePicker.OnFocusChanged(bool gainFocus, Android.Views.FocusSearchDirection direction, Android.Graphics.Rect? previouslyFocusedRect) -> void
*REMOVED* override Microsoft.Maui.Platform.MauiTimePicker.OnFocusChanged(bool gainFocus, Android.Views.FocusSearchDirection direction, Android.Graphics.Rect? previouslyFocusedRect) -> void
31 changes: 9 additions & 22 deletions src/SingleProject/Resizetizer/src/TizenSplashUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,24 @@ public class TizenSplashUpdater : Task
public override bool Execute()
{
var orientations = new List<string>() { "portrait", "landscape" };
var splashInfo = MauiSplashScreen?.Length > 0 ? ResizeImageInfo.Parse(MauiSplashScreen[0]) : null;
var splashInfo = ResizeImageInfo.Parse(MauiSplashScreen[0]);
var image = splashInfo.OutputName + ".png";
var sharedResFullPath = Path.GetFullPath(Path.Combine(IntermediateOutputPath, "shared/res/"));
var splashFullPath = Path.Combine(sharedResFullPath, splashDirectoryName);
var splashFullPath = Path.Combine(IntermediateOutputPath, splashDirectoryName);

if (Directory.Exists(splashFullPath))
Directory.Delete(splashFullPath, true);
Directory.CreateDirectory(splashFullPath);

var appTool = new SkiaSharpAppIconTools(splashInfo, Logger);

splashDpiMap.Clear();
foreach (var dpi in DpiPath.Tizen.SplashScreen)
{
var imageOutputPath = Path.GetFullPath(Path.Combine(IntermediateOutputPath, dpi.Path));
var imageFullPath = Path.Combine(imageOutputPath, image);
var destination = Resizer.GetFileDestination(splashInfo, dpi, IntermediateOutputPath);
destination = Path.ChangeExtension(destination, ".png");
appTool.Resize(dpi, destination);

if (File.Exists(imageFullPath))
if (File.Exists(destination))
{
var resolution = dpi.Path.Split('-')[1].ToLower();
foreach (var orientation in orientations)
Expand All @@ -52,24 +54,9 @@ public override bool Execute()
splashDpiMap.Remove((resolution, orientation));
}
splashDpiMap.Add((resolution, orientation), $"{splashDirectoryName}/{newImage}");
UpdateColorAndMoveFile(splashInfo, GetScreenSize(resolution, orientation), imageFullPath, Path.Combine(splashFullPath, newImage));
UpdateColorAndMoveFile(splashInfo, GetScreenSize(resolution, orientation), destination, Path.Combine(splashFullPath, newImage));
}
}
else
{
Log.LogWarning($"Unable to find splash image at {imageFullPath}.");
return false;
}
}

foreach (var dpi in DpiPath.Tizen.Image)
{
var imageOutputPath = Path.GetFullPath(Path.Combine(IntermediateOutputPath, dpi.Path));
var imageFullPath = Path.Combine(imageOutputPath, image);
if (File.Exists(imageFullPath))
{
File.Delete(imageFullPath);
}
}

return true;
Expand Down

0 comments on commit e3f8bd4

Please sign in to comment.