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