-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
RippleEffect.cs
41 lines (36 loc) · 1.26 KB
/
RippleEffect.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using Android.Util;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Controls.Compatibility.Platform.Android;
using AView = Android.Views.View;
using Microsoft.Maui.Controls.Platform;
[assembly: ExportEffect(typeof(Microsoft.Maui.Controls.Compatibility.ControlGallery.Android.RippleEffect), nameof(Microsoft.Maui.Controls.Compatibility.ControlGallery.Android.RippleEffect))]
namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Android
{
[Preserve(AllMembers = true)]
public class RippleEffect : PlatformEffect
{
protected override void OnAttached()
{
try
{
if (Container is AView view)
{
view.Clickable = true;
view.Focusable = true;
using (var outValue = new TypedValue())
{
view.Context.Theme.ResolveAttribute(Resource.Attribute.selectableItemBackground, outValue, true);
view.SetBackgroundResource(outValue.ResourceId);
}
}
}
catch
{
}
}
protected override void OnDetached()
{
}
}
}