예제 #1
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            //Used to put dark icons on light action bar
            bool isLight = SampleList.THEME == Resource.Style.Sherlock___Theme_Light;

            //Create the search view
            SearchView searchView = new SearchView(SupportActionBar.ThemedContext);

            searchView.QueryHint = "Search for countries…";
            searchView.SetOnQueryTextListener(this);
            searchView.SetOnSuggestionListener(this);

            if (mSuggestionsAdapter == null)
            {
                MatrixCursor cursor = new MatrixCursor(COLUMNS);
                Converter <string, Java.Lang.Object> func = s => new Java.Lang.String(s);
                cursor.AddRow(Array.ConvertAll <string, Java.Lang.Object> (new string[] { "1", "'Murica" }, func));
                cursor.AddRow(Array.ConvertAll <string, Java.Lang.Object> (new string[] { "2", "Canada" }, func));
                cursor.AddRow(Array.ConvertAll <string, Java.Lang.Object> (new string[] { "3", "Denmark" }, func));
                mSuggestionsAdapter = new SuggestionsAdapter(SupportActionBar.ThemedContext, cursor);
            }

            searchView.SuggestionsAdapter = mSuggestionsAdapter;

            menu.Add("Search")
            .SetIcon(isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.abs__ic_search)
            .SetActionView(searchView)
            .SetShowAsAction(MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionCollapseActionView);

            return(true);
        }
예제 #2
0
파일: SearchViews.cs 프로젝트: adbk/spikes
		public override bool OnCreateOptionsMenu (IMenu menu)
		{
			//Used to put dark icons on light action bar
			bool isLight = SampleList.THEME == Resource.Style.Sherlock___Theme_Light;

			//Create the search view
			SearchView searchView = new SearchView (SupportActionBar.ThemedContext);
			searchView.QueryHint = "Search for countries…";
			searchView.SetOnQueryTextListener (this);
			searchView.SetOnSuggestionListener (this);

			if (mSuggestionsAdapter == null) {
				MatrixCursor cursor = new MatrixCursor (COLUMNS);
				Converter<string, Java.Lang.Object> func = s => new Java.Lang.String (s);
				cursor.AddRow (Array.ConvertAll<string,Java.Lang.Object> (new string[] { "1", "'Murica" }, func));
				cursor.AddRow (Array.ConvertAll<string,Java.Lang.Object> (new string[] { "2", "Canada" }, func));
				cursor.AddRow (Array.ConvertAll<string,Java.Lang.Object> (new string[] { "3", "Denmark" }, func));
				mSuggestionsAdapter = new SuggestionsAdapter (SupportActionBar.ThemedContext, cursor);
			}

			searchView.SuggestionsAdapter = mSuggestionsAdapter;

			menu.Add ("Search")
				.SetIcon (isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.abs__ic_search)
					.SetActionView (searchView)
					.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionCollapseActionView);

			return true;
		}
