List View Item Swipe Left and Swipe Right

List view item swipe left and swipe right?

Try this:

navigaList.setOnTouchListener(swipeDetector);
navigaList.setOnItemClickListener(listener);

OnItemClickListener listener = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
if(swipeDetector.swipeDetected()) {
if(swipeDetector.getAction() == Action.RL) {

} else {

}
}
};

SwipeDetector.java

public class SwipeDetector implements View.OnTouchListener {

public static enum Action {
LR, // Left to Right
RL, // Right to Left
TB, // Top to bottom
BT, // Bottom to Top
None // when no action was detected
}

private static final String logTag = "SwipeDetector";
private static final int MIN_DISTANCE = 100;
private float downX, downY, upX, upY;
private Action mSwipeDetected = Action.None;

public boolean swipeDetected() {
return mSwipeDetected != Action.None;
}

public Action getAction() {
return mSwipeDetected;
}

public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
downX = event.getX();
downY = event.getY();
mSwipeDetected = Action.None;
return false; // allow other events like Click to be processed
}
case MotionEvent.ACTION_MOVE: {
upX = event.getX();
upY = event.getY();

float deltaX = downX - upX;
float deltaY = downY - upY;

// horizontal swipe detection
if (Math.abs(deltaX) > MIN_DISTANCE) {
// left or right
if (deltaX < 0) {
Logger.show(Log.INFO,logTag, "Swipe Left to Right");
mSwipeDetected = Action.LR;
return true;
}
if (deltaX > 0) {
Logger.show(Log.INFO,logTag, "Swipe Right to Left");
mSwipeDetected = Action.RL;
return true;
}
} else

// vertical swipe detection
if (Math.abs(deltaY) > MIN_DISTANCE) {
// top or down
if (deltaY < 0) {
Logger.show(Log.INFO,logTag, "Swipe Top to Bottom");
mSwipeDetected = Action.TB;
return false;
}
if (deltaY > 0) {
Logger.show(Log.INFO,logTag, "Swipe Bottom to Top");
mSwipeDetected = Action.BT;
return false;
}
}
return true;
}
}
return false;
}
}

Android ListView Swipe Right and Left to Accept and Reject

Solution number 1 :

You Have to do like following to reach "near" to your functionality,

Wrap the adapter of your ListView

Like following :

  protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Create an Adapter for your content
String[] content = new String[20];
for (int i=0;i<20;i++) content[i] = "Row "+(i+1);
ArrayAdapter<String> stringAdapter = new ArrayAdapter<String>(
this,
R.layout.row_bg,
R.id.text,
new ArrayList<String>(Arrays.asList(content))
);

// Wrap your content in a SwipeActionAdapter
mAdapter = new SwipeActionAdapter(stringAdapter);

// Pass a reference of your ListView to the SwipeActionAdapter
mAdapter.setListView(getListView());

// Set the SwipeActionAdapter as the Adapter for your ListView
setListAdapter(mAdapter);
}

Create a background layout for each swipe direction

Like Following:

  protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Create an Adapter for your content
String[] content = new String[20];
for (int i=0;i<20;i++) content[i] = "Row "+(i+1);
ArrayAdapter<String> stringAdapter = new ArrayAdapter<String>(
this,
R.layout.row_bg,
R.id.text,
new ArrayList<String>(Arrays.asList(content))
);

// Wrap your content in a SwipeActionAdapter
mAdapter = new SwipeActionAdapter(stringAdapter);

// Pass a reference of your ListView to the SwipeActionAdapter
mAdapter.setListView(getListView());

// Set the SwipeActionAdapter as the Adapter for your ListView
setListAdapter(mAdapter);

// Set backgrounds for the swipe directions
mAdapter.addBackground(SwipeDirections.DIRECTION_FAR_LEFT,R.layout.row_bg_left_far)
.addBackground(SwipeDirections.DIRECTION_NORMAL_LEFT,R.layout.row_bg_left)
.addBackground(SwipeDirections.DIRECTION_FAR_RIGHT,R.layout.row_bg_right_far)
.addBackground(SwipeDirections.DIRECTION_NORMAL_RIGHT,R.layout.row_bg_right);
}

