void ShowChartsTooltip()
        {
            var Listener = this.Activity as ITipListener;
            var ToolTips = new ToolTipsManager();
            var builder  = new ToolTip.Builder(this.btnCountryCharts.Context, this.btnCountryCharts, this.LinearRoot, "¡Nuevo!", ToolTip.PositionBelow);

            builder.SetAlign(ToolTip.AlignCenter);
            builder.SetBackgroundColor(Resource.Color.material_grey_50);
            Task.Delay(2000).ContinueWith((task) => this.Activity.RunOnUiThread(() => ToolTips.Show(builder.Build())));
        }
Пример #2
0
        public void OnClick(View view)
        {
            String text = TextUtils.IsEmpty(_editText.Text) ? _tip_text : _editText.Text;

            ToolTip.Builder builder;

            switch (view.Id)
            {
            case Resource.Id.button_above:
                _toolTipsManager.FindAndDismiss(_textView);
                builder = new ToolTip.Builder(this, _textView, _rootLayout, text, ToolTip.PositionAbove);
                builder.SetAlign(_align);
                _toolTipsManager.Show(builder.Build());
                break;

            case Resource.Id.button_below:
                _toolTipsManager.FindAndDismiss(_textView);
                builder = new ToolTip.Builder(this, _textView, _rootLayout, text, ToolTip.PositionBelow);
                builder.SetAlign(_align);
                builder.SetBackgroundColor(ContextCompat.GetColor(this, Resource.Color.colorOrange));
                _toolTipsManager.Show(builder.Build());
                break;

            case Resource.Id.button_left_to:
                _toolTipsManager.FindAndDismiss(_textView);
                builder = new ToolTip.Builder(this, _textView, _rootLayout, text, ToolTip.PositionLeftTo);
                builder.SetBackgroundColor(ContextCompat.GetColor(this, Resource.Color.colorLightGreen));
                builder.SetTextColor(ContextCompat.GetColor(this, Resource.Color.colorBlack));
                builder.SetGravity(ToolTip.GravityCenter);
                builder.SetTextSize(12);
                _toolTipsManager.Show(builder.Build());
                break;

            case Resource.Id.button_right_to:
                _toolTipsManager.FindAndDismiss(_textView);
                builder = new ToolTip.Builder(this, _textView, _rootLayout, text, ToolTip.PositionRightTo);
                builder.SetBackgroundColor(ContextCompat.GetColor(this, Resource.Color.colorDarkRed));
                builder.SetTextColor(ContextCompat.GetColor(this, Resource.Color.colorWhite));
                _toolTipsManager.Show(builder.Build());
                break;

            case Resource.Id.button_align_center:
                _align = ToolTip.AlignCenter;
                break;

            case Resource.Id.button_align_left:
                _align = ToolTip.AlignLeft;
                break;

            case Resource.Id.button_align_right:
                _align = ToolTip.AlignRight;
                break;
            }
        }
        private void DetailsFragment_OnItemClickCallback(object sender, EventArgs e)
        {
            DebugHelper.Method(MethodBase.GetCurrentMethod());
            var Args = e as DetailsItemClickEventArgs;

            if (Args is null)
            {
                return;
            }

            var builder = new ToolTip.Builder(this, Args.Anchor, this.RootView, Args.ToolTipText, Args.Position ?? ToolTip.PositionAbove);

            builder.SetAlign(ToolTip.AlignCenter);
            builder.SetBackgroundColor(Resource.Color.material_grey_50);
            this.ToolTips.Show(builder.Build());
            Task.Delay(2000).ContinueWith((task) => RunOnUiThread(() => this.ToolTips.FindAndDismiss(Args.Anchor)));
        }
