Skip to content

Commit

Permalink
Merge pull request #4 from selimtoksal/fixDownArrowPositionBug
Browse files Browse the repository at this point in the history
fixDownArrowPositionBug
  • Loading branch information
bilgehankalkan authored Sep 27, 2019
2 parents 19354f3 + 02c277f commit ad59c9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ object TooltipFieldUtil {

fun calculateMarginForCircle(resources: Resources, top: Float, bottom: Float, arrowPosition: ArrowPosition, statusBarDiff: Int) = when (arrowPosition) {
ArrowPosition.UP -> bottom.toInt() + statusBarDiff
ArrowPosition.DOWN -> resources.displayMetrics.heightPixels - top.toInt()// + statusBarDiff
ArrowPosition.DOWN -> (resources.displayMetrics.heightPixels - top.toInt()) + ((bottom.toInt() - top.toInt()) / 3) // + statusBarDiff
else -> 0//throw IllegalArgumentException("arrowPosition should be ArrowPosition.UP or ArrowPosition.DOWN")
}

fun calculateMarginForRectangle(resources: Resources, top: Float, bottom: Float, arrowPosition: ArrowPosition, statusBarDiff: Int) = when (arrowPosition) {
ArrowPosition.UP -> bottom.toInt() + statusBarDiff
ArrowPosition.DOWN -> resources.displayMetrics.heightPixels - top.toInt()// + statusBarDiff
ArrowPosition.DOWN -> (resources.displayMetrics.heightPixels - top.toInt()) + (bottom.toInt() - top.toInt())
else -> 0//throw IllegalArgumentException("arrowPosition should be ArrowPosition.UP or ArrowPosition.DOWN")
}

Expand Down
3 changes: 2 additions & 1 deletion sample/src/main/java/com/trendyol/sample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void onClick(View view) {
.closeButtonColor(ContextCompat.getColor(getBaseContext(), R.color.white))
.showCloseButton(true)
.arrowPosition(ArrowPosition.AUTO)
.highlightType(HighlightType.CIRCLE)
.highlightType(HighlightType.RECTANGLE)
.windowBackgroundAlpha(255)
.titleTextSize(30F)
.build()
Expand Down Expand Up @@ -72,6 +72,7 @@ public void onClick(View v) {
.arrowPosition(ArrowPosition.AUTO)
.highlightType(HighlightType.CIRCLE)
.descriptionTextSize(21)
.highlightPadding(8F)
.build()
.show(MainActivity.this, 0);
}
Expand Down

0 comments on commit ad59c9b

Please sign in to comment.