Beispiel #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Options);
            weightInput = FindViewById<EditText>(Resource.Id.weightInput);
            stepSizeInput = FindViewById<EditText>(Resource.Id.stepSizeInput);
            sensivityInput = FindViewById<SeekBar>(Resource.Id.sensivityInput);
            sensivityOutput = FindViewById<TextView>(Resource.Id.sensivityOutput);
            sensivityInput.SetOnSeekBarChangeListener(this);

            weightInput.Text = MainActivity.weight.ToString();
            stepSizeInput.Text = MainActivity.stepLength.ToString();
            sensivityInput.Progress = sensivityInput.Max - MainActivity.mLimit;
        }
        protected override void OnBindDialogView(View view)
        {
            base.OnBindDialogView(view);

            if (ShouldPersist())
                _progress = GetPersistedInt(_defaultValue + _minimumValue) - _minimumValue;

            _valueText = view.FindViewById<TextView>(Resource.Id.Label);

            _seekBar = view.FindViewById<SeekBar>(Resource.Id.SeekBar);
            _seekBar.SetOnSeekBarChangeListener(this);
            _seekBar.Max = _maximumValue;
            _seekBar.Progress = _progress;

            updateText();
        }
Beispiel #3
0
        //use a scrollview: http://stackoverflow.com/questions/4055537/how-do-you-make-a-linearlayout-scrollable
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

                // Create your application here
                SetContentView (Resource.Layout.MoodAssessment);

                //select random background picture
                //find view with background
                LinearLayout LayoutMood = FindViewById<LinearLayout>(Resource.Id.LinearLayoutMood);
                rnd = new Random(); //generator is seeded each time it is initialized
                switch (rnd.Next (7)) {
                case 0:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.clouds_low));
                    break;
                case 1:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.beach_gauss));
                    break;
                case 2:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.dawn_low));
                    break;
                case 3:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.flower_pink_low));
                    break;
                case 4:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.flower_red_low));
                    break;
                case 5:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.forest_low));
                    break;
                case 6:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.sea_low));
                    break;
                }

                //CHOOSE QUESTIONS TO ASK

                int alreadyAsked = 0; //default value: no questions have been asked yet since this is an example

                int posQuestion = ChoosePositiveQuestion (alreadyAsked);
                int negQuestion = ChooseNegativeQuestion (alreadyAsked);
                //update alreadyAsked with the newly chosen questions, only write to db after the save button has been pressed
                alreadyAsked += (int)Math.Pow(2,posQuestion) + (int)Math.Pow(2,negQuestion+5);
                //Toast.MakeText(this, "New Asked: " + alreadyAsked.ToString(), ToastLength.Short).Show();

                //Provide the chosen questions with seekbars and smileys. Make sure to pick good smileys for the negative affect questions
                //CODE FOR POSITIVE AND NEGATIVE SEEKBAR QUESTIONS
                TextView posAffectText = FindViewById<TextView>(Resource.Id.textViewPosAffect);
                TextView negAffectText = FindViewById<TextView>(Resource.Id.textViewNegAffect);
                switch (posQuestion) {
                case 0:
                    posAffectText.Text = GetString(Resource.String.PosAffect1);
                    break;
                case 1:
                    posAffectText.Text = GetString(Resource.String.PosAffect2);
                    break;
                case 2:
                    posAffectText.Text = GetString(Resource.String.PosAffect3);
                    break;
                case 3:
                    posAffectText.Text = GetString(Resource.String.PosAffect4);
                    break;
                case 4:
                    posAffectText.Text = GetString(Resource.String.PosAffect5);
                    break;
                }
                _seekBarPosAffect = FindViewById<SeekBar>(Resource.Id.seekBarPosAffect);
                _LeftPosAffect = FindViewById<ImageView> (Resource.Id.imageViewLeftPosAffect);
                _RightPosAffect = FindViewById<ImageView> (Resource.Id.imageViewRightPosAffect);
                nProgressPosAffect = _seekBarPosAffect.Progress;
                _seekBarPosAffect.SetOnSeekBarChangeListener(this);

                _seekBarNegAffect = FindViewById<SeekBar>(Resource.Id.seekBarNegAffect);
                _LeftNegAffect = FindViewById<ImageView> (Resource.Id.imageViewLeftNegAffect);
                _RightNegAffect = FindViewById<ImageView> (Resource.Id.imageViewRightNegAffect);
                nProgressNegAffect = _seekBarNegAffect.Progress;
                _seekBarNegAffect.SetOnSeekBarChangeListener(this);

                switch (negQuestion) {
                case 0:
                    negAffectText.Text = GetString(Resource.String.NegAffect1);
                    break;
                case 1:
                    negAffectText.Text = GetString(Resource.String.NegAffect2);
                    //change sad smiley to afraid
                    _RightNegAffect.SetImageResource(Resource.Drawable.afraid);
                    break;
                case 2:
                    negAffectText.Text = GetString(Resource.String.NegAffect3);
                    break;
                case 3:
                    negAffectText.Text = GetString(Resource.String.NegAffect4);
                    //change sad smiley to agitated
                    _RightNegAffect.SetImageResource(Resource.Drawable.Agitated);
                    break;
                case 4:
                    negAffectText.Text = GetString(Resource.String.NegAffect5);
                    //change sad smiley to angry
                    _RightNegAffect.SetImageResource(Resource.Drawable.angry);
                    break;
                }

                //SEEKBAR CODE FOR HOW ARE YOU
                _seekBarHowAreYou = FindViewById<SeekBar>(Resource.Id.seekBar1);
                _sadHowAreYou = FindViewById<ImageView> (Resource.Id.imageViewSadHowAreYou);
                _happyHowAreYou = FindViewById<ImageView> (Resource.Id.imageViewHappyHowAreYou);
                nProgressHowAreYou = _seekBarHowAreYou.Progress;

                // Assign this class as a listener for the SeekBar events
                // In order to be able to do so I have to put the ChangeListener into the definition of the class: extend Activity as well as the Listener
                // and implement all functions of the Listener, even if they do nothing
                _seekBarHowAreYou.SetOnSeekBarChangeListener(this);

                //PEOPLE AROUND CODE
                nPeopleAround = -1;

                Button ButtonNone = FindViewById<Button> (Resource.Id.buttonNone);
                Button ButtonOne = FindViewById<Button> (Resource.Id.buttonOne);
                Button ButtonMany = FindViewById<Button> (Resource.Id.buttonMany);

                ButtonNone.Click += delegate {
                    ButtonOne.Background.ClearColorFilter();
                    ButtonMany.Background.ClearColorFilter();
                    ButtonNone.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nPeopleAround = 0;
                };

                ButtonOne.Click += delegate {
                    ButtonNone.Background.ClearColorFilter();
                    ButtonMany.Background.ClearColorFilter();
                    ButtonOne.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nPeopleAround = 1;
                };

                ButtonMany.Click += delegate {
                    ButtonMany.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    ButtonOne.Background.ClearColorFilter();
                    ButtonNone.Background.ClearColorFilter();
                    nPeopleAround = 2;
                };

                //WHAT ARE YOU DOING? CODE
                nWhat = -1;

                Button ButtonLeisure = FindViewById<Button> (Resource.Id.buttonLeisure);
                Button ButtonEating = FindViewById<Button> (Resource.Id.buttonEating);
                Button ButtonWork = FindViewById<Button> (Resource.Id.buttonWorking);

                ButtonLeisure.Click += delegate {
                    ButtonEating.Background.ClearColorFilter();
                    ButtonWork.Background.ClearColorFilter();
                    ButtonLeisure.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhat = 0;
                };

                ButtonEating.Click += delegate {
                    ButtonLeisure.Background.ClearColorFilter();
                    ButtonWork.Background.ClearColorFilter();
                    ButtonEating.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhat = 1;
                };

                ButtonWork.Click += delegate {
                    ButtonEating.Background.ClearColorFilter();
                    ButtonLeisure.Background.ClearColorFilter();
                    ButtonWork.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhat = 2;
                };

                nWhere = -1;

                Button ButtonAway = FindViewById<Button> (Resource.Id.buttonAway);
                Button ButtonHome = FindViewById<Button> (Resource.Id.buttonHome);

                ButtonAway.Click += delegate {
                    ButtonHome.Background.ClearColorFilter();
                    ButtonAway.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhere = 0;
                };

                ButtonHome.Click += delegate {
                    ButtonAway.Background.ClearColorFilter();
                    ButtonHome.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhere = 1;
                };

                //CONTINUE BUTTON CODE
                Button ContinueHome = FindViewById<Button> (Resource.Id.buttonContinue);
                ContinueHome.Click += delegate {
                    //only possible if data has been correctly selected
                    if ( (nPeopleAround == -1) || (nWhere == -1) || (nWhat == -1) ) {
                        Toast toast = Toast.MakeText(this, Resource.String.AnswerQuestions, ToastLength.Short);
                        toast.SetGravity(GravityFlags.Center,0,0);
                        toast.Show();
                    }
                    else
                    {
                        //go back
                        OnBackPressed();
                    }
                };
        }