예제 #3
0
        public override void OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu, Xamarin.ActionbarSherlockBinding.Views.MenuInflater inflater)
        {
            base.OnCreateOptionsMenu(menu, inflater);

            try
            {
                menu.RemoveItem(CHAPTERS_MENU);
                menu.RemoveItem(TEXTSIZE_MENU);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            var chaptersMenu = menu.Add(0, CHAPTERS_MENU, CHAPTERS_MENU, "Chapters");

            chaptersMenu.SetIcon(Resource.Drawable.chapters);
            chaptersMenu.SetShowAsAction((int)ShowAsAction.IfRoom);

            //var screenModeMenu = menu.Add(0, SCREENMODE_MENU, SCREENMODE_MENU, "Mode");
            ////screenModeMenu.SetIcon(Resource.Drawable.expand);
            //screenModeMenu.SetShowAsAction((int)ShowAsAction.IfRoom);

            var fontIncreaseMenu = menu.Add(0, TEXTSIZE_MENU, TEXTSIZE_MENU, "Text Size");

            //fontIncreaseMenu.SetIcon(Resource.Drawable.fontsize);
            fontIncreaseMenu.SetShowAsAction((int)ShowAsAction.Never | (int)ShowAsAction.WithText);
        }
            public bool OnCreateActionMode(ActionMode mode, IMenu menu)
            {
                //Used to put dark icons on light action bar
                bool isLight = SampleList.THEME == Resource.Style.Theme_Sherlock_Light;

                menu.Add("Save")
                .SetIcon(isLight ? Resource.Drawable.ic_compose_inverse : Resource.Drawable.ic_compose)
                .SetShowAsAction(MenuItem.ShowAsActionIfRoom);

                menu.Add("Search")
                .SetIcon(isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.ic_search)
                .SetShowAsAction(MenuItem.ShowAsActionIfRoom);

                menu.Add("Refresh")
                .SetIcon(isLight ? Resource.Drawable.ic_refresh_inverse : Resource.Drawable.ic_refresh)
                .SetShowAsAction(MenuItem.ShowAsActionIfRoom);

                menu.Add("Save")
                .SetIcon(isLight ? Resource.Drawable.ic_compose_inverse : Resource.Drawable.ic_compose)
                .SetShowAsAction(MenuItem.ShowAsActionIfRoom);

                menu.Add("Search")
                .SetIcon(isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.ic_search)
                .SetShowAsAction(MenuItem.ShowAsActionIfRoom);

                menu.Add("Refresh")
                .SetIcon(isLight ? Resource.Drawable.ic_refresh_inverse : Resource.Drawable.ic_refresh)
                .SetShowAsAction(MenuItem.ShowAsActionIfRoom);

                return(true);
            }
예제 #5
0
			public bool OnCreateActionMode (ActionMode mode, IMenu menu)
			{
				//Used to put dark icons on light action bar
				bool isLight = SampleList.THEME == Resource.Style.Theme_Sherlock_Light;

				menu.Add ("Save")
					.SetIcon (isLight ? Resource.Drawable.ic_compose_inverse : Resource.Drawable.ic_compose)
						.SetShowAsAction (MenuItem.ShowAsActionIfRoom);

				menu.Add ("Search")
					.SetIcon (isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.ic_search)
						.SetShowAsAction (MenuItem.ShowAsActionIfRoom);

				menu.Add ("Refresh")
					.SetIcon (isLight ? Resource.Drawable.ic_refresh_inverse : Resource.Drawable.ic_refresh)
						.SetShowAsAction (MenuItem.ShowAsActionIfRoom);

				menu.Add ("Save")
					.SetIcon (isLight ? Resource.Drawable.ic_compose_inverse : Resource.Drawable.ic_compose)
						.SetShowAsAction (MenuItem.ShowAsActionIfRoom);

				menu.Add ("Search")
					.SetIcon (isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.ic_search)
						.SetShowAsAction (MenuItem.ShowAsActionIfRoom);

				menu.Add ("Refresh")
					.SetIcon (isLight ? Resource.Drawable.ic_refresh_inverse : Resource.Drawable.ic_refresh)
						.SetShowAsAction (MenuItem.ShowAsActionIfRoom);

				return true;
			}
예제 #6
0
        public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
        {
            menu.Add("Refresh")
            .SetIcon(Resource.Drawable.refresh)
            .SetShowAsAction(MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionCollapseActionView);

            return(base.OnCreateOptionsMenu(menu));
        }
 public override bool OnCreateOptionsMenu(IMenu menu)
 {
     ISubMenu sub = menu.AddSubMenu ("Theme");
     sub.Add (0, Resource.Style.Theme_Sherlock, 0, "Default");
     sub.Add (0, Resource.Style.Theme_Sherlock_Light, 0, "Light");
     sub.Add (0, Resource.Style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
     sub.Item.SetShowAsAction (MenuItem.ShowAsActionAlways | MenuItem.ShowAsActionWithText);
     return true;
 }
예제 #8
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            ISubMenu sub = menu.AddSubMenu("Theme");

            sub.Add(0, Resource.Style.Theme_Sherlock, 0, "Default");
            sub.Add(0, Resource.Style.Theme_Sherlock_Light, 0, "Light");
            sub.Add(0, Resource.Style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
            sub.Item.SetShowAsAction(MenuItem.ShowAsActionAlways | MenuItem.ShowAsActionWithText);
            return(true);
        }
        public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
        {
            for (int i = 0; i < items; i++)
            {
                menu.Add("Text")
                .SetIcon(Resource.Drawable.ic_title_share_default)
                .SetShowAsAction(MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);
            }

            return(base.OnCreateOptionsMenu(menu));
        }
예제 #10
0
        public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
        {
            //Used to put dark icons on light action bar
            bool isLight = SampleList.THEME == Resource.Style.Theme_Sherlock_Light;

            menu.Add("Search")
            .SetIcon(isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.ic_search)
            .SetActionView(Resource.Layout.collapsible_edittext)
            .SetShowAsAction(MenuItem.ShowAsActionAlways | MenuItem.ShowAsActionCollapseActionView);

            return(true);
        }
예제 #11
0
        public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
        {
            menu.Add("Previous")
            .SetIcon(Resource.Drawable.previous)
            .SetShowAsAction(MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionCollapseActionView);

            menu.Add("Next")
            .SetIcon(Resource.Drawable.next)
            .SetShowAsAction(MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionCollapseActionView);

            return(true);
        }
예제 #12
0
		public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
		{
			menu.Add ("Search")
				.SetIcon (Android.Resource.Drawable.IcMenuSearch)
				.SetActionView (Resource.Layout.collapsible_edittext)
				.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionCollapseActionView);

			menu.Add ("Add")
				.SetIcon (Android.Resource.Drawable.IcMenuAdd)
				.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionCollapseActionView);

			return base.OnCreateOptionsMenu (menu);
		}
        public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
        {
            //Used to put dark icons on light action bar
            bool isLight = SampleList.THEME == Resource.Style.Theme_Sherlock_Light;

            menu.Add("Save")
            .SetIcon(isLight ? Resource.Drawable.ic_compose_inverse : Resource.Drawable.ic_compose)
            .SetShowAsAction(MenuItem.ShowAsActionIfRoom);

            menu.Add("Search")
            .SetShowAsAction(MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);

            menu.Add("Refresh")
            .SetIcon(isLight ? Resource.Drawable.ic_refresh_inverse : Resource.Drawable.ic_refresh)
            .SetShowAsAction(MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);

            return(true);
        }
