예제 #1
0
        private static async void CancelTrip(Activity activity, TripDetailsPresenter cancelTripListener, Trip trip, AlertDialog dialog)
        {
            int  travelerId = AndroidLoginManager.Instance(activity).GetTravelerId();
            bool success    = await new UserTripDataManager().CancelTripForUser(travelerId, trip);

            dialog.Dismiss();
            cancelTripListener.OnTripCancelComplete(success);
        }
예제 #2
0
 public TripDetailsView(Activity activity, TripDetailsPresenter presenter, bool cancelable)
 {
     this.presenter = presenter;
     this.activity  = activity;
     this.activity.SetContentView(Resource.Layout.trip_details);
     this.tvNumberOfTransfers     = activity.FindViewById <TextView>(Resource.Id.trip_details_number_of_transfers);
     this.tvTotalWalk             = activity.FindViewById <TextView>(Resource.Id.trip_details_total_walk);
     this.tvTotalTime             = activity.FindViewById <TextView>(Resource.Id.trip_details_total_time);
     this.tvTravel                = activity.FindViewById <TextView>(Resource.Id.trip_details_travel);
     this.listViewLegs            = activity.FindViewById <ListView> (Resource.Id.trip_details_number_listview_legs);
     this.btnCancel               = activity.FindViewById <Button> (Resource.Id.trip_details_bottom_btn);
     this.stepAdapter             = new StepAdapter(activity.LayoutInflater);
     this.listViewLegs.Adapter    = this.stepAdapter;
     this.listViewLegs.ItemClick += OnStepSelected;
     this.btnCancel.Visibility    = cancelable ? ViewStates.Visible : ViewStates.Gone;
     this.btnCancel.Click        += btnCancel_Click;
 }
예제 #3
0
        public static void Show(Activity activity, TripDetailsPresenter tripDetailsPresenter, Trip trip)
        {
            var builder = new AlertDialog.Builder(activity);

            builder.SetTitle("Cancel Trip");
            builder.SetMessage("Are you sure?");
            builder.SetPositiveButton("Yes", (EventHandler <DialogClickEventArgs>)null);
            builder.SetNegativeButton("No", (EventHandler <DialogClickEventArgs>)null);
            var dialog = builder.Create();

            dialog.Show();
            var yesBtn = dialog.GetButton((int)DialogButtonType.Positive);
            var noBtn  = dialog.GetButton((int)DialogButtonType.Negative);

            yesBtn.Click += (s, e) =>
            {
                CancelTrip(activity, tripDetailsPresenter, trip, dialog);
            };
            noBtn.Click += (s, e) =>
            {
                dialog.Dismiss();
            };
        }