You got both libraries and Example from the here :
https://github.com/wdullaer/SwipeActionAdapter

This will not exact like you want, but i hope this will help you so much to fulfilled your functionality.

Solution number 2 :

Solution 2 is about Changing some code in your Used code : http://www.tutecentral.com/android-swipe-listview/

i had try your code from the link http://www.tutecentral.com/android-swipe-listview/ and changing some code and successfully solve your problem(your confusion) about onOpened(..) method ( called left to right and vice versa )

First change :

  1. custom_row.xml layout file has three button swipe_button1 to 3 ,
    remove middle of them.

  2. Copy paste following code for remain two button :

    <Button
    android:id="@+id/swipe_button1"
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/your_accept_image" />

    <Button
    android:id="@+id/swipe_button3"
    style="@style/MyListButtonAction"
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/your_reject_image" />

Remains code same for this layout.

Second change :

So now your accept and reject and list code is ready , now discuss about onOpened(..) method.

Confusion solution 1- You told , your onOpend(...) method called same both left to right and vice-verse

-> just to change following :

public void onOpened(int position, boolean toRight) {

if(toRight)
{

// for left to right your api calling here
swipelistview.closeAnimate(position);
}
else
{
// for right to left your api calling here
swipelistview.closeAnimate(position);
}

}

Confusion solution 2 when i take finger up it will must display entire listview or listview sides should retain it corners so its not working

-> i already answered it in above

called swipelistview.closeAnimate(position); in both if else, it hide left accept and right reject image when your your swipe left and right over.

So final code is following :

Entire cutom_row.xml layout

 <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<RelativeLayout
android:id="@+id/back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="back" >

<Button
android:id="@+id/swipe_button1"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@drawable/accept_image" />

<Button
android:id="@+id/swipe_button3"
style="@style/MyListButtonAction"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/reject_image" />
</RelativeLayout>

<RelativeLayout
android:id="@+id/front"
style="@style/MyListFrontContent"
android:orientation="vertical"
android:tag="front" >

<ImageView
android:id="@+id/example_image"
style="@style/MyListImage" />

<TextView
android:id="@+id/example_itemname"
style="@style/MyListTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/example_image" />
</RelativeLayout>

</FrameLayout>

Entire MainActivity.java

public class MainActivity extends Activity {

SwipeListView swipelistview;
ItemAdapter adapter;
List<ItemRow> itemData;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

swipelistview=(SwipeListView)findViewById(R.id.example_swipe_lv_list);
itemData=new ArrayList<ItemRow>();
adapter=new ItemAdapter(this,R.layout.custom_row,itemData);

swipelistview.setSwipeListViewListener(new BaseSwipeListViewListener() {
@Override
public void onOpened(int position, boolean toRight) {

if(toRight)
{

// for left to right your api calling here
swipelistview.closeAnimate(position);
}
else
{
// for right to left your api calling here
swipelistview.closeAnimate(position);
}

}

@Override
public void onClosed(int position, boolean fromRight) {
// close list slide
}

@Override
public void onListChanged() {

}

@Override
public void onMove(int position, float x) {

}

@Override
public void onStartOpen(int position, int action, boolean right) {
Log.d("swipe", String.format("onStartOpen %d - action %d", position, action));

}

@Override
public void onStartClose(int position, boolean right) {
Log.d("swipe", String.format("onStartClose %d", position));

}

@Override
public void onClickFrontView(int position) {
Log.d("swipe", String.format("onClickFrontView %d", position));

}

@Override
public void onClickBackView(int position) {
Log.d("swipe", String.format("onClickBackView %d", position));

swipelistview.closeAnimate(position);//when you touch back view it will close

}

@Override
public void onDismiss(int[] reverseSortedPositions) {

}

});

//These are the swipe listview settings. you can change these
//setting as your requirement
swipelistview.setSwipeMode(SwipeListView.SWIPE_MODE_BOTH); // there are five swiping modes
// swipelistview.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_DISMISS); //there are four swipe actions
swipelistview.setSwipeActionRight(SwipeListView.SWIPE_ACTION_REVEAL);
swipelistview.setOffsetLeft(convertDpToPixel(0f)); // left side offset
swipelistview.setOffsetRight(convertDpToPixel(80f)); // right side offset
swipelistview.setAnimationTime(500); // Animation time
swipelistview.setSwipeOpenOnLongPress(true); // enable or disable SwipeOpenOnLongPress

swipelistview.setAdapter(adapter);

for(int i=0;i<10;i++)
{
itemData.add(new ItemRow("Swipe Item"+ i,getResources().getDrawable(R.drawable.ic_launcher) ));

}

adapter.notifyDataSetChanged();
}

