Skip to content

Commit 58eaafb

Browse files
committed
Fix #39 Shadow binding stopped working in 1.2.0 version (worked in 1.1.0) and #36 Crash: ShadowView.CreateBitmap: java.lang.nullpointerException
1 parent b92faa9 commit 58eaafb

File tree

14 files changed

+304
-288
lines changed

14 files changed

+304
-288
lines changed

Sample/ShadowsSample.Android/Resources/Resource.designer.cs

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sample/ShadowsSample.Android/ShadowsSample.Android.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
1717
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
1818
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
19-
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
2019
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
2120
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
2221
<AndroidUseAapt2>true</AndroidUseAapt2>
@@ -38,6 +37,8 @@
3837
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
3938
<BundleAssemblies>false</BundleAssemblies>
4039
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
40+
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
41+
<AndroidDexTool>dx</AndroidDexTool>
4142
</PropertyGroup>
4243
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
4344
<DebugSymbols>true</DebugSymbols>
@@ -126,7 +127,7 @@
126127
<Name>Shadows.Droid</Name>
127128
</ProjectReference>
128129
<ProjectReference Include="..\ShadowsSample\ShadowsSample.csproj">
129-
<Project>{A5BE210F-0735-431E-9BF3-1F2875D3BA92}</Project>
130+
<Project>{4A4B357C-63C2-4572-B25F-0CE9391B6766}</Project>
130131
<Name>ShadowsSample</Name>
131132
</ProjectReference>
132133
</ItemGroup>

Sample/ShadowsSample/Styles/Shadows.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
<Setter Property="CornerRadius" Value="10" />
1212
<Setter Property="Shades">
1313
<sh:ImmutableShades>
14-
<sh:Shade BlurRadius="8"
14+
<sh:Shade BlurRadius="15"
1515
Opacity="1"
1616
Offset="-10,-10"
1717
Color="White" />
18-
<sh:Shade BlurRadius="10"
18+
<sh:Shade BlurRadius="15"
1919
Opacity="1"
20-
Offset="6, 6"
20+
Offset="10, 10"
2121
Color="#19000000" />
2222
</sh:ImmutableShades>
2323
</Setter>

Shadows/AssemblyInfo.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup>
55
<Copyright>Copyright © Sharpnado 2020</Copyright>
6-
<Version>1.2.0</Version>
6+
<Version>1.2.1</Version>
77
<Company>Sharpnado</Company>
88
<Product>Shadows</Product>
99
<Description>Add as many custom shadows as you like to any Xamarin.Forms view (Android, iOS, UWP). Set Color, Opacity, Blur, and Offset for each shadow.</Description>

