Android Open Source - Planets-App Wrap Motion Event






From Project

Back to project page Planets-App.

License

The source code is released under:

Apache License

If you think the Android project Planets-App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.andrewq.planets;
/*from  w ww.java  2  s .c o  m*/
/**
 * Created by Andrew Quebe on 4/13/14.
 */

import android.view.MotionEvent;

public class WrapMotionEvent {
    protected MotionEvent event;

    protected WrapMotionEvent(MotionEvent event) {
        this.event = event;
    }

    static public WrapMotionEvent wrap(MotionEvent event) {
        try {
            return new EclairMotionEvent(event);
        } catch (VerifyError e) {
            return new WrapMotionEvent(event);
        }
    }

    public int getAction() {
        return event.getAction();
    }

    public float getX() {
        return event.getX();
    }

    public float getX(int pointerIndex) {
        verifyPointerIndex(pointerIndex);
        return getX();
    }

    public float getY() {
        return event.getY();
    }

    public float getY(int pointerIndex) {
        verifyPointerIndex(pointerIndex);
        return getY();
    }

    public int getPointerCount() {
        return 1;
    }

    public int getPointerId(int pointerIndex) {
        verifyPointerIndex(pointerIndex);
        return 0;
    }

    private void verifyPointerIndex(int pointerIndex) {
        if (pointerIndex > 0) {
            throw new IllegalArgumentException(
                    "Invalid pointer index for Donut/Cupcake");
        }
    }

}




Java Source Code List

com.andrewq.planets.CustomAdapter.java
com.andrewq.planets.Deimos.java
com.andrewq.planets.EclairMotionEvent.java
com.andrewq.planets.FragmentA.java
com.andrewq.planets.FragmentB.java
com.andrewq.planets.FragmentC.java
com.andrewq.planets.FragmentD.java
com.andrewq.planets.FragmentE.java
com.andrewq.planets.FragmentF.java
com.andrewq.planets.FragmentG.java
com.andrewq.planets.FragmentH.java
com.andrewq.planets.FragmentHome.java
com.andrewq.planets.FragmentI.java
com.andrewq.planets.FragmentPlanets.java
com.andrewq.planets.ImageGallery.java
com.andrewq.planets.Phobos.java
com.andrewq.planets.RandomQuotes.java
com.andrewq.planets.RowItem.java
com.andrewq.planets.SatelliteEarth.java
com.andrewq.planets.Settings.java
com.andrewq.planets.SunGLActivity.java
com.andrewq.planets.SunRenderer.java
com.andrewq.planets.TouchImageView.java
com.andrewq.planets.VenusRenderer.java
com.andrewq.planets.WrapMotionEvent.java
com.obsidian.planets.Main.java