Esempio n. 1
0
 private void ItemLongClicked(object sender, NotificationItemClickedEventArgs e)
 {
     notification.Visibility = ViewStates.Visible;
     openNotification        = new OpenNotification(e.StatusBarNotification);
     openNotification.Cancel();
     notification.Visibility = ViewStates.Invisible;
 }
 private void ItemLongClicked(object sender, NotificationItemClickedEventArgs e)
 {
     position = e.Position;
     notification.Visibility = ViewStates.Visible;
     using (OpenNotification openNotification = new OpenNotification(e.Position))
     {
         //If the notification is removable...
         if (openNotification.IsRemovable())
         {
             //Then remove the notification
             using (NotificationSlave slave = NotificationSlave.NotificationSlaveInstance())
             {
                 if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop)
                 {
                     int    notiId   = CatcherHelper.statusBarNotifications[position].Id;
                     string notiTag  = CatcherHelper.statusBarNotifications[position].Tag;
                     string notiPack = CatcherHelper.statusBarNotifications[position].PackageName;
                     slave.CancelNotification(notiPack, notiTag, notiId);
                 }
                 else
                 {
                     slave.CancelNotification(CatcherHelper.statusBarNotifications[position].Key);
                 }
             }
             notification.Visibility = ViewStates.Invisible;
             titulo.Text             = null;
             texto.Text = null;
             notificationActions.RemoveAllViews();
         }
     }
 }
        private void NotificationAdapterViewHolder_ItemClicked(object sender, NotificationItemClickedEventArgs e)
        {
            openNotification = e.StatusBarNotification;

            if (configurationManager.RetrieveAValue(ConfigurationParameters.TestEnabled))
            {
                Toast.MakeText(floatingNotificationView.Context, "Progress Indeterminate?: " + openNotification.IsProgressIndeterminate().ToString() + "\n"
                               + "Current Progress: " + openNotification.GetProgress().ToString() + "\n"
                               + "Max Progress: " + openNotification.GetProgressMax().ToString() + "\n"
                               + openNotification.GetGroupInfo()
                               , ToastLength.Short).Show();
            }
            //Only do this process if the notification that I want to show is different than the one that
            //the Floating Notification Widget has.
            //If it's the same then simply show it.
            if ((string)floatingNotificationView.GetTag(Resource.String.defaulttag) != openNotification.GetCustomId())
            {
                floatingNotificationView.SetTag(Resource.String.defaulttag, openNotification.GetCustomId());
            }
            if (floatingNotificationView.Visibility != ViewStates.Visible)
            {
                floatingNotificationView.Visibility = ViewStates.Visible;
            }
            else if (floatingNotificationView.Visibility != ViewStates.Visible)
            {
                floatingNotificationView.Visibility = ViewStates.Invisible;
            }
        }
