Esempio n. 1
0
        public FloatingActionButton()
        {
            SizeRequest = 40;
            AllowTap    = true;

            GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => {
                    if (TapAction != null)
                    {
                        TapAction.Dispatch();
                        return;
                    }

                    if (IsOpened)
                    {
                        IsOpened = false;
                        CloseAction.Dispatch();
                    }
                    else
                    {
                        IsOpened = true;
                        OpenAction.Dispatch();
                    }
                }, () => AllowTap)
            });
        }
Esempio n. 2
0
        public static WindowInfo AddWindowInfo(string path, ShowMode showMode, OpenAction openAct, BackgroundMode bgMode)
        {
            var info = new WindowInfo(path, showMode, openAct, bgMode);

            mWindowInfoMap.Add(info.name, info);
            return(info);
        }
Esempio n. 3
0
        public void TestHasClosureReferenceClassMethodLambda()
        {
            var          target = new TestClass();
            Action <int> action = i => target.SetValue(i + 1);

            Assert.That(OpenAction.HasClosureReference(action), Is.True);
        }
Esempio n. 4
0
 public virtual void ApplyActionsStyle()
 {
     NotificationActions?.RemoveAllViews();
     if (OpenNotification.HasActions())
     {
         var actions = OpenNotification.RetrieveActions();
         for (int i = 0; i <= actions.Count - 1; i++)
         {
             var        action       = actions[i];
             OpenAction openAction   = new OpenAction(action);
             Button     actionButton = new Button(Application.Context);
             float      weight       = 1f / actions.Count;
             actionButton.LayoutParameters = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, weight);
             SetActionTextColor(actionButton);
             SetActionTag(actionButton, openAction);
             actionButton.Click += ActionButton_Click;
             SetActionButtonGravity(actionButton);
             SetActionButtonTextMaxLines(actionButton);
             SetActionButtonTextTypeface(actionButton);
             SetActionButtonBackground(actionButton);
             SetActionText(actionButton, openAction.Title());
             SetActionTextLowercase(actionButton);
             SetActionIcon(actionButton, openAction);
             AddActionToActionsView(actionButton, i);
         }
     }
 }
Esempio n. 5
0
        public void TestHasClosureReferenceClassMethod()
        {
            var          target = new TestClass();
            Action <int> action = target.SetValue;

            Assert.That(OpenAction.HasClosureReference(action), Is.False);
        }
Esempio n. 6
0
 public WeakActionImpl(Action action, Action <Action> unregister)
 {
     m_target_ref  = new WeakReference(action.Target);
     m_open_action = (OpenAction)Delegate.CreateDelegate(typeof(OpenAction), null, action.Method);
     Handler       = Invoke;
     m_unregister  = unregister;
 }
Esempio n. 7
0
        public bool Equals(DestinyItemSackBlockDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     DetailAction == input.DetailAction ||
                     (DetailAction != null && DetailAction.Equals(input.DetailAction))
                     ) &&
                 (
                     OpenAction == input.OpenAction ||
                     (OpenAction != null && OpenAction.Equals(input.OpenAction))
                 ) &&
                 (
                     SelectItemCount == input.SelectItemCount ||
                     (SelectItemCount.Equals(input.SelectItemCount))
                 ) &&
                 (
                     VendorSackType == input.VendorSackType ||
                     (VendorSackType != null && VendorSackType.Equals(input.VendorSackType))
                 ) &&
                 (
                     OpenOnAcquire == input.OpenOnAcquire ||
                     (OpenOnAcquire != null && OpenOnAcquire.Equals(input.OpenOnAcquire))
                 ));
        }
Esempio n. 8
0
        public void TestCreateOpenActionStaticMethod()
        {
            Assert.That(() => OpenAction.CreateOpenAction <int>(TestClass.SetStaticValue), Throws.ArgumentException);

            Action <int, int> method = TestClass.SetStaticValues;

            Assert.That(() => OpenAction.CreateOpenAction <int, int>(method.Method), Throws.ArgumentException);
        }
Esempio n. 9
0
        public void TestHasClosureReferenceLocalVariableLambda()
        {
            int          value  = 0;
            Action <int> action = i => value = i;

            Assert.That(OpenAction.HasClosureReference(action), Is.True);
            Assert.That(value, Is.EqualTo(0)); // prevent unused variable
        }
Esempio n. 10
0
 public WindowInfo(string path, ShowMode showMode, OpenAction openAct, BackgroundMode bgMode)
 {
     this.prefabPath     = path;
     this.name           = path.Substring(path.LastIndexOf('/') + 1);
     this.showMode       = showMode;
     this.openAction     = openAct;
     this.backgroundMode = bgMode;
 }
Esempio n. 11
0
        public void TestOpenActionWrongTargetType()
        {
            var target = new TestClass();
            Action <object, int> openAction = OpenAction.CreateOpenAction <int>(target.SetValue);

            Assert.That(openAction, Is.Not.Null, "failed to create openAction");

            Assert.That(() => openAction(this, 3), Throws.InstanceOf <InvalidCastException>());
        }
        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. 13
0
        public void TestOpenActionTargetAsObject()
        {
            var target = new TestClass();
            Action <object, int> openAction = OpenAction.CreateOpenAction <int>(target.SetValue);

            Assert.That(openAction, Is.Not.Null, "failed to create openAction");

            openAction(target, 3);
            Assert.That(target.Value, Is.EqualTo(3));
        }
Esempio n. 14
0
        private void NotificationAdapterViewHolder_ItemClicked(object sender, Notificaciones.NotificationEventArgs.NotificationItemClickedEventArgs e)
        {
            position = e.Position;
            using (OpenNotification notification = new OpenNotification(e.Position))
            {
                position = e.Position;
                using (OpenNotification openNotification = new OpenNotification(e.Position))
                {
                    floatingNotificationAppName.Text = notification.GetAppName();
                    floatingNotificationWhen.Text    = notification.GetWhen();
                    floatingNotificationTitle.Text   = notification.GetTitle();
                    floatingNotificationText.Text    = notification.GetText();
                    floatingNotificationActionsContainer.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.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
                {
                    floatingNotificationView.Visibility = ViewStates.Invisible;
                }
            };
        }
Esempio n. 15
0
        public void TestCreateOpenActionTwoParameters()
        {
            var target = new TestClass();
            Action <int, int>         method     = target.SetValues;
            Action <object, int, int> openAction = OpenAction.CreateOpenAction <int, int>(method.Method);

            Assert.That(openAction, Is.Not.Null, "failed to create openAction");

            openAction(target, 3, 4);
            Assert.That(target.Value, Is.EqualTo(7));
        }
Esempio n. 16
0
    public void CheckPassword()
    {
        string correctPassword = "******";
        string inputPassword   = "";

        foreach (Text text in texts)
        {
            inputPassword += text.text;
        }
        if (correctPassword == inputPassword)
        {
            OpenAction.Invoke();
        }
    }
Esempio n. 17
0
        public JsonResult OnPostLoadDirectory([FromBody] OpenAction openAction)
        {
            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                connection.Open();

                DataTable dt = new DataTable();

                using (SqlCommand command = new SqlCommand("[dbo].[GetDirectoryItems]", connection))
                {
                    command.CommandType    = CommandType.StoredProcedure;
                    command.CommandTimeout = 300;

                    command.Parameters.Add("@IdDirectory", SqlDbType.Int);
                    command.Parameters["@IdDirectory"].Value = openAction.IdDirectory ?? Convert.DBNull;

                    command.Parameters.Add("@IsSortByName", SqlDbType.Bit);
                    command.Parameters["@IsSortByName"].Value = openAction.IsSortByName;

                    using (SqlDataReader dataReader = command.ExecuteReader())
                    {
                        dt.Load(dataReader);
                    }
                }
                connection.Close();

                OpenResult result = new OpenResult();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i].Field <int?>("Id_Directory").HasValue)
                    {
                        Directory dir = new Directory(dt.Rows[i].Field <int>("Id_Directory"));
                        dir.Name        = dt.Rows[i].Field <string>("Name");
                        dir.HasSubItems = dt.Rows[i].Field <bool>("HasSubItems");
                        result.Directories.Add(dir);
                    }
                    else
                    {
                        File file = new File(dt.Rows[i].Field <int>("Id_File"));
                        file.Name = dt.Rows[i].Field <string>("Name");
                        file.Size = dt.Rows[i].Field <long>("Size");
                        result.Files.Add(file);
                    }
                }

                return(new JsonResult(JsonConvert.SerializeObject(result)));
            }
        }
Esempio n. 18
0
        void Main()
        {
            MethodInfo sayHelloMethod          = typeof(Person).GetMethod("SayHello");
            OpenAction <Person, string> action =
                (OpenAction <Person, string>)
                Delegate.CreateDelegate(
                    typeof(OpenAction <Person, string>),
                    null,
                    sayHelloMethod);

            Person joe = new Person {
                Name = "Joe"
            };

            action(joe, "Jack"); // Prints "Hello Jack, my name is Joe"
        }
Esempio n. 19
0
        public void ApplyActionsStyle(OpenNotification notification)
        {
            notificationActions?.RemoveAllViews();
            if (notification.HasActions())
            {
                var actions = notification.RetrieveActions();
                foreach (Notification.Action action in actions)
                {
                    OpenAction openAction   = new OpenAction(action);
                    Button     actionButton = new Button(Application.Context);
                    float      weight       = 1f / actions.Count;
                    actionButton.LayoutParameters = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, weight);
                    actionButton.SetTextColor(Color.White); //Should change in MediaStyle (?)
                    actionButton.SetTag(DefaultActionIdentificator, openAction);
                    actionButton.Click  += AnActionButton_Click;
                    actionButton.Gravity = actionButtonsGravity;
                    actionButton.SetMaxLines(actiontextMaxLines);
                    TypedValue outValue = new TypedValue();
                    Application.Context.Theme.ResolveAttribute(Android.Resource.Attribute.SelectableItemBackground, outValue, true);
                    actionButton.SetBackgroundResource(outValue.ResourceId);
                    actionButton.SetTypeface(Typeface.Create(actionTextsTypeface, TypefaceStyle.Normal), TypefaceStyle.Normal);
                    //notificationActions.SetGravity(actionButtonsContainerGravity);

                    if (notification.Style() != MediaStyle)
                    {
                        actionButton.Text = openAction.Title();
                    }

                    if (actionTextsAreinCapitalLetters == false)
                    {
                        actionButton.TransformationMethod = null; //Disables all caps text.
                    }

                    Handler looper = new Handler(Looper.MainLooper);
                    looper.Post(() =>
                    {
                        if (shouldShowIcons || notification.Style() == MediaStyle)     //The MediaStyle allows icons to be shown.
                        {
                            actionButton.SetCompoundDrawablesRelativeWithIntrinsicBounds(openAction.GetActionIcon(), null, null, null);
                        }

                        notificationActions.AddView(actionButton);
                    });
                }
            }
        }
Esempio n. 20
0
        private void SendInlineResponse_Click(object sender, EventArgs e)
        {
            ImageButton actionButton = sender as ImageButton;
            OpenAction  openAction   = actionButton.GetTag(DefaultActionIdentificator) as OpenAction;

            openAction.SendInlineResponse(InlineResponse.Text);
            InlineResponse.Text            = string.Empty;
            NotificationActions.Visibility = ViewStates.Visible;
            InlineResponseNotificationContainer.Visibility = ViewStates.Invisible;
            // Check if no view has focus:
            View view = NotificationFragment?.Activity?.CurrentFocus;

            if (view != null)
            {
                InputMethodManager imm = (InputMethodManager)NotificationFragment.Activity.GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromInputMethod(view.WindowToken, 0);
            }
            SendInlineResponseAvailabityChanged?.Invoke(null, false);
        }
Esempio n. 21
0
        private void AnActionButton_Click(object sender, System.EventArgs e)
        {
            Button     actionButton = sender as Button;
            OpenAction openAction   = actionButton.GetTag(DefaultActionIdentificator) as OpenAction;

            if (openAction.ActionRepresentDirectReply())
            {
                notificationActions.Visibility         = ViewStates.Invisible;
                inlineNotificationContainer.Visibility = ViewStates.Visible;
                inlineresponse.Hint = openAction.GetPlaceholderTextForInlineResponse();
                sendinlineresponse.SetTag(DefaultActionIdentificator, openAction);
                sendinlineresponse.Click += Sendinlineresponse_Click;

                SendInlineResponseAvailabityChanged?.Invoke(null, true); //Is currently showing.
            }
            else
            {
                openAction.ClickAction();
                SendInlineResponseAvailabityChanged?.Invoke(null, false); //Here I assume the send inline textbox is not present, because the action simply does not represent a direct reply.
            }
        }
Esempio n. 22
0
        public void Open <T>(T uiID, AbstractPanel masterPanel, params object[] args) where T : IConvertible
        {
            if (m_Stack == null)
            {
                m_Stack = new List <OpenAction>();
            }

            int id = uiID.ToInt32(null);

            OpenAction action = new OpenAction(id, masterPanel);

            action.SetParam(args);

            for (int i = 0; i < m_Stack.Count; ++i)
            {
                m_Stack[i].Hide();
            }

            m_Stack.Add(action);

            action.Show();
        }
Esempio n. 23
0
        protected virtual void ActionButton_Click(object sender, EventArgs e)
        {
            Button     actionButton = sender as Button;
            OpenAction openAction   = actionButton.GetTag(DefaultActionIdentificator) as OpenAction;

            if (openAction.ActionRepresentDirectReply())
            {
                if (new ConfigurationManager(AppPreferences.Default).RetrieveAValue(ConfigurationParameters.EnableQuickReply))
                {
                    NotificationActions.Visibility = ViewStates.Invisible;
                    InlineResponseNotificationContainer.Visibility = ViewStates.Visible;
                    InlineResponse.Hint = openAction.GetPlaceholderTextForInlineResponse();
                    SendInlineResponse.SetTag(DefaultActionIdentificator, openAction);
                    SendInlineResponse.Click += SendInlineResponse_Click;
                    SendInlineResponseAvailabityChanged?.Invoke(null, true);
                }
            }
            else
            {
                openAction.ClickAction();
            }
        }
Esempio n. 24
0
    public void DataSet(Command order)
    {
        ActionShell AS;

        foreach (DataShell Shell in order.Data)
        {
            switch (Shell.key)
            {
            case "TextBox.Open":
            case "TextBox.Close":
                AS = new OpenAction(TextBoxPivot);
                ActionPlan.Add(AS);
                break;

            case "FaceBox.Open":
            case "FaceBox.Close":
                AS = new OpenAction(FaceBoxPivot);
                ActionPlan.Add(AS);
                break;

            case "ImageBox.Open":
            case "ImageBox.Close":
                AS = new OpenAction(ImageBoxPivot);
                ActionPlan.Add(AS);
                break;

            case "SelectBox.Open":
            case "SelectBox.Close":
                AS = new OpenAction(SelectBoxPivot);
                ActionPlan.Add(AS);
                break;

            case "TextBox.AddText":
                AS = new TalkAction(Shell.Data, this);
                ActionPlan.Add(AS);
                break;

            case "FaceBox.SetImage":
                AS = new SetImage(NPCFace, Shell.Data);
                ActionPlan.Add(AS);
                break;

            case "ImageBox.SetImage":
                AS = new SetImage(ImageBox, Shell.Data);
                ActionPlan.Add(AS);
                break;

            case "SelectBox.AddChoice":

                break;

            case "SelectBox.AddText":
                break;

            case "SelectBox.SetImage":
                AS = new SetImage(PlayerFace, Shell.Data);
                ActionPlan.Add(AS);
                break;

            default:
                Debug.Log("Lost order : " + Shell.key);
                break;
            }
        }

        StartCoroutine(DataAction());
    }
Esempio n. 25
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. 26
0
        private void CatcherHelper_NotificationPosted(object sender, NotificationPostedEventArgs e)
        {
            openNotification = new OpenNotification(e.StatusBarNotification);

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

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

            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();
            }

            if (e.UpdatesPreviousNotification)
            {
                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
            {
                //Is a new notification, so set a new tag.
                floatingNotificationView.SetTag(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);
                    }
                    ;
                }

                if (floatingNotificationView.Visibility != ViewStates.Visible)
                {
                    if (currentActivityState == ActivityStates.Resumed)
                    {
                        floatingNotificationView.Visibility = ViewStates.Visible;
                    }
                }
            }
        }
Esempio n. 27
0
 protected virtual void SetActionIcon(Button action, OpenAction openAction)
 {
     action.SetCompoundDrawablesRelativeWithIntrinsicBounds(openAction.GetActionIcon(Android.Graphics.Color.White), null, null, null);
 }
Esempio n. 28
0
 protected virtual void SetActionTag(Button action, OpenAction openAction)
 {
     action.SetTag(DefaultActionIdentificator, openAction);
 }
Esempio n. 29
0
        public void TestHasClosureReferenceThisMethodLambda()
        {
            Action <int> action = i => LocalMethod(i + 1);

            Assert.That(OpenAction.HasClosureReference(action), Is.False);
        }
Esempio n. 30
0
 public void TestCreateOpenActionArgumentNull()
 {
     Assert.That(() => OpenAction.CreateOpenAction((Action <int>)null), Throws.InstanceOf <ArgumentNullException>());
 }