public int convertDpToPixel(float dp) {
DisplayMetrics metrics = getResources().getDisplayMetrics();
float px = dp * (metrics.densityDpi / 160f);
return (int) px;
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}

Other code and library remains same, It helpful to you and other also, So enjoy.

Implement Swipe in ListView

try this code :

main.xml file


<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>


raw.xml


<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:gravity="left"
android:text="ABC"
android:textSize="22sp" />

<LinearLayout
android:id="@+id/delete_lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55ff0000"
android:visibility="gone" >

<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:src="@drawable/ic_menu_delete"
android:visibility="visible" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:gravity="left"
android:text="Deleting..."
android:textColor="#ff0000"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>


MainActivity.java

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import de.timroes.swipetodismiss.SwipeDismissList;
import de.timroes.swipetodismiss.SwipeDismissList.SwipeDirection;
import de.timroes.swipetodismiss.SwipeDismissList.UndoMode;
import de.timroes.swipetodismiss.SwipeDismissList.Undoable;

public class MainActivity extends Activity {

ArrayList<String> listData;
ListView listView;
ArrayAdapter<String> adapter;
SwipeListAdapter listAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

listView = (ListView) findViewById(R.id.listView1);

listData = new ArrayList<String>();
listData.add("item 1");
listData.add("item 2");
listData.add("item 3");
listData.add("item 4");
listData.add("item 5");
listData.add("item 6");
listData.add("item 7");
listData.add("item 8");
listData.add("item 9");
listData.add("item 10");
listData.add("item 11");
listData.add("item 12");
listData.add("item 13");
listData.add("item 14");
listData.add("item 15");
listData.add("item 16");
listData.add("item 17");

listAdapter = new SwipeListAdapter(MainActivity.this);
listView.setAdapter(listAdapter);

listAdapter.notifyDataSetChanged();
SwipeDismissList.OnDismissCallback callback = new SwipeDismissList.OnDismissCallback() {
@Override
public Undoable onDismiss(AbsListView listView, int position) {
View view = (View) listView.getChildAt(0);

view.animate().alpha(1).setDuration(200).translationX(10);
listAdapter.remove(position);
return null;
}
};

UndoMode mode = SwipeDismissList.UndoMode.SINGLE_UNDO;

SwipeDismissList swipeList = new SwipeDismissList(listView, callback,
mode);
swipeList.setSwipeDirection(SwipeDirection.END);

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

class SwipeListAdapter extends BaseAdapter {

Context mContext;

public SwipeListAdapter(Context context) {
this.mContext = context;
}

@Override
public int getCount() {
return listData.size();
}

@Override
public Object getItem(int position) {
return listData.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

private void remove(int pos) {
listData.remove(pos);
notifyDataSetChanged();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
try {
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(
R.layout.raw, null);
}
TextView textView = (TextView) convertView
.findViewById(R.id.name);
textView.setText(listData.get(position));

RelativeLayout layout = (RelativeLayout) convertView
.findViewById(R.id.parentLayout);

LayoutParams params = new LayoutParams(
LayoutParams.MATCH_PARENT, 50);
layout.setLayoutParams(params);

} catch (Exception e) {
e.printStackTrace();
}
return convertView;
}

}

}

SwipeDismissList.java

import static com.nineoldandroids.view.ViewHelper.setAlpha;
import static com.nineoldandroids.view.ViewHelper.setTranslationX;
import static com.nineoldandroids.view.ViewPropertyAnimator.animate;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;

import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.AnimatorListenerAdapter;
import com.nineoldandroids.animation.ValueAnimator;

