public void cargaremulador(int console)
        {
            RunOnUiThread(() => {
                searchview.SetQuery("", true);
                SupportActionBar.Title = miselaneousmethods.consolelistformal[console];
            });
            try
            {
                Glide.Get(this).ClearMemory();
            }
            catch { }
            listaelementos.Clear();

            setdialog("Cargando lista de emuladores", "Por favor espere...");


            foreach (var ax in diccionarioemuladores[miselaneousmethods.consolelist[console]])
            {
                Models.romsinfos modelito = new Models.romsinfos
                {
                    Name     = ax.nombre,
                    InfoLink = ax.link,
                    Portrait = ax.imagen,
                    Region   = ax.compactible
                };

                /*    if (modelito.InfoLink.Contains("https://play.google.com/store/apps/details?id="))
                 *  {*/
                try {
                    if (miselaneousmethods.existepaquete(this, modelito.InfoLink.Split('=')[1]))
                    {
                        modelito.Region += " - instalado";
                    }
                }
                catch (Exception)
                {
                }
                //  }

                listaelementos.Add(modelito);
                modelito = new Models.romsinfos();
            }



            estado = 4;

            idimagen = resourceids[console];
            ///   listaelementos = listaelementos.OrderBy(c => c.nombre).ToList();

            var adaptadolllll = new adaptadorroms(this, listaelementos, resourceids[console]);

            RunOnUiThread(() => {
                listin.Adapter = adaptadolllll;
                dialogoprogreso.Dismiss();
                SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.home);
            });

            GC.Collect(0);
        }
Exemple #2
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            instance = this;
            base.OnCreate(savedInstanceState);

            MainActivity.LoadTheme(this);
            SetContentView(Resource.Layout.SearchLayout);

            SetSupportActionBar(FindViewById <Toolbar>(Resource.Id.toolbar));
            SupportActionBar.Title = "";
            ListView = FindViewById <ListView>(Resource.Id.searchSuggestions);

            ListView.Divider       = null;
            ListView.DividerHeight = 0;
            ListView.ItemClick    += (sender, e) =>
            {
                searchView.SetQuery(suggestions[e.Position].Text, true);
            };
            ListView.ItemLongClick += (sender, e) =>
            {
                Suggestion toRemove = suggestions[e.Position];
                if (History.Contains(toRemove))
                {
                    AlertDialog dialog = new AlertDialog.Builder(this, MainActivity.dialogTheme)
                                         .SetTitle(suggestions[e.Position].Text)
                                         .SetMessage(Resource.String.remove_search)
                                         .SetPositiveButton(Resource.String.remove, (send, eventArg) =>
                    {
                        History.Remove(toRemove);
                        adapter.Remove(toRemove);
                        suggestions.Remove(toRemove);
                        Task.Run(() =>
                        {
                            SQLiteConnection db = new SQLiteConnection(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "RecentSearch.sqlite"));
                            db.Delete(db.Table <Suggestion>().ToList().Find(x => x.Text == toRemove.Text));
                        });
                    })
                                         .SetNegativeButton(Resource.String.cancel, (send, eventArg) => { })
                                         .Create();
                    dialog.Show();
                }
            };

            await Task.Run(() =>
            {
                SQLiteConnection db = new SQLiteConnection(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "RecentSearch.sqlite"));
                db.CreateTable <Suggestion>();

                History = db.Table <Suggestion>().ToList().ConvertAll(HistoryItem);
                History.Reverse();
                suggestions = History;
            });

            adapter          = new SuggestionAdapter(instance, Resource.Layout.SuggestionLayout, suggestions);
            ListView.Adapter = adapter;
        }
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.SearchGif_Menu, menu);

            try
            {
                var        item       = menu.FindItem(Resource.Id.searchUserBar);
                SearchView searchItem = (SearchView)item.ActionView;

                SearchView = searchItem.JavaCast <SearchView>();
                SearchView.SetQuery("", false);
                SearchView.SetIconifiedByDefault(false);
                SearchView.OnActionViewExpanded();
                SearchView.Iconified        = false;
                SearchView.QueryTextChange += SearchViewOnQueryTextChange;
                SearchView.QueryTextSubmit += SearchViewOnQueryTextSubmit;
                SearchView.ClearFocus();

                //Change text colors
                var editText = (EditText)SearchView.FindViewById(Resource.Id.search_src_text);
                editText.SetHintTextColor(Color.White);
                editText.SetTextColor(Color.White);

                //Remove Icon Search
                ImageView searchViewIcon         = (ImageView)SearchView.FindViewById(Resource.Id.search_mag_icon);
                ViewGroup linearLayoutSearchView = (ViewGroup)searchViewIcon.Parent;
                linearLayoutSearchView.RemoveView(searchViewIcon);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(base.OnCreateOptionsMenu(menu));
        }
Exemple #4
0
        private void InitToolbar(View view)
        {
            try
            {
                var toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar);
                GlobalContext.SetToolBar(toolbar, "");

                SearchBox = view.FindViewById <SearchView>(Resource.Id.searchBox);
                SearchBox.SetQuery("", false);
                SearchBox.SetIconifiedByDefault(false);
                SearchBox.OnActionViewExpanded();
                SearchBox.Iconified        = false;
                SearchBox.QueryTextChange += SearchBoxOnQueryTextChange;
                SearchBox.QueryTextSubmit += SearchBoxOnQueryTextSubmit;
                SearchBox.ClearFocus();

                //Change text colors
                var editText = (EditText)SearchBox.FindViewById(Resource.Id.search_src_text);
                editText.SetHintTextColor(Color.Gray);
                editText.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                //Remove Icon Search
                ImageView searchViewIcon         = (ImageView)SearchBox.FindViewById(Resource.Id.search_mag_icon);
                ViewGroup linearLayoutSearchView = (ViewGroup)searchViewIcon.Parent;
                linearLayoutSearchView.RemoveView(searchViewIcon);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #5
0
        private void InitComponent(View view)
        {
            try
            {
                SearchView = view.FindViewById <SearchView>(Resource.Id.searchviewbox);
                SearchView.SetQuery("", false);
                SearchView.ClearFocus();
                SearchView.OnActionViewExpanded();
                SearchView.SetIconifiedByDefault(true);
                SearchView.OnActionViewExpanded();

                //Change text colors
                var editText = (EditText)SearchView.FindViewById(Resource.Id.search_src_text);
                editText.SetHintTextColor(Color.Gray);
                editText.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                TabLayout = view.FindViewById <TabLayout>(Resource.Id.Searchtabs);
                ViewPager = view.FindViewById <ViewPager>(Resource.Id.Searchviewpager);

                AppBarLayout = view.FindViewById <AppBarLayout>(Resource.Id.mainAppBarLayout);
                AppBarLayout.SetExpanded(true);

                //Set Tab
                ViewPager.OffscreenPageLimit = 2;
                SetUpViewPager(ViewPager);
                TabLayout.SetupWithViewPager(ViewPager);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #6
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.search_toolbar, menu);
            IMenuItem searchItem = menu.FindItem(Resource.Id.search);

            searchItem.ExpandActionView();
            searchView           = searchItem.ActionView.JavaCast <SearchView>();
            searchView.MaxWidth  = int.MaxValue;
            searchView.QueryHint = GetString(Resource.String.youtube_search);
            searchView.SetQuery(((SearchView)MainActivity.instance.menu.FindItem(Resource.Id.search).ActionView).Query, false);
            searchView.QueryTextChange += (s, e) =>
            {
                Console.WriteLine("&Search view query changed, newText: " + e.NewText);
                if (e.NewText.Length > 0)
                {
                    Task.Run(() =>
                    {
                        try
                        {
                            using (WebClient client = new WebClient {
                                Encoding = System.Text.Encoding.UTF7
                            })
                            {
                                string json         = client.DownloadString("http://suggestqueries.google.com/complete/search?client=youtube&ds=yt&client=firefox&q=" + /*WebUtility.HtmlEncode(*/ e.NewText /*)*/);
                                json                = json.Substring(json.IndexOf(",") + 1);
                                json                = json.Remove(json.Length - 1);
                                List <string> items = JsonConvert.DeserializeObject <List <string> >(json);
                                suggestions         = items.ConvertAll(StringToSugest);
                                suggestions.InsertRange(0, History.Where(x => x.Text.StartsWith(e.NewText)));

                                if (SearchQuery == null || SearchQuery == "")
                                {
                                    RunOnUiThread(new Java.Lang.Runnable(() => { ListView.Adapter = new SuggestionAdapter(instance, Resource.Layout.SuggestionLayout, suggestions); }));
                                }
                            }
                        }
                        catch (Exception ex) { Console.WriteLine("&Search ex: " + ex.Message); }
                    });
                }
                else
                {
                    suggestions      = History;
                    adapter          = new SuggestionAdapter(instance, Resource.Layout.SuggestionLayout, suggestions);
                    ListView.Adapter = adapter;
                }
            };
            searchView.QueryTextSubmit += (s, e) =>
            {
                SearchQuery = e.NewText;
                AddQueryToHistory(e.NewText);
                Finish();
                OverridePendingTransition(0, 0);
                e.Handled = true;
            };
            searchItem.SetOnActionExpandListener(this);
            return(base.OnCreateOptionsMenu(menu));
        }
Exemple #7
0
        private void AddSearchToToolBar()
        {
            var search         = Element as TabbedSearchPage;
            var searchTextTemp = string.Empty;

            if (search.SearchText != null)
            {
                searchTextTemp = search.SearchText;
            }

            var maintoolbar = MainActivity.ToolBar;

            if (maintoolbar == null || Element == null)
            {
                System.Diagnostics.Debug.WriteLine("SearchPageRenderer ToolBar or Element is null");
                return;
            }
            maintoolbar.Title = Element.Title;
            maintoolbar.InflateMenu(Resource.Menu.mainmenu);
            //if (MainActivity.ToolBar == null || Element == null)
            //{
            //    System.Diagnostics.Debug.WriteLine("SearchPageRenderer ToolBar or Element is null");
            //    return;
            //}

            //MainActivity.ToolBar.Title = Element.Title;
            //MainActivity.ToolBar.InflateMenu(Resource.Menu.mainmenu);

            var actionSearch = Resource.Id.action_search;

            System.Diagnostics.Debug.WriteLine("SearchPageRenderer AddSearchToToolBar actionSearch " + actionSearch);
            _searchView = maintoolbar.Menu?.FindItem(Resource.Id.action_search)?.ActionView?.JavaCast <SearchView>();
            // _searchView = MainActivity.ToolBar.Menu?.FindItem(Resource.Id.action_search)?.ActionView?.JavaCast<SearchView>();

            if (_searchView == null)
            {
                return;
            }

            //default open but has a debug make searchview hasnot cursor
            // _searchView.OnActionViewExpanded();
            //_searchView.SetBackgroundColor(Android.Graphics.Color.Green);
            //_searchView.SetIconifiedByDefault(false);

            _searchView.OnActionViewExpanded();
            _searchView.QueryTextChange += searchView_QueryTextChange;
            _searchView.QueryTextSubmit += searchView_QueryTextSubmit;

            //_searchView.QueryHint = (Element as SearchPage)?.SearchPlaceHolderText;
            //_searchView.ImeOptions = (int)Android.Views.InputMethods.ImeAction.Search;
            // donn't use this code it make the cursor miss
            //_searchView.InputType = (int)Android.Text.InputTypes.TextVariationNormal;
            //_searchView.MaxWidth = int.MaxValue;
            _searchView.SetQuery(searchTextTemp, false);
        }
Exemple #8
0
        void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            var listView = sender as ListView;
            var t        = torrents[e.Position];
            //Android.Widget.Toast.MakeText(this, t.Name, Android.Widget.ToastLength.Short).Show();
            Bundle mybundle = new Bundle();

            mybundle.PutString("torname", t.Name);
            mybundle.PutString("magnet", t.Magnet);
            mybundle.PutString("pageurl", t.TpbPage);
            //mybundle.PutString("torname", t.Name);
            TorDetailDialogFragment modalBottomSheet = new TorDetailDialogFragment();

            modalBottomSheet.Arguments = mybundle;
            modalBottomSheet.Show(SupportFragmentManager, "modalMenu");


            //View dialogView = LayoutInflater.Inflate(Resource.Layout.TorrentDetailDialog, null);
            //BottomSheetDialog dialog = new BottomSheetDialog(this);
            //dialog.SetContentView(dialogView);
            //dialog.Show();

            //FragmentTransaction transaction = FragmentManager.BeginTransaction().SetCustomAnimations(Resource.Animation.abc_grow_fade_in_from_bottom, Resource.Animation.abc_shrink_fade_out_from_bottom) ;
            //TorDetailDialogFragment detdialog = new TorDetailDialogFragment();
            //detdialog.Show(transaction, "Dialog Fragment");

            //torrentDialog = new Dialog(this);
            //torrentDialog.SetContentView(Resource.Layout.TorrentDetailDialog);
            //torrentDialog.Window.SetSoftInputMode(SoftInput.AdjustResize);

            torSearchView.ClearFocus();
            torSearchView.SetQuery("", false);

            //MenuItemCompat.CollapseActionView(item);
            //torrentDialog.Show();

            // detailDialogToolbar = torrentDialog.FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.tordetaildialog_toolbar);
            //detailDialogToolbar.SetNavigationIcon(Resource.Drawable.ic_backarrow);
            //detailDialogToolbar.SetOnMenuItemClickListener(new Android.Support.V7.Widget.Toolbar.on() {

            //torrentDialog.Window.SetLayout(LayoutParams.FillParent, LayoutParams.FillParent);
            //torrentDialog.Window.SetBackgroundDrawableResource(Resource.Color.mtrl_btn_transparent_bg_color);;

            //tvTorName = torrentDialog.FindViewById<TextView>(Resource.Id.tvTorrentName);
            //tvTorUploaded = torrentDialog.FindViewById<TextView>(Resource.Id.tvTorrentUploaded);
            //tvTorName.Text = t.Name;
            //tvTorUploaded.Text = t.Uploaded;
        }
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate(Resource.Menu.menu, menu);
            item = menu.FindItem(Resource.Id.action_search);
            var searchItem = Android.Support.V4.View.MenuItemCompat.GetActionView(item);

            searchView           = searchItem.JavaCast <SearchView>();
            searchView.QueryHint = "Search WeClip";
            searchView.Focusable = (false);
            searchView.SetQuery(query, false);
            searchView.Iconified = (false);
            searchView.RequestFocusFromTouch();
            searchView.SetOnQueryTextListener(this);
            if (query != null)
            {
                searchView.ClearFocus();
            }
        }
Exemple #10
0
        protected virtual void BuildMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.list_menu, menu);

            var actionSearch = menu.FindItem(Resource.Id.action_search);
            var searchItem   = MenuItemCompat.GetActionView(actionSearch);

            _searchView = searchItem.JavaCast <SearchView>();

            _searchTreeObserver = ViewTreeObserverCompat.From(_searchView.ViewTreeObserver);
            _searchTreeObserver.GlobalLayoutCompat += _searchTreeObserver_GlobalLayoutCompat;
            _searchView.SetIconifiedByDefault(true);


            var id              = Class.ForName("android.support.v7.appcompat.R$id");
            int searchPlateId   = (int)id.GetField("search_plate").Get(id);
            int searchSrcTextId = (int)id.GetField("search_src_text").Get(id);

            LinearLayout searchPlate = _searchView.FindViewById <LinearLayout>(searchPlateId);

            SearchView.SearchAutoComplete textArea =
                _searchView.FindViewById <SearchView.SearchAutoComplete>(searchSrcTextId);
            if (searchPlate != null)
            {
                searchPlate.SetBackgroundColor(Resources.GetColor(Resource.Color.white));
            }
            if (textArea != null)
            {
                textArea.SetTextColor(Resources.GetColor(Resource.Color.black));
            }

            if (bundledSearchInformation != null)
            {
                SearchHelper.SetSearchInfo(bundledSearchInformation);
                bundledSearchInformation = null;
            }

            if (!string.IsNullOrEmpty(SearchHelper.SearchInfo.Query) && SearchView != null)
            {
                actionSearch.ExpandActionView();
                SearchView.SetQuery(SearchHelper.SearchInfo.Query, false);
            }
        }