Beispiel #4
0
        protected override View OnCreateView(ViewGroup parent)
        {
            var view = base.OnCreateView(parent);
            _seekBar = view.FindViewById<SeekBar>(Sessions.Android.Resource.Id.seekBarPreference_seekBar);
            _lblTitle = view.FindViewById<TextView>(Sessions.Android.Resource.Id.seekBarPreference_lblTitle);
            _lblMinValue = view.FindViewById<TextView>(Sessions.Android.Resource.Id.seekBarPreference_lblMinValue);
            _lblMaxValue = view.FindViewById<TextView>(Sessions.Android.Resource.Id.seekBarPreference_lblMaxValue);
            _lblValue = view.FindViewById<TextView>(Sessions.Android.Resource.Id.seekBarPreference_lblValue);

            _lblTitle.Text = _title;
            _seekBar.Max = _maxValue;
            _seekBar.SetOnSeekBarChangeListener(this);

            var layout = (LinearLayout) view;
            layout.SetPadding(0, 0, 0, 0);
            layout.Orientation = Orientation.Vertical;

            // Hide standard preference widgets
            int childCount = layout.ChildCount;
            for (int i = 0; i < childCount; i++)
            {
                var v = layout.GetChildAt(i);
                if(v.Id != Android.Resource.Id.WidgetFrame)
                    v.Visibility = ViewStates.Gone;
            }

            return view;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            SetContentView(Resource.Layout.PieChartLayout);

            //mChart = new PieChart(this);
            //SetContentView(mChart);

            #if true
            tvX = (TextView) FindViewById(Resource.Id.tvXMax);
            tvY = (TextView) FindViewById(Resource.Id.tvYMax);

            mSeekBarX = (SeekBar) FindViewById(Resource.Id.seekBar1);
            mSeekBarY = (SeekBar) FindViewById(Resource.Id.seekBar2);

            mSeekBarY.Progress = 10;

            mSeekBarX.SetOnSeekBarChangeListener(this);
            mSeekBarY.SetOnSeekBarChangeListener(this);
            #endif
            #if true
            mChart = (PieChart) FindViewById(Resource.Id.chart1);
            mChart.SetUsePercentValues(true);
            mChart.SetDescription("");
            mChart.SetExtraOffsets(5, 10, 5, 5);

            mChart.DragDecelerationFrictionCoef = 0.95f;

            //tf = Typeface.CreateFromAsset(Assets, "OpenSans-Regular.ttf");

            //mChart.SetCenterTextTypeface(Typeface.CreateFromAsset(Assets, "OpenSans-Light.ttf"));
            mChart.CenterText = "MPAndroidChart developed by Philipp Jahoda";
            //mChart.setcenter CenterText = new SpannableString(mChart.) Spanable generateCenterSpannableText();

            mChart.DrawHoleEnabled = true;
            mChart.SetHoleColorTransparent(true);

            mChart.SetTransparentCircleColor(Color.White);
            mChart.SetTransparentCircleAlpha(110);

            mChart.HoleRadius = 58f;
            mChart.TransparentCircleRadius = 61f;

            mChart.SetDrawCenterText(true);

            mChart.RotationAngle = 0;
            // enable rotation of the chart by touch
            mChart.RotationEnabled = true;
            mChart.HighlightEnabled = true;

            // mChart.setUnit(" €");
            // mChart.setDrawUnitsInChart(true);

            // add a selection listener
            mChart.SetOnChartValueSelectedListener(this);

            SetData(3, 100);

            mChart.AnimateY(1400, Easing.EasingOption.EaseInOutQuad);
            // mChart.spin(2000, 0, 360);

            var l = mChart.Legend;
            l.Position = Legend.LegendPosition.RightOfChart;
            l.XEntrySpace = 7f;
            l.YEntrySpace = 0f;
            l.YOffset = 0f;
            // Create your application here
            #endif
        }
		private void InitializeUi(Activity activity)
		{
			if (IsUiInitialized) return;

			_startButton = activity.FindViewById<Button>(Resource.Id.StartButton);
			_startButton.Enabled = EnableStartButtonFlag;
			_cancelButton = activity.FindViewById<Button>(Resource.Id.CancelButton);
			_feedbackButton = activity.FindViewById<Button>(Resource.Id.FeedbackButton);

			_statusText = activity.FindViewById<TextView>(Resource.Id.StatusText);
			_resultText = activity.FindViewById<TextView>(Resource.Id.Result);
			_animationView = activity.FindViewById<ImageView>(Resource.Id.AnimationView);
			_smartPhoneView = activity.FindViewById<ImageView>(Resource.Id.SmartphoneImage);
			_resultViews = activity.FindViewById<LinearLayout>(Resource.Id.ResultsView);
			_countdownText = activity.FindViewById<TextView>(Resource.Id.CountdownText);
			_manualText = activity.FindViewById<TextView>(Resource.Id.ManualText1);
			_manualText2 = activity.FindViewById<TextView>(Resource.Id.ManualText2);

			_progressBar = activity.FindViewById<SeekBar>(Resource.Id.SeekBar);
			_progressBar.SetOnSeekBarChangeListener(this);
			_progressBar.Touch += OnTouchProgressBar;
			_progressBar.SetThumb(activity.Resources.GetDrawable(Resource.Drawable.thumb_green));
			_progressBar.ProgressDrawable = activity.Resources.GetDrawable(Resource.Drawable.progress_seekbar_green);
			_progressBar.Max = MaxProgress;
			_progressBar.Progress = 0;

			_dontShowAgainBox = activity.FindViewById<CheckBox>(Resource.Id.DontShowAgainBox);
			_dontShowAgainBox.Visibility = ViewStates.Invisible;
			var preferences = PreferenceManager.GetDefaultSharedPreferences(SkillStoreApplication.AppContext);
			_dontShowAgainBox.Checked = preferences.GetBoolean(SettingsKey.ShowAgainPreference, false);

			IsUiInitialized = true;
		}
        private void InitPreference(Context context, IAttributeSet attrs)
        {
            SetValuesFromXml(attrs);

            seekBar = new SeekBar (context, attrs);
            seekBar.Max = maxValue - minValue;
            seekBar.SetOnSeekBarChangeListener (this);

            this.WidgetLayoutResource = Resource.Layout.seek_bar_preference;
        }
