public bool OnTouch(Android.Views.View v, MotionEvent e)
        {
            if (v is EditText && e.Action == MotionEventActions.Up)
            {
                EditText editText = (EditText)v;
                if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width()))
                {
                    if (editText.TransformationMethod == null)
                    {
                        editText.TransformationMethod = PasswordTransformationMethod.Instance;
                        editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.avd_hide_password, 0);
                        editText.SetSelection(editText.Length());
                    }
                    else
                    {
                        editText.TransformationMethod = null;
                        editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.avd_show_password, 0);
                        editText.SetSelection(editText.Length());
                    }

                    foreach (Drawable drawable in editText.GetCompoundDrawables())
                    {
                        var color = new Android.Graphics.Color(editText.CurrentTextColor);
                        if (drawable != null)
                        {
                            drawable.SetColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SrcIn));
                        }
                    }

                    return(true);
                }
            }

            return(false);
        }
        public bool OnTouch(Android.Views.View v, MotionEvent e)
        {
            if (v is EditText && e.Action == MotionEventActions.Up)
            {
                EditText editText = (EditText)v;
                if (e.RawX >= (editText.Right - editText.GetCompoundDrawables()[2].Bounds.Width()))
                {
                    if (editText.TransformationMethod == null)
                    {
                        editText.TransformationMethod = PasswordTransformationMethod.Instance;
                        editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.HidePass, 0);
                        editText.SetSelection(editText.Length());
                    }
                    else
                    {
                        editText.TransformationMethod = null;
                        editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, Resource.Drawable.ShowPass, 0);
                        editText.SetSelection(editText.Length());
                    }

                    return(true);
                }
            }

            return(false);
        }
예제 #3
0
        /// <summary>
        /// Fieldses the text changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="TextChangedEventArgs"/> instance containing the event data.</param>
        private void FieldsTextChanged(object sender, TextChangedEventArgs e)
        {
            if ((EditText)sender == _loginEditText && _loginEditText.Length() > 0)
            {
                new CheckLoginTask(_progressBar, _loginWraper, GetString(Resource.String.Register_LoginExist))
                .Execute(_loginEditText.Text);
            }
            EmptyFieldErrorShow();
            if (_passEditText.Length() < 8)
            {
                _passWraper.Error = GetString(Resource.String.ErrorPassLenght);
            }
            else
            {
                _passWraper.ErrorEnabled = false;
            }

            if (_passEditText.Text != _rpPassEditText.Text)
            {
                _rpPassWraper.Error = GetString(Resource.String.ErrorPassEquel);
            }
            else
            {
                _rpPassWraper.ErrorEnabled = false;
            }
        }
예제 #4
0
        private void Txtmsg_TextChanged(object sender, Android.Text.TextChangedEventArgs e)
        {
            int length = 160;

            length     = length - txtmsg.Length();
            count.Text = length.ToString();
        }
예제 #5
0
        private bool ValidateViews()
        {
            var validacao = true;

            //A CONSIDERAR
            if (txt_ProdTabPreco.Length() == 0)
            {
                txt_ProdTabPreco.Error = "Valor inválido!";
            }

            if (spinIdTabPreco.SelectedItemPosition == 0)
            {
                validacao = false;
                Toast.MakeText(this, "Por favor, insira a tabela de preço!", ToastLength.Short).Show();
            }

            if (spinIdProduto.SelectedItemPosition == 0)
            {
                validacao = false;
                Toast.MakeText(this, "Por favor, insira o código do produto!", ToastLength.Short).Show();
            }


            return(validacao);
        }
