/// <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);
            }
        }
Пример #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();
 }
Пример #3
0
        public static Task <JwtLoginCredentials> GetInputAsync(string title)
        {
            var         context = GetContext();
            var         tcs     = new TaskCompletionSource <JwtLoginCredentials>();
            var         result  = new JwtLoginCredentials();
            AlertDialog dialog  = null;

            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.SetTitle(title);

            var viewInflated  = LayoutInflater.From(context).Inflate(Resource.Layout.login_view, null, false);
            var userInput     = viewInflated.FindViewById <AppCompatEditText>(Resource.Id.input_user);
            var passwordInput = viewInflated.FindViewById <AppCompatEditText>(Resource.Id.input_password);

            builder.SetView(viewInflated);

            builder.SetOnCancelListener(new DialogInterfaceOnCancelListener(() => tcs.TrySetResult(null)));
            builder.SetOnDismissListener(new DialogInterfaceOnDismissListener(() => tcs.TrySetResult(null)));
            builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) =>
            {
                result.User     = userInput.Text;
                result.Password = passwordInput.Text;
                tcs.TrySetResult(result);
                dialog.Dismiss();
            });
            builder.SetNegativeButton(Android.Resource.String.Cancel, (sender, args) =>
            {
                tcs.TrySetResult(null);
                dialog.Cancel();
            });

            dialog = builder.Show();

            return(tcs.Task);
        }
Пример #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();
            }
Пример #5
0
 /// <summary>
 /// 显示Android提示框
 /// </summary>
 /// <param name="title">标题</param>
 /// <param name="msg">内容消息</param>
 /// <param name="onSureClick">确定事件</param>
 /// <param name="onCancelClick">取消事件</param>
 /// <param name="sureText">确定文字</param>
 /// <param name="cancelText">取消文字</param>
 public void ShowAndroidPromptBox(string title, string msg, Action onSureClick, Action onCancelClick, bool isCancelable = false, string sureText = "确定", string cancelText = "取消")
 {
     AndroidX.AppCompat.App.AlertDialog jk = null;
     jk =
         new AndroidX.AppCompat.App.AlertDialog.Builder(this)
         .SetTitle(title)
         .SetMessage(msg)
         .SetCancelable(isCancelable)
         .SetPositiveButton(sureText, (object sender, DialogClickEventArgs eve) => { jk.Dismiss(); jk = null; onSureClick?.Invoke(); })
         .SetNegativeButton(cancelText, (object sender, DialogClickEventArgs eve) => { jk.Dismiss(); jk = null; onCancelClick?.Invoke(); })
         .Show();
 }
Пример #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();
                });
            }
        }
Пример #7
0
 public FlexibleAlertDialog(AppCompatAlertDialog alertDialog)
 {
     _appcompatAlertDialog = alertDialog;
     _useAppCompat         = true;
 }
Пример #8
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);
        }