private void OptionMenuDialog(int pos)
        {
            var optionMenu = LayoutInflater.Inflate(Resource.Layout.menu_dialog_2, null, false);
            var btnShare   = optionMenu.FindViewById <Button>(Resource.Id.btnShare);
            var btnWish    = optionMenu.FindViewById <Button>(Resource.Id.btnWishlist);

            var alert = new Android.App.AlertDialog.Builder(this).Create();

            alert.SetView(optionMenu);
            alert.Window.EnterTransition = new Slide(GravityFlags.Bottom);
            alert.Window.RequestFeature(WindowFeatures.NoTitle);
            alert.Show();

            btnShare.Click += (o, s) =>
            {
                alert.Dismiss();
                ShareBottomDialog();
            };
            btnWish.Click += (o, s) =>
            {
                alert.Dismiss();
                var product       = mAdapter.Product[pos].Product;
                var id            = mAdapter.Product[pos].ProductID;
                var categoryID    = mAdapter.Product[pos].CategoryID;
                var subcategoryID = mAdapter.Product[pos].SubCategoryID;

                db = FirebaseDatabase.Instance;
                var _ref = db.GetReference("Wishlists");
                _ref.Child(UserID).Child(id).RemoveValue();

                mAdapter.OnItemDismiss(pos);
                var text = Resources.GetString(Resource.String.snkbr_rem_wishlist);
                Snackbar.Make(FindViewById(Android.Resource.Id.Content), product + " " + text, Snackbar.LengthShort).Show();
            };
        }
Beispiel #2
0
        /// <summary>
        /// ACCION QUE AGREGA UN CLIENTE
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAgregar_Click(object sender, EventArgs e)
        {
            //SE INFLA LA VISTA CON EL LAYOUT DETALLE DE LIBRO
            View view = LayoutInflater.Inflate(Resource.Layout.CustomerAdd, null);

            //SE CREA EL POP UP DEL LIBRO
            Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder((Activity)rootView.Context)
                                              .SetTitle("Agregar cliente")
                                              .SetIcon(Android.Resource.Drawable.IcDialogInfo).Create();
            //ASIGNACION DE TEXTOS :v
            edtCode = view.FindViewById <EditText>(Resource.Id.editText1);
            EditText    edtName     = view.FindViewById <EditText>(Resource.Id.editText2);
            EditText    edtLastName = view.FindViewById <EditText>(Resource.Id.editText3);
            ImageButton b           = view.FindViewById <ImageButton>(Resource.Id.imageButton1);

#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            b.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            b.Click += async delegate {
                //Tell our scanner to use the default overlay
                scanner.UseCustomOverlay = false;

                //PERSONALIZAR LOS MENSAJES QUE SE MOSTRARAN EN LA CAMARA DEL SCANNER
                scanner.TopText    = "Por favor, no mueva el dispositivo móvil\nMantengalo al menos 10cm de distancia";
                scanner.BottomText = "Espere mientras el scanner lee el código de barra";

                //COMIENZO DEL SCANEO
                var result = await scanner.Scan();

                HandleScanResult(result);
            };
            view.FindViewById <Button>(Resource.Id.button1).Click += delegate {
                if (edtCode.Text != "" && edtName.Text != "" && edtLastName.Text != "")
                {
                    var save = Service.AddCustomer(edtName.Text, edtLastName.Text, edtCode.Text);
                    if (save.band)
                    {
                        edtCedula.Text  = edtCode.Text;
                        edtNombres.Text = edtName.Text + " " + edtLastName.Text;

                        //BUSCAR EL CLIENTE PARA SU ID
                        idCliente = Service.GetCustomerData(edtCode.Text).Id;
                        Toast.MakeText(rootView.Context, save.message, ToastLength.Long).Show();
                        //CERRAR EL DIALOG
                        builder.Dismiss();
                    }
                    else
                    {
                        Toast.MakeText(rootView.Context, save.message, ToastLength.Long).Show();
                    }
                }
                else
                {
                    Toast.MakeText(rootView.Context, "Llene los campos importantes", ToastLength.Long).Show();
                }
            };

            builder.SetView(view);
            builder.Show();
        }
