fixing some haptic feedback
This commit is contained in:
parent
3c85d89dad
commit
21a1367fc2
|
@ -271,12 +271,17 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||
mIgnoreMoveEvents = true
|
||||
val clickedGridItem = home_screen_grid.isClickingGridItem(x.toInt(), y.toInt())
|
||||
if (clickedGridItem != null) {
|
||||
if (clickedGridItem.type == ITEM_TYPE_ICON) {
|
||||
main_holder.performHapticFeedback()
|
||||
}
|
||||
|
||||
val yOffset = resources.getDimension(R.dimen.long_press_anchor_button_offset_y)
|
||||
val anchorY = home_screen_grid.sideMargins.top + (clickedGridItem.top * home_screen_grid.rowHeight.toFloat()) - yOffset
|
||||
showHomeIconMenu(x, anchorY, clickedGridItem, false)
|
||||
return
|
||||
}
|
||||
|
||||
main_holder.performHapticFeedback()
|
||||
showMainLongPressMenu(x, y)
|
||||
}
|
||||
|
||||
|
|
|
@ -142,6 +142,10 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
|
|||
|
||||
// figure out at which cell was the item dropped, if it is empty
|
||||
fun itemDraggingStopped() {
|
||||
widgetViews.forEach {
|
||||
it.hasLongPressed = false
|
||||
}
|
||||
|
||||
if (draggedItem == null) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import com.simplemobiletools.commons.extensions.performHapticFeedback
|
|||
|
||||
class MyAppWidgetHostView(context: Context) : AppWidgetHostView(context) {
|
||||
private var longPressHandler = Handler()
|
||||
private var hasLongPressed = false
|
||||
private var actionDownCoords = PointF()
|
||||
var hasLongPressed = false
|
||||
var longPressListener: ((x: Float, y: Float) -> Unit)? = null
|
||||
|
||||
override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
|
||||
|
|
Loading…
Reference in New Issue