Esempio n. 1
0
        public void OnClick(IDialogInterface dialog, int which)
        {
            switch (adType)
            {
            case MainActivity.ADTYPE_REWARDED:
                MediationPartners.setRewardedPartners(adRequest);
                break;

            case MainActivity.ADTYPE_INTERSTITIAL:
                MediationPartners.setInterstitialPartners(adRequest);
                break;

            case MainActivity.ADTYPE_BANNER:
            case MainActivity.ADTYPE_MREC_BANNER:
                MediationPartners.setBannerPartners(adRequest);
                break;

            default:
                break;
            }
            listener.OnClick(dialog, adType);
        }
        private void InitView()
        {
            string title           = builder.title;
            string message         = builder.message;
            string negativeBtnText = builder.negativeBtnText;
            string positiveBtnText = builder.positiveBtnText;
            IDialogInterfaceOnClickListener positiveListener = builder.positiveListener;
            IDialogInterfaceOnClickListener negativeListner  = builder.negativeListner;
            View contentView      = builder.contentView;
            bool showTitleDivider = builder.showTitleDivider;
            int  titleBgResId     = builder.titleBgResId;
            int  titleTextColor   = builder.titleTextColor;

            TextView titleView = FindViewById <TextView>(Resource.Id.title);

            if (title != null && title.Length > 0)
            {
                titleView.Text = title;
            }
            else
            {
                FindViewById(Resource.Id.popup_header).Visibility = ViewStates.Gone;
            }

            if (titleBgResId > 0)
            {
                titleView.SetBackgroundResource(titleBgResId);
            }

            if (titleTextColor > 0)
            {
                titleView.SetTextColor(titleView.Context.Resources.GetColor(titleTextColor));
            }

            ImageView titleDivider = FindViewById <ImageView>(Resource.Id.divide);

            if (showTitleDivider)
            {
                titleDivider.Visibility = ViewStates.Visible;
            }
            else
            {
                titleDivider.Visibility = ViewStates.Gone;
            }

            TextView messageView = FindViewById <TextView>(Resource.Id.content);

            if (message != null && message.Length > 0)
            {
                messageView.Text           = message;
                messageView.MovementMethod = new ScrollingMovementMethod();
            }
            else
            {
                messageView.Visibility = ViewStates.Gone;
            }

            if (contentView != null)
            {
                FrameLayout container = FindViewById <FrameLayout>(Resource.Id.content_group);
                container.Visibility = ViewStates.Visible;
                container.AddView(contentView);
            }

            Button positiveBtn = FindViewById <Button>(Resource.Id.bt_right);

            if (positiveBtnText != null && positiveBtnText.Length > 0)
            {
                positiveBtn.Text = positiveBtnText;
            }
            else
            {
                positiveBtn.Visibility = ViewStates.Gone;
            }

            Button negativeBtn = FindViewById <Button>(Resource.Id.bt_left);

            if (negativeBtnText != null && negativeBtnText.Length > 0)
            {
                negativeBtn.Text = negativeBtnText;
            }
            else
            {
                negativeBtn.Visibility = ViewStates.Gone;
            }

            if (positiveBtn.Visibility == ViewStates.Visible && negativeBtn.Visibility == ViewStates.Gone)
            {
                positiveBtn.SetBackgroundResource(Resource.Drawable.popup_btn_c);
            }

            negativeBtn.Click += (s, e) =>
            {
                if (negativeListner != null)
                {
                    negativeListner.OnClick(this, 0);
                }
                Dismiss();
            };

            positiveBtn.Click += (s, e) =>
            {
                if (positiveListener != null)
                {
                    positiveListener.OnClick(this, 0);
                }
                Dismiss();
            };

            FindViewById(Resource.Id.root).Click += (s, e) =>
            {
                Dismiss();
            };

            FindViewById(Resource.Id.popup).Click += (s, e) =>
            {
                // skip
            };
        }
 public bool OnSelection(MaterialDialog dialog, View itemView, int which, string text)
 {
     listener.OnClick(dialog, which);
     return(true);
 }
 public virtual void OnSelection(MaterialDialog dialog, View itemView, int which, string text)
 {
     listener.OnClick(dialog, which);
 }