Beispiel #3
0
        public void dialodTransacaoAprovadaMsitef(Intent data)
        {
            Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create();

            StringBuilder cupom = new StringBuilder();

            cupom.Append("CODRESP: " + data.GetStringExtra("CODRESP") + "\n");
            cupom.Append("COMP_DADOS_CONF: " + data.GetStringExtra("COMP_DADOS_CONF") + "\n");
            cupom.Append("CODTRANS: " + data.GetStringExtra("CODTRANS") + "\n");

            cupom.Append("CODTRANS: " + data.GetStringExtra("CODTRANS") + " " + Convert.ToString(retornaTipoParcelamento(Convert.ToInt32(data.GetStringExtra("TIPO_PARC")))) + "\n");

            cupom.Append("VLTROCO: " + data.GetStringExtra("VLTROCO") + "\n");
            cupom.Append("REDE_AUT: " + data.GetStringExtra("REDE_AUT") + "\n");
            cupom.Append("BANDEIRA: " + data.GetStringExtra("BANDEIRA") + "\n");

            cupom.Append("NSU_SITEF: " + data.GetStringExtra("NSU_SITEF") + "\n");
            cupom.Append("NSU_HOST: " + data.GetStringExtra("NSU_HOST") + "\n");
            cupom.Append("COD_AUTORIZACAO: " + data.GetStringExtra("COD_AUTORIZACAO") + "\n");
            cupom.Append("NUM_PARC: " + data.GetStringExtra("NUM_PARC") + "\n");

            alertDialog.SetTitle("Ação executada com sucesso");
            alertDialog.SetMessage(cupom.ToString());
            alertDialog.SetButton("OK", delegate
            {
                alertDialog.Dismiss();
            });
            alertDialog.Show();
        }
        /// <summary>
        /// CAMBIAR CONTRASEÑA DEL CLIENTE DE SU SESION
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TxtContra_Click(object sender, EventArgs e)
        {
            //SE INFLA LA VISTA CON EL LAYOUT DETALLE DE LIBRO
            View view = LayoutInflater.Inflate(Resource.Layout.passwordChange, null);

            //SE CREA EL POP UP DEL LIBRO
            Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(this)
                                              .SetTitle("Cambio de contraseña")
                                              .SetIcon(Android.Resource.Drawable.IcDialogInfo)
                                              .Create();
            //ASIGNACION DE TEXTOS :v
            EditText vieja = view.FindViewById <EditText>(Resource.Id.editText1);
            EditText nueva = view.FindViewById <EditText>(Resource.Id.editText2);
            EditText conf  = view.FindViewById <EditText>(Resource.Id.editText3);

            view.FindViewById <Button>(Resource.Id.button1).Click += (send, arg) => {
                //VALIDAR CAMPOS NO QUEDEN VACIOS
                if (vieja.Text != "" && nueva.Text != "" && conf.Text != "")
                {
                    if (nueva.Text.Length >= 6)
                    {
                        //VALIDAR CONTRASEÑAS IGUALES
                        if (nueva.Text == conf.Text)
                        {
                            //CONSUMIR EL SERVICIO
                            var change = Service.PasswordChange(Service.Email, vieja.Text, nueva.Text);
                            //SI SE CAMBIO EXITOSAMENTE
                            if (change.band)
                            {
                                Toast.MakeText(this, change.message, ToastLength.Long).Show();
                                //CERRAR EL DIALOG
                                builder.Dismiss();
                            }
                            else
                            {
                                Toast.MakeText(this, change.message, ToastLength.Long).Show();
                            }
                        }
                        else
                        {
                            Toast.MakeText(this, "Las contraseña no coinciden", ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(this, "La longitud de la contraseña debe ser mayor a 6 dígitos", ToastLength.Long).Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "Complete los campos necesarios", ToastLength.Long).Show();
                }
            };

            builder.SetView(view);
            builder.Show();
        }
Beispiel #5
0
        private void Listacomentarios_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            if (list[e.Position].ClienteId == Service.CustomerId)
            {
                Toast.MakeText(this, "FELCIDADES SOS ING", ToastLength.Long).Show();

                var item = list[e.Position];

                View view = LayoutInflater.Inflate(Resource.Layout.layout1, null);

                Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(this)
                                                  .SetTitle("Editar Valoración")
                                                  .SetIcon(Android.Resource.Drawable.IcDialogInfo).Create();
                EditText edtComment = view.FindViewById <EditText>(Resource.Id.editText1);
                edtComment.Text = item.Comentario;
                EditText edtSuggest = view.FindViewById <EditText>(Resource.Id.editText2);
                edtSuggest.Text = item.Sugerencia;
                RatingBar ratingBarComentario = view.FindViewById <RatingBar>(Resource.Id.ratingBar1);
                ratingBarComentario.Rating = item.Puntaje;

                view.FindViewById <Button>(Resource.Id.button1).Click += (send, arg) =>
                {
                    if (edtComment.Text != "" && ratingBarComentario.Rating != 0)
                    {
                        var servicio = Service.CustomerFeedback(float.Parse(ratingBarComentario.Rating.ToString()), edtComment.Text, edtSuggest.Text, Service.CustomerId, IdLibro, DateTime.Now);

                        if (servicio)
                        {
                            Toast.MakeText(this, "Comentario actualizado", ToastLength.Long).Show();
                            list = Service.FeedBackByBook(IdLibro);

                            /// <summary>
                            /// aqui estuvo josiel castillo
                            /// </summary>
                            float suma = calcularrating(list);
                            ratingBarlibro.Rating = suma;

                            listacomentarios.Adapter = new AdapterListFeeBack(this, list);
                            builder.Dismiss();
                        }
                        else
                        {
                            Toast.MakeText(this, "Error. Intentelo de nuevo", ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(this, "Llene los campos necesarios", ToastLength.Long).Show();
                    }
                };

                builder.SetView(view);
                builder.Show();
            }
        }
Beispiel #6
0
        private void Fabn_Click(object sender, EventArgs e)
        {
            var cliente = list.DefaultIfEmpty(null).FirstOrDefault(x => x.ClienteId == Service.CustomerId);

            if (cliente == null)
            {
                View view = LayoutInflater.Inflate(Resource.Layout.layout1, null);

                Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(this)
                                                  .SetTitle("Valoracion de libro")
                                                  .SetIcon(Android.Resource.Drawable.IcDialogInfo).Create();
                EditText  edtComment          = view.FindViewById <EditText>(Resource.Id.editText1);
                EditText  edtSuggest          = view.FindViewById <EditText>(Resource.Id.editText2);
                RatingBar ratingBarComentario = view.FindViewById <RatingBar>(Resource.Id.ratingBar1);

                view.FindViewById <Button>(Resource.Id.button1).Click += (send, arg) =>
                {
                    if (edtComment.Text != "" && ratingBarComentario.Rating != 0)
                    {
                        var servicio = Service.CustomerFeedback(float.Parse(ratingBarComentario.Rating.ToString()), edtComment.Text, edtSuggest.Text, Service.CustomerId, IdLibro, DateTime.Now);

                        if (servicio)
                        {
                            Toast.MakeText(this, "Comentario agregado", ToastLength.Long).Show();
                            list = Service.FeedBackByBook(IdLibro);

                            /// <summary>
                            /// aqui estuvo josiel castillo
                            /// </summary>
                            float suma = calcularrating(list);
                            ratingBarlibro.Rating = suma;

                            listacomentarios.Adapter = new AdapterListFeeBack(this, list);
                            builder.Dismiss();
                        }
                        else
                        {
                            Toast.MakeText(this, "Error. Intentelo de nuevo", ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(this, "Llene los campos necesarios", ToastLength.Long).Show();
                    }
                };

                builder.SetView(view);
                builder.Show();
            }
            else
            {
                Toast.MakeText(this, "Ya existe un comentario, que se puede editar", ToastLength.Long).Show();
            }
        }
Beispiel #7
0
 private void alert(String message)
 {
     Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(Impressora.impressoraActivity).Create();
     alertDialog.SetTitle("Alerta");
     alertDialog.SetMessage(message);
     alertDialog.SetButton("OK", delegate
     {
         alertDialog.Dismiss();
     });
     alertDialog.Show();
 }
 public static void Alert(String titleAlert, String message)
 {
     Android.App.AlertDialog AlertDialog = new Android.App.AlertDialog.Builder(context).Create();
     AlertDialog.SetTitle(titleAlert);
     AlertDialog.SetMessage(message);
     AlertDialog.SetButton("OK", delegate
     {
         AlertDialog.Dismiss();
     });
     AlertDialog.Show();
 }
        private void LvDados_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            for (int i = 0; i < lvDados.Count; i++)
            {
                if (e.Position == i)
                {
                    lvDados.GetChildAt(i).SetBackgroundColor(Android.Graphics.Color.Chocolate);
                }
                else
                {
                    lvDados.GetChildAt(i).SetBackgroundColor(Android.Graphics.Color.Transparent);
                }
            }

            items.Add(solicitacoesListView[e.Position].Conteudo);
            items.Add(solicitacoesListView[e.Position].Local);
            items.Add(solicitacoesListView[e.Position].DtRegistro);
            items.Add(solicitacoesListView[e.Position].IdServico);
            items.Add(solicitacoesListView[e.Position].IdTipoAssunto);
            items.Add(solicitacoesListView[e.Position].IdTipoPrioridade);
            items.Add(solicitacoesListView[e.Position].IdStatusOuvidoria);

            View view = LayoutInflater.Inflate(Resource.Layout.PopupWindow, null);

            Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(this).Create();

            TextView txtconteudo    = view.FindViewById <TextView>(Resource.Id.txtConteudo);
            TextView txtlocal       = view.FindViewById <TextView>(Resource.Id.txtLocal);
            TextView txtservico     = view.FindViewById <TextView>(Resource.Id.txtServico);
            TextView txtassunto     = view.FindViewById <TextView>(Resource.Id.txtAssunto);
            TextView txtprioridade  = view.FindViewById <TextView>(Resource.Id.txtPrioridade);
            TextView txtdataservico = view.FindViewById <TextView>(Resource.Id.txtDataRegistro);
            TextView txtstatus      = view.FindViewById <TextView>(Resource.Id.txtStatus);

            txtconteudo.Text    = solicitacoesListView[e.Position].Conteudo;
            txtlocal.Text       = solicitacoesListView[e.Position].Local;
            txtservico.Text     = servicos[solicitacoesListView[e.Position].IdServico];
            txtassunto.Text     = assuntos[solicitacoesListView[e.Position].IdTipoAssunto];
            txtprioridade.Text  = prioridades[solicitacoesListView[e.Position].IdTipoPrioridade];
            txtstatus.Text      = status[solicitacoesListView[e.Position].IdStatusOuvidoria];
            txtdataservico.Text = solicitacoesListView[e.Position].DtRegistro.ToString();

            builder.SetView(view);
            builder.SetCanceledOnTouchOutside(true);
            Button button = view.FindViewById <Button>(Resource.Id.btnSair);

            button.Click += delegate {
                builder.Dismiss();
            };
            builder.Show();
        }
Beispiel #10
0
        public void dialodTransacaoNegadaMsitef(Intent data)
        {
            Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create();

            StringBuilder cupom = new StringBuilder();

            cupom.Append("CODRESP: " + data.GetStringExtra("CODRESP") + "\n");

            alertDialog.SetTitle("Ocorreu um erro durante a realização da ação");
            alertDialog.SetMessage(cupom.ToString());
            alertDialog.SetButton("OK", delegate
            {
                alertDialog.Dismiss();
            });
            alertDialog.Show();
        }
Beispiel #11
0
        void ShowCustomAlertDialog()
        {
            //Inflate layout
            View view = LayoutInflater.Inflate(Resource.Layout.spinner_dialog, null);

            Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(this).Create();
            builder.SetView(view);
            builder.SetCanceledOnTouchOutside(false);
            Button button = view.FindViewById <Button>(Resource.Id.btnClearLL);

            button.Click += delegate {
                builder.Dismiss();
                Toast.MakeText(this, "Alert dialog dismissed!", ToastLength.Short).Show();
            };
            builder.Show();
        }
        public void ValidateDialog()
        {
            Button   btnLoad;
            EditText edtemp_code;

            try
            {
                View view = LayoutInflater.Inflate(Resource.Layout.DialogPostValidation, null);
                Android.App.AlertDialog dialog = new Android.App.AlertDialog.Builder(this).Create();
                edtemp_code = view.FindViewById <EditText>(Resource.Id.edtEmp_Code);
                edtemp_code = view.FindViewById <EditText>(Resource.Id.edtEmp_Code);
                dialog.SetView(view);
                dialog.SetTitle("Employee Code");
                btnLoad = view.FindViewById <Button>(Resource.Id.btnLoadDialogPost);
                dialog.Show();
                btnLoad.Click += async delegate
                {
                    ReturnGenericPost returnGenericPost = new ReturnGenericPost();
                    string            CS  = PathLink.UserURI;
                    JObject           obj = await returnGenericPost.ReturnGeneralPosMeth(CS + edtemp_code.Text.ToUpper(), null);

                    GetResult getResult1 = obj.ToObject <GetResult>();
                    if (getResult1.Status == 1)
                    {
                        Bundle mybundle = new Bundle();
                        string emp_code = edtemp_code.Text.ToUpper();
                        //	Intent intent = new Intent(this, typeof(UIPostVendorFragment));
                        //intent.PutExtra("empcode", emp_code);
                        mybundle.PutString("employee", emp_code);

                        var fragmentTransaction           = FragmentManager.BeginTransaction();
                        UIPostVendorFragment uIPostVendor = new UIPostVendorFragment();
                        uIPostVendor.Arguments = mybundle;
                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, uIPostVendor).AddToBackStack(null).Commit();
                        dialog.Dismiss();
                    }
                };
                dialog.Show();
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Beispiel #13
0
        public void dialodTransacaoNegadaGer7(OperacaoRetorno retorno)
        {
            Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create();

            StringBuilder cupom = new StringBuilder();

            cupom.Append("version: " + retorno.version + "\n");
            cupom.Append("errcode: " + retorno.errcode + "\n");
            cupom.Append("errmsg: " + retorno.errmsg + "\n");

            alertDialog.SetTitle("Ocorreu um erro durante a realização da ação");
            alertDialog.SetMessage(cupom.ToString());
            alertDialog.SetButton("OK", delegate
            {
                alertDialog.Dismiss();
            });
            alertDialog.Show();
        }
Beispiel #14
0
        public void dialodTransacaoAprovadaGer7(OperacaoRetorno retorno)
        {
            Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create();
            StringBuilder           cupom       = new StringBuilder();

            cupom.Append("version: " + retorno.version + "\n");
            cupom.Append("status: " + retorno.status + "\n");
            cupom.Append("config: " + retorno.config + "\n");
            cupom.Append("license: " + retorno.license + "\n");
            cupom.Append("terminal: " + retorno.terminal + "\n");
            cupom.Append("merchant: " + retorno.merchant + "\n");
            cupom.Append("id: " + retorno.id + "\n");
            cupom.Append("type: " + retorno.type + "\n");
            cupom.Append("product: " + retorno.product + "\n");
            cupom.Append("response: " + retorno.response + "\n");
            cupom.Append("authorization: " + retorno.authorization + "\n");
            cupom.Append("amount: " + retorno.amount + "\n");
            cupom.Append("installments: " + retorno.installments + "\n");
            cupom.Append("instmode: " + retorno.instmode + "\n");
            cupom.Append("stan: " + retorno.stan + "\n");
            cupom.Append("rrn: " + retorno.rrn + "\n");
            cupom.Append("time: " + retorno.time + "\n");
            cupom.Append("track2: " + retorno.track2 + "\n");
            cupom.Append("aid: " + retorno.aid + "\n");
            cupom.Append("cardholder: " + retorno.cardholder + "\n");
            cupom.Append("prefname: " + retorno.prefname + "\n");
            cupom.Append("errcode: " + retorno.errcode + "\n");
            cupom.Append("label: " + retorno.label + "\n");

            alertDialog.SetTitle("Ação executada com sucesso");
            alertDialog.SetMessage(cupom.ToString());
            alertDialog.SetButton("OK", delegate
            {
                alertDialog.Dismiss();
            });
            alertDialog.Show();
        }
Beispiel #15
0
        public void recording()
        {
            View view = LayoutInflater.Inflate(Resource.Layout.audio_recorder, null);

            Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(Activity).Create();
            builder.SetView(view);
            builder.Window.SetLayout(600, 600);
            builder.SetCanceledOnTouchOutside(false);
            recordbtn = view.FindViewById <Button>(Resource.Id.recordbtn);
            stopbtn   = view.FindViewById <ImageView>(Resource.Id.stopbtn);
            playbtn   = view.FindViewById <ImageView>(Resource.Id.playbtn);
            Timer     = view.FindViewById <TextView>(Resource.Id.timerbtn);
            seekBar   = view.FindViewById <SeekBar>(Resource.Id.seek_bar);
            Done_Btn  = view.FindViewById <Button>(Resource.Id.donebtn);


            Done_Btn.Click += delegate
            {
                long   size3     = fileaudioPath.Length() / 1024;
                string audiosize = size3.ToString();
                Comp_AttachmentModel attachmentModel = new Comp_AttachmentModel();
                attachmentModel.localPath   = AudioSavePathInDevice;
                attachmentModel.file_type   = "Audio";
                attachmentModel.FileName    = audioname;
                attachmentModel.taskId      = task_id_to_send;
                attachmentModel.GeoLocation = geolocation;
                attachmentModel.FileSize    = audiosize;
                attachmentModel.file_format = ".mp3";
                // attachmentModel.max_numbers = audio_max.ToString();
                db.InsertAttachmentData(attachmentModel, "no");
                //comp_AttachmentModels.Add(attachmentModel);
                //imagelist.AddRange(comp_AttachmentModels.Where(p => p.Attachment_Type == "Image" ));
                audio_comp_lst.AddRange(db.GetAttachmentData(audioname));

                // postattachmentcomplianceAsync(attachmentModel);
                adapter3          = new GridViewAdapter_Audio(Activity, audio_comp_lst, FragmentManager);
                Gridview3.Adapter = adapter3;


                if (ic.connectivity())
                {
                    postattachmentcomplianceAsync(attachmentModel);
                    // db.updateComplianceattachmentstatus("yes");
                }

                builder.Dismiss();
            };
            recordbtn.Click += delegate
            {
                MediaRecorderReady();

                try
                {
                    timer          = new Timer();
                    timer.Interval = 1000; // 1 second
                    timer.Elapsed += Timer_Elapsed;
                    timer.Start();
                    mediaRecorder.Stop();
                    mediaRecorder.Prepare();
                    mediaRecorder.Start();
                }
                catch (Exception e)
                {
                    // TODO Auto-generated catch block
                    //e.printStackTrace();
                }

                Toast.MakeText(Activity, "Recording started", ToastLength.Long).Show();
            };
            stopbtn.Click += delegate
            {
                try
                {
                    mediaRecorder.Stop();
                    Timer.Text = "00:00:00";
                    timer.Stop();

                    timer = null;
                }
                catch (Exception ex)
                {
                }

                //stoprecorder();

                //btn2.Enabled=false;
                //buttonPlayLastRecordAudio.setEnabled(true);
                //buttonStart.setEnabled(true);
                //buttonStopPlayingRecording.setEnabled(false);

                Toast.MakeText(Activity, "Recording completed", ToastLength.Long).Show();
            };
            //pausebtn.Click += delegate
            //{
            //    //OnPause();
            //    mediaRecorder.Pause();
            //    timer.Dispose();

            //};
            playbtn.Click += delegate
            {
                mediaPlayer = new MediaPlayer();
                mediaPlayer.SetDataSource(AudioSavePathInDevice);
                mediaPlayer.Prepare();
                mediaPlayer.Start();

                //mediaPlayer = MediaPlayer.Create(this, Resource.Raw.AudioSavePathInDevice);
                seekBar.Max = mediaPlayer.Duration;
                run();
            };


            builder.Show();
        }
Beispiel #16
0
        private void recording()
        {
            View view = LayoutInflater.Inflate(Resource.Layout.audio_recorder, null);

            Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(Activity).Create();
            builder.SetView(view);
            builder.Window.SetLayout(600, 600);
            builder.SetCanceledOnTouchOutside(false);
            recordbtn = view.FindViewById <Button>(Resource.Id.recordbtn);
            stopbtn   = view.FindViewById <ImageView>(Resource.Id.stopbtn);
            playbtn   = view.FindViewById <ImageView>(Resource.Id.playbtn);
            Timer     = view.FindViewById <TextView>(Resource.Id.timerbtn);
            seekBar   = view.FindViewById <SeekBar>(Resource.Id.seek_bar);
            Done_Btn  = view.FindViewById <Button>(Resource.Id.donebtn);


            Done_Btn.Click += delegate
            {
                TaskFileMapping_Model attachmentModel = new TaskFileMapping_Model();
                long   size3     = fileaudioPath.Length() / 1024 * 1024;
                string audiosize = size3.ToString();
                attachmentModel.Path        = AudioSavePathInDevice;
                attachmentModel.FileType    = "Audio";
                attachmentModel.FileName    = audioname;
                attachmentModel.localtaskId = task_id_to_send;
                // attachmentModel.file_format = Utility.audiotype;
                attachmentModel.FileSize = audiosize;
                //  attachmentModel.GeoLocation = geolocation;
                //  attachmentModel.max_numbers = audio_max.ToString();
                // db.InsertCreateAttachData(attachmentModel);

                //   comp_AttachmentModels.Add(attachmentModel);

                listmapping.Add(attachmentModel);
                //imagelist.AddRange(comp_AttachmentModels.Where(p => p.Attachment_Type == "Image" ));
                //  audio_list = db.GetCreateAttachmentData("Audio", licenceidmodel[0].taskid.ToString());
                for (int i = 0; i < listmapping.Count; i++)
                {
                    if (listmapping[i].FileType.Equals("Audio"))
                    {
                        audio_list.Add(listmapping[i]);
                    }
                }
                adapter_3          = new GridAudioCreateTask(Activity, audio_list);
                Gridview_3.Adapter = adapter_3;
                Gridview_3.setExpanded(true);
                Gridview_3.ChoiceMode = (ChoiceMode)AbsListViewChoiceMode.MultipleModal;
                Gridview_3.SetMultiChoiceModeListener(new MultiChoiceModeListener3(Activity));
                audioCount++;
                builder.Dismiss();
            };
            recordbtn.Click += delegate
            {
                MediaRecorderReady();

                try
                {
                    timer          = new Timer();
                    timer.Interval = 1000; // 1 second
                    timer.Elapsed += Timer_Elapsed;
                    timer.Start();
                    mediaRecorder.Prepare();
                    mediaRecorder.Start();
                }
                catch (Exception e)
                {
                    // TODO Auto-generated catch block
                    //e.printStackTrace();
                }

                Toast.MakeText(Activity, "Recording started", ToastLength.Long).Show();
            };
            stopbtn.Click += delegate
            {
                try
                {
                    mediaRecorder.Stop();
                    Timer.Text = "00:00:00";
                    timer.Stop();

                    timer = null;
                }
                catch (Exception ex)
                {
                }

                //stoprecorder();

                //btn2.Enabled=false;
                //buttonPlayLastRecordAudio.setEnabled(true);
                //buttonStart.setEnabled(true);
                //buttonStopPlayingRecording.setEnabled(false);

                Toast.MakeText(Activity, "Recording completed", ToastLength.Long).Show();
            };
            //pausebtn.Click += delegate
            //{
            //    //OnPause();
            //    mediaRecorder.Pause();
            //    timer.Dispose();

            //};
            playbtn.Click += delegate
            {
                mediaPlayer = new MediaPlayer();
                mediaPlayer.SetDataSource(AudioSavePathInDevice);
                mediaPlayer.Prepare();
                mediaPlayer.Start();
                //mediaPlayer = MediaPlayer.Create(this, Resource.Raw.AudioSavePathInDevice);
                seekBar.Max = mediaPlayer.Duration;
                run();
            };

            //resumebtn.Click += delegate
            // {
            //     mediaRecorder.Resume();
            //     timer.Start();

            // };

            //savebtn.Click += delegate
            // {
            //     Java.IO.File path = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures);
            //     audiofile = new Java.IO.File(path, "TaskApp");
            //     if (!audiofile.Exists())
            //     {
            //         audiofile.Mkdirs();
            //     }
            //     audioname = Utility.fileName1();
            //     fileImagePath = new Java.IO.File(audiofile, string.Format(audioname, Guid.NewGuid()));
            //     AudioSavePathInDevice = fileImagePath.AbsolutePath;

            //     mediaRecorder.SetOutputFile(AudioSavePathInDevice);

            //     builder.Dismiss();
            // };
            builder.Show();
        }
Beispiel #17
0
        private void FabFunctions(int v)
        {
            string     projectName = "", start = "", end = "", percent = "", work = "", duration = "";
            EditText   mProjectName, mStart, mEnd, mPercent, mWork, mDuration;
            DatePicker mDatePicker;
            DateTime   today;



            switch (v)
            {
            case 1:
                addItems.Click += delegate {
                    View view = LayoutInflater.Inflate(Resource.Layout.builder_add_project, null);
                    Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(this).Create();
                    builder.SetView(view);


                    mProjectName = view.FindViewById <EditText>(Resource.Id.builderProjectName);
                    mStart       = view.FindViewById <EditText>(Resource.Id.builderStart);
                    mEnd         = view.FindViewById <EditText>(Resource.Id.builderEnd);
                    mPercent     = view.FindViewById <EditText>(Resource.Id.builderProgress);
                    mWork        = view.FindViewById <EditText>(Resource.Id.builderWork);
                    mDuration    = view.FindViewById <EditText>(Resource.Id.builderDuration);


                    builder.SetCanceledOnTouchOutside(false);
                    builder.SetButton2("Submit", async delegate
                    {
                        projectName = mProjectName.Text;
                        start       = mStart.Text;
                        end         = mEnd.Text;
                        percent     = mPercent.Text + " %";
                        work        = mWork.Text + " hrs";
                        duration    = mDuration.Text + " day(s)";
                        await addListItems(projectName, start, end, percent, work, duration);
                    });
                    builder.SetButton3("Cancel", delegate { builder.Dismiss(); });


                    mStart.Click += (sender, e) => {
                        Android.Support.V7.App.AlertDialog builder2 = new Android.Support.V7.App.AlertDialog.Builder(this).Create();
                        View view2 = LayoutInflater.Inflate(Resource.Layout.date_picker, null);
                        builder2.SetView(view2);

                        mDatePicker = FindViewById <DatePicker>(Resource.Id.datePicker);

                        builder2.SetButton(-1, "OK", delegate {
                            //mStart.Text = mDatePicker.Month + "/" + mDatePicker.DayOfMonth + "/" + mDatePicker.Year;
                        });
                        builder2.SetButton(-2, "Cancel", delegate { });
                        builder2.Show();
                    };



                    builder.Show();
                };



                //addItems.Click += async delegate { await addListItems(projectName, start, end, percent, work, duration); };
                break;
            }
        }
Beispiel #18
0
        public void recording()
        {
            View view = LayoutInflater.Inflate(Resource.Layout.audiorecord_final, null);

            Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(this).Create();
            builder.SetView(view);
            builder.Window.SetLayout(600, 600);
            builder.SetCanceledOnTouchOutside(false);
            recordbtn = view.FindViewById <Button>(Resource.Id.recordbtn);
            stopbtn   = view.FindViewById <Button>(Resource.Id.stopbtn);
            playbtn   = view.FindViewById <Button>(Resource.Id.playbtn);
            pausebtn  = view.FindViewById <Button>(Resource.Id.pausebtn);
            resumebtn = view.FindViewById <Button>(Resource.Id.resumebtn);
            Timer     = view.FindViewById <TextView>(Resource.Id.timerbtn);
            seekBar   = view.FindViewById <SeekBar>(Resource.Id.seek_bar);

            savebtn          = view.FindViewById <Button>(Resource.Id.savebtn);
            recordbtn.Click += delegate
            {
                MediaRecorderReady();

                try
                {
                    timer          = new Timer();
                    timer.Interval = 1000; // 1 second
                    timer.Elapsed += Timer_Elapsed;
                    timer.Start();
                    mediaRecorder.Prepare();
                    mediaRecorder.Start();
                    state = true;
                }
                catch (Exception e)
                {
                    // TODO Auto-generated catch block
                    //e.printStackTrace();
                }

                Toast.MakeText(this, "Recording started", ToastLength.Long).Show();
            };
            stopbtn.Click += delegate
            {
                mediaRecorder.Stop();

                //stoprecorder();
                Timer.Text = "0:0:0";
                timer.Stop();
                timer = null;
                //btn2.Enabled=false;
                //buttonPlayLastRecordAudio.setEnabled(true);
                //buttonStart.setEnabled(true);
                //buttonStopPlayingRecording.setEnabled(false);

                Toast.MakeText(this, "Recording completed", ToastLength.Long).Show();
            };
            //pausebtn.Click += delegate
            //{
            //    //pauserecording();
            //    //OnPause();
            //    //mediaRecorder.Pause();
            //    timer.Dispose();

            //};
            playbtn.Click += delegate
            {
                mediaPlayer = new MediaPlayer();
                mediaPlayer.SetDataSource(AudioSavePathInDevice);
                mediaPlayer.Prepare();
                mediaPlayer.Start();
                //mediaPlayer = MediaPlayer.Create(this, Resource.Raw.AudioSavePathInDevice);
                seekBar.Max = mediaPlayer.Duration;
            };

            //resumebtn.Click += delegate
            //{
            //    //resumerecording();
            //  //  mediaRecorder.Resume();
            //    timer.Start();

            //};

            savebtn.Click += delegate
            {
                Java.IO.File path = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures);
                audiofile = new Java.IO.File(path, "TaskApp");
                if (!audiofile.Exists())
                {
                    audiofile.Mkdirs();
                }
                audioname             = Utility.fileName1();
                fileImagePath         = new Java.IO.File(audiofile, string.Format(audioname, Guid.NewGuid()));
                AudioSavePathInDevice = fileImagePath.AbsolutePath;

                mediaRecorder.SetOutputFile(AudioSavePathInDevice);

                builder.Dismiss();
            };
            builder.Show();
        }