Skip to content

Commit cd6538a

Browse files
committed
Removed all usages of deprecated code.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
1 parent 19bcdb1 commit cd6538a

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Sample/Toasts.Forms.Plugin.Sample.iOS/Toasts.Forms.Plugin.Sample.iOS.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<MtouchArch>Default, i386, x86_64</MtouchArch>
2929
<MtouchLink>None</MtouchLink>
3030
<MtouchDebug>True</MtouchDebug>
31-
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
3231
<MtouchSdkVersion>
3332
</MtouchSdkVersion>
3433
<MtouchProfiling>False</MtouchProfiling>

Toasts.Forms.Plugin.Droid/AlarmHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.IO;
55
using System.Xml.Serialization;
66
using Android.Graphics;
7+
using Android.Support.V4.App;
78

89
namespace Plugin.Toasts
910
{
@@ -24,12 +25,12 @@ public override void OnReceive(Context context, Intent intent)
2425
}
2526

2627
// Show Notification
27-
Android.App.Notification.Builder builder = new Android.App.Notification.Builder(Application.Context)
28+
var builder = new NotificationCompat.Builder(Application.Context, NotificationBuilder.DefaultChannelName)
2829
.SetContentTitle(options.Title)
2930
.SetContentText(options.Description)
3031
.SetSmallIcon(options.AndroidOptions.SmallDrawableIcon.Value) // Must have small icon to display
3132
.SetPriority((int)NotificationPriority.High) // Must be set to High to get Heads-up notification
32-
.SetDefaults(NotificationDefaults.All) // Must also include vibrate to get Heads-up notification
33+
.SetDefaults((int) NotificationDefaults.All) // Must also include vibrate to get Heads-up notification
3334
.SetAutoCancel(true)
3435
.SetColor(Color.ParseColor(options.AndroidOptions.HexColor));
3536

Toasts.Forms.Plugin.Droid/NotificationBuilder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Xml.Serialization;
99
using Plugin.Toasts.Interfaces;
1010
using System.Collections.Concurrent;
11+
using Android.Support.V4.App;
1112

1213
namespace Plugin.Toasts
1314
{
@@ -211,12 +212,12 @@ public INotificationResult Notify(Activity activity, INotificationOptions option
211212
options.AndroidOptions.HexColor = "#" + options.AndroidOptions.HexColor;
212213
}
213214

214-
Android.App.Notification.Builder builder = new Android.App.Notification.Builder(Application.Context)
215+
var builder = new NotificationCompat.Builder(Application.Context)
215216
.SetContentTitle(options.Title)
216217
.SetContentText(options.Description)
217218
.SetSmallIcon(smallIcon) // Must have small icon to display
218219
.SetPriority((int)NotificationPriority.High) // Must be set to High to get Heads-up notification
219-
.SetDefaults(NotificationDefaults.All) // Must also include vibrate to get Heads-up notification
220+
.SetDefaults((int) NotificationDefaults.All) // Must also include vibrate to get Heads-up notification
220221
.SetAutoCancel(true) // To allow click event to trigger delete Intent
221222
.SetContentIntent(pendingClickIntent) // Must have Intent to accept the click
222223
.SetDeleteIntent(pendingDismissIntent)

Toasts.Forms.Plugin.Droid/SnackbarNotification.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public NotificationResult Notify(Activity activity, INotificationOptions options
3636

3737
var snackbar = Snackbar.Make(view, builder, Snackbar.LengthLong);
3838
if (options.IsClickable)
39-
snackbar.SetAction(options.AndroidOptions.ViewText, new EmptyOnClickListener(id, (toastId, result) => { ToastClosed(toastId, result); }, new NotificationResult() { Action = NotificationAction.Clicked }));
39+
snackbar.SetAction(options.AndroidOptions.ViewText, new EmptyOnClickListener(id, ToastClosed, new NotificationResult() { Action = NotificationAction.Clicked }));
4040
else
41-
snackbar.SetAction(options.AndroidOptions.DismissText, new EmptyOnClickListener(id, (toastId, result) => { ToastClosed(toastId, result); }, new NotificationResult() { Action = NotificationAction.Dismissed }));
41+
snackbar.SetAction(options.AndroidOptions.DismissText, new EmptyOnClickListener(id, ToastClosed, new NotificationResult() { Action = NotificationAction.Dismissed }));
4242

4343
// Monitor callbacks
44-
snackbar.SetCallback(new ToastCallback(id, (toastId, result) => { ToastClosed(toastId, result); }));
44+
snackbar.AddCallback(new ToastCallback(id, ToastClosed));
4545

4646
// Setup reset events
4747
var resetEvent = new ManualResetEvent(false);

0 commit comments

Comments
 (0)