Пример #4
0
        public void ShowTooltip(Xamarin.Forms.View onView, TooltipConfig config)
        {
            var control = GetOrCreateRenderer(onView).View;

            if (!string.IsNullOrEmpty(config.Text))
            {
                ToolTip.Builder builder;
                var             position      = config.Position;
                var             parentContent = control.RootView;
                switch (position)
                {
                case TooltipPosition.Top:
                    builder = new ToolTip.Builder(global::Android.App.Application.Context, control,
                                                  parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionAbove);
                    break;

                case TooltipPosition.Left:
                    builder = new ToolTip.Builder(global::Android.App.Application.Context, control,
                                                  parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionLeftTo);
                    break;

                case TooltipPosition.Right:
                    builder = new ToolTip.Builder(global::Android.App.Application.Context, control,
                                                  parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionRightTo);
                    break;

                default:
                    builder = new ToolTip.Builder(global::Android.App.Application.Context, control,
                                                  parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionBelow);
                    break;
                }

                builder.SetAlign(ToolTip.AlignLeft);
                builder.SetBackgroundColor(config.BackgroundColor.ToAndroid());
                builder.SetTextColor(config.TextColor.ToAndroid());

                toolTipView = builder.Build();

                _toolTipsManager?.Show(toolTipView);
            }
        }
Пример #5
0
        protected override void OnAttached()
        {
            var control = Control ?? Container;

            listener.command = TooltipEffect.GetDismishedCommand(Element);
            var text = TooltipEffect.GetText(Element);

            if (!string.IsNullOrEmpty(text))
            {
                ToolTip.Builder builder;
                var             parentContent = control.RootView;
                var             position      = TooltipEffect.GetPosition(Element);
                switch (position)
                {
                case TooltipPosition.Top:
                    builder = new ToolTip.Builder(control.Context, control, parentContent as ViewGroup, text.PadRight(80, ' '), ToolTip.PositionAbove);
                    break;

                case TooltipPosition.Left:
                    builder = new ToolTip.Builder(control.Context, control, parentContent as ViewGroup, text.PadRight(80, ' '), ToolTip.PositionLeftTo);
                    break;

                case TooltipPosition.Right:
                    builder = new ToolTip.Builder(control.Context, control, parentContent as ViewGroup, text.PadRight(80, ' '), ToolTip.PositionRightTo);
                    break;

                default:
                    builder = new ToolTip.Builder(control.Context, control, parentContent as ViewGroup, text.PadRight(80, ' '), ToolTip.PositionBelow);
                    break;
                }

                builder.SetAlign(ToolTip.AlignLeft);
                builder.SetBackgroundColor(TooltipEffect.GetBackgroundColor(Element).ToAndroid());
                builder.SetTextColor(TooltipEffect.GetTextColor(Element).ToAndroid());

                toolTipView = builder.Build();
                builder.Dispose();
                _toolTipsManager?.Show(toolTipView);
                listener.toolTipsManager = _toolTipsManager;
            }
        }
        void OnTap(object sender, EventArgs e)
        {
            var control = Control ?? Container;

            var text = TooltipEffect.GetText(Element);

            if (!string.IsNullOrEmpty(text))
            {
                ToolTip.Builder builder;
                var             parentContent = control.RootView;

                var position = TooltipEffect.GetPosition(Element);
                switch (position)
                {
                case TooltipPosition.Top:
                    builder = new ToolTip.Builder(control.Context, control, parentContent as ViewGroup, text.PadRight(80, ' '), ToolTip.PositionAbove);
                    break;

                case TooltipPosition.Left:
                    builder = new ToolTip.Builder(control.Context, control, parentContent as ViewGroup, text.PadRight(80, ' '), ToolTip.PositionLeftTo);
                    break;

                case TooltipPosition.Right:
                    builder = new ToolTip.Builder(control.Context, control, parentContent as ViewGroup, text.PadRight(80, ' '), ToolTip.PositionRightTo);
                    break;

                default:
                    builder = new ToolTip.Builder(control.Context, control, parentContent as ViewGroup, text.PadRight(80, ' '), ToolTip.PositionBelow);
                    break;
                }

                builder.SetAlign(ToolTip.AlignLeft);
                builder.SetBackgroundColor(TooltipEffect.GetBackgroundColor(Element).ToAndroid());
                builder.SetTextColor(TooltipEffect.GetTextColor(Element).ToAndroid());

                toolTipView = builder.Build();

                _toolTipsManager?.Show(toolTipView);
            }
        }