public final class SwipeDismissList implements View.OnTouchListener {

// Cached ViewConfiguration and system-wide constant values
private int mSlop;
private int mMinFlingVelocity;
private int mMaxFlingVelocity;
private long mAnimationTime;

// Fixed properties
private AbsListView mListView;
private OnDismissCallback mCallback;
private int mViewWidth = 1; // 1 and not 0 to prevent dividing by zero

// Transient properties
private SortedSet<PendingDismissData> mPendingDismisses = new TreeSet<PendingDismissData>();
private int mDismissAnimationRefCount = 0;
private float mDownX;
private boolean mSwiping;
private VelocityTracker mVelocityTracker;
private int mDownPosition;
private View mDownView;
private boolean mPaused;
private float mDensity;
private boolean mSwipeDisabled;

private UndoMode mMode;
private List<Undoable> mUndoActions;
private Handler mHandler;

private PopupWindow mUndoPopup;
private TextView mUndoText;
private Button mUndoButton;

private SwipeDirection mSwipeDirection = SwipeDirection.BOTH;
private int mAutoHideDelay = 5000;
private String mDeleteString = "Item deleted";
private String mDeleteMultipleString = "%d items deleted";
private boolean mTouchBeforeAutoHide = true;

private int mDelayedMsgId;

View frontView;
View backView;
RelativeLayout layout ;

public enum UndoMode {

SINGLE_UNDO,

MULTI_UNDO,

COLLAPSED_UNDO
};

public enum SwipeDirection {

BOTH,

START,

END
}

public interface OnDismissCallback {

Undoable onDismiss(AbsListView listView, int position);
}

public abstract static class Undoable {

public String getTitle() {
return null;
}

public abstract void undo();

public void discard() { }

}

public SwipeDismissList(AbsListView listView, OnDismissCallback callback) {
this(listView, callback, UndoMode.SINGLE_UNDO);
}

public SwipeDismissList(AbsListView listView, OnDismissCallback callback, UndoMode mode) {

if(listView == null) {
throw new IllegalArgumentException("listview must not be null.");
}

mHandler = new HideUndoPopupHandler();
mListView = listView;
mCallback = callback;
mMode = mode;

ViewConfiguration vc = ViewConfiguration.get(listView.getContext());
mSlop = vc.getScaledTouchSlop();
mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
mAnimationTime = listView.getContext().getResources().getInteger(
android.R.integer.config_shortAnimTime);

mDensity = mListView.getResources().getDisplayMetrics().density;

// -- Load undo popup --
LayoutInflater inflater = (LayoutInflater) mListView.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.undo_popup, null);
mUndoButton = (Button)v.findViewById(R.id.undo);
mUndoButton.setOnClickListener(new UndoHandler());
mUndoButton.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// If user tabs "undo" button, reset delay time to remove popup
mDelayedMsgId++;
return false;
}
});
mUndoText = (TextView)v.findViewById(R.id.text);

mUndoPopup = new PopupWindow(v);
mUndoPopup.setAnimationStyle(R.style.fade_animation);
// Get scren width in dp and set width respectively
int xdensity = (int)(mListView.getContext().getResources().getDisplayMetrics().widthPixels / mDensity);
if(xdensity < 300) {
mUndoPopup.setWidth((int)(mDensity * 280));
} else if(xdensity < 350) {
mUndoPopup.setWidth((int)(mDensity * 300));
} else if(xdensity < 500) {
mUndoPopup.setWidth((int)(mDensity * 330));
} else {
mUndoPopup.setWidth((int)(mDensity * 450));
}
mUndoPopup.setHeight((int)(mDensity * 56));
// -- END Load undo popu --

listView.setOnTouchListener(this);
listView.setOnScrollListener(this.makeScrollListener());

switch(mode) {
case SINGLE_UNDO:
mUndoActions = new ArrayList<Undoable>(1);
break;
default:
mUndoActions = new ArrayList<Undoable>(10);
break;
}

}

private void setEnabled(boolean enabled) {
mPaused = !enabled;
}

public void setAutoHideDelay(int delay) {
mAutoHideDelay = delay;
}

public void setSwipeDirection(SwipeDirection direction) {
mSwipeDirection = direction;
}

