GestureDetector setIsLongpressEnabled - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GestureDetector setIsLongpressEnabled method.

This code example shows how to use the following methods:setIsLongpressEnabled
		super(context);
		init(); 
	} 
 
	private void init() { 
		gestureDetector = new GestureDetector(this);
		gestureDetector.setIsLongpressEnabled(true);
	} 
 
	public void setSwipeListener(ISwipeListener swipeListener) {
		this.swipeListener = swipeListener;
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
 
		if (!swipeEnabled)
			return super.onTouchEvent(event);
 
		// l("onTouch", event, false); 
6
CodeRank
This code example shows how to use the following methods:setIsLongpressEnabled
     * Constructor 
     * @param context the current context 
     * @param listener the scrolling listener 
     */ 
    public WheelScroller(Context context, ScrollingListener listener) {
        gestureDetector = new GestureDetector(context, gestureListener);
        gestureDetector.setIsLongpressEnabled(false);
         
        scroller = new Scroller(context);
 
        this.listener = listener;
        this.context = context;
    } 
     
    /** 
     * Set the the specified scrolling interpolator 
     * @param interpolator the interpolator 
     */ 
    public void setInterpolator(Interpolator interpolator) {
        scroller.forceFinished(true);
6
CodeRank
This code example shows how to use the following methods:setIsLongpressEnabled, setOnDoubleTapListener
  
  public PushPinMapView(Context aContext, AttributeSet attrs) {
    super(aContext, attrs);
    context = aContext;
  
    gestureDetector = new GestureDetector((OnGestureListener) context);
    gestureDetector.setOnDoubleTapListener((OnDoubleTapListener) context);
    gestureDetector.setIsLongpressEnabled(true);
  } 
  
  // Override the onTouchEvent() method to intercept events and pass them 
  // to the GestureDetector. If the GestureDetector doesn't handle the event, 
  // propagate it up to the MapView. 
  public boolean onTouchEvent(MotionEvent ev) {
    if(this.gestureDetector.onTouchEvent(ev))
       return true; 
    else 
      return super.onTouchEvent(ev);
  } 
} 
6
CodeRank
This code example shows how to use the following methods:setIsLongpressEnabled
    init(context);
  } 
 
  private void init(final Context context) {
    super.setFactory(this);
    gestureDetector = new GestureDetector(context, this);
    gestureDetector.setIsLongpressEnabled(true);
  } 
 
  @Override 
  public void setFactory(final ViewFactory factory) { }
 
  public void setNavigationListener(final OnNavigationListener l) { this.nListener = l; }
 
  /** 
   * @param progressBar the progressBar to set 
   */ 
  public void setProgressBar(final ProgressBar progressBar) { this.progressBar = progressBar; }
 
  /** 
5
CodeRank
This code example shows how to use the following methods:setIsLongpressEnabled
     * Constructor 
     * @param context the current context 
     * @param listener the scrolling listener 
     */ 
    public WheelScroller(Context context, ScrollingListener listener) {
        gestureDetector = new GestureDetector(context, new SimpleOnGestureListener() {
            public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
                // Do scrolling in onTouchEvent() since onScroll() are not call immediately 
                //  when user touch and move the spinnerwheel 
                return true; 
            } 
 
            public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
                lastScrollPosition = 0;
                scrollerFling(lastScrollPosition, (int) velocityX, (int) velocityY);
                setNextMessage(MESSAGE_SCROLL);
                return true; 
            } 
 
            // public boolean onDown(MotionEvent motionEvent); 

5
CodeRank
This code example shows how to use the following methods:setIsLongpressEnabled
    init(context);
  } 
 
  private void init(final Context context) {
    super.setFactory(this);
    gestureDetector = new GestureDetector(context, this);
    gestureDetector.setIsLongpressEnabled(true);
  } 
 
  @Override 
  public void setFactory(final ViewFactory factory) { }
 
  public void setNavigationListener(final OnNavigationListener l) { this.nListener = l; }
 
  /** 
   * @param progressBar the progressBar to set 
   */ 
  public void setProgressBar(final ProgressBar progressBar) { this.progressBar = progressBar; }
 
  /** 
5
CodeRank
This code example shows how to use the following methods:setIsLongpressEnabled
     * Constructor 
     * @param context the current context 
     * @param listener the scrolling listener 
     */ 
    public WheelScroller(Context context, ScrollingListener listener) {
        gestureDetector = new GestureDetector(context, gestureListener);
        gestureDetector.setIsLongpressEnabled(false);
         
        scroller = new Scroller(context);
 
        this.listener = listener;
        this.context = context;
    } 
     
    /** 
     * Set the the specified scrolling interpolator 
     * @param interpolator the interpolator 
     */ 
    public void setInterpolator(Interpolator interpolator) {
        scroller.forceFinished(true);
5
CodeRank
This code example shows how to use the following methods:setIsLongpressEnabled, setOnDoubleTapListener
This code example shows how to use the following methods:setIsLongpressEnabled
     * Constructor 
     * @param context the current context 
     * @param listener the scrolling listener 
     */ 
    public WheelScroller(Context context, ScrollingListener listener) {
        gestureDetector = new GestureDetector(context, gestureListener);
        gestureDetector.setIsLongpressEnabled(false);
         
        scroller = new Scroller(context);
 
        this.listener = listener;
        this.context = context;
    } 
     
    /** 
     * Set the the specified scrolling interpolator 
     * @param interpolator the interpolator 
     */ 
    public void setInterpolator(Interpolator interpolator) {
        scroller.forceFinished(true);
4
CodeRank
This code example shows how to use the following methods:setIsLongpressEnabled
     * Constructor 
     * @param context the current context 
     * @param listener the scrolling listener 
     */ 
    public WheelScroller(Context context, ScrollingListener listener) {
        gestureDetector = new GestureDetector(context, gestureListener);
        gestureDetector.setIsLongpressEnabled(false);
         
        scroller = new Scroller(context);
 
        this.listener = listener;
        this.context = context;
    } 
     
    /** 
     * Set the the specified scrolling interpolator 
     * @param interpolator the interpolator 
     */ 
    public void setInterpolator(Interpolator interpolator) {
        scroller.forceFinished(true);
4
CodeRank

Related GestureDetector setIsLongpressEnabled Questions & Answers:

setIsLongpressEnabled Method Overview
Set whether longpress is enabled, if this is enabled when a user presses and holds down you get a longpress event and nothing further.
See Code Examples for other Android GestureDetector Methods: