Android Open Source - appboy-android-sdk Touch Aware Swipe Dismiss Touch Listener

From Project

Back to project page appboy-android-sdk.


The source code is released under:

Copyright (c) 2014 Appboy, Inc. All rights reserved. * Use of source code or binaries contained within Appboy's Android SDK is permitted only to enable use of the Appboy platform by customers of Appb...

If you think the Android project appboy-android-sdk 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.appboy.ui.slideups;
//ww  w .j  a va2s .co m
import android.view.MotionEvent;
import android.view.View;

 * Adds touch events to the SwipeDismissTouchListener.
 * Note: The SwipeDismissTouchListener requires API level 12 or later due to use of {@link
 * android.view.ViewPropertyAnimator}.</p>
public class TouchAwareSwipeDismissTouchListener extends SwipeDismissTouchListener {
  private ITouchListener mTouchListener;

  interface ITouchListener {
    void onTouchStartedOrContinued();
    void onTouchEnded();

  public TouchAwareSwipeDismissTouchListener(View view, Object token, DismissCallbacks callbacks) {
    super(view, token, callbacks);

  public void setTouchListener(ITouchListener touchListener) {
    mTouchListener = touchListener;

  public boolean onTouch(View view, MotionEvent motionEvent) {
    switch (motionEvent.getAction()) {
      case MotionEvent.ACTION_DOWN:
        if (mTouchListener != null) {
      case MotionEvent.ACTION_UP:
      case MotionEvent.ACTION_CANCEL:
        if (mTouchListener != null) {
    return super.onTouch(view, motionEvent);

Java Source Code List