Esempio n. 1
0
        public void ShowWaitDialog_Samll(string msg, bool isCanCancel = false, bool isOutSideTouch = false)
        {
            if (dialog_Show == null)
            {
                InitShowDialog();
            }
            if (dialog_Show.IsShowing)
            {
                dialog_Show.FindViewById <TextView>(Resource.Id.tv_hint).Text = msg;
            }
            else
            {
                var v = LayoutInflater.From(this).Inflate(Resource.Layout.Dialog_WaitProgress_Small, null);
                v.FindViewById <TextView>(Resource.Id.tv_hint).Text = msg;
                dialog_Show.SetContentView(v);
            }
            dialog_Show.SetCancelable(isCanCancel);
            dialog_Show.SetCanceledOnTouchOutside(isOutSideTouch);
            var window = dialog_Show.Window;

            if (window != null)
            {
                var attr = window.Attributes;
                if (attr != null)
                {
                    attr.Height       = 160;
                    attr.Width        = 160;
                    attr.Gravity      = GravityFlags.Center;
                    window.Attributes = (attr);
                }
            }
            dialog_Show.Show();
        }
Esempio n. 2
0
 private void InitShowDialog()
 {
     dialog_ShowBuilder = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.Theme_Dialog_FullScreen);
     dialog_Show        = dialog_ShowBuilder.Create();
     dialog_Show.Show();
     dialog_Show.Dismiss();
 }
        /// <summary>
        /// Show Reaction dialog when user long click on react button
        /// </summary>
        public void ClickDialog(CommentReplyClickEventArgs postData)
        {
            try
            {
                PostData = postData;

                //Show Dialog With 6 React
                AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainContext);

                //Irrelevant code for customizing the buttons and title
                LayoutInflater inflater   = (LayoutInflater)MainContext.GetSystemService(Context.LayoutInflaterService);
                View           dialogView = inflater?.Inflate(Resource.Layout.XReactDialogLayout, null);

                InitializingReactImages(dialogView);
                ClickImageButtons();

                dialogBuilder.SetView(dialogView);
                MReactAlertDialog = dialogBuilder.Create();
                MReactAlertDialog.Window?.SetBackgroundDrawableResource(MReactDialogShape);

                Window window = MReactAlertDialog.Window;
                window?.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

                MReactAlertDialog.Show();
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Esempio n. 4
0
            void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)
            {
                // Verify that the page making the request is part of this activity
                if (!PageIsInThisContext(sender))
                {
                    return;
                }

                var builder = new AlertDialog.Builder(Activity);

                builder.SetTitle(arguments.Title);
                string[] items = arguments.Buttons.ToArray();
                builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which]));

                if (arguments.Cancel != null)
                {
                    builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel));
                }

                if (arguments.Destruction != null)
                {
                    builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction));
                }

                AlertDialog dialog = builder.Create();

                builder.Dispose();
                //to match current functionality of renderer we set cancelable on outside
                //and return null
                dialog.SetCanceledOnTouchOutside(true);
                dialog.CancelEvent += (o, e) => arguments.SetResult(null);
                dialog.Show();
            }
Esempio n. 5
0
 public void Show()
 {
     if (_useAppCompat)
     {
         _appcompatAlertDialog.Show();
     }
     else
     {
         _legacyAlertDialog.Show();
     }
 }