Beispiel #8
0
        //use a scrollview: http://stackoverflow.com/questions/4055537/how-do-you-make-a-linearlayout-scrollable
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            //CHECK HOW OFTEN WE ALREADY TESTED TODAY
            dbMood = new MoodDatabase(this);
            cursor = dbMood.ReadableDatabase.RawQuery("SELECT date, QuestionFlags FROM MoodData WHERE date = '" + DateTime.Now.ToString("dd.MM.yy") + "'", null); // cursor query
            if (cursor.Count >= 5) { //IF ALREADY 5 OR MORE RETURN TO HOME
                Toast toast = Toast.MakeText (this, GetString (Resource.String.Already5Times), ToastLength.Long);
                toast.SetGravity (GravityFlags.Center, 0, 0);
                toast.Show ();

                //create an intent to go back to the home screen
                Intent intent = new Intent (this, typeof(Home));
                intent.SetFlags (ActivityFlags.ClearTop); //remove the history and go back to home screen
                StartActivity (intent);
            } else {  //OTHERWISE LOAD THE SCREEN AND START

                // Create your application here
                SetContentView (Resource.Layout.MoodAssessment);

                //select random background picture
                //find view with background
                LinearLayout LayoutMood = FindViewById<LinearLayout>(Resource.Id.LinearLayoutMood);
                rnd = new Random(); //generator is seeded each time it is initialized
                switch (rnd.Next (7)) {
                case 0:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.clouds_low));
                    break;
                case 1:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.beach_gauss));
                    break;
                case 2:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.dawn_low));
                    break;
                case 3:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.flower_pink_low));
                    break;
                case 4:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.flower_red_low));
                    break;
                case 5:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.forest_low));
                    break;
                case 6:
                    LayoutMood.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.sea_low));
                    break;
                }

                //CHOOSE QUESTIONS TO ASK
                //rnd = new Random(); //generator is seeded each time it is initialized

                //take latest db entry from today and read out which questions have already been asked.
                //if there is no enry yet, set already asked to 0
                int alreadyAsked = 0; //default value: no questions have been asked yet
                if (cursor.Count > 0) { //data was already saved today and questions have been asked, so retrieve which ones have been asked
                    cursor.MoveToLast (); //take the last entry of today
                    alreadyAsked = cursor.GetInt(cursor.GetColumnIndex("QuestionFlags")); //retrieve value from last entry in db column QuestionFlags
                }
                //This was for testing purposes
                //int alreadyAsked = 1 + 4 + 8 + 32 + 64 + 128 ; //only 1 and 4 are still valid options for pos and 3 & 4 for neg

                int posQuestion = ChoosePositiveQuestion (alreadyAsked);
                int negQuestion = ChooseNegativeQuestion (alreadyAsked);
                //update alreadyAsked with the newly chosen questions, only write to db after the save button has been pressed
                alreadyAsked += (int)Math.Pow(2,posQuestion) + (int)Math.Pow(2,negQuestion+5);
                //Toast.MakeText(this, "New Asked: " + alreadyAsked.ToString(), ToastLength.Short).Show();

                //Provide the chosen questions with seekbars and smileys. Make sure to pick good smileys for the negative affect questions
                //CODE FOR POSITIVE AND NEGATIVE SEEKBAR QUESTIONS
                TextView posAffectText = FindViewById<TextView>(Resource.Id.textViewPosAffect);
                TextView negAffectText = FindViewById<TextView>(Resource.Id.textViewNegAffect);
                switch (posQuestion) {
                case 0:
                    posAffectText.Text = GetString(Resource.String.PosAffect1);
                    break;
                case 1:
                    posAffectText.Text = GetString(Resource.String.PosAffect2);
                    break;
                case 2:
                    posAffectText.Text = GetString(Resource.String.PosAffect3);
                    break;
                case 3:
                    posAffectText.Text = GetString(Resource.String.PosAffect4);
                    break;
                case 4:
                    posAffectText.Text = GetString(Resource.String.PosAffect5);
                    break;
                }
                _seekBarPosAffect = FindViewById<SeekBar>(Resource.Id.seekBarPosAffect);
                _LeftPosAffect = FindViewById<ImageView> (Resource.Id.imageViewLeftPosAffect);
                _RightPosAffect = FindViewById<ImageView> (Resource.Id.imageViewRightPosAffect);
                nProgressPosAffect = _seekBarPosAffect.Progress;
                _seekBarPosAffect.SetOnSeekBarChangeListener(this);

                _seekBarNegAffect = FindViewById<SeekBar>(Resource.Id.seekBarNegAffect);
                _LeftNegAffect = FindViewById<ImageView> (Resource.Id.imageViewLeftNegAffect);
                _RightNegAffect = FindViewById<ImageView> (Resource.Id.imageViewRightNegAffect);
                nProgressNegAffect = _seekBarNegAffect.Progress;
                _seekBarNegAffect.SetOnSeekBarChangeListener(this);

                switch (negQuestion) {
                case 0:
                    negAffectText.Text = GetString(Resource.String.NegAffect1);
                    break;
                case 1:
                    negAffectText.Text = GetString(Resource.String.NegAffect2);
                    //change sad smiley to afraid
                    _RightNegAffect.SetImageResource(Resource.Drawable.afraid);
                    break;
                case 2:
                    negAffectText.Text = GetString(Resource.String.NegAffect3);
                    break;
                case 3:
                    negAffectText.Text = GetString(Resource.String.NegAffect4);
                    //change sad smiley to agitated
                    _RightNegAffect.SetImageResource(Resource.Drawable.Agitated);
                    break;
                case 4:
                    negAffectText.Text = GetString(Resource.String.NegAffect5);
                    //change sad smiley to angry
                    _RightNegAffect.SetImageResource(Resource.Drawable.angry);
                    break;
                }

                //SEEKBAR CODE FOR HOW ARE YOU
                _seekBarHowAreYou = FindViewById<SeekBar>(Resource.Id.seekBar1);
                _sadHowAreYou = FindViewById<ImageView> (Resource.Id.imageViewSadHowAreYou);
                _happyHowAreYou = FindViewById<ImageView> (Resource.Id.imageViewHappyHowAreYou);
                nProgressHowAreYou = _seekBarHowAreYou.Progress;

                // Assign this class as a listener for the SeekBar events
                // In order to be able to do so I have to put the ChangeListener into the definition of the class: extend Activity as well as the Listener
                // and implement all functions of the Listener, even if they do nothing
                _seekBarHowAreYou.SetOnSeekBarChangeListener(this);

                //PEOPLE AROUND CODE
                nPeopleAround = -1;

                Button ButtonNone = FindViewById<Button> (Resource.Id.buttonNone);
                Button ButtonOne = FindViewById<Button> (Resource.Id.buttonOne);
                Button ButtonMany = FindViewById<Button> (Resource.Id.buttonMany);

                ButtonNone.Click += delegate {
                    ButtonOne.Background.ClearColorFilter();
                    ButtonMany.Background.ClearColorFilter();
                    ButtonNone.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nPeopleAround = 0;
                };

                ButtonOne.Click += delegate {
                    ButtonNone.Background.ClearColorFilter();
                    ButtonMany.Background.ClearColorFilter();
                    ButtonOne.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nPeopleAround = 1;
                };

                ButtonMany.Click += delegate {
                    ButtonMany.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    ButtonOne.Background.ClearColorFilter();
                    ButtonNone.Background.ClearColorFilter();
                    nPeopleAround = 2;
                };

                //WHAT ARE YOU DOING? CODE
                nWhat = -1;

                Button ButtonLeisure = FindViewById<Button> (Resource.Id.buttonLeisure);
                Button ButtonEating = FindViewById<Button> (Resource.Id.buttonEating);
                Button ButtonWork = FindViewById<Button> (Resource.Id.buttonWorking);

                ButtonLeisure.Click += delegate {
                    ButtonEating.Background.ClearColorFilter();
                    ButtonWork.Background.ClearColorFilter();
                    ButtonLeisure.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhat = 0;
                };

                ButtonEating.Click += delegate {
                    ButtonLeisure.Background.ClearColorFilter();
                    ButtonWork.Background.ClearColorFilter();
                    ButtonEating.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhat = 1;
                };

                ButtonWork.Click += delegate {
                    ButtonEating.Background.ClearColorFilter();
                    ButtonLeisure.Background.ClearColorFilter();
                    ButtonWork.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhat = 2;
                };

                nWhere = -1;

                Button ButtonAway = FindViewById<Button> (Resource.Id.buttonAway);
                Button ButtonHome = FindViewById<Button> (Resource.Id.buttonHome);

                ButtonAway.Click += delegate {
                    ButtonHome.Background.ClearColorFilter();
                    ButtonAway.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhere = 0;
                };

                ButtonHome.Click += delegate {
                    ButtonAway.Background.ClearColorFilter();
                    ButtonHome.Background.SetColorFilter(Android.Graphics.Color.Green, Android.Graphics.PorterDuff.Mode.Darken);
                    nWhere = 1;
                };

                //CONTINUE BUTTON CODE
                Button ContinueHome = FindViewById<Button> (Resource.Id.buttonContinue);
                ContinueHome.Click += delegate {
                    //only possible if data has been correctly selected
                    if ( (nPeopleAround == -1) || (nWhere == -1) || (nWhat == -1) ) {
                        Toast toast = Toast.MakeText(this, Resource.String.AnswerQuestions, ToastLength.Short);
                        toast.SetGravity(GravityFlags.Center,0,0);
                        toast.Show();
                    }
                    else
                    {
                        //update database
                        ContentValues insertValues = new ContentValues();
                        insertValues.Put("date", DateTime.Now.ToString("dd.MM.yy"));
                        insertValues.Put("time", DateTime.Now.ToString("HH:mm"));
                        insertValues.Put("mood", nProgressHowAreYou);
                        insertValues.Put("people", nPeopleAround);
                        insertValues.Put("what", nWhat);
                        insertValues.Put("location", nWhere);
                        insertValues.Put("QuestionFlags", alreadyAsked);
                        //score affect questions between 1 and 9 instead of 0 and 8, because in the database question that have not been asked are stored as zeros.
                        insertValues.Put("pos" + (posQuestion+1).ToString(), nProgressPosAffect+1);
                        insertValues.Put("neg" + (negQuestion+1).ToString(), nProgressNegAffect+1);

                        dbMood.WritableDatabase.Insert ("MoodData", null, insertValues);

                        //TEST CODE FOR QUERYING THE DB
                        //cursor = dbMood.ReadableDatabase.RawQuery("SELECT date, mood FROM MoodData ORDER BY _id DESC LIMIT 2", null); // cursor query
                        //select only these entries where mood = 4; later change to where date = today
                        //cursor = dbMood.ReadableDatabase.RawQuery("SELECT date, mood FROM MoodData WHERE mood = 0 ORDER BY _id DESC LIMIT 3", null); // cursor query
                        //cursor = dbMood.ReadableDatabase.RawQuery("SELECT date, mood FROM MoodData WHERE date = '24.09.15' ORDER BY _id DESC LIMIT 3", null); // cursor query
                        //Select only entries from today
                        //cursor = dbMood.ReadableDatabase.RawQuery("SELECT date, mood FROM MoodData WHERE date = '" + DateTime.Now.ToString("dd.MM.yy") + "' ORDER BY _id DESC", null); // cursor query
                        //Select only entries for which the question pos2 has been answered
                        //					cursor = dbMood.ReadableDatabase.RawQuery("SELECT date, mood FROM MoodData WHERE pos2 IS NOT NULL ORDER BY _id DESC LIMIT 3", null); // cursor query
                        //					cursor.MoveToLast();
                        //					Toast.MakeText(this, cursor.Count.ToString(), ToastLength.Short).Show();
                        //Tutorial on SELECT: http://zetcode.com/db/sqlite/select/

                        //After the questions have been answered we disable the questionnaire button again and start a new alarm
                        ISharedPreferences sharedPref = GetSharedPreferences("com.FSoft.are_u_ok.PREFERENCES",FileCreationMode.Private);
                        ISharedPreferencesEditor editor = sharedPref.Edit();
                        editor.PutBoolean("QuestionnaireActive", false );
                        editor.Commit ();

                        //cancel the invalidation alarm
                        // http://stackoverflow.com/questions/14485368/delete-alarm-from-alarmmanager-using-cancel-android
                        AlarmManager alarmMgr = (AlarmManager)GetSystemService(Context.AlarmService);
                        Intent intentTemp = new Intent(this, typeof(AlarmReceiverInvalid));
                        PendingIntent alarmIntent = PendingIntent.GetBroadcast(this, 0, intentTemp, 0);
                        alarmMgr.Cancel(alarmIntent);

                        //set the new alarm
                        AlarmReceiverQuestionnaire temp = new AlarmReceiverQuestionnaire();
                        temp.SetAlarm(this);

                        //create an intent to go to the next screen
                        Intent intent = new Intent(this, typeof(Home));
                        intent.SetFlags(ActivityFlags.ClearTop); //remove the history and go back to home screen
                        StartActivity(intent);
                    }
                };

            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            subTotalTextView = FindViewById<TextView>(Resource.Id.lblSubTotal);
            generosityTextView = FindViewById<TextView>(Resource.Id.lblGenerosity);
            tipToLeaveTextView = FindViewById<TextView>(Resource.Id.lblTipToLeave);
            tipTextView = FindViewById<TextView>(Resource.Id.lblTip);
            generositySeekBar = FindViewById<SeekBar>(Resource.Id.seekGenerosityProgress);
            subTotalEditText = FindViewById<EditText>(Resource.Id.txtSubTotal);

            generositySeekBar.SetOnSeekBarChangeListener(new SeekBarChangeListener(this));
            subTotalEditText.AfterTextChanged += (sender, e) =>
            {
                double value = 0;
                try
                {
                    value = Double.Parse(subTotalEditText.Text.ToString());
                }
                catch (Exception)
                {
                    value = 0;
                    throw;
                }
                ViewModel.SubTotal = value;
                tipTextView.Text = ViewModel.Tip.ToString();
            };
        }