Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Android] Add null checks to ActivityIndicator #804

Merged
merged 1 commit into from Mar 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -45,16 +45,22 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE

void UpdateColor()
{
if (Element == null || Control == null)
return;

Color color = Element.Color;

if (!color.IsDefault)
Control.IndeterminateDrawable.SetColorFilter(color.ToAndroid(), PorterDuff.Mode.SrcIn);
Control.IndeterminateDrawable?.SetColorFilter(color.ToAndroid(), PorterDuff.Mode.SrcIn);
else
Control.IndeterminateDrawable.ClearColorFilter();
Control.IndeterminateDrawable?.ClearColorFilter();
}

void UpdateVisibility()
{
if (Element == null || Control == null)
return;

Control.Visibility = Element.IsRunning ? ViewStates.Visible : ViewStates.Invisible;
}
}
Expand Down