Hello all,
I have a little bit of a puzzle and am wondering what the best approach would be.
I've used a ScrollView component and populated it with a series of customized items. I'd like the ability to swipe any given item off the screen to delete it.
Ive implemented the Touch event on each item to animate the movement of each item in sync with my finger from left to right as I am swiping. The problem is, if I accidently move a little up or down during the swipe, crossing into the boundary of the item in the list above or below, the Touch event with an action of 'UP' is called, and the swipe is completed in splte of the fact my finger is still on the screen.
I can get round this relatively easily by putting a large panel over the entire area and calculating the desired effects manually. The kicker is that by taking that approach, I lose the ScrollView's scrolling effect. That is, I have to emulate the scrolling up and down by myself which has proven very error prone when dealing with larger lists and attempting to replicate the inertial scroll effect.
Another approach would be to disable the ScrollViews scrolling during a swipe from left to right, and continue to animate the swiping if I enter into another view's area, effectively ignoring the intermediate 'Up' action. The problem is then, how do i know when user's finger has truly left the screen to finish the swipe animation?? Is there a method I can call to determine if a user has their finger on the screen at any point in time?
I figure by this stage I've already gone too far off track and there must be an easier way.
I have a little bit of a puzzle and am wondering what the best approach would be.
I've used a ScrollView component and populated it with a series of customized items. I'd like the ability to swipe any given item off the screen to delete it.
Ive implemented the Touch event on each item to animate the movement of each item in sync with my finger from left to right as I am swiping. The problem is, if I accidently move a little up or down during the swipe, crossing into the boundary of the item in the list above or below, the Touch event with an action of 'UP' is called, and the swipe is completed in splte of the fact my finger is still on the screen.
I can get round this relatively easily by putting a large panel over the entire area and calculating the desired effects manually. The kicker is that by taking that approach, I lose the ScrollView's scrolling effect. That is, I have to emulate the scrolling up and down by myself which has proven very error prone when dealing with larger lists and attempting to replicate the inertial scroll effect.
Another approach would be to disable the ScrollViews scrolling during a swipe from left to right, and continue to animate the swiping if I enter into another view's area, effectively ignoring the intermediate 'Up' action. The problem is then, how do i know when user's finger has truly left the screen to finish the swipe animation?? Is there a method I can call to determine if a user has their finger on the screen at any point in time?
I figure by this stage I've already gone too far off track and there must be an easier way.