예제 #6
0
        public void OnClick(View v)
        {
            if (v.Id == Resource.Id.ok)
            {
                numText = FindViewById <EditText>(Resource.Id.getnumber);
                pswText = FindViewById <EditText>(Resource.Id.getpassword);
                if (numText.Length() == 0 || pswText.Length() == 0)
                {
                    Toast.MakeText(this, "账号密码不得为空!", ToastLength.Long).Show();
                }
                else
                {
                    ISharedPreferences mySharedPreferences = GetSharedPreferences("test", FileCreationMode.Append);
                    //实例化SharedPreferences.Editor对象(第二步)   
                    ISharedPreferencesEditor editor = mySharedPreferences.Edit();
                    //用putString的方法保存数据   
                    editor.PutString("nub", numText.Text.ToString());
                    editor.PutString("psw", pswText.Text.ToString());
                    //提交当前数据   
                    editor.Commit();
                    Toast.MakeText(this, "注册成功!", ToastLength.Long).Show();
                    Intent intent = new Intent(this, typeof(LoginActivity));
                    StartActivity(intent);
                    Finish();
                }
            }
            else if (v.Id == Resource.Id.register)
            {
                SetContentView(Resource.Layout.Registerlayout);
                Button okbutton = FindViewById <Button>(Resource.Id.ok);
                okbutton.SetOnClickListener(this);
            }
            else if (v.Id == Resource.Id.loginenter)
            {
                numText = FindViewById <EditText>(Resource.Id.number);
                pswText = FindViewById <EditText>(Resource.Id.password);

                if ((numText.Text.Equals("20155355")) && (pswText.Text.Equals("123456")))
                {
                    Intent intent = new Intent(this, typeof(ChooseActivity));
                    StartActivity(intent);
                    Finish();
                    Toast.MakeText(this, "登录成功!", ToastLength.Long).Show();
                }

                else
                {
                    ISharedPreferences mySharedPreferences = GetSharedPreferences("test", FileCreationMode.Private);
                    //实例化SharedPreferences.Editor对象(第二步)   
                    if ((numText.Text.Equals(mySharedPreferences.GetString("nub", ""))) &&
                        (pswText.Text.Equals(mySharedPreferences.GetString("psw", ""))))
                    {
                        Intent intent = new Intent(this, typeof(ChooseActivity));
                        StartActivity(intent);
                        Finish();
                        Toast.MakeText(this, "登录成功!", ToastLength.Long).Show();
                    }
                }
            }
        }
예제 #7
0
        private bool ValidateViews()
        {
            var validacao = true;

            if (txtCodTabelaPreco.Length() == 0)
            {
                validacao = false;
                txtCodTabelaPreco.Error = "Código da tabela inválido!";
            }

            if (txtDescricaoTabelaPreco.Length() == 0)
            {
                validacao = false;
                txtDescricaoTabelaPreco.Error = "Descrição da tabela inválida!";
            }

            //if (txtValorTabelaPreco.Length() == 0)
            //{
            //    validacao = false;
            //    txtValorTabelaPreco.Error = "Valor da tabela inválido!";
            //}

            //if (txtDescMaxTabelaPreco.Length() == 0)
            //{
            //    validacao = false;
            //    txtDescMaxTabelaPreco.Error = "Desconto máximo inválido!";
            //}

            return(validacao);
        }
예제 #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            txtEditNoteTitle       = FindViewById <EditText>(Resource.Id.txtEditNoteTitle);
            txtEditNoteDescription = FindViewById <EditText>(Resource.Id.txtEditNoteDescription);

            btnEditNote   = FindViewById <Button>(Resource.Id.btnEditNote);
            btnDeleteNote = FindViewById <Button>(Resource.Id.btnDeleteNote);

            btnEditNote.Click   += OnBtnEditNoteClick;
            btnDeleteNote.Click += OnBtnDeleteNoteClick;

            NoteId  = Intent.GetIntExtra("NoteId", 0);
            Details = Intent.GetStringExtra("Details");
            Title   = Intent.GetStringExtra("Title");

            //txtEditNoteTitle.Text = "";
            //txtEditNoteTitle.Append(Title);
            //txtEditNoteDescription.Text = "";
            //txtEditNoteDescription.Append(Details);

            txtEditNoteTitle.Text       = Title;
            txtEditNoteDescription.Text = Details;

            txtEditNoteDescription.RequestFocus();
            txtEditNoteDescription.SetSelection(txtEditNoteDescription.Length());

            objDB = new DatabaseManager();
        }