Esempio n. 4
0
 private void ItemLongClicked(object sender, NotificationItemClickedEventArgs e)
 {
     e.StatusBarNotification.Cancel();
     WidgetStatusPublisher.RequestShow(new WidgetStatusEventArgs {
         Show = false, WidgetName = "NotificationFragment"
     });
     maincontainer.Visibility = ViewStates.Invisible;
 }
        private void ItemClicked(object sender, NotificationItemClickedEventArgs e)
        {
            position = e.Position;
            using (OpenNotification openNotification = new OpenNotification(e.Position))
            {
                ThreadPool.QueueUserWorkItem(method =>
                {
                    var notificationBigPicture = new BitmapDrawable(Resources, openNotification.GetBigPicture());
                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs {
                        Wallpaper = notificationBigPicture, OpacityLevel = 125, SecondsOfAttention = 5
                    });
                });
                titulo.Text  = openNotification.GetTitle();
                texto.Text   = openNotification.GetText();
                appName.Text = openNotification.GetAppName();
                when.Text    = openNotification.GetWhen();
                notificationActions.RemoveAllViews();

                if (openNotification.NotificationHasActionButtons() == true)
                {
                    var actions = openNotification.RetrieveActions();
                    foreach (var a in actions)
                    {
                        OpenAction openAction = new OpenAction(a);
                        float      weight     = (float)1 / actions.Count;

                        Button anActionButton = new Button(Application.Context)
                        {
                            LayoutParameters = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, weight),
                            Text             = openAction.GetTitle()
                        };
                        anActionButton.TransformationMethod = null;
                        anActionButton.SetTypeface(Typeface.Create("sans-serif-condensed", TypefaceStyle.Normal), TypefaceStyle.Normal);
                        anActionButton.SetMaxLines(1);
                        anActionButton.SetTextColor(Color.White);
                        anActionButton.Click += (o, eventargs) =>
                        {
                            openAction.ClickAction();
                        };
                        anActionButton.Gravity = GravityFlags.CenterVertical;
                        TypedValue outValue = new TypedValue();
                        Application.Context.Theme.ResolveAttribute(Android.Resource.Attribute.SelectableItemBackgroundBorderless, outValue, true);
                        anActionButton.SetBackgroundResource(outValue.ResourceId);
                        anActionButton.SetCompoundDrawablesRelativeWithIntrinsicBounds(openAction.GetActionIcon(), null, null, null);
                        notificationActions.AddView(anActionButton);
                    }
                    ;
                }
            }
            if (notification.Visibility != ViewStates.Visible)
            {
                notification.Visibility = ViewStates.Visible;
                StartTimeout();
            }

            NotificationClicked?.Invoke(null, EventArgs.Empty);
        }
Esempio n. 6
0
        private void ItemClicked(object sender, NotificationItemClickedEventArgs e)
        {
            openNotification = new OpenNotification(e.StatusBarNotification);

            //if the current notification widget does not have a tag, let's set it.

            if (notification.GetTag(Resource.String.defaulttag) == null)
            {
                notification.SetTag(Resource.String.defaulttag, openNotification.GetCustomId());
            }

            if (configurationManager.RetrieveAValue(ConfigurationParameters.TestEnabled))
            {
                Toast.MakeText(Activity, "Progress Indeterminate?: " + openNotification.IsProgressIndeterminate().ToString() + "\n"
                               + "Current Progress: " + openNotification.GetProgress().ToString() + "\n"
                               + "Max Progress: " + openNotification.GetProgressMax().ToString() + "\n"
                               + openNotification.GetGroupInfo()
                               , ToastLength.Short).Show();
            }

            //Only do this process if the notification that I want to show is different than the one that
            //the Notification Widget has.
            //If it's the same then simply show it.
            if ((string)notification.GetTag(Resource.String.defaulttag) != openNotification.GetCustomId())
            {
                styleApplier?.ApplyStyle(openNotification);
                notification.SetTag(Resource.String.defaulttag, openNotification.GetCustomId());
                if (notification.Visibility != ViewStates.Visible)
                {
                    notification.Visibility = ViewStates.Visible;
                }
            }
            else if (notification.Visibility != ViewStates.Visible)
            {
                styleApplier?.ApplyStyle(openNotification);
                notification.Visibility = ViewStates.Visible;
            }
            StartTimeout(false);
        }
Esempio n. 7
0
 private void ItemClicked(object sender, NotificationItemClickedEventArgs e)
 {
     ShowNotification(e.StatusBarNotification);
 }