Exemple #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);
            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.SetVmPolicy(builder.Build());
            builder.DetectFileUriExposure();
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(ValidateRemoteCertificate);
            // se selecciona la version de el protocolo de seguridad a la versiond e tls 1.2
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.my_toolbar);
            SetSupportActionBar(toolbar);
            sidem      = FindViewById <Android.Support.V4.Widget.DrawerLayout>(Resource.Id.drawer_layout);
            itemsm     = FindViewById <NavigationView>(Resource.Id.content_frame);
            searchview = FindViewById <Android.Support.V7.Widget.SearchView>(Resource.Id.searchView);
            listin     = FindViewById <ListView>(Resource.Id.listView1);
            actividad  = this;
            //////////////////////////////////////////////////
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.hambur);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.Title = "";
            SupportActionBar.SetBackgroundDrawable(new ColorDrawable(Color.ParseColor("#2b2e30")));
            online = Intent.GetBooleanExtra("online", false);


            TextView titleTextView = null;

            try
            {
                var f = toolbar.Class.GetDeclaredField("mTitleTextView");
                f.Accessible  = true;
                titleTextView = (TextView)f.Get(toolbar);

                titleTextView.Ellipsize            = Android.Text.TextUtils.TruncateAt.Marquee;
                titleTextView.Focusable            = true;
                titleTextView.FocusableInTouchMode = true;
                titleTextView.RequestFocus();
                titleTextView.SetSingleLine(true);
                titleTextView.Selected = true;
                titleTextView.SetMarqueeRepeatLimit(-1);
            }
            catch
            {
            }

            if (!Directory.Exists(directoriocache))
            {
                Directory.CreateDirectory(directoriocache);
            }

            listin.ItemClick += async(aa, aaa) => {
                var texto = aaa.View.FindViewById <TextView>(Resource.Id.textView).Text;
                if (estado == 0)
                {
                    var    link    = listaelementos.First(aax => aax.Name == texto).InfoLink;
                    Intent intento = new Intent(this, typeof(actbiginfo));
                    intento.PutExtra("link", link);
                    intento.PutExtra("consoleindex", selectedconsole);
                    intento.PutExtra("placeholder", idimagen);
                    StartActivity(intento);
                    Console.WriteLine("");
                }
                else
                if (estado == 1)
                {
                    var seleccion = listaelementos.First(aax => aax.Name == texto);
                    new Thread(() =>
                    {
                        miselaneousmethods.abriremulador(this, miselaneousmethods.consolelist[miselaneousmethods.consolelistformal.ToList().IndexOf(seleccion.Region)], Android.Net.Uri.Parse(seleccion.InfoLink), dialogoprogreso);
                    }).Start();
                }
                else
                if (estado == 2)
                {
                    var consoleindex = miselaneousmethods.consolelist.ToList().IndexOf(listaelementos.First(aax => aax.Name == texto).InfoLink);

                    selectedconsole = consoleindex;
                    SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.home);
                    new Thread(() =>
                    {
                        cargarconsola(consoleindex);
                    }).Start();
                }
                else
                if (estado == 3)
                {
                    var seleccion = listaelementos.First(aax => aax.Name == texto);
                    var indice    = miselaneousmethods.consolelistformal.ToList().IndexOf(seleccion.Name);
                    if (diccionarioemuladores.ContainsKey(miselaneousmethods.consolelist[indice]))
                    {
                        new Thread(() =>
                        {
                            cargaremulador(indice);
                        }).Start();
                    }
                    else
                    {
                        Toast.MakeText(this, "No se han añadido emuladores para esta consola aún", ToastLength.Long).Show();
                    }
                }
                if (estado == 4)
                {
                    var seleccion = listaelementos.First(aax => aax.Name == texto);
                    var uri       = Android.Net.Uri.Parse(seleccion.InfoLink);
                    var intent    = new Intent(Intent.ActionView, uri);
                    StartActivity(intent);
                }
                if (estado == 5)
                {
                    var seleccion        = listaelementos.First(aax => aax.Name == texto);
                    SimpleFileDialog sfd = new SimpleFileDialog(this, SimpleFileDialog.FileSelectionMode.FolderChooseRoot);
                    var rutula           = await sfd.GetFileOrDirectoryAsync(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath);

                    miselaneousmethods.cambiarruta(this, miselaneousmethods.consolelist[miselaneousmethods.consolelistformal.ToList().IndexOf(seleccion.Name)], rutula);
                    new Thread(() =>
                    {
                        cargarrutas();
                    }).Start();
                }
            };
            new Thread(() =>
            {
                ///idimagen = Resource.Drawable.gameboy;
                ///

                if (online)
                {
                    llenarlistas();
                    cargarconsolas();
                }
                else
                {
                    cargardescargas();
                }
                //  cargarconsola(0);
            }).Start();
            new Thread(() =>
            {
                alertifnewdowload();
            }).Start();
            new Thread(() => infoserverstatus()).Start();
            ////////////////////////////////
            itemsm.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);
                e.MenuItem.SetChecked(true);
                var nombreconsola = e.MenuItem.TitleFormatted.ToString().Trim();
                SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.hambur);
                if (nombreconsola == "Acerca de")
                {
                    StartActivity(new Intent(this, typeof(actacercade)));
                }
                else
                if (nombreconsola == "Deja un feedback")
                {
                    if (online)
                    {
                        StartActivity(new Intent(this, typeof(actsugerencias)));
                    }
                    else
                    {
                        Toast.MakeText(this, "Solo disponible en modo online", ToastLength.Long).Show();
                    }
                }
                if (nombreconsola == "Roms descargados")
                {
                    if (File.Exists(miselaneousmethods.archivoregistro))
                    {
                        searchview.SetQuery("", true);
                        new Thread(() =>
                        {
                            cargardescargas();
                        }).Start();
                    }
                    else
                    {
                        Toast.MakeText(this, "Usted no ha descargado ningun rom", ToastLength.Long).Show();
                    }
                }
                else
                if (nombreconsola == "Roms")
                {
                    if (online)
                    {
                        searchview.SetQuery("", true);
                        new Thread(() =>
                        {
                            cargarconsolas();
                        }).Start();
                    }
                    else
                    {
                        Toast.MakeText(this, "Solo disponible en modo online", ToastLength.Long).Show();
                    }
                }
                if (nombreconsola == "Emuladores")
                {
                    if (online)
                    {
                        searchview.SetQuery("", true);
                        new Thread(() =>
                        {
                            cargaremuladores();
                        }).Start();
                    }
                    else
                    {
                        Toast.MakeText(this, "Solo disponible en modo online", ToastLength.Long).Show();
                    }
                }
                if (nombreconsola == "Carpetas de descargas")
                {
                    searchview.SetQuery("", true);
                    new Thread(() =>
                    {
                        cargarrutas();
                    }).Start();
                }
                e.MenuItem.SetChecked(false);
                e.MenuItem.SetChecked(false);
                sidem.CloseDrawers();
            };
            //////////////////////////////////////////////////////////////////////////////filter
            ///

            searchview.QueryTextSubmit += (aa, aaa) =>
            {
                Console.WriteLine("klkprro");
                if (estado == 0 || estado == 4)
                {
                    adaptadorroms adaptadolllll = null;
                    adaptadolllll = new adaptadorroms(this, listaelementos.Where(aaxx => aaxx.Name.ToLower().Contains(aaa.Query.ToLower())).ToList(), idimagen);
                    RunOnUiThread(() => listin.Adapter = adaptadolllll);
                }
            };
            searchview.QueryTextChange += (aa, aaa) =>
            {
                try
                {
                    if (aaa.NewText != null)
                    {
                        adaptadorroms           adaptadolllll  = null;
                        adaptadorromsdownloaded adaptadolllll2 = null;
                        if (estado == 0 || estado == 4)
                        {
                            if (romcounts[selectedconsole] <= 500)
                            {
                                adaptadolllll = new adaptadorroms(this, listaelementos.Where(aaxx => aaxx.Name.ToLower().Contains(aaa.NewText.ToLower())).ToList(), idimagen);
                            }
                            else
                            if (aaa.NewText.Length <= 1)
                            {
                                adaptadolllll = new adaptadorroms(this, listaelementos.Where(aaxx => aaxx.Name.ToLower().Contains("")).ToList(), idimagen);
                            }
                        }
                        else
                        if (estado == 1)
                        {
                            var selector = listaelementos.Where(aaxx => aaxx.Name.ToLower().Contains(aaa.NewText.ToLower()) || aaxx.Region.ToLower().Contains(aaa.NewText.ToLower())).ToList();
                            var links    = new List <string>();
                            foreach (var axx in selector)
                            {
                                links.Add(downloadlinks[listaelementos.IndexOf(axx)]);
                            }

                            adaptadolllll2 = new adaptadorromsdownloaded(this, selector, Resource.Drawable.download, null, links);

                            RunOnUiThread(() => listin.Adapter = adaptadolllll2);
                            //   links.Clear();
                        }

                        else
                        {
                            var selector  = listaelementos.Where(aaxx => aaxx.Name.ToLower().Contains(aaa.NewText.ToLower())).ToList();
                            var portraits = new List <int>();
                            foreach (var axx in selector)
                            {
                                portraits.Add(resourceids[listaelementos.IndexOf(axx)]);
                            }

                            adaptadolllll = new adaptadorroms(this, listaelementos.Where(aaxx => aaxx.Name.ToLower().Contains(aaa.NewText.ToLower())).ToList(), idimagen, portraits.ToArray(), true);
                        }

                        if (estado != 1 && romcounts[selectedconsole] <= 500)
                        {
                            RunOnUiThread(() => listin.Adapter = adaptadolllll);
                        }
                    }
                    else
                    {
                        if (estado == 0 || estado == 4)
                        {
                            if (romcounts[selectedconsole] >= 500)
                            {
                                adaptadorroms adaptadolllll = null;
                                adaptadolllll = new adaptadorroms(this, listaelementos.Where(aaxx => aaxx.Name.ToLower().Contains("")).ToList(), idimagen);
                            }
                        }
                    }
                }
                catch {
                }

                /*var adaptadol2 = new adapterlistaoffline(this, nombreses.Where(a => a.ToLower().Contains(aaa.NewText.ToLower())).ToList(), portadases, "", nombreses, diccionario, patheses);
                 *
                 * RunOnUiThread(() => lista.Adapter = adaptadol2);*/
            };
        }
        protected override void InitBindings()
        {
            Bindings.Add(this.SetBinding(() => ViewModel.Clubs).WhenSourceChanges(() =>
            {
                if (ViewModel.MyClubs == null)
                {
                    List.ClearFlingAdapter();
                    List.Adapter = null;
                }
                else
                {
                    List.ClearFlingAdapter();
                    List.InjectFlingAdapter(ViewModel.Clubs, ViewHolderFactory, DataTemplateFull, DataTemplateFling, DataTemplateBasic, ContainerTemplate);
                }
            }));

            Bindings.Add(
                this.SetBinding(() => ViewModel.EmptyNoticeVisibility,
                                () => EmptyNotice.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(this.SetBinding(() => ViewModel.SearchQuery).WhenSourceChanges(() =>
            {
                if (!_settingQuery)
                {
                    SearchView.SetQuery(ViewModel.SearchQuery, false);
                }
                if (ViewModel.SearchQuery?.Length > 2)
                {
                    ActionButton.Show();
                }
                else
                {
                    ActionButton.Hide();
                }
            }));

            if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
            {
                List.SetOnScrollChangeListener(new ScrollListener(i =>
                {
                    if (ViewModel.Loading || !ViewModel.MoreButtonVisibility || List.Adapter == null ||
                        ViewModel.QueryType == MalClubQueries.QueryType.My)
                    {
                        return;
                    }
                    if (List.Adapter.Count - List.FirstVisiblePosition <= 2)
                    {
                        ViewModel.MoreCommand.Execute(null);
                    }
                }));
            }


            SearchView.FindViewById(Resource.Id.search_close_btn).Alpha     = 1;
            SearchView.FindViewById(Resource.Id.search_close_btn).Clickable = true;
            SearchView.FindViewById(Resource.Id.search_close_btn).SetOnClickListener(new OnClickListener(view =>
            {
                SearchView.SetQuery("", false);
                ViewModel.SearchCommand.Execute(null);
            }));

            SearchView.QueryTextChange += SearchViewOnQueryTextChange;
            SearchView.QueryTextSubmit += SearchViewOnQueryTextSubmit;

            ActionButton.SetOnClickListener(new OnClickListener(v => OpenFiltersDrawer()));
        }