Exemplo n.º 1
0
 public PlannedMealAdapter(PlannedMealObject inPMObject)
 {
     mPMObject = inPMObject;
 }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            //RECYCLER VIEW
            mObject = new PlannedMealObject ();
            mAdapter = new PlannedMealAdapter (mObject);
            SetContentView (Resource.Layout.Main);
            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.GenerateUpcomingMeals ("http://speedychef.azurewebsites.net/search/GenerateUpcomingMeals?user=tester&date1=" + DateTime.Now + "&date2=" + DateTime.Now.AddDays (7.0), "GenerateUpcomingMeals");
        }