-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...rViewFormsSample/BlurViewFormsSample/BlurViewFormsSample.Android/FormsBlurViewRenderer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Android.App; | ||
using Android.Content; | ||
using Android.Views; | ||
using Android.Widget; | ||
|
||
using Xamarin.Forms; | ||
using Xamarin.Forms.Platform.Android; | ||
|
||
using Com.EightbitLab.BlurViewBinding; | ||
|
||
using BlurViewFormsSample; | ||
using BlurViewFormsSample.Droid; | ||
|
||
[assembly: ExportRenderer(typeof(FormsBlurView), typeof(FormsBlurViewRenderer))] | ||
|
||
namespace BlurViewFormsSample.Droid | ||
{ | ||
public class FormsBlurViewRenderer : ViewRenderer<FormsBlurView, FrameLayout> | ||
{ | ||
public FormsBlurViewRenderer(Context context) : base(context) | ||
{ | ||
} | ||
|
||
protected override void OnElementChanged(ElementChangedEventArgs<FormsBlurView> e) | ||
{ | ||
base.OnElementChanged(e); | ||
|
||
if (Control == null) | ||
{ | ||
var context = Context; | ||
var activity = context as Activity; | ||
|
||
var rootView = (ViewGroup) activity.Window.DecorView.FindViewById(Android.Resource.Id.Content); | ||
var windowBackground = activity.Window.DecorView.Background; | ||
|
||
var blurView = new BlurView(context); | ||
|
||
blurView.SetOverlayColor(Resource.Color.colorOverlay); | ||
|
||
blurView.SetupWith(rootView) | ||
.WindowBackground(windowBackground) | ||
.BlurAlgorithm(new RenderScriptBlur(context)) | ||
.BlurRadius(10f); | ||
|
||
SetNativeControl(blurView); | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
samples/BlurViewFormsSample/BlurViewFormsSample/BlurViewFormsSample/FormsBlurView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
using Xamarin.Forms; | ||
|
||
namespace BlurViewFormsSample | ||
{ | ||
public class FormsBlurView : StackLayout | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters