Esempio n. 1
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            ((ViewHolder.timeLine)(holder)).created_.Text    = DateTime.Parse(rows_[position].createdAt_).ToString("HH:mm:ss");
            ((ViewHolder.timeLine)(holder)).content_.Text    = rows_[position].content_;
            ((ViewHolder.timeLine)(holder)).content_.Enabled = rows_[position].enabled;
            ((ViewHolder.timeLine)(holder)).content_.Click  += (sender, e) => {
                TableLayout tableLayout = new TableLayout(activity_.ApplicationContext);
                tableLayout.SetGravity(GravityFlags.Bottom | GravityFlags.CenterHorizontal);
                tableLayout.SetBackgroundColor(Color.Argb(100, 160, 160, 160));
                activity_.AddContentView(tableLayout,
                                         new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                    ViewGroup.LayoutParams.MatchParent));


                WindowManagerLayoutParams layoutParams = new WindowManagerLayoutParams(
                    600,
                    600,
                    WindowManagerTypes.SystemOverlay,
                    WindowManagerFlags.NotTouchable |
                    WindowManagerFlags.NotFocusable,
                    Android.Graphics.Format.Translucent);
                ImageView imageView = new ImageView(activity_.ApplicationContext);
                imageView.SetImageResource(awesome.Resource.Drawable.met);
                imageView.SetPadding(0, 0, 0, 50);



                tableLayout.AddView(imageView, layoutParams);
                var upAnimation = new Utilities.Animation.Horizontal()
                                  .StartPos(imageView.GetX(),
                                            imageView.GetY())
                                  .MoveDistance(-80)
                                  .Duration(100)
                                  .Build();
                var downAnimation = new Utilities.Animation.Horizontal()
                                    .StartPos(imageView.GetX(),
                                              imageView.GetY() - 80)
                                    .MoveDistance(80)
                                    .Duration(100)
                                    .Build();
                imageView.StartAnimation(upAnimation);
                upAnimation.AnimationEnd += (_1, _2) => {
                    imageView.StartAnimation(downAnimation);
                };

                downAnimation.AnimationEnd += (_1, _2) => {
                    imageView.StartAnimation(upAnimation);
                };


                new Handler().PostDelayed(() => {
                    ((ViewGroup)tableLayout.Parent).RemoveView(tableLayout);
                }, 500);

                onRowClicked(rows_[position]);
                ((Android.Widget.TextView)sender).Enabled = false;
                rows_[position].enabled = false;
            };
        }
Esempio n. 2
0
        /// <summary>
        /// Constructs a new representation as a visual ball with a number of string in its center.
        /// </summary>
        /// <param name="currentActivity">The activity on which the ball should be drawn.</param>
        /// <param name="note">The note that should be played correspondingly when visually arriving to the guitar's neck.</param>
        public NoteRepresentation(Activity currentActivity, Note note)
        {
            //Basic values.
            _currentActivity = currentActivity;
            _note            = note;

            //The color of the ball.
            BallColor ballColor = (BallColor)note.Position.String;             //note.Position.Fret;

            //Which string the number on the ball should represent.
            //GuitarString stringNum = note.Position.String;

            _noteCircle = new TextView(_currentActivity);

            //Select the ball's color.
            switch (ballColor)
            {
            case BallColor.Red:
                _noteCircle.SetBackgroundResource(Resource.Drawable.ball_red);
                break;

            case BallColor.Purple:
                _noteCircle.SetBackgroundResource(Resource.Drawable.ball_purple);
                break;

            case BallColor.Blue:
                _noteCircle.SetBackgroundResource(Resource.Drawable.ball_blue);
                break;

            case BallColor.Green:
                _noteCircle.SetBackgroundResource(Resource.Drawable.ball_green);
                break;

            case BallColor.Orange:
                _noteCircle.SetBackgroundResource(Resource.Drawable.ball_orange);
                break;

            case BallColor.Aqua:
                _noteCircle.SetBackgroundResource(Resource.Drawable.ball_aqua);
                break;

            case BallColor.Yellow:
                _noteCircle.SetBackgroundResource(Resource.Drawable.ball_yellow);
                break;
            }

            //Set dimensions.
            _noteCircle.Layout(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT);
            //Center text.
            _noteCircle.Gravity = GravityFlags.Center;
            //Set text.
            //_noteCircle.SetText(((int)stringNum).ToString(), TextView.BufferType.Normal);
            //Refresh view.
            _noteCircle.RequestLayout();

            //Add the newly created note circle to the current activity.
            _currentActivity.AddContentView(_noteCircle, new ViewGroup.LayoutParams(BUTTON_WIDTH, BUTTON_HEIGHT));
        }
        /**
         * Adds a {@link Crouton} to the {@link ViewParent} of it's {@link Activity}.
         *
         * @param crouton
         *     The {@link Crouton} that should be added.
         */

        private void AddCroutonToView(Crouton crouton)
        {
            // don't Add if it is already showing
            if (crouton.IsShowing())
            {
                return;
            }

            View croutonView = crouton.GetView();

            if (null == croutonView.Parent)
            {
                ViewGroup.LayoutParams parameters = croutonView.LayoutParameters;
                if (null == parameters)
                {
                    parameters = new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                  ViewGroup.LayoutParams.WrapContent);
                }
                // display Crouton in ViewGroup is it has been supplied
                if (null != crouton.GetViewGroup())
                {
                    ViewGroup croutonViewGroup = crouton.GetViewGroup();
                    if (ShouldAddViewWithoutPosition(croutonViewGroup))
                    {
                        croutonViewGroup.AddView(croutonView, parameters);
                    }
                    else
                    {
                        croutonViewGroup.AddView(croutonView, 0, parameters);
                    }
                }
                else
                {
                    Activity activity = crouton.GetActivity();
                    if (null == activity || activity.IsFinishing)
                    {
                        return;
                    }
                    HandleTranslucentActionBar((ViewGroup.MarginLayoutParams)parameters, activity);
                    HandleActionBarOverlay((ViewGroup.MarginLayoutParams)parameters, activity);

                    activity.AddContentView(croutonView, parameters);
                }
            }

            croutonView.RequestLayout(); // This is needed so the animation can use the measured with/height
            ViewTreeObserver observer = croutonView.ViewTreeObserver;

            if (null != observer)
            {
                CallOnGlobalLayout(crouton, croutonView);
            }
        }