Image zooming/panning inside of a Gallery

by Eric F » Wed, 02 Jun 2010 01:54:54 GMT


Sponsored Links
 I'm trying to combine the capability of doing image zoom/panning
inside of a Gallery view. The problem is controlling which touch
events are processed by each. In a horizontal drag on the image, the
ImageView needs to process the drag in order to pan, up until the edge
of the image is reached then the gallery view needs to process the
touch event so that it can swipe over to the next photo.

It seems that if I return false from the imageview's ontouchevent,
then I won't be notified of the panning-drag move events.

What I tried to do was return true from the imageview's ontouchevent
until the edge of the image was hit then return false. However I
believe that this doesn't cause the Gallery to begin processing these
events, as it missed the initial touchdown event.

My next thought is to somehow turn the containing activity into the
touch handler, and somehow stop the Gallery and ImageView from getting
touch events normally, and have the activity forward the touch event's
manually. Not sure if this is possible or if there is an example.

My last resort will be to simply not use the android.widget.Gallery,
which I want to avoid because I want the widget to "feel" the same as
other places on the phone, and I like code re-use. Unfortunately I
might have to do this, as I see all other apps that have this zoom/pan
capability don't seem to use the Gallery widget (Gallery3D etc).

My question is, what's the best way to design for this situation where
motionevents need to split between two views? Any ideas would be
greatly appreciated thank you.

--



Other Threads

1. Email File using content provider

I'm trying to email out a file using intents and content providers.
I've hit a road block with the below code.  It crashes gmail.  I think
it may have something to do the attachment having a size of 0
according to the gmail app.

Yea I now I can save it to the sd card, but I'd like to do it without
leaving files around the external drive.

@Override
   public ParcelFileDescriptor openFile(Uri uri, String mode) throws
FileNotFoundException {

         //get string
        String text = new String("test");

        //save to disk
        ParcelFileDescriptor fd = openFile(Uri.parse ("file://test.csv"),
"r");
        FileOutputStream fos = new FileOutputStream(fd.getFileDescriptor
());
        OutputStreamWriter out = null;


        try {
                out = new OutputStreamWriter(fos, "UTF-8");
        } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
        }


        try {
                //outputs start,stop,duration,apart
                out.write(text);
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }


                try {
                        out.flush();
                        out.close();

                        fos.flush();
                        fos.close();

                        fd.close();
                } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                }


           File file = new File("test.csv");
       ParcelFileDescriptor parcel = ParcelFileDescriptor.open(file,
ParcelFileDescriptor.MODE_READ_ONLY);
       return parcel;
   }

The code runs fine, except for gmail crashing on sync.  It was a good
lesson, just clear your cache to get it working again!  :-)

Thanks for any help!

--~--~---------~--~----~------------~-------~--~----~

2. Need to implement Android for my website powered in PHP

Well before anyone can tell you what/how to do it, you need to find out what
you need. Once you find that out, let us know.

On Thu, Aug 20, 2009 at 6:16 AM, andyandroi...@gmail.com <







-- 
Donn
http://blog.donnfelker.com/

--~--~---------~--~----~------------~-------~--~----~

3. Contacts.ContactMethods.POSTAL_LOCATION_LATITUDE returns email address instead of physical address

4. Lossless rotation of a jpeg image in Android (without fully decoding the image). How to?

5. Book or Tutorial on XML-based Layouts?

6. How do I split up or separate large XML layout files

7. disable HOME key and right soft key