예제 #9
0
        private bool ValidateViews()
        {
            var validacao = true;

            if (txtCodigoProd.Length() == 0)
            {
                validacao           = false;
                txtCodigoProd.Error = "Código do produto inválido!";
            }

            if (txtNomeProd.Length() == 0)
            {
                validacao         = false;
                txtNomeProd.Error = "Nome do produto inválido!";
            }


            if (txtValorProd.Length() == 0)
            {
                validacao         = false;
                txtNomeProd.Error = "Valor do produto inválido!";
            }

            if (spinUniMedidaProd.SelectedItemPosition == 0)
            {
                validacao = false;
                Toast.MakeText(this, "Por favor, insira a unidade de medida!", ToastLength.Short).Show();
            }

            return(validacao);
        }
예제 #10
0
        private void PopulateNoteList(string searchstring)
        {
            objDb = new DatabaseManager();

            if (searchstring != "")
            {
                myNoteList         = objDb.SearchNotes(searchstring);
                lvNoteList.Adapter = new DataAdapter(this, myNoteList);
                //txtSearch.RequestFocus();
                txtSearch.SetSelection(txtSearch.Length());
                return;
            }
            myNoteList         = objDb.ViewAllNotes();
            lvNoteList.Adapter = new DataAdapter(this, myNoteList);
            //txtSearch.RequestFocus();
            txtSearch.SetSelection(txtSearch.Length());
        }
예제 #11
0
 //shows only totems that are searched
 void Search()
 {
     totemList = _appController.FindTotemOpNaamOfSyn(query.Text);
     totemAdapter.UpdateData(totemList);
     totemAdapter.NotifyDataSetChanged();
     if (query.Length() > 0)
     {
         allTotemListView.SetSelection(0);
     }
 }
예제 #12
0
        private void CalibrarPlataforma1()
        {
            ZeraBalanca = true;
            Thread.Sleep(1000);
            int Contador = 0;
            //=================================+
            //  PRIMEIRO 05 CARACTERES FIXO   //
            //================================//
            // >FF5F0000320301AAAAAA          //
            //================================//
            int TamanhoStringPesoCalibracao = TxtPesoCal1.Length();

            byte[] buffer = new byte[21 + TamanhoStringPesoCalibracao + 1];
            // byte[] buffer = new byte[26];
            buffer[0]  = 0x3E; // >
            buffer[1]  = 0x46; // F
            buffer[2]  = 0x46; // F
            buffer[3]  = 0x35; // 5
            buffer[4]  = 0x46; // F
            buffer[5]  = 0x30; // 0
            buffer[6]  = 0x30; // 0
            buffer[7]  = 0x30; // 0
            buffer[8]  = 0x30; // 0
            buffer[9]  = 0x33; // 3
            buffer[10] = 0x32; // 2
            buffer[11] = 0x30; // 0
            buffer[12] = 0x33; // 3
            buffer[13] = 0x30; // 0
            buffer[14] = 0x31; // 1
            buffer[15] = 0x41; // A
            buffer[16] = 0x41; // A
            buffer[17] = 0x41; // A
            buffer[18] = 0x41; // A
            buffer[19] = 0x41; // A
            buffer[20] = 0x41; // A
            //==========================================//
            //          LENDO  VALOR PESO CONHECIDO     //
            //==========================================//
            int  arraycont = 21;
            byte ValorHex  = 0X30;

            for (int i = 0; i < TamanhoStringPesoCalibracao; i++)
            {
                ValorHex          = Validacoes.ConverteCaracterehex(TxtPesoCal1.Text.Substring(i, 1));
                buffer[arraycont] = Convert.ToByte(ValorHex);
                arraycont         = arraycont + 1;
            }
            buffer[buffer.Count() - 1] = 0x0A; // 0A
            var output = Validacoes.BSocket[0].OutputStream;

            output.Write(buffer, 0, buffer.Count());
            Thread.Sleep(1000);
            ZeraBalanca = false;
            Desbloquearbotoes();
        }
 private async void ConsultarCEP()
 {
     if (EtCep.Length() != 8)
     {
         Toast.MakeText(this, FormatoInvalido, ToastLength.Short).Show();
     }
     else
     {
         await RequisicaoCEP();
     }
 }
예제 #14
0
 //shows only totems that match the query
 void Search()
 {
     fullList          = false;
     eigenschappenList = _appController.FindEigenschapOpNaam(query.Text);
     eigenschapAdapter.UpdateData(eigenschappenList);
     eigenschapAdapter.NotifyDataSetChanged();
     if (query.Length() > 0)
     {
         allEigenschappenListView.SetSelection(0);
     }
 }