Esempio n. 6
0
        private async Task LoadVisitedRestaurant(int id)
        {
            var current = Connectivity.NetworkAccess;

            if (current == NetworkAccess.Internet)
            {
                try
                {
                    restaurantItemModel = await restaurantRecommenderPayLoad.Restaurants_Visited_By_User(id);

                    if (restaurantItemModel.Count() > 0)
                    {
                        Activity.RunOnUiThread(() =>
                        {
                            restaurantlayoutManager = new LinearLayoutManager(restaurant_recyclerView.Context);
                            restaurant_recyclerView.SetLayoutManager(restaurantlayoutManager);
                            restaurantrecommendationAdapter = new VisitedRestaurantListAdapter(restaurantItemModel);
                            restaurant_recyclerView.SetAdapter(restaurantrecommendationAdapter);
                        });
                    }
                }
                catch (Exception ex)
                {
                    Activity.RunOnUiThread(() =>
                    {
                        AndroidX.AppCompat.App.AlertDialog.Builder dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(Context);
                        AndroidX.AppCompat.App.AlertDialog alert          = dialog.Create();
                        alert.SetTitle("Error");
                        alert.SetMessage(ex.Message.ToString());
                        alert.SetCancelable(true);
                        alert.Show();
                    });
                }
            }
            else
            {
                Activity.RunOnUiThread(() =>
                {
                    AndroidX.AppCompat.App.AlertDialog.Builder dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(Context);
                    AndroidX.AppCompat.App.AlertDialog alert          = dialog.Create();
                    alert.SetTitle("Error");
                    alert.SetMessage("Please connect to the internet");
                    alert.SetCancelable(true);
                    alert.Show();
                });
            }
        }
Esempio n. 7
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.baggagedistribution_fragment, container, false);

            view.FindViewById <TextView>(Resource.Id.totalBaggageLoadMassUnitTextView).Text = _massUnit;
            _picesRemainingCounterTextView = view.FindViewById <TextView>(Resource.Id.picesRemainingCounterTextView);
            _hold1LoadTextView             = view.FindViewById <TextView>(Resource.Id.hold1LoadTextView);
            _hold2LoadTextView             = view.FindViewById <TextView>(Resource.Id.hold2LoadTextView);
            _hold3LoadTextView             = view.FindViewById <TextView>(Resource.Id.hold3LoadTextView);
            _hold4LoadTextView             = view.FindViewById <TextView>(Resource.Id.hold4LoadTextView);
            view.FindViewById <TextView>(Resource.Id.hold1MassUnitTextView).Text = _massUnit;
            view.FindViewById <TextView>(Resource.Id.hold2MassUnitTextView).Text = _massUnit;
            view.FindViewById <TextView>(Resource.Id.hold3MassUnitTextView).Text = _massUnit;
            view.FindViewById <TextView>(Resource.Id.hold4MassUnitTextView).Text = _massUnit;
            _totalBaggageLoadEditText  = view.FindViewById <EditText>(Resource.Id.totalBaggageLoadEditText);
            _totalBaggagePicesEditText = view.FindViewById <EditText>(Resource.Id.totalBaggagePicesEditText);
            _hold1EditText             = view.FindViewById <EditText>(Resource.Id.hold1EditText);
            _hold2EditText             = view.FindViewById <EditText>(Resource.Id.hold2EditText);
            _hold3EditText             = view.FindViewById <EditText>(Resource.Id.hold3EditText);
            _hold4EditText             = view.FindViewById <EditText>(Resource.Id.hold4EditText);

            _totalBaggageLoadEditText.Text  = _settingsService.GetSetting <string>("TotalBaggageLoad");
            _totalBaggagePicesEditText.Text = _settingsService.GetSetting <string>("TotalBaggagePices");
            _hold1EditText.Text             = _settingsService.GetSetting <string>("Hold1Pices");
            _hold2EditText.Text             = _settingsService.GetSetting <string>("Hold2Pices");
            _hold3EditText.Text             = _settingsService.GetSetting <string>("Hold3Pices");
            _hold4EditText.Text             = _settingsService.GetSetting <string>("Hold4Pices");
            _baggageDistributionService.CalculateBaggageDistribution(_totalBaggageLoadEditText.Text, _totalBaggagePicesEditText.Text, _hold1EditText.Text, _hold2EditText.Text, _hold3EditText.Text, _hold4EditText.Text);
            SetValues();

            _totalBaggageLoadEditText.TextChanged += (s, e) =>
            {
                _baggageDistributionService.CalculateBaggageDistribution(_totalBaggageLoadEditText.Text, _totalBaggagePicesEditText.Text, _hold1EditText.Text, _hold2EditText.Text, _hold3EditText.Text, _hold4EditText.Text);
                SetValues();
                _settingsService.SaveSetting("TotalBaggageLoad", e.Text.ToString());
            };
            _totalBaggagePicesEditText.TextChanged += (s, e) =>
            {
                _baggageDistributionService.CalculateBaggageDistribution(_totalBaggageLoadEditText.Text, _totalBaggagePicesEditText.Text, _hold1EditText.Text, _hold2EditText.Text, _hold3EditText.Text, _hold4EditText.Text);
                SetValues();
                _settingsService.SaveSetting("TotalBaggagePices", e.Text.ToString());
            };
            _hold1EditText.TextChanged += (s, e) =>
            {
                _baggageDistributionService.CalculateBaggageDistribution(_totalBaggageLoadEditText.Text, _totalBaggagePicesEditText.Text, _hold1EditText.Text, _hold2EditText.Text, _hold3EditText.Text, _hold4EditText.Text);
                SetValues();
                _settingsService.SaveSetting("Hold1Pices", e.Text.ToString());
            };
            _hold2EditText.TextChanged += (s, e) =>
            {
                _baggageDistributionService.CalculateBaggageDistribution(_totalBaggageLoadEditText.Text, _totalBaggagePicesEditText.Text, _hold1EditText.Text, _hold2EditText.Text, _hold3EditText.Text, _hold4EditText.Text);
                SetValues();
                _settingsService.SaveSetting("Hold2Pices", e.Text.ToString());
            };
            _hold3EditText.TextChanged += (s, e) =>
            {
                _baggageDistributionService.CalculateBaggageDistribution(_totalBaggageLoadEditText.Text, _totalBaggagePicesEditText.Text, _hold1EditText.Text, _hold2EditText.Text, _hold3EditText.Text, _hold4EditText.Text);
                SetValues();
                _settingsService.SaveSetting("Hold3Pices", e.Text.ToString());
            };
            _hold4EditText.TextChanged += (s, e) =>
            {
                _baggageDistributionService.CalculateBaggageDistribution(_totalBaggageLoadEditText.Text, _totalBaggagePicesEditText.Text, _hold1EditText.Text, _hold2EditText.Text, _hold3EditText.Text, _hold4EditText.Text);
                SetValues();
                _settingsService.SaveSetting("Hold4Pices", e.Text.ToString());
            };

            view.FindViewById <Button>(Resource.Id.clearBaggageDistributionButton).Click += (s, e) =>
            {
                view.PerformHapticFeedback(FeedbackConstants.VirtualKey, FeedbackFlags.IgnoreGlobalSetting);
                _picesRemainingCounterTextView.Text = "0";
                _hold1LoadTextView.Text             = "0";
                _hold2LoadTextView.Text             = "0";
                _hold3LoadTextView.Text             = "0";
                _hold4LoadTextView.Text             = "0";
                _totalBaggageLoadEditText.Text      = "";
                _totalBaggagePicesEditText.Text     = "";
                _hold1EditText.Text = "";
                _hold2EditText.Text = "";
                _hold3EditText.Text = "";
                _hold4EditText.Text = "";
            };

            _baggageDistributionService.ErrorMessageEvent += (s, e) =>
            {
                AndroidX.AppCompat.App.AlertDialog.Builder alertDialogBuilder = new AndroidX.AppCompat.App.AlertDialog.Builder(Context);
                AndroidX.AppCompat.App.AlertDialog         alertDialog        = alertDialogBuilder.Create();
                alertDialog.SetTitle("Error");
                alertDialog.SetIcon(Resource.Drawable.ic_stat_error_outline);
                alertDialog.SetMessage((e as ErrorMessageEventArgs).ErrorMessage);
                alertDialog.SetButton((int)DialogButtonType.Positive, "OK", (sender, eventArgs) => { });
                alertDialog.Show();
            };
            return(view);
        }