use of com.github.xizzhu.simpletooltip.ToolTip in project simple-tool-tip by xizzhu.
the class MainActivity method createToolTip.
private ToolTip createToolTip(CharSequence text, int backgroundColor) {
Resources resources = getResources();
int padding = resources.getDimensionPixelSize(R.dimen.padding);
int textSize = resources.getDimensionPixelSize(R.dimen.text_size);
int radius = resources.getDimensionPixelSize(R.dimen.radius);
return new ToolTip.Builder().withText(text).withTextColor(Color.WHITE).withTextSize(textSize).withBackgroundColor(backgroundColor).withPadding(padding, padding, padding, padding).withCornerRadius(radius).build();
}
use of com.github.xizzhu.simpletooltip.ToolTip in project WordPress-Android by wordpress-mobile.
the class MeFragment method showGravatarTooltipIfNeeded.
private void showGravatarTooltipIfNeeded() {
if (!isAdded() || !mAccountStore.hasAccessToken() || !AppPrefs.isGravatarChangePromoRequired() || !mIsUserVisible || mGravatarToolTipView != null) {
return;
}
ToolTip toolTip = createGravatarPromoToolTip(getString(R.string.gravatar_tip), ContextCompat.getColor(getActivity(), R.color.color_primary));
mGravatarToolTipView = new ToolTipView.Builder(getActivity()).withAnchor(mAvatarTooltipAnchor).withToolTip(toolTip).withGravity(Gravity.END).build();
mGravatarToolTipView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AnalyticsTracker.track(AnalyticsTracker.Stat.ME_GRAVATAR_TOOLTIP_TAPPED);
mGravatarToolTipView.remove();
AppPrefs.setGravatarChangePromoRequired(false);
}
});
mGravatarToolTipView.showDelayed(500);
}
use of com.github.xizzhu.simpletooltip.ToolTip in project WordPress-Android by wordpress-mobile.
the class MeFragment method createGravatarPromoToolTip.
private ToolTip createGravatarPromoToolTip(CharSequence text, int backgroundColor) {
Resources resources = getResources();
int padding = resources.getDimensionPixelSize(R.dimen.tooltip_padding);
int textSize = resources.getDimensionPixelSize(R.dimen.tooltip_text_size);
int radius = resources.getDimensionPixelSize(R.dimen.tooltip_radius);
return new ToolTip.Builder().withText(text).withTextColor(Color.WHITE).withTextSize(textSize).withBackgroundColor(backgroundColor).withPadding(padding, padding, padding, padding).withCornerRadius(radius).build();
}
use of com.github.xizzhu.simpletooltip.ToolTip 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);
}
});
}
Aggregations