예제 #1
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.actionNew:
                if (POIListActivity.isDualMode)
                {
                    var detailFragment     = new POIDetailFragment();
                    FragmentTransaction ft = FragmentManager.BeginTransaction();
                    ft.Replace(Resource.Id.poiDetailLayout, 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));
            }
        }
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            POIDetailFragment targetFragment = (POIDetailFragment)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());
        }
예제 #3
0
        public override void OnListItemClick(ListView l, View v, int position, long id)
        {
            PointOfInterest poi = poiListData[position];

            if (POIListActivity.isDualMode)
            {
                var detailFragment = new POIDetailFragment();
                detailFragment.Arguments = new Bundle();
                detailFragment.Arguments.PutString("poi", JsonConvert.SerializeObject(poi));

                FragmentTransaction ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.poiDetailLayout, detailFragment);
                ft.Commit();
            }
            else
            {
                Intent poiDetailIntent = new Intent(activity, typeof(POIDetailActivity));
                poiDetailIntent.PutExtra("poi", JsonConvert.SerializeObject(poi));
                StartActivity(poiDetailIntent);
            }
        }
예제 #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.POIDetail);

            SetProgressBarIndeterminateVisibility(true);

            if (null == bundle)
            {
                var detailFragment = new POIDetailFragment();
                detailFragment.Arguments = new Bundle();

                if (Intent.HasExtra("poi"))
                {
                    string poiJson = Intent.GetStringExtra("poi");
                    detailFragment.Arguments.PutString("poi", poiJson);
                }

                FragmentTransaction ft = FragmentManager.BeginTransaction();
                ft.Add(Resource.Id.poiDetailLayout, detailFragment);
                ft.Commit();
            }
        }