Пример #1
0
 public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
 {
     if (item.ItemId == Android.Resource.Id.Home)
     {
         // This is called when the Home (Up) button is pressed in the action bar.
         // Create a simple intent that starts the hierarchical parent activity and
         // use NavUtils in the Support Package to ensure proper handling of Up.
         var upIntent = new Intent(this, typeof(MainActivity));
         if (NavUtils.ShouldUpRecreateTask(this, upIntent))
         {
             // This activity is not part of the application's task, so create a new task
             // with a synthesized back stack.
             TaskStackBuilder.Create(this)
             // If there are ancestor activities, they should be added here.
             .AddNextIntent(upIntent)
             .StartActivities();
             this.Finish();
         }
         else
         {
             // This activity is part of the application's task, so simply
             // navigate up to the hierarchical parent activity.
             NavUtils.NavigateUpTo(this, upIntent);
         }
         return(true);
     }
     return(base.OnOptionsItemSelected(item));
 }
Пример #2
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     switch (item.ItemId)
     {
     case Resource.Id.home:
     {
         var upIntent = NavUtils.GetParentActivityIntent(this);
         if (NavUtils.ShouldUpRecreateTask(this, upIntent))
         {
             // This activity is NOT part of this app's task, so create a new task
             // when navigating up, with a synthesized back stack.
             Android.Support.V4.App.TaskStackBuilder.Create(this).
             AddNextIntentWithParentStack(upIntent).StartActivities();
         }
         else
         {
             // This activity is part of this app's task, so simply
             // navigate up to the logical parent activity.
             NavUtils.NavigateUpTo(this, upIntent);
         }
     }
         return(true);
     }
     return(base.OnOptionsItemSelected(item));
 }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                NavUtils.NavigateUpTo(this, new Intent(this, typeof(MainActivity)));
                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
Пример #4
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId != Android.Resource.Id.Home)
            {
                return(base.OnOptionsItemSelected(item));
            }
            cancellationtokenSource?.Cancel();
            var intent = NavUtils.GetParentActivityIntent(this);

            intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
            NavUtils.NavigateUpTo(this, intent);
            return(true);
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                NavUtils.NavigateUpTo(this, new Intent(this, typeof(MainActivity)));
                return(true);

            case Resource.Id.action_add_item:
                FindViewById(Android.Resource.Id.Empty).Visibility = ViewStates.Gone;
                AddItem();
                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                NavUtils.NavigateUpTo(this, new Intent(this, typeof(MainActivity)));
                return(true);

            case Resource.Id.action_toggle:
                _contentLoaded = !_contentLoaded;
                ShowContentOrLoadingIndicator(_contentLoaded);
                return(true);
            }


            return(base.OnOptionsItemSelected(item));
        }
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     switch (item.ItemId)
     {
     case Android.Resource.Id.Home:
         // This ID represents the Home or Up button. In the case of this
         // activity, the Up button is shown. Use NavUtils to allow users
         // to navigate up one level in the application structure. For
         // more details, see the Navigation pattern on Android Design:
         //
         // http://developer.android.com/design/patterns/navigation.html#up-vs-back
         //
         NavUtils.NavigateUpTo(this, new Intent(this, typeof(ItemListActivity)));
         return(true);
     }
     return(base.OnOptionsItemSelected(item));
 }
Пример #8
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                NavUtils.NavigateUpTo(this, new Intent(this, typeof(StockPriceListActivity)));
                return(true);

            case Resource.Id.action_add_moving_average:
                var dialog = new MovingAveragePeriodDialogFragment((period) => {
                    MovingAverageRequested(this, new MovingAverageRequestedEventArgs(period));
                });
                dialog.Show(FragmentManager, "Moving Average Dialog");
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Пример #9
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId != Android.Resource.Id.Home)
            {
                return(base.OnOptionsItemSelected(item));
            }
            var intent = NavUtils.GetParentActivityIntent(this);

            if (goal != null)
            {
                Preferences.HeroImageGoalId = goal.Id.ToString();
            }

            intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
            NavUtils.NavigateUpTo(this, intent);

            OverridePendingTransition(Resource.Animation.abc_fade_in, Resource.Animation.abc_fade_out);
            return(true);
        }
Пример #10
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                NavUtils.NavigateUpTo(this, new Intent(this, typeof(MainActivity)));
                return(true);

            case Resource.Id.action_previous:
                _viewPager.CurrentItem = _viewPager.CurrentItem - 1;
                return(true);

            case Resource.Id.action_next:
                _viewPager.CurrentItem = _viewPager.CurrentItem + 1;
                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
Пример #11
0
 public override bool OnSupportNavigateUp()
 {
     Android.Content.Intent upIntent = NavUtils.GetParentActivityIntent(this);
     if (upIntent == null)
     {
         NavUtils.NavigateUpFromSameTask(this);
         return(true);
     }
     if (NavUtils.ShouldUpRecreateTask(this, upIntent))
     {
         // this activity is not part of this app's task
         global::Android.Support.V4.App.TaskStackBuilder.Create(this).AddNextIntentWithParentStack(upIntent).StartActivities();
     }
     else
     {
         // this activity is part of this app's task
         NavUtils.NavigateUpTo(this, upIntent);
     }
     return(true);
 }
Пример #12
0
        private async void OnSaveGoal(object sender, EventArgs e)
        {
            StartSpinner();

            var saved = await TrySave();

            StopSpinner();

            if (!saved)
            {
                return;
            }

            var intent = NavUtils.GetParentActivityIntent(this);

            intent.PutExtra(IntentExtra.GoalAdded, true);
            intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
            NavUtils.NavigateUpTo(this, intent);

            OverridePendingTransition(Resource.Animation.abc_fade_in, Resource.Animation.abc_fade_out);
        }
Пример #13
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:

                var intent = NavUtils.GetParentActivityIntent(this);
                if (NavUtils.ShouldUpRecreateTask(this, intent))
                {
                    //This activity is not part of the app's tasks, so create new when navigating
                    Android.Support.V4.App.TaskStackBuilder.Create(this).
                    AddNextIntentWithParentStack(intent)
                    .StartActivities();
                }
                else
                {
                    NavUtils.NavigateUpTo(this, intent);
                }
                break;
            }

            return(base.OnOptionsItemSelected(item));
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            // Respond to the action bar's Up/Home button
            case Android.Resource.Id.Home:
                Intent upIntent = new Intent(this, typeof(NmdMobileMain));
                upIntent.PutExtra("UserCode", ((SharedEnviroment)ApplicationContext).UserCode);
                upIntent.PutExtra("UserName", ((SharedEnviroment)ApplicationContext).UserName);
                upIntent.PutExtra("IsAdmin", ((SharedEnviroment)ApplicationContext).IsAdmin);
                upIntent.PutExtra("OrgID", ((SharedEnviroment)ApplicationContext).OrgID);
                upIntent.PutExtra("SystemCode", ((SharedEnviroment)ApplicationContext).SystemCode);
                upIntent.PutExtra("ActionCode", 0);
                upIntent.AddFlags(ActivityFlags.NewTask);
                upIntent.AddFlags(ActivityFlags.ClearTask);
                NavUtils.NavigateUpTo(this, upIntent);
                //StartActivity(upIntent);
                Finish();
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Пример #15
0
 public virtual void SupportNavigateUpTo(Intent intent)
 {
     NavUtils.NavigateUpTo(this, intent);
 }
Пример #16
0
 public override void SupportNavigateUpTo(Intent intent)
 {
     NavUtils.NavigateUpTo(this, intent);
 }