set => SetProperty(ref iconBackground, value);
}
- private void SetDefaultBackground()
+ private ImageVisual GetDefaultImageVisual()
{
ImageVisual imageVisual = new ImageVisual()
{
URL = Resources.GetImagePath() + "default_gradient.png",
};
- IconBackground = imageVisual.OutputVisualMap;
+ return imageVisual;
}
- private void SetGradientBackground(PropertyArray stopColor)
+ private GradientVisual GetGradientVisual(PropertyArray stopColor)
{
GradientVisual gradientVisual = new GradientVisual()
{
StopColor = stopColor,
SpreadMethod = GradientVisualSpreadMethodType.Pad,
};
- IconBackground = gradientVisual.OutputVisualMap;
+ return gradientVisual;
}
private PropertyArray GetGradientStopColors(Palette palette)
if (stopColor.Count() < 2)
{
Tizen.Log.Info(Resources.LogTag, "Palette or palatte values not valid, adding default gradient");
- SetDefaultBackground();
+ IconBackground = GetDefaultImageVisual().OutputVisualMap;
}
else
{
- Tizen.Log.Info(Resources.LogTag, "setting palette color");
- SetGradientBackground(stopColor);
+ Tizen.Log.Info(Resources.LogTag, "setting palette color");\r
+ IconBackground = GetGradientVisual(stopColor).OutputVisualMap;
}
}
}
public void CreateData(IEnumerable<ApplicationInfo> list)
{
Clear();
+ if(list == null)\r
+ {\r
+ return;\r
+ }
foreach (ApplicationInfo appInfo in list)
{
- if (string.IsNullOrEmpty(appInfo.IconPath))
+ if (appInfo == null || string.IsNullOrEmpty(appInfo.IconPath))
{
continue;
}
URL = Resources.GetImagePath() + "default_gradient.png",
};
IconBackground = imageVisual.OutputVisualMap;
+ imageVisual.Dispose();
}
private void SetGradientBackground(PropertyArray stopColor)
SpreadMethod = GradientVisualSpreadMethodType.Pad,
};
IconBackground = gradientVisual.OutputVisualMap;
+ gradientVisual.Dispose();
}
private PropertyArray GetGradientStopColors(Palette palette)