diff --git a/src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/glide/GlideLogging.java b/src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/glide/GlideLogging.java
new file mode 100644
index 000000000000..389203d20760
--- /dev/null
+++ b/src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/glide/GlideLogging.java
@@ -0,0 +1,18 @@
+package com.microsoft.maui.glide;
+
+import android.util.Log;
+
+public class GlideLogging {
+ private static final String TAG = "Glide";
+ private static final boolean IS_VERBOSE_LOGGABLE = Log.isLoggable(TAG, Log.VERBOSE);
+
+ public static boolean isVerboseLoggable() {
+ return IS_VERBOSE_LOGGABLE;
+ }
+
+ public static void v(String message) {
+ if (IS_VERBOSE_LOGGABLE) {
+ Log.v(TAG, message);
+ }
+ }
+}
diff --git a/src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/glide/MauiGlideModule.java b/src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/glide/MauiGlideModule.java
index 7cf85d7c1f54..7e397aa61374 100644
--- a/src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/glide/MauiGlideModule.java
+++ b/src/Core/AndroidNative/maui/src/main/java/com/microsoft/maui/glide/MauiGlideModule.java
@@ -2,13 +2,16 @@
import android.content.Context;
import android.graphics.Bitmap;
+import android.util.Log;
import com.bumptech.glide.Glide;
+import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
import com.microsoft.maui.ImageLoaderCallback;
+import com.microsoft.maui.glide.GlideLogging;
import com.microsoft.maui.glide.fallback.ImageLoaderCallbackModelLoaderFactory;
import com.microsoft.maui.glide.font.FontModel;
import com.microsoft.maui.glide.font.FontModelLoaderFactory;
@@ -33,4 +36,13 @@ public void registerComponents(Context context, Glide glide, Registry registry)
public boolean isManifestParsingEnabled() {
return false;
}
-}
\ No newline at end of file
+
+ @Override
+ public void applyOptions(Context context, GlideBuilder builder) {
+ // Glide is checking for the log level only on some classes, so we have to do it ourselves here.
+ // Command: adb shell setprop log.tag.Glide VERBOSE
+ if (GlideLogging.isVerboseLoggable()) {
+ builder.setLogLevel(Log.VERBOSE);
+ }
+ }
+}
diff --git a/src/Core/src/Core.csproj b/src/Core/src/Core.csproj
index b0a5c29e8d03..ebe6dc232f5f 100644
--- a/src/Core/src/Core.csproj
+++ b/src/Core/src/Core.csproj
@@ -36,7 +36,7 @@
-
+
diff --git a/src/Core/tests/Benchmarks.Droid/Benchmarks.Droid.csproj b/src/Core/tests/Benchmarks.Droid/Benchmarks.Droid.csproj
index 00b9bdf6593f..16e165daee0d 100644
--- a/src/Core/tests/Benchmarks.Droid/Benchmarks.Droid.csproj
+++ b/src/Core/tests/Benchmarks.Droid/Benchmarks.Droid.csproj
@@ -28,7 +28,7 @@
-
+
diff --git a/src/Core/tests/Benchmarks.Droid/ImageBenchmarks.cs b/src/Core/tests/Benchmarks.Droid/ImageBenchmarks.cs
index af1bba5bb831..30793443200e 100644
--- a/src/Core/tests/Benchmarks.Droid/ImageBenchmarks.cs
+++ b/src/Core/tests/Benchmarks.Droid/ImageBenchmarks.cs
@@ -1,12 +1,12 @@
using Android.Content;
+using Android.Graphics;
using Android.Graphics.Drawables;
using Android.OS;
using Bumptech.Glide;
-using Bumptech.Glide.Request.Target;
-using Bumptech.Glide.Request.Transition;
using Java.Lang;
using Microsoft.Maui.Storage;
using AImageView = Android.Widget.ImageView;
+using Path = System.IO.Path;
namespace Benchmarks.Droid;
@@ -20,6 +20,7 @@ public class ImageBenchmark
Handler? handler;
Context? context;
string? imageFilename;
+ Typeface? defaultTypeface;
[GlobalSetup]
public void GlobalSetup()
@@ -29,6 +30,7 @@ public void GlobalSetup()
imageView = new AImageView(context);
glide = Glide.Get(context);
handler = new Handler(Looper.MainLooper!);
+ defaultTypeface = Typeface.Default;
var imageName = "dotnet_bot.png";
var cacheDir = FileSystem.CacheDirectory;
@@ -70,6 +72,25 @@ public async Task ImageHelperFromFile()
await callback.SuccessTask;
}
+ [Benchmark]
+ public async Task ImageHelperFromFont()
+ {
+ var callback = new Callback();
+
+ handler!.Post(() =>
+ {
+ Microsoft.Maui.PlatformInterop.LoadImageFromFont(
+ context,
+ Color.Aquamarine,
+ "A",
+ defaultTypeface,
+ 24,
+ callback);
+ });
+
+ await callback.SuccessTask;
+ }
+
class Callback : Java.Lang.Object, Microsoft.Maui.IImageLoaderCallback
{
readonly TaskCompletionSource tcsDrawable = new TaskCompletionSource();