Ejemplo n.º 1
0
		public override bool OnPrepareOptionsMenu (Android.Views.IMenu menu)
		{
			if (mSortMode != -1) {
				var icon = menu.FindItem (mSortMode).Icon;
				menu.FindItem(Resource.Id.action_sort).SetIcon (icon);
			}
			return base.OnPrepareOptionsMenu(menu);
		}
Ejemplo n.º 2
0
		//add custom icon to tolbar
		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			MenuInflater.Inflate (Resource.Menu.action_menu,menu);
			if (menu != null) { 
				menu.FindItem (Resource.Id.action_refresh).SetVisible (true); 
				menu.FindItem (Resource.Id.action_attach).SetVisible (false);
			}
			return base.OnCreateOptionsMenu (menu);
		}
Ejemplo n.º 3
0
		public override bool OnPrepareOptionsMenu (Android.Views.IMenu menu)
		{
			menu.Clear();

			var items = _viewModel.OptionsMenu;

			foreach(var item in items)
			{
				menu
					.Add(0,
					item.Id,
					0,
					new Java.Lang.String(item.Text));

				var menuItem = menu.FindItem(item.Id);

				switch(item.ShowAs)
				{
				case ShowAs.Hidden:
					{
						menuItem.SetShowAsAction(Android.Views.ShowAsAction.Never);
					}
					break;
				case ShowAs.Visible:
					{
						menuItem.SetShowAsAction(Android.Views.ShowAsAction.IfRoom);
					}
					break;
				default: 
					break;
				}
			}

			return base.OnPrepareOptionsMenu(menu);
		}
Ejemplo n.º 4
0
 public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
 {
     MenuInflater.Inflate(Resource.Menu.menu_events, menu);
     var item = menu.FindItem(Resource.Id.menu_filter_events);
     item.SetTitle(Settings.ShowAllEvents ? Resource.String.limit_events : Resource.String.show_all_events);
     return base.OnCreateOptionsMenu(menu);
 }
		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			MenuInflater.Inflate (Resource.Menu.main_screen, menu);

			_addAlarmMenuButton = menu.FindItem (Resource.Id.add_alarm);
			_acceptMenuButton = menu.FindItem (Resource.Id.accept);
			_alarmNameMenuItem = menu.FindItem (Resource.Id.alarm_name);
			_deleteAlarmMenuItem = menu.FindItem (Resource.Id.delete);
			_disableAlarmMenuItem = menu.FindItem (Resource.Id.switch_button);
			_alarmRadiusMenuItem = menu.FindItem (Resource.Id.alarm_radius);
			_settingsMenuItem = menu.FindItem (Resource.Id.action_settings);
            
			_alarmNameEditText = MenuItemCompat.GetActionView (_alarmNameMenuItem) as EditText;
			_alarmNameEditText.Hint = Resources.GetString (Resource.String.alarm_name);
			_alarmNameEditText.SetWidth (Resources.GetDimensionPixelSize (Resource.Dimension.abc_search_view_preferred_width));

			_enableAlarmToggleButton = MenuItemCompat.GetActionView (_disableAlarmMenuItem) as ToggleButton;
			_enableAlarmToggleButton.CheckedChange += AlarmEnabledChange;

			_alarmRadiusSpinner = MenuItemCompat.GetActionView (_alarmRadiusMenuItem) as Spinner;
			var adapter = new ArrayAdapter (this, Resource.Layout.support_simple_spinner_dropdown_item, 
				              Android.Resource.Id.Text1, Constants.AlarmRadiusValues.Select (r => string.Format ("{0} m", r)).ToList ());
			adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
			_alarmRadiusSpinner.Adapter = adapter;
			_alarmRadiusSpinner.ItemSelected += (s, e) => RedrawAddCircle ();

			ManageMenuItemsVisibilityForMode ();

			_addAlarmMenuButton.SetVisible (_isGooglePlayServicesAvailable == ConnectionResult.Success);

			return base.OnCreateOptionsMenu (menu);
		}
Ejemplo n.º 6
0
		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			var inflater = MenuInflater;
			inflater.Inflate(Resource.Menu.actions, menu);
			var arg1 = menu.FindItem (Resource.Id.action_search);

			var test = new Android.Support.V7.Widget.SearchView (this);
			arg1.SetActionView (test);

			var searchView = MenuItemCompat.GetActionView (arg1);
			var searchView2 = searchView as Android.Support.V7.Widget.SearchView;
			searchView2.QueryTextChange += (sender, e) => {
				e.Handled = OnQueryTextChange (e.NewText);
			};

			searchView2.QueryTextSubmit += (sender, e) => {
				e.Handled = OnQueryTextSubmit (e.Query);
			};

			return true;
		}
		public bool OnPrepareActionMode (ActionMode mode, Android.Views.IMenu menu)
		{
			Logger.Debug ("onPrepareActionMode");

			bool selectionContainsRead = false;
			bool selectionContainsUnread = false;

			foreach (string id in inbox.SelectedMessages) {
				RichPushMessage message = richPushInbox.GetMessage (id);
				if (message.IsRead) {
					selectionContainsRead = true;
				} else {
					selectionContainsUnread = true;
				}

				if (selectionContainsRead && selectionContainsUnread) {
					break;
				}
			}

			// Show them both
			menu.FindItem (Resource.Id.mark_read).SetVisible (selectionContainsUnread);
			menu.FindItem (Resource.Id.mark_unread).SetVisible (selectionContainsRead);

			// If we have an action selection button update the text
			if (actionSelectionButton != null) {
				string selectionText = this.GetString (Resource.String.cab_selection, inbox.SelectedMessages.Count);
				actionSelectionButton.Text = selectionText;
			}

			return true;
		}
Ejemplo n.º 8
0
        public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.alarm_screen, menu);

            _deleteAlarmMenuItem = menu.FindItem(Resource.Id.delete);
            _disableAlarmMenuItem = menu.FindItem(Resource.Id.switch_button);

            _enableAlarmToggleButton = MenuItemCompat.GetActionView(_disableAlarmMenuItem) as ToggleButton;
            _enableAlarmToggleButton.SetBackgroundResource(Resource.Drawable.toggle_button);
            _enableAlarmToggleButton.Checked = _selectedAlarm.Enabled;
            _enableAlarmToggleButton.CheckedChange += AlarmEnabledChange;

            CorrectOptionsMenuVisibility();

            return base.OnCreateOptionsMenu(menu);
        }