Use loading.png for loading time image placeholder

This commit is contained in:
Hongtao Zhang 2022-11-26 10:16:04 -06:00
parent 45335f269f
commit ca6c6cb62a
No known key found for this signature in database
GPG key ID: 75F655B91C7AC9BB
5 changed files with 8 additions and 6 deletions

View file

@ -29,6 +29,7 @@ namespace Flow.Launcher.Infrastructure
public static readonly string DefaultIcon = Path.Combine(ImagesDirectory, "app.png");
public static readonly string ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
public static readonly string MissingImgIcon = Path.Combine(ImagesDirectory, "app_missing_img.png");
public static readonly string LoadingImgIcon = Path.Combine(ImagesDirectory, "loading.png");
public static string PythonPath;

View file

@ -21,7 +21,8 @@ namespace Flow.Launcher.Infrastructure.Image
private static readonly ConcurrentDictionary<string, string> GuidToKey = new();
private static IImageHashGenerator _hashGenerator;
private static readonly bool EnableImageHash = true;
public static ImageSource DefaultImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon));
public static ImageSource MissingImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon));
public static ImageSource LoadingImage { get; } = new BitmapImage(new Uri(Constant.LoadingImgIcon));
public const int SmallIconSize = 32;
@ -111,7 +112,7 @@ namespace Flow.Launcher.Infrastructure.Image
{
if (string.IsNullOrEmpty(path))
{
return new ImageResult(DefaultImage, ImageType.Error);
return new ImageResult(MissingImage, ImageType.Error);
}
if (ImageCache.ContainsKey(path, loadFullImage))

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

View file

@ -35,7 +35,7 @@ namespace Flow.Launcher.ViewModel
{
get
{
if (_image == ImageLoader.DefaultImage)
if (_image == ImageLoader.MissingImage)
LoadIconAsync();
return _image;
@ -67,7 +67,7 @@ namespace Flow.Launcher.ViewModel
? new Control()
: settingProvider.CreateSettingPanel()
: null;
private ImageSource _image = ImageLoader.DefaultImage;
private ImageSource _image = ImageLoader.MissingImage;
public Visibility ActionKeywordsVisibility => PluginPair.Metadata.ActionKeywords.Count == 1 ? Visibility.Visible : Visibility.Collapsed;
public string InitilizaTime => PluginPair.Metadata.InitTime + "ms";

View file

@ -126,7 +126,7 @@ namespace Flow.Launcher.ViewModel
private volatile bool ImageLoaded;
private ImageSource image = ImageLoader.DefaultImage;
private ImageSource image = ImageLoader.LoadingImage;
public ImageSource Image
{
@ -168,7 +168,7 @@ namespace Flow.Launcher.ViewModel
if (ImageLoader.CacheContainImage(imagePath))
{
// will get here either when icoPath has value\icon delegate is null\when had exception in delegate
image = await ImageLoader.LoadAsync(imagePath, loadFullImage);
image = await ImageLoader.LoadAsync(imagePath, loadFullImage).ConfigureAwait(false);
return;
}