Search in sources :

Example 1 with ToolTipView

use of com.github.xizzhu.simpletooltip.ToolTipView in project simple-tool-tip by xizzhu.

the class MainActivity method showToolTipView.

private void showToolTipView(final View anchorView, int gravity, CharSequence text, int backgroundColor, long delay) {
    if (anchorView.getTag() != null) {
        ((ToolTipView) anchorView.getTag()).remove();
        anchorView.setTag(null);
        return;
    }
    ToolTip toolTip = createToolTip(text, backgroundColor);
    ToolTipView toolTipView = createToolTipView(toolTip, anchorView, gravity);
    if (delay > 0L) {
        toolTipView.showDelayed(delay);
    } else {
        toolTipView.show();
    }
    anchorView.setTag(toolTipView);
    toolTipView.setOnToolTipClickedListener(new ToolTipView.OnToolTipClickedListener() {

        @Override
        public void onToolTipClicked(ToolTipView toolTipView) {
            anchorView.setTag(null);
        }
    });
}
Also used : ToolTip(com.github.xizzhu.simpletooltip.ToolTip) ToolTipView(com.github.xizzhu.simpletooltip.ToolTipView)

Aggregations

ToolTip (com.github.xizzhu.simpletooltip.ToolTip)1 ToolTipView (com.github.xizzhu.simpletooltip.ToolTipView)1