예제 #1
0
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (requestCode == Camera)
            {
                Bitmap bitmap = BitmapFactory.DecodeFile(imageURL);

                Comp_AttachmentModel attachmentModel = new Comp_AttachmentModel();
                attachmentModel.Attachment_Path = AudioSavePathInDevice;
                attachmentModel.Attachment_Type = "Image";
                attachmentModel.Attachment_Name = audioname;
                attachmentModel.Task_id         = task_id_to_send;

                db.InsertAttachmentData(attachmentModel);

                //comp_AttachmentModels.Add(attachmentModel);


                //imagelist.AddRange(comp_AttachmentModels.Where(p => p.Attachment_Type == "Image" ));
                imagelist         = db.GetAttachmentData("Image");
                adapter1          = new GridViewAdapter_Image(this, imagelist);
                Gridview1.Adapter = adapter1;
                Gridview1.setExpanded(true);
                Gridview1.ChoiceMode = (ChoiceMode)AbsListViewChoiceMode.MultipleModal;
                Gridview1.SetMultiChoiceModeListener(new MultiChoiceModeListener1(this));
                imageCount++;
            }
            if (requestCode == Video)
            {
                Comp_AttachmentModel attachmentModel = new Comp_AttachmentModel();
                attachmentModel.Attachment_Path = AudioSavePathInDevice;
                attachmentModel.Attachment_Type = "Video";
                attachmentModel.Attachment_Name = audioname;
                attachmentModel.Task_id         = task_id_to_send;

                db.InsertAttachmentData(attachmentModel);

                //comp_AttachmentModels.Add(attachmentModel);


                //imagelist.AddRange(comp_AttachmentModels.Where(p => p.Attachment_Type == "Image" ));
                videolist = db.GetAttachmentData("Video");

                adapter2          = new GridViewAdapter_Video(this, videolist);
                Gridview2.Adapter = adapter2;
                Gridview2.setExpanded(true);
                Gridview2.ChoiceMode = (ChoiceMode)AbsListViewChoiceMode.MultipleModal;
                Gridview2.SetMultiChoiceModeListener(new MultiChoiceModeListener2(this));

                videoCount++;
            }

            if (requestCode == VOICE)
            {
                var matches = data.GetStringArrayListExtra(RecognizerIntent.ExtraResults);
                if (matches.Count != 0)
                {
                    string textInput = Description.Text + matches[0];

                    // limit the output to 500 characters
                    if (textInput.Length > 500)
                    {
                        textInput = textInput.Substring(0, 500);
                    }
                    Description.Text = textInput;
                }
                else
                {
                    Description.Text = "No speech was recognised";
                }
            }
        }