예제 #14
0
파일: Preference.cs 프로젝트: adbk/spikes
		public override bool OnCreateOptionsMenu (IMenu menu)
		{
			//Used to put dark icons on light action bar
			bool isLight = SampleList.THEME == Resource.Style.Theme_Sherlock_Light;

			menu.Add ("Save")
				.SetIcon (isLight ? Resource.Drawable.ic_compose_inverse : Resource.Drawable.ic_compose)
					.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);

			menu.Add ("Search")
				.SetIcon (isLight ? Resource.Drawable.ic_search_inverse : Resource.Drawable.ic_search)
					.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);

			menu.Add ("Refresh")
				.SetIcon (isLight ? Resource.Drawable.ic_refresh_inverse : Resource.Drawable.ic_refresh)
					.SetShowAsAction (MenuItem.ShowAsActionIfRoom | MenuItem.ShowAsActionWithText);

			return base.OnCreateOptionsMenu (menu);
		}
예제 #15
0
 public bool OnPrepareActionMode(ActionMode mode, IMenu menu)
 {
     return prepare(mode, menu);
 }
예제 #16
0
		public override bool OnCreateOptionsMenu (IMenu menu)
		{
			menu.Add ("Refresh")
				.SetIcon (Android.Resource.Drawable.IcMenuMyLocation)
				.SetShowAsAction (MenuItem.ShowAsActionAlways);

			return true;
		}
 /**
  * {@inheritDoc}
  */
 public override bool OnCreateOptionsMenu(Xamarin.ActionbarSherlockBinding.Views.IMenu menu)
 {
     base.OnCreateOptionsMenu(menu);
     SupportMenuInflater.Inflate(Resource.Menu.settings_action_provider, menu);
     return(true);
 }
예제 #18
0
 public bool OnCreateActionMode(ActionMode mode, IMenu menu)
 {
     return create(mode, menu);
 }
예제 #19
0
			public bool OnPrepareActionMode (ActionMode mode, IMenu menu)
			{
				return false;
			}
 public bool OnPrepareActionMode(ActionMode mode, IMenu menu)
 {
     return(false);
 }