protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); this.mostRecentKeywords = ""; this.asc = "Asc"; this.ordertype = "Diff"; //RECYCLER VIEW mObject = new RecipeObject (); mAdapter = new RecipeAdapter (mObject, this); mAdapter.itemClick += this.OnItemClick; SetContentView (Resource.Layout.Search); mRecyclerView = FindViewById<v7Widget.RecyclerView> (Resource.Id.recyclerView); mRecyclerView.SetAdapter (mAdapter); mLayoutManager = new v7Widget.LinearLayoutManager (this); mRecyclerView.SetLayoutManager (mLayoutManager); //SEARCH VIEW SearchView searchView = FindViewById<SearchView> (Resource.Id.main_search); searchView.SetBackgroundColor (Android.Graphics.Color.DarkOrange); searchView.SetOnQueryTextListener ((SearchView.IOnQueryTextListener)this); int id = Resources.GetIdentifier ("android:id/search_src_text", null, null); TextView textView = (TextView)searchView.FindViewById (id); textView.SetTextColor (Android.Graphics.Color.White); textView.SetHintTextColor (Android.Graphics.Color.White); searchView.SetQueryHint ("Search Recipes..."); LinearLayout search_container = FindViewById<LinearLayout> (Resource.Id.search_container); search_container.Click += (sender, e) => { if (searchView.Iconified != false) { searchView.Iconified = false; } }; //MENU VIEW Button menu_button = FindViewById<Button> (Resource.Id.menu_button); menu_button.Click += (s, arg) => { menu_button.SetBackgroundResource (Resource.Drawable.pressed_lines); PopupMenu menu = new PopupMenu (this, menu_button); menu.Inflate (Resource.Menu.Main_Menu); menu.MenuItemClick += this.MenuButtonClick; menu.DismissEvent += (s2, arg2) => { menu_button.SetBackgroundResource (Resource.Drawable.menu_lines); Console.WriteLine ("menu dismissed"); }; menu.Show (); }; this.filter_button = FindViewById<Button> (Resource.Id.filter_button); RegisterForContextMenu (filter_button); filter_button.Click += (s, arg) => { ((Button) s).ShowContextMenu(); }; if(CachedData.Instance.PreviousActivity.GetType() == typeof(SubtypeBrowseActivity)){ string selectionInput = CachedData.Instance.SelectedSubgenre.Replace(' ', ','); string url = "http://speedychef.azurewebsites.net/search/searchbyunion?inputKeywords=" + this.mostRecentKeywords + "&ordertype=" + this.ordertype + "&ascending=" + this.asc + "&subgenre=" + selectionInput; this.ProcessSingleSearchQuery (url, "SearchByUnion"); } if(CachedData.Instance.SubmissionFromMain){ string url = "http://speedychef.azurewebsites.net/search/search?inputKeywords=" + CachedData.Instance.LastSubmissionFromMain + "&ordertype=" + this.ordertype + "&ascending=" + this.asc; this.ProcessSingleSearchQuery (url, "Search"); CachedData.Instance.SubmissionFromMain = false; } }
public RecipeAdapter(RecipeObject inRObject, CustomActivity inActivity) { this.mRObject = inRObject; this.callingActivity = inActivity; }