Skip to content

Commit

Permalink
Bug fixes for SimpleIndicator and touch event handle
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasMata committed Oct 20, 2020
1 parent 19f1239 commit d9f94f1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ class CustomSwipeRefreshLayout: SwipeRefreshLayout, SpotlightTarget {
override val handlesSpotlightTouchEvent: Boolean = true

override fun onSpotlightTouchEvent(event: MotionEvent): Boolean {
return false
return !boundingRect.contains(event.x, event.y)
}
}
2 changes: 1 addition & 1 deletion spotlight/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdkVersion 24
targetSdkVersion 30
versionCode 3
versionName "0.2.5"
versionName "0.2.6"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
20 changes: 11 additions & 9 deletions spotlight/src/main/java/com/matadesigns/spotlight/SpotlightView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import android.widget.FrameLayout
import android.widget.TextView
import androidx.annotation.LayoutRes
import androidx.core.graphics.toRect
import androidx.core.view.marginBottom
import androidx.core.view.marginEnd
import androidx.core.view.marginStart
import androidx.core.view.marginTop
import androidx.fragment.app.Fragment
import com.matadesigns.spotlight.abstraction.*
import com.matadesigns.spotlight.config.SpotlightDismissType
Expand Down Expand Up @@ -239,11 +243,13 @@ open class SpotlightView @JvmOverloads constructor(
_targetRect.set(boundingRect)
} else {
val point = SpotlightMath.pointOnScreen(targetView)
val left = point.x
val top = point.y
_targetRect.set(
point.x,
point.y,
point.x + targetView.width,
point.y + targetView.height
left,
top,
left + targetView.width,
top + targetView.height
)
}
postInvalidate()
Expand Down Expand Up @@ -286,11 +292,7 @@ open class SpotlightView @JvmOverloads constructor(
if (dismissType == SpotlightDismissType.targetView &&
targetView is SpotlightTarget && targetView.handlesSpotlightTouchEvent
) {
val result = targetView.onSpotlightTouchEvent(event)
if (result) {
performClick()
}
return result
return targetView.onSpotlightTouchEvent(event)
}
if (event.action == ACTION_DOWN) {
when (dismissType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ open class SimpleIndicatorView @JvmOverloads constructor(
_innerDotPaint.isAntiAlias = true
}

// override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
// super.onSizeChanged(w, h, oldw, oldh)
//
// }
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
val start = getLineStart()
_start.set(start)
_end.set(start)
}

override fun startAnimation() {
val start = getLineStart()
Expand Down

0 comments on commit d9f94f1

Please sign in to comment.