public void setUndoString(String msg) {
mDeleteString = msg;
}

public void setUndoMultipleString(String msg) {
mDeleteMultipleString = msg;
}

public void setRequireTouchBeforeDismiss(boolean require) {
mTouchBeforeAutoHide = require;
}

public void discardUndo() {
for(Undoable undoable : mUndoActions) {
undoable.discard();
}
mUndoActions.clear();
mUndoPopup.dismiss();
}

private AbsListView.OnScrollListener makeScrollListener() {
return new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
setEnabled(scrollState != AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
}

@Override
public void onScroll(AbsListView absListView, int i, int i1, int i2) {
}
};
}

@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (this.mSwipeDisabled) {
return false;
}

if (mViewWidth < 2) {
mViewWidth = mListView.getWidth();
}

switch (motionEvent.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
if (mPaused) {
return false;
}

// TODO: ensure this is a finger, and set a flag

// Find the child view that was touched (perform a hit test)
Rect rect = new Rect();
int childCount = mListView.getChildCount();
int[] listViewCoords = new int[2];
mListView.getLocationOnScreen(listViewCoords);
int x = (int) motionEvent.getRawX() - listViewCoords[0];
int y = (int) motionEvent.getRawY() - listViewCoords[1];
View child;
for (int i = 0; i < childCount; i++) {
child = mListView.getChildAt(i);
child.getHitRect(rect);
if (rect.contains(x, y)) {
mDownView = child;
break;
}
}

if (mDownView != null) {
mDownX = motionEvent.getRawX();
mDownPosition = mListView.getPositionForView(mDownView);

mVelocityTracker = VelocityTracker.obtain();
mVelocityTracker.addMovement(motionEvent);
}
view.onTouchEvent(motionEvent);
return true;
}

case MotionEvent.ACTION_UP: {
if (mVelocityTracker == null) {
break;
}

float deltaX = motionEvent.getRawX() - mDownX;
mVelocityTracker.addMovement(motionEvent);
mVelocityTracker.computeCurrentVelocity(1000);
float velocityX = Math.abs(mVelocityTracker.getXVelocity());
float velocityY = Math.abs(mVelocityTracker.getYVelocity());
boolean dismiss = false;
boolean dismissRight = false;
if (Math.abs(deltaX) > mViewWidth / 2 && mSwiping) {
dismiss = true;
dismissRight = deltaX > 0;
} else if (mMinFlingVelocity <= velocityX && velocityX <= mMaxFlingVelocity
&& velocityY < velocityX && mSwiping && isDirectionValid(mVelocityTracker.getXVelocity())
&& deltaX >= mViewWidth * 0.2f) {
dismiss = true;
dismissRight = mVelocityTracker.getXVelocity() > 0;
}
if (dismiss) {
// dismiss
final View downView = frontView; // mDownView gets null'd before animation ends
final int downPosition = mDownPosition;
++mDismissAnimationRefCount;
animate(frontView)
.translationX(dismissRight ? mViewWidth : -mViewWidth)
.alpha(0)
.setDuration(mAnimationTime)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
performDismiss(downView, downPosition);
}
});
} else {
// cancel
animate(frontView)
.translationX(0)
.alpha(1)
.setDuration(mAnimationTime)
.setListener(null);
}
mVelocityTracker = null;
mDownX = 0;
mDownView = null;
mDownPosition = ListView.INVALID_POSITION;
mSwiping = false;

if(backView != null) {
backView.setVisibility(View.GONE);
frontView.setVisibility(View.VISIBLE);
setTranslationX(frontView, 0);

layout = null;
backView = null;
frontView = null;
}
break;
}

case MotionEvent.ACTION_MOVE: {
if(mTouchBeforeAutoHide && mUndoPopup.isShowing()) {
// Send a delayed message to hide popup
mHandler.sendMessageDelayed(mHandler.obtainMessage(mDelayedMsgId),
mAutoHideDelay);
}

if (mVelocityTracker == null || mPaused) {
break;
}

mVelocityTracker.addMovement(motionEvent);
float deltaX = motionEvent.getRawX() - mDownX;
// Only start swipe in correct direction


Related Topics



Leave a reply



Submit