示例#1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.layout_complaince, null);

            task_id_to_send = Arguments.GetString("task_id") ?? string.Empty;

            referencecardview = view.FindViewById <CardView>(Resource.Id.referncecardview);
            Description       = view.FindViewById <EditText>(Resource.Id.comment);
            descrip_text      = view.FindViewById <TextView>(Resource.Id.c_descrip);
            name_text         = view.FindViewById <TextView>(Resource.Id.c_name);
            detail_text       = view.FindViewById <TextView>(Resource.Id.c_detail);
            markby_text       = view.FindViewById <TextView>(Resource.Id.c_markby);
            deadline_text     = view.FindViewById <TextView>(Resource.Id.c_deadline);
            createdby_text    = view.FindViewById <TextView>(Resource.Id.c_createdby);
            creationdate_text = view.FindViewById <TextView>(Resource.Id.c_creationdate);
            camera            = view.FindViewById <ImageButton>(Resource.Id.camera_btn);
            video             = view.FindViewById <ImageButton>(Resource.Id.video_btn);
            create_by_call    = view.FindViewById <ImageButton>(Resource.Id.create_by_call);
            mark_by_call      = view.FindViewById <ImageButton>(Resource.Id.mark_by_call);
            microphone        = view.FindViewById <ImageButton>(Resource.Id.micro_btn);
            linear1           = view.FindViewById <LinearLayout>(Resource.Id.ll1);
            linear2           = view.FindViewById <LinearLayout>(Resource.Id.ll2);
            linear3           = view.FindViewById <LinearLayout>(Resource.Id.ll3);
            ll_task_desc      = view.FindViewById <LinearLayout>(Resource.Id.ll_task_desc);
            task_desc         = view.FindViewById <TextView>(Resource.Id.task_desc);
            Image_no          = view.FindViewById <TextView>(Resource.Id.image_no);
            Video_no          = view.FindViewById <TextView>(Resource.Id.video_no);
            Audio_no          = view.FindViewById <TextView>(Resource.Id.audio_no);
            comment_micro     = view.FindViewById <ImageView>(Resource.Id.comment_micro);
            Submit_Btn        = view.FindViewById <Button>(Resource.Id.submit);
            uploadimage       = view.FindViewById <TextView>(Resource.Id.uploaded_no1);
            uploadvideo       = view.FindViewById <TextView>(Resource.Id.uploaded_no2);
            uploadaudio       = view.FindViewById <TextView>(Resource.Id.uploaded_no3);
            Gridview1         = view.FindViewById <ExpandableHeightGridView>(Resource.Id.gridView1);
            Gridview2         = view.FindViewById <ExpandableHeightGridView>(Resource.Id.gridView2);
            Gridview3         = view.FindViewById <ExpandableHeightGridView>(Resource.Id.gridView3);

            progress = new Android.App.ProgressDialog(Activity);
            progress.Indeterminate = true;
            progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
            progress.SetCancelable(false);
            progress.SetMessage("Please wait...");

            referencecardview.Click += delegate
            {
                ReferenceAttachmentActivity reference         = new ReferenceAttachmentActivity();
                Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();
                //ft.Replace(Resource.Id.container, reference);
                ft.Hide(FragmentManager.FindFragmentByTag("ComplainceFragment"));
                ft.Add(Resource.Id.container, reference);
                ft.AddToBackStack(null);
                ft.SetTransition(FragmentTransaction.TransitFragmentOpen);
                ft.Commit();
                Bundle bundle = new Bundle();
                bundle.PutString("TaskId", task_id_to_send);
                reference.Arguments = bundle;
            };

            create_by_call.Click += delegate
            {
                try
                {
                    var hasTelephony = Activity.PackageManager.HasSystemFeature(PackageManager.FeatureTelephony);
                    if (hasTelephony)
                    {
                        //var uri = Android.Net.Uri.Parse("tel:" +creat_by_num);
                        var uri    = Android.Net.Uri.Parse("tel:" + "9984059984");
                        var intent = new Intent(Intent.ActionDial, uri);
                        Activity.StartActivity(intent);
                    }
                }
                catch (System.Exception e) { }
            };

            mark_by_call.Click += delegate
            {
                try
                {
                    var hasTelephony = Activity.PackageManager.HasSystemFeature(PackageManager.FeatureTelephony);
                    if (hasTelephony)
                    {
                        // var uri = Android.Net.Uri.Parse("tel:" +mark_by_num);
                        var uri    = Android.Net.Uri.Parse("tel:" + "9984059984");
                        var intent = new Intent(Intent.ActionDial, uri);
                        Activity.StartActivity(intent);
                    }
                }
                catch (System.Exception e) { }
            };

            Gridview1.setExpanded(true);
            //Gridview1.ChoiceMode = (ChoiceMode)AbsListViewChoiceMode.MultipleModal;
            //Gridview1.SetMultiChoiceModeListener(new MultiChoiceModeListener1(Activity));

            Gridview2.setExpanded(true);
            //Gridview2.ChoiceMode = (ChoiceMode)AbsListViewChoiceMode.MultipleModal;
            //Gridview2.SetMultiChoiceModeListener(new MultiChoiceModeListener2(Activity));

            Gridview3.setExpanded(true);
            //Gridview3.ChoiceMode = (ChoiceMode)AbsListViewChoiceMode.MultipleModal;
            //Gridview3.SetMultiChoiceModeListener(new MultiChoiceModeListener3(Activity));


            //if (ic.connectivity())
            //{
            getDataFromServer();
            //}
            //else
            // {

            //}
            //attachmentData = db.GetComp_Attachments(task_id_to_send);
            //if (attachmentData != null)
            //{
            //    for (int i = 0; i < attachmentData.Count; i++)
            //    {
            //        if (attachmentData[i].file_type.Equals("Image"))
            //        {
            //            imagelist.Add(attachmentData[i]);

            //        }
            //        else if (attachmentData[i].file_type.Equals("Video"))
            //        {
            //            videolist.Add(attachmentData[i]);
            //        }
            //        else if (attachmentData[i].file_type.Equals("Audio"))
            //        {
            //            audiolist.Add(attachmentData[i]);
            //        }
            //    }
            //    adapter1 = new GridViewAdapter_Image(Activity, imagelist);
            //    Gridview1.Adapter = adapter1;

            //    adapter2 = new GridViewAdapter_Video(Activity, videolist);
            //    Gridview2.Adapter = adapter2;

            //    adapter3 = new GridViewAdapter_Audio(Activity, audiolist);
            //    Gridview3.Adapter = adapter3;

            //}



            camera.Click += delegate
            {
                Click_Type = "Camera";
                CheckForShapeData_Camera();
            };

            video.Click += delegate
            {
                Click_Type = "Video";
                CheckForShapeData_Video();
            };

            microphone.Click += delegate
            {
                if (audio_comp_lst.Count < aud_max)
                {
                    if (shapes1 != null)
                    {
                        if (CheckForShape())
                        {
                            recording();
                        }
                        else
                        {
                            Toast.MakeText(Activity, "you are outside marked area", ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        recording();
                    }
                }
            };

            Submit_Btn.Click += delegate
            {
                Submit_Method();
            };
            comment_micro.Click += delegate
            {
                CheckMicrophone();
            };

            return(view);
        }
示例#2
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";
                }
            }
        }