Esempio n. 8
0
        private void NotificationAdapterViewHolder_ItemClicked(object sender, NotificationItemClickedEventArgs e)
        {
            openNotification = new OpenNotification(e.StatusBarNotification);

            if (configurationManager.RetrieveAValue(ConfigurationParameters.TestEnabled))
            {
                Toast.MakeText(floatingNotificationView.Context, "Progress Indeterminate?: " + openNotification.IsProgressIndeterminate().ToString() + "\n"
                               + "Current Progress: " + openNotification.GetProgress().ToString() + "\n"
                               + "Max Progress: " + openNotification.GetProgressMax().ToString() + "\n"
                               + openNotification.GetGroupInfo()
                               , ToastLength.Short).Show();
            }
            //Only do this process if the notification that I want to show is different than the one that
            //the Floating Notification Widget has.
            //If it's the same then simply show it.
            if ((string)floatingNotificationView.GetTag(Resource.String.defaulttag) != openNotification.GetCustomId())
            {
                floatingNotificationAppName.Text = openNotification.AppName();
                floatingNotificationWhen.Text    = openNotification.When();
                floatingNotificationTitle.Text   = openNotification.Title();
                floatingNotificationText.Text    = openNotification.Text();
                floatingNotificationActionsContainer.RemoveAllViews();

                if (openNotification.HasActions() == true)
                {
                    var actions = openNotification.RetrieveActions();
                    foreach (var a in actions)
                    {
                        OpenAction openAction = new OpenAction(a);
                        float      weight     = (float)1 / actions.Count;

                        Button anActionButton = new Button(Application.Context)
                        {
                            LayoutParameters = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, weight),
                            Text             = openAction.Title(),
                        };
                        anActionButton.SetTypeface(Typeface.Create("sans-serif-condensed", TypefaceStyle.Normal), TypefaceStyle.Normal);
                        anActionButton.SetMaxLines(1);
                        anActionButton.SetTextColor(Color.Black);
                        anActionButton.Click += (o, eventargs) =>
                        {
                            openAction.ClickAction();
                        };
                        anActionButton.Gravity = GravityFlags.CenterVertical;
                        TypedValue outValue = new TypedValue();
                        Application.Context.Theme.ResolveAttribute(Android.Resource.Attribute.SelectableItemBackgroundBorderless, outValue, true);
                        anActionButton.SetBackgroundResource(outValue.ResourceId);
                        //anActionButton.SetCompoundDrawablesRelativeWithIntrinsicBounds(openAction.GetActionIcon(), null, null, null);
                        floatingNotificationActionsContainer.AddView(anActionButton);
                    }
                    ;
                }
            }
            else
            {
                floatingNotificationAppName.Text = openNotification.AppName();
                floatingNotificationWhen.Text    = openNotification.When();
                floatingNotificationTitle.Text   = openNotification.Title();
                floatingNotificationText.Text    = openNotification.Text();
                floatingNotificationActionsContainer.RemoveAllViews();

                if (openNotification.HasActions() == true)
                {
                    var actions = openNotification.RetrieveActions();
                    foreach (var a in actions)
                    {
                        OpenAction openAction = new OpenAction(a);
                        float      weight     = (float)1 / actions.Count;

                        Button anActionButton = new Button(Application.Context)
                        {
                            LayoutParameters = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, weight),
                            Text             = openAction.Title(),
                        };
                        anActionButton.SetTypeface(Typeface.Create("sans-serif-condensed", TypefaceStyle.Normal), TypefaceStyle.Normal);
                        anActionButton.SetMaxLines(1);
                        anActionButton.SetTextColor(Color.Black);
                        anActionButton.Click += (o, eventargs) =>
                        {
                            openAction.ClickAction();
                        };
                        anActionButton.Gravity = GravityFlags.CenterVertical;
                        TypedValue outValue = new TypedValue();
                        Application.Context.Theme.ResolveAttribute(Android.Resource.Attribute.SelectableItemBackgroundBorderless, outValue, true);
                        anActionButton.SetBackgroundResource(outValue.ResourceId);
                        //anActionButton.SetCompoundDrawablesRelativeWithIntrinsicBounds(openAction.GetActionIcon(), null, null, null);
                        floatingNotificationActionsContainer.AddView(anActionButton);
                    }
                    ;
                }
            }
            if (floatingNotificationView.Visibility != ViewStates.Visible)
            {
                floatingNotificationView.Visibility = ViewStates.Visible;
            }
            else if (floatingNotificationView.Visibility != ViewStates.Visible)
            {
                floatingNotificationView.Visibility = ViewStates.Invisible;
            }
        }
Esempio n. 9
0
 private void NotificationAdapterViewHolder_ItemLongClicked(object sender, NotificationItemClickedEventArgs e)
 {
     openNotification = new OpenNotification(e.StatusBarNotification);
     openNotification.Cancel();
     floatingNotificationView.Visibility = ViewStates.Gone;
 }
 private void CatcherHelper_NotificationUpdated(object sender, NotificationItemClickedEventArgs e)
 {
     ItemClicked(this, e);
 }