Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            ListView lista   = FindViewById <ListView>(Resource.Id.listMostrar);
            Button   Mostrar = FindViewById <Button>(Resource.Id.btnmostra);


            Pila <string> pi = new Pila <string>();

            Mostrar.Click += mostrar;
            void mostrar(object sender, System.EventArgs e)
            {
                string[] array = pi.mostrar();
                for (int i = 0; i < array.Length; i++)
                {
                    var editText = new EditText(this);

                    var layoutParams = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);
                    layoutParams.BottomMargin = 6;

                    editText.LayoutParameters = layoutParams;

                    editText.Hint = array[i];

                    lista.AddView(editText);
                }
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //Set appropriate layout.
            SetContentView(Resource.Layout.Recorder);

            _recorder = new Recorder(this);

            /*GridLayout gridLayout = FindViewById< GridLayout>(Resource.Id.gridLayout);
             * gridLayout.Touch += GridLayout_Touch;
             * View view = gridLayout.GetChildAt(5);
             *
             * this.AddContentView(view, null);
             *
             * Log.Info("", view.LayoutParameters.Height.ToString());
             * Log.Info("", view.LayoutParameters.Width.ToString());
             * Log.Info("", view.GetX().ToString());
             * Log.Info("", view.GetY().ToString());*/

            //Initialize activity and get the microphone listener thread.
            Thread micThread = CreateMicrophoneRecorder();

            OnMicrophoneFinishedSampling += RecorderActivity_OnMicrophoneFinishedSampling;

            //Start the microphone listening thread.
            //micThread.Start();

            _closestNote = FindViewById <TextView>(Resource.Id.closestNote);

            ImageView guitarBG = FindViewById <ImageView>(Resource.Id.guitarBG);

            //guitarBG.SetImageResource(Resource.Drawable.Neck_Acustic_01);

            _recorder.AnimateGuitarIntro(guitarBG);
            _recorder.OnIntroAnimationFinished += Recorder_OnIntroAnimationFinished;;

            //Add test recording list item.
            ListView lstRecordings = FindViewById <ListView>(Resource.Id.lstRecordings);
            TextView txtRec        = new TextView(this);

            txtRec.Text = "Test recording";
            lstRecordings.AddView(txtRec);
            lstRecordings.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                Toast.MakeText(this, ((TextView)e.View).Text, ToastLength.Long);
            };

            //On record button click.
            _btnRecord        = FindViewById <ImageButton>(Resource.Id.btnRecord);
            _btnRecord.Click += (object sender, EventArgs e) =>
            {
                micManager.Record();
                //TODO: Switch button to stop recording.
            };
        }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.Mostrar);
            ListView lista   = FindViewById <ListView>(Resource.Id.listMostrar);
            Button   Mostrar = FindViewById <Button>(Resource.Id.btnmostra);


            Button Salir = FindViewById <Button>(Resource.Id.btnsalir);

            Salir.Click += btnSalir_Click;
            void btnSalir_Click(object sender, System.EventArgs e)
            {
                var Volver = new Intent(this, typeof(MainActivity));

                Volver.PutExtra("Datos", "Datos Enviados");
                StartActivity(Volver);
            }

            Mostrar.Click += mostrar;
            void mostrar(object sender, System.EventArgs e)
            {
                string[] array = pi.mostrar();
                for (int i = 0; i < array.Length; i++)
                {
                    var editText = new EditText(this);

                    var layoutParams = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);
                    layoutParams.BottomMargin = 6;

                    editText.LayoutParameters = layoutParams;

                    editText.Hint = array[i];

                    lista.AddView(editText);
                }
            }
        }
Exemplo n.º 4
0
        private ListView GenerateList(string[] data, SubmissionEvent onclick, bool exitOnSubmit = false, bool hideOnBack = true)
        {
            //var list = GetView<ListView>("account_show");
            var list = new ListView(new ViewData("ListView").SetAttribute("padding_left", 2).SetAttribute("padding_right", 2).SetAttribute("border", 8), LangManager.NO_LANG);

            //if (data.Length == 1 && data[0].Length == 0) data = new string[0];
            Tuple <string, View>[] listData = new Tuple <string, View> [data.Length - ((data.Length == 1 && data[0].Length == 0) ? 1: 0)];
            for (int i = 0; i < listData.Length; ++i)
            {
                ButtonView t = new ButtonView(new ViewData("ButtonView").AddNestedSimple("Text", data[i]), LangManager.NO_LANG); // Don't do translations
                t.SetEvent(v =>
                {
                    onclick?.Invoke(v);
                    if (exitOnSubmit)
                    {
                        Hide(list);
                    }
                });
                listData[i] = new Tuple <string, View>(t.Text, t);
            }
            if (listData.Length > 0)
            {
                list.AddViews(0, listData);
            }
            else
            {
                ButtonView close = new ButtonView(new ViewData("ButtonView").AddNestedSimple("Text", GetIntlString("GENERIC_dismiss")), LangManager.NO_LANG);
                close.SetEvent(_ => Hide(list));
                list.AddView(close, "close");
            }
            if (hideOnBack)
            {
                list.OnBackEvent = v => Hide(v);
            }
            return(list);
        }