예제 #15
0
        private bool Validate_Password()
        {
            var _password = Password.Text.ToString();

            if (Password.Length() == 0)
            {
                Password.Error = "Password can't be left empty";
                return(false);
            }
            return(true);
        }
예제 #16
0
            }  //replace deleted spans

            public void BeforeTextChanged(ICharSequence s, int start, int count, int after)  //delete spans and insert spaces
            {
                try
                {
                    var span = EditText.EditableText.GetSpans(0, EditText.Length(), Java.Lang.Class.FromType(typeof(ImageSpan)));
                    spanStart = -1;
                    spanEnd   = -1;
                    int end;
                    slend = EditText.SelectionEnd;


                    if ((span != null || span.Length != 0) && Editing)
                    {
                        if (count > after)
                        {
                            for (int i = 0; i < span.Length; i++)
                            {
                                end = EditText.EditableText.GetSpanEnd(span[i]);
                                if (slend != end)
                                {
                                    continue;
                                }
                                spanStart = EditText.EditableText.GetSpanStart(span[i]);
                                spanEnd   = EditText.EditableText.GetSpanEnd(span[i]);
                                EditText.EditableText.RemoveSpan(span[i]);
                            }

                            return;
                        }
                        for (int i = 0; i < span.Length; i++)
                        {
                            spanStart = EditText.EditableText.GetSpanStart(span[i]);
                            spanEnd   = EditText.EditableText.GetSpanEnd(span[i]);
                            if (spanStart == slend)
                            {
                                Editing = false;
                                EditText.EditableText.Insert(slend, "\n");
                            }
                            if (spanEnd == slend)
                            {
                                Editing = false;
                                IsEnd   = true;
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                finally { Editing = true; }
            }
예제 #17
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.action_salvar:
                if (txtCNPJCli.Length() < 14)
                {
                    txtCNPJCli.Error = "CNPJ inválido!";
                }
                else
                {
                    Save();
                    return(true);
                }
                break;

            case Resource.Id.action_deletar:
                Delete();
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
예제 #18
0
 private void RestoreSettings()
 {
     objDs                   = new DataStorage(this);
     txtNoteTitle.Text       = objDs.getNoteTitle();
     txtNoteDescription.Text = objDs.getNoteDetails();
     if (txtNoteTitle.Text != "" && txtNoteDescription.Text != "")
     {
         txtNoteDescription.RequestFocus();
         txtNoteDescription.SetSelection(txtNoteDescription.Length());
         return;
     }
     txtNoteTitle.RequestFocus();
 }
예제 #19
0
        static int GetSelectionEnd(EditText editText, ITextInput entry, int start)
        {
            int end             = start;
            int selectionLength = entry.SelectionLength;

            end = System.Math.Max(start, System.Math.Min(editText.Length(), start + selectionLength));
            int newSelectionLength = System.Math.Max(0, end - start);

            // Updating this property results in UpdateSelectionLength being called again messing things up
            if (newSelectionLength != selectionLength)
            {
                entry.SelectionLength = newSelectionLength;
            }
            return(end);
        }
예제 #20
0
        private void UpdateHintTextForCurrentTextEntry()
        {
            string hintText = "";

            for (int i = 0; i < this.hintText.Length; ++i)
            {
                if (i < textTextView.Length())
                {
                    hintText += " ";
                }
                else
                {
                    hintText += this.hintText.Substring(i, 1);
                }
            }
            hintTextView.Text = hintText;
        }
        private bool ValidateViews()
        {
            var validacao = true;

            if (txtid_Vendedor.Length() == 0)
            {
                validacao            = false;
                txtid_Vendedor.Error = "Código do Vendedor inválido!";
            }

            if (spinnerClientes.SelectedItemPosition == 0)
            {
                validacao = false;
                Toast.MakeText(this, "Por favor, selecione o código do cliente", ToastLength.Short).Show();
            }

            return(validacao);
        }
예제 #22
0
        private bool ValidateViews()
        {
            var validacao = true;

            if (txtCodTabelaPreco.Length() == 0)
            {
                validacao = false;
                txtCodTabelaPreco.Error = "Código da tabela inválido!";
            }

            if (txtDescricaoTabelaPreco.Length() == 0)
            {
                validacao = false;
                txtDescricaoTabelaPreco.Error = "Descrição da tabela inválida!";
            }

            return(validacao);
        }
예제 #23
0
 /// <summary>
 /// Errors the show.
 /// </summary>
 private void ErrorShow()
 {
     if (_loginEt.Length() == 0)
     {
         _loginWraper.Error = GetString(Resource.String.ErrorEmptyField);
     }
     else
     {
         _loginWraper.ErrorEnabled = false;
     }
     if (_passEt.Length() == 0)
     {
         _passWraper.Error = GetString(Resource.String.ErrorEmptyField);
     }
     else
     {
         _passWraper.ErrorEnabled = false;
     }
 }
예제 #24
0
        static int GetSelectionStart(EditText editText, ITextInput entry)
        {
            int start          = editText.Length();
            int cursorPosition = entry.CursorPosition;

            if (editText.Text != null)
            {
                // Capping cursorPosition to the end of the text if needed
                start = System.Math.Min(editText.Text.Length, cursorPosition);
            }

            if (start != cursorPosition)
            {
                // Update the interface if start was capped
                entry.CursorPosition = start;
            }

            return(start);
        }
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.products_fragment_items_new_product_description);
     mDpVal = this.Resources.DisplayMetrics.Density;
     FnSetUpToolBar();
     FnSetControls();
     FnSetEvents();
     FnGetData();
     //Window.SetWindowAnimations(Resource.Style.dialog_animation);
     Window.SetSoftInputMode(SoftInput.AdjustResize); //make button appear on top of keyboard
     Window.DecorView.Post(() =>
     {
         SetContentsLayoutHeight(mRlContents, mToolBar);
         keyboardState("VISIBLE", mEtDescription);
         mEtDescription.RequestFocus();
         mEtDescription.SetSelection(mEtDescription.Length());
     });
 }
예제 #26
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);
            var lstData = FindViewById <ListView>(Resource.Id.lstCoins);

            edtCoinName = FindViewById <EditText>(Resource.Id.edtText);



            try
            {
                myStuff    = JObject.Parse(CoinMarketCapAPI.makeAPICall());
                lstMyCoins = ListAll();
                var adapter = new CustomAdapter(this, lstMyCoins);
                lstData.Adapter = adapter;
            }
            catch (WebException e)
            {
                Toast.MakeText(this, "API Error - " + e.Message, ToastLength.Short).Show();
            }



            edtCoinName.TextChanged += delegate {
                if (edtCoinName.Length() > 0)
                {
                    lstMyCoins = ListByText(edtCoinName.Text.ToString());
                }
                else
                {
                    lstMyCoins = ListAll();
                }
                var adapter = new CustomAdapter(this, lstMyCoins);
                lstData.Adapter = adapter;
            };

            lstData.ItemClick += LstData_ItemClick;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);  
            
            mLinearLayout = FindViewById<LinearLayout>(Resource.Id.mainView);
            mTitleSectionLayout = FindViewById<LinearLayout>(Resource.Id.titleSection);
            mGetSectionLayout = FindViewById<LinearLayout>(Resource.Id.getSection);
            mListaLayout = FindViewById<ListView>(Resource.Id.listaFilm);

            mLinearLayout.Click += (sender, e) =>
            {
                InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Activity.InputMethodService);
                inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.None);
            };

            mTitleSectionLayout.Click += (sender, e) =>
            {
                InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Activity.InputMethodService);
                inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.None);
            };
            mGetSectionLayout.Click += (sender, e) =>
            {
                InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Activity.InputMethodService);
                inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.None);
            };

            movieTitle = FindViewById<EditText>(Resource.Id.titleText);
            listaFilm = FindViewById<ListView>(Resource.Id.listaFilm);
            Button searchMoviesButton = FindViewById<Button>(Resource.Id.getMoviesButton);

            searchMoviesButton.Click += async (sender, e) =>
            {
                InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Activity.InputMethodService);
                inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.None);

                pageNumber = 1;
                if (isConnected())
                {
                    if (movieTitle.Length() > 1)
                    {

                        // Get the title text  entered by the user and create a query.
                        string url = "http://www.omdbapi.com/?s=" + movieTitle.Text + "&r=json" + "&page=" + pageNumber.ToString();
                        
                        // Fetch the weather information asynchronously, 
                        // parse the results, then update the screen:

                        results = await FetchDataMoviesAsync(url);
                        

                        if (results != null)
                        {
                            if (results.Response == "False")
                            {
                                listaFilm.SetAdapter(null);
                                DisplayAlert("Alert", "No results were found", "OK");
                            }
                            else
                            {
                                items = new List<string>();
                                items = results.Search.Select(x => x.Title + " (" + x.Year + ")").ToList();                              
                                if (Convert.ToInt16(results.totalResults) > 10)
                                    items.Add("Load more items...");

                               // Console.Out.WriteLine("vedere se funziona il parse : {0} {1} {2}", results.totalResults, results.Response, results.Error);

                                listaFilm.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, items);
                                
                            }
                        }
                    }
                    else
                    {
                        DisplayAlert("Alert", "You need to insert more than 1 character", "OK");
                    }
                }
                else
                {
                    DisplayAlert("Alert", "You need INTERNET CONNECTION", "OK");
                }

                

            };

            listaFilm.ItemClick += async (sender, e) =>
            {
                
                if (e.Position == (items.Count - 1) && pageNumber != (Convert.ToInt16(results.totalResults) % 10 == 0 ? Convert.ToInt16(results.totalResults) / 10 : (Convert.ToInt16(results.totalResults) / 10) + 1))
                {
                    if (pageNumber < (Convert.ToInt16(results.totalResults) % 10 == 0 ? Convert.ToInt16(results.totalResults) / 10 : (Convert.ToInt16(results.totalResults) / 10) + 1) - 1)
                    {
                        pageNumber++;
                        string url = "http://www.omdbapi.com/?s=" + movieTitle.Text + "&r=json" + "&page=" + pageNumber.ToString();
                        SearchResponse resultsNuovi = await FetchDataMoviesAsync(url);
                        results.Search.AddRange(resultsNuovi.Search);
                        //Console.Out.WriteLine("I nuovi risultati messi insieme {0}", JsonConvert.SerializeObject(resultsNuovi));
                     
                        List<string> itemsNew = new List<string>();
                        itemsNew = resultsNuovi.Search.Select(x => x.Title + " (" + x.Year + ")").ToList();
                     
                        items.RemoveAt(e.Position);
                        scrollNumber = items.Count();
                        items.AddRange(itemsNew);
                        items.Add("Load more items...");

                        listaFilm.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, items);
                       
                        listaFilm.SetSelection(scrollNumber);


                    }
                    else
                    if (pageNumber < (Convert.ToInt16(results.totalResults) % 10 == 0 ? Convert.ToInt16(results.totalResults) / 10 : (Convert.ToInt16(results.totalResults) / 10) + 1))
                    {
                        pageNumber++;
                        string url = "http://www.omdbapi.com/?s=" + movieTitle.Text + "&r=json" + "&page=" + pageNumber.ToString();
                        SearchResponse resultsNuovi = await FetchDataMoviesAsync(url);
                        results.Search.AddRange(resultsNuovi.Search);
                        
                        List<string> itemsNew = new List<string>();
                        itemsNew = resultsNuovi.Search.Select(x => x.Title + " (" + x.Year + ")").ToList();
                      
                        items.RemoveAt(e.Position);
                        items.AddRange(itemsNew);

                        listaFilm.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, items);

                    }
                }
                else {

                    Intent intent = new Intent(this, typeof(MovieDetails));
                    Console.Out.WriteLine("lunghezza di results : {0}", results.Search.Count());
                    intent.PutExtra("MovieId", results.Search[e.Position].imdbID);
                    this.StartActivity(intent);
                    
                }
            };


        }
예제 #28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            editText = FindViewById<EditText>(Resource.Id.MyButton);
            txtLength = FindViewById<EditText>(Resource.Id.txtLength);
            var mTextWatcher = new TextWatcher(editText, txtLength);
            //editText.AddTextChangedListener(mTextWatcher);

            editText.AddTextChangedListener(mTextWatcher);
            editText.SetSelection(editText.Length()); // 将光标移动最后一个字符后面
        }