public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.actionNew:
                if (POIListActivity.isDualMode)
                {
                    var detailFragment = new POIDetailsFragment();
                    Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();
                    ft.Replace(Resource.Id.poiDualDetailLayout, detailFragment);
                    ft.Commit();
                }
                else
                {
                    Intent intent = new Intent(activity, typeof(POIDetailActivity));
                    StartActivity(intent);
                }
                return(true);

            case Resource.Id.actionRefresh:
                DownloadPoisListAsync();
                return(true);

            default: return(base.OnOptionsItemSelected(item));
            }
        }
Ejemplo n.º 2
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            POIDetailsFragment targetFragment = (POIDetailsFragment)TargetFragment;
            string             poiName        = Arguments.GetString("name");

            AlertDialog.Builder alertConfirm = new AlertDialog.Builder(this.Activity);
            alertConfirm.SetTitle("Confirm delete");
            alertConfirm.SetCancelable(false);
            alertConfirm.SetPositiveButton("OK", (sender, e) => { targetFragment.DeletePOIAsync(); });
            alertConfirm.SetNegativeButton("Cancel", delegate { });
            alertConfirm.SetMessage(String.Format("Are you sure you want to delete {0}?", poiName));
            return(alertConfirm.Create());
        }
        public override void OnListItemClick(ListView l, View v, int position, long id)
        {
            PointOfInterest poi = poiListData[position];

            if (POIListActivity.isDualMode)
            {
                var detailFragment = new POIDetailsFragment();
                detailFragment.Arguments = new Bundle();
                detailFragment.Arguments.PutString("poi", JsonConvert.SerializeObject(poi));
                Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.poiDualDetailLayout, detailFragment);
                ft.Commit();
            }
            else
            {
                Intent poiDetailIntent = new Intent(activity, typeof(POIDetailActivity));
                poiDetailIntent.PutExtra("poi", JsonConvert.SerializeObject(poi));
                StartActivity(poiDetailIntent);
            }
        }