Hi,

Sorry that I missed the continuation of this thread, and only noticed it now
as I got a Google Alert for our app name.

@Dianne, that's not quite true (that all MT data is lost). The coordinates
of the additional points are removed from the event data, but the size and
pressure values change predictably as additional fingers are added.

We have been swamped with work on our products and have not published the
solution. But, in a nut shell, our solution is a "simulated" multi-touch
that lets you zoom easily using either pinch/stretch or "paw" gestures. If
you're curious how well it works, download PhoneMyPC or Imagine Multi-touch
and give it a try.

Here's how it works:

* When an additional finger touches the screen, the size and pressure
([MotionEvent].getSize() and [MotionEvent].getPressure()) change in fairly
predictable ways.
* When that change is detected, track the one point (x,y) that you get to
determine whether it's moving towards, or away from the center of screen.
* If it's moving towards, zoom in. If it's moving away, zoom out.

Some things to consider are:

1) HTC devices work best when both pressure and size are used
2) On Samsung devices, size is always zero, but pressure changes predictably
3) The Motorola Cliq is the only phone we've found on which this will not
work. Both size and pressure are constant.

Both values can be a bit neurotic and require some denouncing, but if you
try the software, you'll see this method works well enough to give a good
user experience.

And, in the interest of time, here are some more details copied from an
email I recently sent someone who asked about this:


First, we no longer override onTouchEvent because it's simpler to provide
support for all API versions using view.setOnTouchListener(...). We use one
OnTouchListener implementer for pre-2.0 devices, and a different one for
2.0+ devices. Determine this with (Integer.parseInt(
android.os.Build.VERSION.SDK )). This value is >4 for 2.0+ devices.

Next, in our implementation for < 2.0 devices, we grab three important
values:

    float size = event.getSize();
    float pressure = event.getPressure();
    float total = size * pressure;

We use the total to help us detect the device type.

In our code for handling events when the action is MotionEvent.ACTION_MOVE,
we're always watching to see if the values indicate we should switch to zoom
mode (an extra finger down). Note, we never worry about this when action is
ACTION_DOWN, because you just can't get two fingers on the screen at the
same time, and even if you could, we'd pick it up int he fist ACTION_MOVE.
We check as follows:

    if( (total > .1f) || (size == 0f && pressure < .15f ) ) { ...

The first subexpression indicates a non-Samsung device, and that a second
finger is down. The second subexpression is for Samsung, where size is
always 0, and pressure will drop below .15 when a second finger goes down.

Note, there is something wrong with this approach because we've now got two
reports (out of many thousand users) that they are unable to pan. One is
using a G1 (this MUST be a strange device calibration issue, because I
personally have ran this code on MANY G1's); one is a Cliq. Ironically now
that we've added support for Samsung, they are the only users with zero
reports of issues (and of course Droid and Nexus One users don't count
because they are using different code that supports true multi-touch).


Warm regards,
Scott
SoftwareForMe.com

On Thu, Jan 7, 2010 at 10:49 AM, theSmith <chris.smith...@gmail.com> wrote:

> Scott,
>
> Please publish your code, I would love to take a look at it :-)
>
> -theSmith
>
> On Jan 7, 12:48 pm, Dan Sherman <impact...@gmail.com> wrote:
> > I'd love to see this as well :)
> >
> > On Thu, Jan 7, 2010 at 9:30 AM, Dianne Hackborn <hack...@android.com>
> wrote:
> > > Well I would really like to see this, given that prior to 2.0 there was
> no
> > > multitouch information propagated through the framework at all, and
> > > applications do not have permission to open the raw driver.
> >
> > > On Thu, Nov 12, 2009 at 11:03 PM, SoftwareForMe.com SoftwareForMe.com <
> > > softwareforme....@gmail.com> wrote:
> >
> > >> Our solution is software only, works on production phones (i.e., no
> > >> rooting or modding required).
> >
> > >> Scott
> > >> SoftwareForMe.com
> > >> Makers of PhoneMyPC
> >
> > >>  On Thu, Nov 12, 2009 at 11:02 PM, Nathan <nathan.d.mel...@gmail.com
> >wrote:
> >
> > >>> I'm curious about this. Does multi-touch require hardware changes? Or
> > >>> am I reading this right that it can all be done through software?
> >
> > >>> Nathan
> >
> > >>> --
> > >>> You received this message because you are subscribed to the Google
> > >>> Groups "Android Developers" group.
> > >>> To post to this group, send email to
> android-developers@googlegroups.com
> > >>> To unsubscribe from this group, send email to
> > >>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
> >
> > >>> For more options, visit this group at
> > >>>http://groups.google.com/group/android-developers?hl=en
> >
> > >> --
> > >> Warm regards,
> > >> The PhoneMyPC Team
> >
> > >> --
> > >> You received this message because you are subscribed to the Google
> > >> Groups "Android Developers" group.
> > >> To post to this group, send email to
> android-developers@googlegroups.com
> > >> To unsubscribe from this group, send email to
> > >> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
> >
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > hack...@android.com
> >
> > > Note: please don't send private questions to me, as I don't have time
> to
> > > provide private support, and so won't reply to such e-mails.  All such
> > > questions should be posted on public forums, where I and others can see
> and
> > > answer them.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to