Example usage for android.view GestureDetector GestureDetector

List of usage examples for android.view GestureDetector GestureDetector

Introduction

In this page you can find the example usage for android.view GestureDetector GestureDetector.

Prototype

@Deprecated
public GestureDetector(OnGestureListener listener) 

Source Link

Document

Creates a GestureDetector with the supplied listener.

Usage

From source file:com.bangqu.eshow.view.sample.ESInnerViewPager.java

/**
 * ?ViewPager./*w  w  w  . j a  va 2s. c om*/
 *
 * @param context the context
 */
public ESInnerViewPager(Context context) {
    super(context);
    mGestureDetector = new GestureDetector(new YScrollDetector());
    setFadingEdgeLength(0);
}

From source file:cn.org.eshow.framwork.view.sample.AbInnerViewPager.java

/**
 * ?ViewPager.//from ww w .  j a  va 2s  .  c o  m
 *
 * @param context the context
 */
public AbInnerViewPager(Context context) {
    super(context);
    mGestureDetector = new GestureDetector(new YScrollDetector());
    setFadingEdgeLength(0);
}

From source file:name.raev.kaloyan.android.snowcams.CameraActivity.java

/** Called when the activity is first created. */
@Override/*w ww . j  a  v a  2s  .c  o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Gesture detection
    final GestureDetector gestureDetector = new GestureDetector(new DoubleTapDetector());
    OnTouchListener gestureListener = new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    };

    // create view
    setContentView(R.layout.camera);
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(new CameraPageAdapter());
    mPager.setPageMargin(8);

    mPager.setOnClickListener(this);
    mPager.setOnTouchListener(gestureListener);

    // find the initial page index - first check if passed with the intent
    int initialPage = getIntent().getIntExtra("index", 0);
    // check if there is a cached state
    Object cachedObject = getLastNonConfigurationInstance();
    if (cachedObject != null) {
        // cache found - scroll to the cached page index
        initialPage = (Integer) cachedObject;
    }

    // scroll to the initial page
    mPager.setCurrentItem(initialPage);
}

From source file:com.bangqu.eshow.view.sample.ESInnerViewPager.java

/**
 * ?ViewPager.//from w  ww .  j  a v  a2s. co m
 *
 * @param context the context
 * @param attrs the attrs
 */
public ESInnerViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
    mGestureDetector = new GestureDetector(new YScrollDetector());
    setFadingEdgeLength(0);
}

From source file:cn.org.eshow.framwork.view.sample.AbInnerViewPager.java

/**
 * ?ViewPager./*from w w w .  j av a 2 s  .  c o m*/
 *
 * @param context the context
 * @param attrs the attrs
 */
public AbInnerViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
    mGestureDetector = new GestureDetector(new YScrollDetector());
    setFadingEdgeLength(0);
}

From source file:net.bible.android.view.activity.footnoteandref.FootnoteAndRefActivity.java

/** Called when the activity is first created. */
@Override//from   ww w. j  av a  2s .co  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(TAG, "Displaying notes");
    setContentView(R.layout.notes);

    mWarning = (TextView) findViewById(R.id.warningText);

    mChapterNotesList = footnoteAndRefControl.getCurrentPageFootnotesAndReferences();
    //TODO: remove this redundant stuff - DataPipe.getInstance().popNotes();

    initialiseView();

    // create gesture related objects
    gestureDetector = new GestureDetector(new SwipeGestureListener(this));
}

From source file:com.bellman.bible.android.view.activity.footnoteandref.FootnoteAndRefActivity.java

/**
 * Called when the activity is first created.
 *//*  w w  w  .ja v  a 2 s  .c o m*/
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(TAG, "Displaying notes");
    setContentView(R.layout.notes);

    //fetch verse from intent if set - so that goto via History works nicely
    currentVerseRange = intentHelper.getIntentVerseRangeOrDefault(getIntent());

    mWarning = (TextView) findViewById(R.id.warningText);

    mChapterNotesList = footnoteAndRefControl.getCurrentPageFootnotesAndReferences();

    initialiseView();

    // create gesture related objects
    gestureDetector = new GestureDetector(new SwipeGestureListener(this));
}

From source file:com.tnc.android.graphite.activities.GraphActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    model = new DrawableGraph();
    controller = new GraphController(model);
    controller.addOutboxHandler(new Handler(this));
    controller.handleMessage(GraphController.MESSAGE_VIEW_READY, this.getIntent().getExtras());

    fragment.setOnUpdatedListener(new EditGraphsFragment.OnUpdatedListener() {
        @Override/* w w w  .  ja  v a  2s. c  o m*/
        public void onUpdated() {
            controller.handleMessage(GraphController.MESSAGE_FINISHED_EDITING);
        }
    });

    SwipeGestureListener sgl = new SwipeGestureListener() {
        @Override
        public boolean onDown(MotionEvent e) {
            return true;
        }

        @Override
        public void onRightSwipe() {
            me.finish();
        }
    };
    gestureDetector = new GestureDetector(sgl);

    imageView.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            if (gestureDetector.onTouchEvent(event)) {
                return true;
            }
            return false;
        }
    });
}

From source file:org.immopoly.android.widget.ImmoscoutPlacesOverlay.java

public ImmoscoutPlacesOverlay(Fragment fragment, MapView mapView, LayoutInflater inflator,
        boolean isPortfolio) {
    super(boundCenter(fragment.getResources().getDrawable(R.drawable.map_marker_icon)));
    mMapView = mapView;//ww w  .  jav a  2 s . c o  m
    this.isPortfolio = isPortfolio;
    mMapFragment = fragment;
    Resources resources = fragment.getResources();
    mapMarkerIcon = boundCenter(resources.getDrawable(R.drawable.map_marker_icon));
    mapMarkerIcon_new = boundCenter(resources.getDrawable(R.drawable.map_marker_icon_new));
    mapMarkerIcon_old = boundCenter(resources.getDrawable(R.drawable.map_marker_icon_old));
    mapMarkerIcon_owned = boundCenter(resources.getDrawable(R.drawable.map_marker_property_icon));
    mapMarkerIcon_cluster = boundCenter(resources.getDrawable(R.drawable.map_marker_icon_cluster));

    markerBounds = mapMarkerIcon.getBounds();

    MIN_INTERSECTION_AREA = (int) (markerBounds.width() * markerBounds.height() * MIN_INTERSECTION_AMOUNT);

    ClusterMarker.init(resources.getDisplayMetrics(), mapMarkerIcon.getIntrinsicHeight());
    gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
        public boolean onDoubleTap(MotionEvent e) {
            if (System.currentTimeMillis() - itemTapTime > 500) // hack to prevent zoom for double tap on item
                mMapView.getController().zoomInFixing((int) e.getX(), (int) e.getY());
            return super.onDoubleTap(e);
        }
    });
}

From source file:com.library.core.view.HorizontalListView.java

public HorizontalListView(Context context, AttributeSet attrs) {
    super(context, attrs);
    initView();/*  w w  w  . j a v  a  2  s  .  com*/
    mContext = context;
    mGestureDetector = new GestureDetector(new YScrollDetector());
    setFadingEdgeLength(0);
}