/// <summary> /// Show Reaction dialog when user long click on react button /// </summary> public void LongClickDialog(GlobalClickEventArgs postData, NativePostAdapter nativeFeedAdapter, string namePage = "") { try { PostData = postData; NamePage = namePage; NativeFeedAdapter = nativeFeedAdapter; //Show Dialog With 6 React AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(Context); //Irrelevant code for customizing the buttons and title LayoutInflater inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService); View dialogView = inflater.Inflate(Resource.Layout.XReactDialogLayout, null); InitializingReactImages(dialogView); SetReactionsArray(); ResetReactionsIcons(); 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); } }
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(); }
private async Task LoadRestaurantList() { var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { try { var result = await restaurantRecommenderPayLoad.RestaurantList(); var user_result = await restaurantRecommenderPayLoad.UserList(); RunOnUiThread(() => { progressBar.Visibility = ViewStates.Gone; if (result.Count() > 0 && user_result.Count() > 0) { Intent intent = new Intent(this, typeof(UserActivity)); var restraunt_group = result.GroupBy(x => x.RestaurantType) .Select(group => new RestaurantSection(group.Select(x => x.RestaurantName).ToList()) { SectionName = group.Key, }).OrderBy(x => x.SectionName).ToList(); intent.PutExtra("User_List", JsonConvert.SerializeObject(user_result)); intent.PutExtra("Restaurant_List", JsonConvert.SerializeObject(restraunt_group)); this.StartActivity(intent); } }); } catch (Exception ex) { RunOnUiThread(() => { AndroidX.AppCompat.App.AlertDialog.Builder dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(this); AndroidX.AppCompat.App.AlertDialog alert = dialog.Create(); alert.SetTitle("Error"); alert.SetMessage(ex.Message.ToString()); alert.SetCancelable(true); alert.Show(); }); } } else { RunOnUiThread(() => { AndroidX.AppCompat.App.AlertDialog.Builder dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(this); AndroidX.AppCompat.App.AlertDialog alert = dialog.Create(); alert.SetTitle("Error"); alert.SetMessage("Please connect to the internet"); alert.SetCancelable(true); alert.Show(); }); } }
/// <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> protected 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(); }
private void ShowDialogButton_Click(object sender, EventArgs e) { _builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this); LayoutInflater inflater = this.LayoutInflater; View dialogView = inflater.Inflate(Resource.Layout.layout_loading_dialog, null); _builder.SetView(dialogView); _loadingDialog = _builder.Create(); _loadingProgressMessageTextView = dialogView.FindViewById <TextView>(Resource.Id.loadingProgressMessageTextView); _loadingProgressMessageTextView.Text = "This is loading"; MoveDialogToRightTopCorner(); _loadingDialog.Show(); }