Skip to content

Commit

Permalink
Removed all usages of deprecated code.
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information
ddobrev committed May 11, 2018
1 parent 19bcdb1 commit cd6538a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<MtouchArch>Default, i386, x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>True</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchSdkVersion>
</MtouchSdkVersion>
<MtouchProfiling>False</MtouchProfiling>
Expand Down
5 changes: 3 additions & 2 deletions Toasts.Forms.Plugin.Droid/AlarmHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.IO;
using System.Xml.Serialization;
using Android.Graphics;
using Android.Support.V4.App;

namespace Plugin.Toasts
{
Expand All @@ -24,12 +25,12 @@ public override void OnReceive(Context context, Intent intent)
}

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

Expand Down
5 changes: 3 additions & 2 deletions Toasts.Forms.Plugin.Droid/NotificationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Xml.Serialization;
using Plugin.Toasts.Interfaces;
using System.Collections.Concurrent;
using Android.Support.V4.App;

namespace Plugin.Toasts
{
Expand Down Expand Up @@ -211,12 +212,12 @@ public INotificationResult Notify(Activity activity, INotificationOptions option
options.AndroidOptions.HexColor = "#" + options.AndroidOptions.HexColor;
}

Android.App.Notification.Builder builder = new Android.App.Notification.Builder(Application.Context)
var builder = new NotificationCompat.Builder(Application.Context)
.SetContentTitle(options.Title)
.SetContentText(options.Description)
.SetSmallIcon(smallIcon) // Must have small icon to display
.SetPriority((int)NotificationPriority.High) // Must be set to High to get Heads-up notification
.SetDefaults(NotificationDefaults.All) // Must also include vibrate to get Heads-up notification
.SetDefaults((int) NotificationDefaults.All) // Must also include vibrate to get Heads-up notification
.SetAutoCancel(true) // To allow click event to trigger delete Intent
.SetContentIntent(pendingClickIntent) // Must have Intent to accept the click
.SetDeleteIntent(pendingDismissIntent)
Expand Down
6 changes: 3 additions & 3 deletions Toasts.Forms.Plugin.Droid/SnackbarNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public NotificationResult Notify(Activity activity, INotificationOptions options

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

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

// Setup reset events
var resetEvent = new ManualResetEvent(false);
Expand Down

0 comments on commit cd6538a

Please sign in to comment.