Example #1
0
        private void GoOnlineButton_Click(object sender, EventArgs e)
        {
            if (!CheckSpecialPermision())
            {
                return;
            }
            if (availabilityStatus)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("GO OFFLINE");
                alert.SetMessage("You will not able to receive ride Request");
                alert.SetPositiveButton("Continue", (senderAlert, args) =>
                {
                    homeFragment.GoOffline();
                    goOnlineButton.Text       = "Go Online";
                    goOnlineButton.Background = ContextCompat.GetDrawable(this, Resource.Drawable.tourroundButton_online);
                    availabilityStatus        = false;
                    TakeDriverOffline();
                });

                alert.SetNegativeButton("Cancel", (senderAlert, args) =>
                {
                    alert.Dispose();
                });
                alert.Show();
            }
            else
            {
                availabilityStatus = true;
                homeFragment.GoOnline();
                goOnlineButton.Text       = "Go offline";
                goOnlineButton.Background = ContextCompat.GetDrawable(this, Resource.Drawable.tourroundButton_green);
            }
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            MapsInitializer.Initialize(this);
            onlineSwitcher = FindViewById <Bitvale.SwitcherLib.SwitcherC>(Resource.Id.switcher);
            bottomNav      = (BottomNavigationView)FindViewById(Resource.Id.bnve);
            LoadFragments();
            InitBottomSheets();

            bottomNav.NavigationItemSelected += Bnve_NavigationItemSelected;
            onlineSwitcher.SetOnCheckedChangeListener(@checked =>
            {
                switch (@checked)
                {
                case true:
                    if (!CheckSpecialPermission())
                    {
                        return;
                    }
                    else
                    {
                        availablityStatus = true;
                        homeFragment.GoOnline();
                    }
                    break;

                default:
                    if (availablityStatus)
                    {
                        homeFragment.GoOffline();
                        availablityStatus = false;
                        TakeDriverOffline();
                    }

                    break;
                }
            });
        }