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