public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: if (slidingPaneLayout != null) { if (slidingPaneLayout.IsOpen) { slidingPaneLayout.ClosePane(); } else { slidingPaneLayout.OpenPane(); } } break; case Resource.Id.refresh: inbox.SetListShownNoAnimation(false); RichPushManager.Shared().RefreshMessages(); break; case Resource.Id.preferences: this.StartActivity(new Intent(this, typeof(PushPreferencesActivity))); break; } return(true); }
protected void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.inbox); actionBar = SupportActionBar; ConfigureActionBar(); this.richPushInbox = RichPushManager.Shared().RichPushUser.Inbox; // Set up the inbox fragment this.inbox = (InboxFragment)this.SupportFragmentManager.FindFragmentById(Resource.Id.inbox); this.inbox.ListView.ChoiceMode = ChoiceMode.Single; this.inbox.ListView.SetBackgroundColor(Color.Black); // Set up the message view pager if it exists this.messagePager = (CustomViewPager)this.FindViewById(Resource.Id.message_pager); if (messagePager != null) { messagePager.Adapter = new MessageFragmentAdapter(this.SupportFragmentManager); this.messagePager.PageSelected += (sender, e) => { int position = e.P0; messages [position].MarkRead(); // Highlight the current item you are viewing in the inbox inbox.ListView.SetItemChecked(position, true); // If we are in actionMode, update the menu items if (actionMode != null) { actionMode.Invalidate(); } }; } slidingPaneLayout = (CustomSlidingPaneLayout)FindViewById(Resource.Id.sliding_pane_layout); if (slidingPaneLayout != null) { slidingPaneLayout.SetPanelSlideListener(this); slidingPaneLayout.OpenPane(); GlobalLayoutListener l = null; l = new GlobalLayoutListener(() => { // If sliding pane layout is slidable, set the actionbar to have an up action actionBar.SetDisplayHomeAsUpEnabled(slidingPaneLayout.IsSlideable); slidingPaneLayout.ViewTreeObserver.RemoveGlobalOnLayoutListener(l); }); slidingPaneLayout.ViewTreeObserver.AddOnGlobalLayoutListener(l); } // First create, try to show any messages from the intent if (savedInstanceState == null) { this.SetPendingMessageIdFromIntent(Intent); } }
protected void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); this.SetContentView (Resource.Layout.inbox); actionBar = SupportActionBar; ConfigureActionBar (); this.richPushInbox = RichPushManager.Shared ().RichPushUser.Inbox; // Set up the inbox fragment this.inbox = (InboxFragment)this.SupportFragmentManager.FindFragmentById (Resource.Id.inbox); this.inbox.ListView.ChoiceMode = ChoiceMode.Single; this.inbox.ListView.SetBackgroundColor (Color.Black); // Set up the message view pager if it exists this.messagePager = (CustomViewPager)this.FindViewById (Resource.Id.message_pager); if (messagePager != null) { messagePager.Adapter = new MessageFragmentAdapter (this.SupportFragmentManager); this.messagePager.PageSelected += (sender, e) => { int position = e.P0; messages [position].MarkRead (); // Highlight the current item you are viewing in the inbox inbox.ListView.SetItemChecked (position, true); // If we are in actionMode, update the menu items if (actionMode != null) { actionMode.Invalidate (); } }; } slidingPaneLayout = (CustomSlidingPaneLayout)FindViewById (Resource.Id.sliding_pane_layout); if (slidingPaneLayout != null) { slidingPaneLayout.SetPanelSlideListener (this); slidingPaneLayout.OpenPane (); GlobalLayoutListener l = null; l = new GlobalLayoutListener (() => { // If sliding pane layout is slidable, set the actionbar to have an up action actionBar.SetDisplayHomeAsUpEnabled (slidingPaneLayout.IsSlideable); slidingPaneLayout.ViewTreeObserver.RemoveGlobalOnLayoutListener (l); }); slidingPaneLayout.ViewTreeObserver.AddOnGlobalLayoutListener (l); } // First create, try to show any messages from the intent if (savedInstanceState == null) { this.SetPendingMessageIdFromIntent (Intent); } }