Skip to content

Commit

Permalink
Merge pull request #1 from zumper/master
Browse files Browse the repository at this point in the history
add ability to always show the tooltip below the target
  • Loading branch information
ryanjohn1 committed Jul 7, 2015
2 parents f8c9efc + 427f4fb commit f8b29e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lib/src/main/java/com/appenguin/onboarding/ToolTip.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public enum Position {
private View contentView;
private AnimationType animationType;
private Position position;
private boolean showBelow;
private boolean shouldShowShadow;
private Typeface typeface;
private int delayInMilliseconds;
Expand All @@ -55,6 +56,7 @@ public ToolTip() {
textResId = 0;
color = 0;
contentView = null;
showBelow = false;
animationType = AnimationType.FROM_MASTER_VIEW;
position = Position.CENTER;
delayInMilliseconds = 0;
Expand Down Expand Up @@ -114,6 +116,16 @@ public ToolTip withTextColor(final int color) {
return this;
}

/**
* attempt to place the tooltip below the target.
*
* @return this ToolTip to build upon.
*/
public ToolTip withShowBelow() {
showBelow = true;
return this;
}

/**
* Set a custom content View for the ToolTip. This will cause any text that has been set to be ignored.
*
Expand Down Expand Up @@ -223,4 +235,8 @@ public int getDelayInMilliseconds() {
public Position getPosition() {
return position;
}

public boolean getShowBelow() {
return showBelow;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private void applyToolTipPosition(ToolTip.Position position) {
setX(toolTipViewX);
setPointerCenterX(pointerCenterX);

final boolean showBelow = toolTipViewAboveY < 0;
final boolean showBelow = toolTip.getShowBelow() || toolTipViewAboveY < 0;

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
ViewHelper.setAlpha(topPointerView, showBelow ? 1 : 0);
Expand Down

0 comments on commit f8b29e9

Please sign in to comment.