Exemplo n.º 1
0
        protected override void OnActivityResult(int requestCode, Result resultVal, Intent data)
        {
            if (requestCode == VOICE)
            {
                if (resultVal == Result.Ok)
                {
                    var matches = data.GetStringArrayListExtra(RecognizerIntent.ExtraResults);
                    if (matches.Count != 0)
                    {
                        //string textInput = btTendencias.Text + matches[0];
                        string textInput = matches[0];

                        // limit the output to 500 characters
                        if (textInput.Length > 500)
                        {
                            textInput = textInput.Substring(0, 500);
                        }
                        caixaPesquisa.SetQuery(textInput, true);
                        caixaPesquisa.RequestFocus();
                        Console.WriteLine("Voz: " + textInput);
                    }
                    else
                    {
                        caixaPesquisa.SetQuery("Não perbeci ...", false);
                    }
                    // change the text back on the button
                    //btVoz.Text = "Voz";
                }
            }
            isRecording = false;

            base.OnActivityResult(requestCode, resultVal, data);
        }
Exemplo n.º 2
0
        private void searchByText(object sender, EventArgs e)
        {
            //change focus off button
            Button mButton = (Button)sender;

            mButton.Focusable = false;

            //Get activity and the searchView. Set Listener on it
            MainActivity act     = (MainActivity)this.Activity;
            SearchView   searchV = (SearchView)act.FindViewById(Resource.Id.searchView1);

            //loses focus on search view if it already given focus before ((allows for backout without querying and pressing the button again))
            if (flagSearch)
            {
                searchV.Focusable = false;
                searchV.SetIconifiedByDefault(true);
                searchV.OnActionViewCollapsed();
            }

            searchV.RequestFocus();
            searchV.SetIconifiedByDefault(false);
            searchV.OnActionViewExpanded();
            flagSearch = true;
        }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _currentPage   = Intent.GetIntExtra("currentPage", 0);
            _pubblicazione = (Pubblicazione)ActivitiesBringe.GetObject("pub");
            _documento     = (Documento)ActivitiesBringe.GetObject("doc");
            _pdfCore       = (MuPDFCore)ActivitiesBringe.GetObject("pdfCore");

            SetContentView(Resource.Layout.SearchDialog);

            Window.SetSoftInputMode(SoftInput.AdjustNothing);

            if (ActionBar != null)
            {
                this.Title = ActionBar.Title = GetString(Resource.String.search);

                ActionBar.SetDisplayUseLogoEnabled(false);
                ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
                ActionBar.SetHomeButtonEnabled(false);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetDisplayShowHomeEnabled(true);
                ActionBar.SetDisplayShowTitleEnabled(true);
            }

            _pageList = (ListView)FindViewById <ListView>(Resource.Id.pageList);

            _searchView = (SearchView)FindViewById <SearchView>(Resource.Id.searchView);

            int  searchPlateId = _searchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null);
            View searchPlate   = _searchView.FindViewById(searchPlateId);

            searchPlate.Background.Colorize(DataManager.Get <ISettingsManager>().Settings.ButtonColor);

            _searchView.Focusable = true;
            _searchView.Iconified = false;
            _searchView.RequestFocusFromTouch();

            _searchView.QueryTextChange += (sender, e) =>
            {
                SearchPages(e.NewText);
            };

            _searchView.QueryTextSubmit += (sender, e) =>
            {
                _searchView.ClearFocus();
            };

            _pageList.ItemClick += (sender, e) =>
            {
                var art = _articoli[e.Position];

                Intent myIntent = new Intent(this, typeof(ViewerScreen));
                myIntent.PutExtra("doc", art.IdDocumento);
                myIntent.PutExtra("page", (art.Index - 1).ToString());
                myIntent.PutExtra("action", "page");

                SetResult(Result.Ok, myIntent);
                Finish();
            };

            //paramentro ricerca
            var str = ActivitiesBringe.GetObject("search");

            if (str != null)
            {
                string search = (string)str;

                _searchView.SetQuery(search, true);

                _searchView.RequestFocus();
            }
        }