Shadows/Shadows.Droid/ShadowView.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected override void OnSizeChanged(int w, int h, int oldw, int oldh)
8888
{
8989
base.OnSizeChanged(w, h, oldw, oldh);
9090

91-
if (w <= MinimumSize || h <= MinimumSize)
91+
if (w <= MinimumSize || h <= MinimumSize || _isDisposed)
9292
{
9393
return;
9494
}
@@ -128,7 +128,7 @@ protected override void OnDraw(Canvas canvas)
128128
var stopWatch = new Stopwatch();
129129
stopWatch.Start();
130130
#endif
131-
if (!_weakSource.TryGetTarget(out var source))
131+
if (!_weakSource.TryGetTarget(out var source) || _renderScript.IsNullOrDisposed())
132132
{
133133
return;
134134
}
@@ -207,7 +207,9 @@ private void RefreshBitmap(Shade shade)
207207

208208
private void InsertBitmap(Shade shade)
209209
{
210-
if (!_weakSource.TryGetTarget(out var source) || !HasMinimumSize(source))
210+
if (!_weakSource.TryGetTarget(out var source)
211+
|| !HasMinimumSize(source)
212+
|| _renderScript.IsNullOrDisposed())
211213
{
212214
return;
213215
}

Shadows/Shadows.Droid/Shadows.Droid.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<FileAlignment>512</FileAlignment>
1616
<Deterministic>True</Deterministic>
1717
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
18-
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
1918
<LangVersion>latest</LangVersion>
2019
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
2120
<AndroidUseAapt2>true</AndroidUseAapt2>

Shadows/Shadows.iOS/Info.plist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict/>
5+
</plist>
Lines changed: 77 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,78 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>8.0.30703</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{794C7268-3BCA-483B-9ADB-E7D8E5DCDE89}</ProjectGuid>
9-
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10-
<TemplateGuid>{a52b8a63-bc84-4b47-910d-692533484892}</TemplateGuid>
11-
<OutputType>Library</OutputType>
12-
<RootNamespace>Sharpnado.Shades.iOS</RootNamespace>
13-
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
14-
<AssemblyName>Sharpnado.Shadows.iOS</AssemblyName>
15-
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
16-
<CodeAnalysisRuleSet>..\StyleCopRules.ruleset</CodeAnalysisRuleSet>
17-
</PropertyGroup>
18-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19-
<DebugSymbols>true</DebugSymbols>
20-
<DebugType>full</DebugType>
21-
<Optimize>false</Optimize>
22-
<OutputPath>bin\Debug</OutputPath>
23-
<DefineConstants>DEBUG;</DefineConstants>
24-
<ErrorReport>prompt</ErrorReport>
25-
<WarningLevel>4</WarningLevel>
26-
</PropertyGroup>
27-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28-
<DebugType>full</DebugType>
29-
<Optimize>true</Optimize>
30-
<OutputPath>bin\Release</OutputPath>
31-
<ErrorReport>prompt</ErrorReport>
32-
<WarningLevel>4</WarningLevel>
33-
</PropertyGroup>
34-
<ItemGroup>
35-
<PackageReference Include="Xamarin.Forms">
36-
<Version>4.6.0.847</Version>
37-
</PackageReference>
38-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
39-
<PrivateAssets>all</PrivateAssets>
40-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
41-
</PackageReference>
42-
<PackageReference Include="MSBuildTasks">
43-
<Version>1.5.0.235</Version>
44-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
45-
<PrivateAssets>all</PrivateAssets>
46-
</PackageReference>
47-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.113">
48-
<PrivateAssets>all</PrivateAssets>
49-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
50-
</PackageReference>
51-
</ItemGroup>
52-
<ItemGroup>
53-
<Reference Include="System" />
54-
<Reference Include="System.Xml" />
55-
<Reference Include="System.Core" />
56-
<Reference Include="Xamarin.iOS" />
57-
</ItemGroup>
58-
<ItemGroup>
59-
<Compile Include="..\Shadows\AssemblyInfo.cs">
60-
<Link>AssemblyInfo.cs</Link>
61-
</Compile>
62-
<Compile Include="CALayerExtensions.cs" />
63-
<Compile Include="iOSShadowsController.cs" />
64-
<Compile Include="iOSShadowsController.PropertyChanged.cs" />
65-
<Compile Include="iOSShadowsRenderer.cs" />
66-
<Compile Include="ShadeExtensions.cs" />
67-
</ItemGroup>
68-
<ItemGroup>
69-
<ProjectReference Include="..\Shadows\Shadows.csproj">
70-
<Project>{793936A7-04DD-4C8F-A8C1-524CF432C905}</Project>
71-
<Name>Shadows</Name>
72-
</ProjectReference>
73-
</ItemGroup>
74-
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{794C7268-3BCA-483B-9ADB-E7D8E5DCDE89}</ProjectGuid>
9+
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10+
<TemplateGuid>{a52b8a63-bc84-4b47-910d-692533484892}</TemplateGuid>
11+
<OutputType>Library</OutputType>
12+
<RootNamespace>Sharpnado.Shades.iOS</RootNamespace>
13+
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
14+
<AssemblyName>Sharpnado.Shadows.iOS</AssemblyName>
15+
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
16+
<CodeAnalysisRuleSet>..\StyleCopRules.ruleset</CodeAnalysisRuleSet>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug</OutputPath>
23+
<DefineConstants>DEBUG;</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<DebugType>full</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release</OutputPath>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<PackageReference Include="Xamarin.Forms">
36+
<Version>4.6.0.847</Version>
37+
</PackageReference>
38+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
39+
<PrivateAssets>all</PrivateAssets>
40+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
41+
</PackageReference>
42+
<PackageReference Include="MSBuildTasks">
43+
<Version>1.5.0.235</Version>
44+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
45+
<PrivateAssets>all</PrivateAssets>
46+
</PackageReference>
47+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.113">
48+
<PrivateAssets>all</PrivateAssets>
49+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
50+
</PackageReference>
51+
</ItemGroup>
52+
<ItemGroup>
53+
<Reference Include="System" />
54+
<Reference Include="System.Xml" />
55+
<Reference Include="System.Core" />
56+
<Reference Include="Xamarin.iOS" />
57+
</ItemGroup>
58+
<ItemGroup>
59+
<Compile Include="..\Shadows\AssemblyInfo.cs">
60+
<Link>AssemblyInfo.cs</Link>
61+
</Compile>
62+
<Compile Include="CALayerExtensions.cs" />
63+
<Compile Include="iOSShadowsController.cs" />
64+
<Compile Include="iOSShadowsController.PropertyChanged.cs" />
65+
<Compile Include="iOSShadowsRenderer.cs" />
66+
<Compile Include="ShadeExtensions.cs" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<ProjectReference Include="..\Shadows\Shadows.csproj">
70+
<Project>{793936A7-04DD-4C8F-A8C1-524CF432C905}</Project>
71+
<Name>Shadows</Name>
72+
</ProjectReference>
73+
</ItemGroup>
74+
<ItemGroup>
75+
<None Include="Info.plist" />
76+
</ItemGroup>
77+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
7578
</Project>

0 commit comments

Comments
 (0)