Example #1
0
        private async void OnButtonClick(object sender, EventArgs e)
        {
            if (sender is CircularImageButton imgButton && Activity != null)
            {
                ChatPromptType cpt = ChatPromptType.ReportActivity;
                switch ((string)imgButton.Tag)
                {
                case "qc_safe":
                    // Change the color of the button
                    _safeButtonSelected = !_safeButtonSelected;
                    imgButton.SetBackgroundTint(_safeButtonSelected ? _selectedSafeButtonColor: _origSafeButtonColor);
                    imgButton.SetIconResource(_safeButtonSelected ? Resource.Drawable.personal_check : Resource.Drawable.user);
                    var iconCsl = ColorStateList.ValueOf(_safeButtonSelected ? _selectedSafeIconColor: _origSafeIconColor);
                    imgButton.IconTint = iconCsl;
                    cpt = ChatPromptType.SafetyCheck;
                    break;
                }



                Toast.MakeText(Activity, (string)imgButton.Tag, ToastLength.Short).Show();

                await ViewModel.ActivateChatPrompt(cpt);
            }
        }
Example #2
0
        public async void OnButtonClick(object sender, EventArgs e)
        {
            if (sender is CircularImageButton imgButton && Activity != null)
            {
                ChatPromptType cpt = ChatPromptType.ReportActivity;
                switch ((string)imgButton?.Tag)
                {
                case "qc_safe":
                    // Change the color of the button
                    _safeButtonSelected = !_safeButtonSelected;
                    imgButton.SetBackgroundTint(_safeButtonSelected ? _selectedSafeButtonColor: _origSafeButtonColor);
                    imgButton.SetIconResource(_safeButtonSelected ? Resource.Drawable.personal_check : Resource.Drawable.user);
                    var iconCsl = ColorStateList.ValueOf(_safeButtonSelected ? _selectedSafeIconColor: _origSafeIconColor);
                    imgButton.IconTint = iconCsl;
                    cpt = ChatPromptType.SafetyCheck;
                    break;

                case "qc_activity":
                    if (Activity is MainActivity act)
                    {
                        act.BottomSheetBehaviour.State = BottomSheetBehavior.StateExpanded;
                    }
                    else if (Activity is EventDetailActivity act1)
                    {
                        act1.BottomSheetBehaviour.State = BottomSheetBehavior.StateExpanded;
                    }
                    // inject message into chat
                    cpt = ChatPromptType.ReportActivity;


                    break;

                case "qc_emergency":
                    if (Activity is MainActivity act2)
                    {
                        act2.BottomSheetBehaviour.State = BottomSheetBehavior.StateExpanded;
                    }
                    else if (Activity is EventDetailActivity act3)
                    {
                        act3.BottomSheetBehaviour.State = BottomSheetBehavior.StateExpanded;
                    }
                    // inject message into chat
                    cpt = ChatPromptType.Emergency;

                    // set the selected button to emergency
                    var button = _eventButtonsAdapter.EventButtons.FirstOrDefault(b => b.Name.ToLowerInvariant() == "emergency");
                    var index  = button == null ? -1 : _eventButtonsAdapter.EventButtons.IndexOf(button);
                    _eventButtonsAdapter.SelectedPosition = index;
                    if (index > -1)
                    {
                        _eventButtons.ScrollToPosition(index);
                    }
                    break;
                }

                await ViewModel.ActivateChatPrompt(cpt);
            }
        }