Skip to content

Commit

Permalink
Make bigger padding to make thumbnail always visible.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinMoskala committed Aug 11, 2017
1 parent ead99d1 commit 8aedd5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
android:id="@+id/seekArc"
android:layout_width="200dp"
android:layout_height="100dp"
android:padding="20dp"
android:layout_gravity="center" />

</LinearLayout>
5 changes: 3 additions & 2 deletions lib/src/main/java/com/marcinmoskala/arcseekbar/ArcSeekBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ class ArcSeekBar @JvmOverloads constructor(
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val height = View.getDefaultSize(suggestedMinimumHeight, heightMeasureSpec)
val width = View.getDefaultSize(suggestedMinimumWidth, widthMeasureSpec)
val d = progressWidth + 2F
drawData = ArcSeekBarData(d + paddingLeft, d + paddingTop, width.toFloat() - 2 * d - paddingLeft - paddingRight, height.toFloat() - 2 * d - paddingTop - paddingBottom, progress, maxProgress)
val dx = maxOf(mThumb.intrinsicWidth / 2, progressWidth).toFloat() + 2
val dy = maxOf(mThumb.intrinsicHeight / 2, progressWidth).toFloat() + 2
drawData = ArcSeekBarData(dx + paddingLeft, dy + paddingTop, width.toFloat() - 2 * dx - paddingLeft - paddingRight, height.toFloat() - 2 * dy - paddingTop - paddingBottom, progress, maxProgress)
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
}

Expand Down

0 comments on commit 8aedd5b

Please sign in to comment.