Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit 2f692de

Browse filesBrowse files
author
Serhii Koreniuk
committed
Update to version 2.0.2
1 parent 6b02441 commit 2f692de
Copy full SHA for 2f692de
Expand file treeCollapse file tree

18 files changed

+77
-209
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Xamarin.BlurView
22

3-
![version](https://img.shields.io/badge/original-v1.6.5-orange.svg?style=flat)
3+
![version](https://img.shields.io/badge/original-v2.0.2-orange.svg?style=flat)
44
[![NuGet Badge](https://buildstats.info/nuget/Xamarin.BlurView)](https://www.nuget.org/packages/Xamarin.BlurView/)
55
![Build status](https://yauhenipakala.visualstudio.com/_apis/public/build/definitions/b0170656-dd62-445e-bbb7-d6a336f4a889/1/badge)
66

‎nuget/Xamarin.BlurView.nuspec

Copy file name to clipboardExpand all lines: nuget/Xamarin.BlurView.nuspec
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
22
<metadata>
33
<id>Xamarin.BlurView</id>
4-
<version>1.6.5</version>
4+
<version>2.0.2</version>
55
<title>Dynamic blur for Xamarin Android</title>
66
<authors>Dmitry Saviuk, Yauheni Pakala</authors>
77
<owners>Yauheni Pakala</owners>

‎samples/SampleApp/ListFragment.cs

Copy file name to clipboardExpand all lines: samples/SampleApp/ListFragment.cs
+6-14Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Android.Content;
22
using Android.Views;
3-
using AndroidX.RecyclerView.Widget;
4-
3+
using AndroidX.RecyclerView.Widget;
4+
55
namespace SampleApp
66
{
77
public class ListFragment : BaseFragment
@@ -19,19 +19,11 @@ public override void OnViewCreated(View view, Android.OS.Bundle savedInstanceSta
1919
Init();
2020
}
2121

22-
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState)
23-
{
24-
var view = base.OnCreateView(inflater, container, savedInstanceState);
25-
26-
recyclerView = view.FindViewById<RecyclerView>(Resource.Id.recyclerView);
27-
28-
return view;
29-
}
30-
31-
void Init()
22+
private void Init()
3223
{
33-
recyclerView.SetAdapter(new ExampleListAdapter(Context));
34-
recyclerView.SetLayoutManager(new LinearLayoutManager(Context));
24+
recyclerView = View.FindViewById<RecyclerView>(Resource.Id.recyclerView);
25+
recyclerView?.SetAdapter(new ExampleListAdapter(Context));
26+
recyclerView?.SetLayoutManager(new LinearLayoutManager(Context));
3527
}
3628
}
3729

‎samples/SampleApp/MainActivity.cs

Copy file name to clipboardExpand all lines: samples/SampleApp/MainActivity.cs
+61-45Lines changed: 61 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
using System.Collections.Generic;
22
using Android.App;
33
using Android.Content.PM;
4-
using Android.Graphics.Drawables;
54
using Android.OS;
65
using Android.Views;
76
using Android.Widget;
87
using Java.Lang;
98
using Com.EightbitLab.BlurViewBinding;
10-
using AndroidX.ViewPager.Widget;
11-
using AndroidX.AppCompat.App;
12-
using Google.Android.Material.Tabs;
13-
using AndroidX.Fragment.App;
14-
//using Com.EightbitLab.SupportRenderScriptBlurBinding;
15-
16-
// Ported from:
17-
// https://github.com/Dimezis/BlurView/blob/b5f6f414ae16885acb709fe5a65d24df05c4c62a/app/src/main/java/com/eightbitlab/blurview_sample/MainActivity.java
9+
using AndroidX.ViewPager.Widget;
10+
using AndroidX.AppCompat.App;
11+
using Google.Android.Material.Tabs;
12+
using AndroidX.Fragment.App;
13+
using Math = Java.Lang.Math;
14+
using String = Java.Lang.String;
15+
16+
//using Com.EightbitLab.SupportRenderScriptBlurBinding;
17+
18+
// Ported from:
19+
// https://github.com/Dimezis/BlurView/blob/b5f6f414ae16885acb709fe5a65d24df05c4c62a/app/src/main/java/com/eightbitlab/blurview_sample/MainActivity.java
1820
namespace SampleApp
1921
{
2022
[Activity(
@@ -25,73 +27,88 @@ namespace SampleApp
2527
Theme = "@style/Theme.MyTheme")]
2628
public class MainActivity : AppCompatActivity
2729
{
28-
ViewGroup root;
29-
ViewPager viewPager;
30-
SeekBar radiusSeekBar;
31-
BlurView topBlurView;
32-
BlurView bottomBlurView;
33-
TabLayout tabLayout;
30+
private ViewPager viewPager;
31+
private TabLayout tabLayout;
32+
private BlurView bottomBlurView;
33+
private BlurView topBlurView;
34+
private SeekBar radiusSeekBar;
35+
private ViewGroup root;
3436

3537
protected override void OnCreate(Bundle savedInstanceState)
3638
{
3739
base.OnCreate(savedInstanceState);
3840
SetContentView(Resource.Layout.activity_main);
41+
InitView();
42+
SetupBlurView();
43+
SetupViewPager();
44+
}
3945

40-
root = FindViewById<ViewGroup>(Resource.Id.root);
46+
private void InitView()
47+
{
4148
viewPager = FindViewById<ViewPager>(Resource.Id.viewPager);
42-
radiusSeekBar = FindViewById<SeekBar>(Resource.Id.radiusSeekBar);
43-
topBlurView = FindViewById<BlurView>(Resource.Id.topBlurView);
44-
bottomBlurView = FindViewById<BlurView>(Resource.Id.bottomBlurView);
4549
tabLayout = FindViewById<TabLayout>(Resource.Id.tabLayout);
50+
bottomBlurView = FindViewById<BlurView>(Resource.Id.bottomBlurView);
51+
topBlurView = FindViewById<BlurView>(Resource.Id.topBlurView);
52+
radiusSeekBar = FindViewById<SeekBar>(Resource.Id.radiusSeekBar);
53+
root = FindViewById<ViewGroup>(Resource.Id.root);
54+
}
55+
56+
private void SetupViewPager()
57+
{
58+
viewPager.OffscreenPageLimit = 2;
59+
viewPager.Adapter = new ViewPagerAdapter(SupportFragmentManager);
60+
tabLayout.SetupWithViewPager(viewPager);
61+
}
4662

47-
SetupBlurView();
48-
SetupViewPager();
49-
}
50-
5163
void SetupBlurView()
5264
{
53-
float radius = 25f;
54-
float minBlurRadius = 10f;
55-
float step = 4f;
65+
const float radius = 25f;
66+
const float minBlurRadius = 4f;
67+
const float step = 4f;
5668

5769
//set background, if your root layout doesn't have one
58-
Drawable windowBackground = Window.DecorView.Background;
59-
60-
var topViewSettings = topBlurView.SetupWith(root)
70+
var windowBackground = Window?.DecorView.Background;
71+
var algorithm = GetBlurAlgorithm();
72+
73+
var topViewSettings = topBlurView.SetupWith(root, algorithm)
6174
.SetFrameClearDrawable(windowBackground)
62-
.SetBlurAlgorithm(new RenderScriptBlur(this)) // SupportRenderScriptBlur
63-
.SetBlurRadius(radius)
64-
.SetHasFixedTransformationMatrix(true);
75+
.SetBlurRadius(radius);
6576

66-
var bottomViewSettings = bottomBlurView.SetupWith(root)
77+
var bottomViewSettings = bottomBlurView.SetupWith(root, algorithm)
6778
.SetFrameClearDrawable(windowBackground)
68-
.SetBlurAlgorithm(new RenderScriptBlur(this)) // SupportRenderScriptBlur
69-
.SetBlurRadius(radius)
70-
.SetHasFixedTransformationMatrix(true);
79+
.SetBlurRadius(radius);
7180

72-
int initialProgress = (int)(radius * step);
81+
var initialProgress = (int) (radius * step);
7382
radiusSeekBar.Progress = initialProgress;
7483

7584
radiusSeekBar.ProgressChanged += (sender, args) =>
7685
{
77-
float blurRadius = args.Progress / step;
86+
var blurRadius = args.Progress / step;
7887
blurRadius = Math.Max(blurRadius, minBlurRadius);
7988
topViewSettings.SetBlurRadius(blurRadius);
8089
bottomViewSettings.SetBlurRadius(blurRadius);
8190
};
8291
}
8392

84-
void SetupViewPager()
93+
private IBlurAlgorithm GetBlurAlgorithm()
8594
{
86-
viewPager.OffscreenPageLimit = 2;
87-
viewPager.Adapter = new ViewPagerAdapter(SupportFragmentManager);
88-
tabLayout.SetupWithViewPager(viewPager);
95+
IBlurAlgorithm algorithm;
96+
if (Build.VERSION.SdkInt > BuildVersionCodes.R)
97+
{
98+
algorithm = new RenderEffectBlur();
99+
}
100+
else
101+
{
102+
algorithm = new RenderScriptBlur(this);
103+
}
104+
105+
return algorithm;
89106
}
90107
}
91108

92109
class ViewPagerAdapter : FragmentPagerAdapter
93110
{
94-
List<BaseFragment> pages;
111+
private readonly List<BaseFragment> pages;
95112

96113
public ViewPagerAdapter(AndroidX.Fragment.App.FragmentManager fragmentManager)
97114
: base(fragmentManager, BehaviorResumeOnlyCurrentFragment)
@@ -113,8 +130,7 @@ public override AndroidX.Fragment.App.Fragment GetItem(int position)
113130

114131
public override ICharSequence GetPageTitleFormatted(int position)
115132
{
116-
return new Java.Lang.String(pages[position].Title);
133+
return new String(pages[position].Title);
117134
}
118135
}
119136
}
120-
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company.BlurView.SampleApp" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
3-
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="29" />
3+
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="33" />
44
<application android:label="@string/app_name" android:icon="@drawable/Icon" android:theme="@style/Theme.MyTheme"></application>
55
</manifest>

‎samples/SampleApp/Resources/Resource.Designer.cs

Copy file name to clipboardExpand all lines: samples/SampleApp/Resources/Resource.Designer.cs
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎samples/SampleApp/SampleApp.csproj

Copy file name to clipboardExpand all lines: samples/SampleApp/SampleApp.csproj
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
1919
<DevInstrumentationEnabled>True</DevInstrumentationEnabled>
2020
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
21-
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
21+
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
2222
<NuGetPackageImportStamp>
2323
</NuGetPackageImportStamp>
2424
</PropertyGroup>
@@ -97,10 +97,6 @@
9797
<Project>{f5dda6ed-ab87-4c6f-89a6-96aeeadeb8bb}</Project>
9898
<Name>Xamarin.BlurView</Name>
9999
</ProjectReference>
100-
<ProjectReference Include="..\..\src\Xamarin.BlurView.SupportRenderScriptBlur\Xamarin.BlurView.SupportRenderScriptBlur.csproj">
101-
<Project>{874CA305-2F23-4046-AA19-46955CCA7033}</Project>
102-
<Name>Xamarin.BlurView.SupportRenderScriptBlur</Name>
103-
</ProjectReference>
104100
</ItemGroup>
105101
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
106102
</Project>

‎src/Xamarin.BlurView.SupportRenderScriptBlur/Properties/AssemblyInfo.cs

Copy file name to clipboardExpand all lines: src/Xamarin.BlurView.SupportRenderScriptBlur/Properties/AssemblyInfo.cs
-30Lines changed: 0 additions & 30 deletions
This file was deleted.

‎src/Xamarin.BlurView.SupportRenderScriptBlur/Transforms/EnumFields.xml

Copy file name to clipboardExpand all lines: src/Xamarin.BlurView.SupportRenderScriptBlur/Transforms/EnumFields.xml
-14Lines changed: 0 additions & 14 deletions
This file was deleted.

‎src/Xamarin.BlurView.SupportRenderScriptBlur/Transforms/EnumMethods.xml

Copy file name to clipboardExpand all lines: src/Xamarin.BlurView.SupportRenderScriptBlur/Transforms/EnumMethods.xml
-13Lines changed: 0 additions & 13 deletions
This file was deleted.

‎src/Xamarin.BlurView.SupportRenderScriptBlur/Transforms/Metadata.xml

Copy file name to clipboardExpand all lines: src/Xamarin.BlurView.SupportRenderScriptBlur/Transforms/Metadata.xml
-12Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/Xamarin.BlurView.SupportRenderScriptBlur/Xamarin.BlurView.SupportRenderScriptBlur.csproj

Copy file name to clipboardExpand all lines: src/Xamarin.BlurView.SupportRenderScriptBlur/Xamarin.BlurView.SupportRenderScriptBlur.csproj
-61Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.