private void ShowNoHeaderDialog(IHolder holder, GravityFlags gravity, BaseAdapter adapter, OnClickListener clickListener, OnItemClickListener itemClickListener, OnDismissListener dismissListener, OnCancelListener cancelListener, bool expanded) { DialogPlus dialog = DialogPlus.NewDialog(this) .SetContentHolder(holder) .SetFooter(Resource.Layout.footer) .SetCancelable(true) .SetGravity((int)gravity) .SetAdapter(adapter) .SetOnClickListener(clickListener) .SetOnItemClickListener(new OnItemClickListener() { ItemClick = (p0, p1, p2, p3) => { Toast.MakeText(this, "DialogPlus: " + " onItemClick() called with: " + "item = [" + p1 + "], position = [" + p3 + "]", ToastLength.Short).Show(); } }) .SetOnDismissListener(dismissListener) .SetOnCancelListener(cancelListener) .SetExpanded(expanded) .Create(); dialog.Show(); }
private void ShowCompleteDialog(IHolder holder, GravityFlags gravity, BaseAdapter adapter, IOnClickListener clickListener, OnItemClickListener itemClickListener, OnDismissListener dismissListener, OnCancelListener cancelListener, bool expanded) { DialogPlus dialog = DialogPlus.NewDialog(this) .SetContentHolder(holder) .SetHeader(Resource.Layout.header) .SetFooter(Resource.Layout.footer) .SetCancelable(true) .SetGravity((int)gravity) .SetAdapter(adapter) .SetOnClickListener(clickListener) .SetOnItemClickListener(new OnItemClickListener() { ItemClick = (p0, p1, p2, p3) => { Toast.MakeText(this, "DialogPlus: " + " onItemClick() called with: " + "item = [" + p1 + "], position = [" + p3 + "]", ToastLength.Short).Show(); } }) .SetOnDismissListener(dismissListener) .SetExpanded(expanded) //.SetContentWidth(800) .SetContentHeight(ViewGroup.LayoutParams.WrapContent) .SetOnCancelListener(cancelListener) .SetOverlayBackgroundResource(Android.Resource.Color.Transparent) //.SetContentBackgroundResource(R.drawable.corner_background) //.SetOutMostMargin(0, 100, 0, 0) .Create(); dialog.Show(); }
private void ShowDialog(int holderId, GravityFlags gravity, bool showHeader, bool showFooter, bool expanded) { bool isGrid; Com.Orhanobut.Dialogplus.IHolder holder; switch (holderId) { case Resource.Id.basic_holder_radio_button: holder = new ViewHolder(Resource.Layout.content); isGrid = false; break; case Resource.Id.list_holder_radio_button: holder = new ListHolder(); isGrid = false; break; default: holder = new GridHolder(3); isGrid = true; break; } OnClickListener clickListener = new OnClickListener() { ClickAction = (s, v) => { } }; OnItemClickListener itemClickListener = new OnItemClickListener() { ItemClick = (d, i, v, p) => { TextView textView = v.FindViewById <TextView>(Resource.Id.text_view); string clickedAppName = textView.Text; Toast.MakeText(this, clickedAppName + "Clicked", ToastLength.Short).Show(); } }; OnDismissListener dismissListener = new OnDismissListener() { Dimissed = (d) => { Toast.MakeText(this, "dismiss listener invoked!", ToastLength.Short).Show(); } }; OnCancelListener cancelListener = new OnCancelListener() { Canceled = (d) => { Toast.MakeText(this, "cancel listener invoked!", ToastLength.Short).Show(); } }; DialogPlusQs.Views.SimpleAdapter adapter = new DialogPlusQs.Views.SimpleAdapter(this, isGrid); if (showHeader && showFooter) { ShowCompleteDialog(holder, gravity, adapter, clickListener, itemClickListener, dismissListener, cancelListener, expanded); return; } if (showHeader && !showFooter) { ShowNoFooterDialog(holder, gravity, adapter, clickListener, itemClickListener, dismissListener, cancelListener, expanded); return; } if (!showHeader && showFooter) { ShowNoHeaderDialog(holder, gravity, adapter, clickListener, itemClickListener, dismissListener, cancelListener, expanded); return; } ShowOnlyContentDialog(holder, gravity, adapter, itemClickListener, dismissListener, cancelListener, expanded); }