mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Removed useless swipe detection from details view
This commit is contained in:
parent
2f1aaa8b15
commit
6d4ce68a81
2 changed files with 0 additions and 98 deletions
|
@ -1,82 +0,0 @@
|
||||||
package com.owncloud.android.ui;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.GestureDetector;
|
|
||||||
import android.view.GestureDetector.SimpleOnGestureListener;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnTouchListener;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class OnSwipeTouchListener implements OnTouchListener {
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
private final GestureDetector mGestureDetector;
|
|
||||||
|
|
||||||
public OnSwipeTouchListener(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
mGestureDetector = new GestureDetector(context, new GestureListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onTouch(final View v, final MotionEvent event) {
|
|
||||||
//super.onTouch(v, event);
|
|
||||||
Log.d("SWIPE", "Swipe listener touched");
|
|
||||||
return mGestureDetector.onTouchEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final class GestureListener extends SimpleOnGestureListener {
|
|
||||||
|
|
||||||
private static final int SWIPE_THRESHOLD = 100;
|
|
||||||
private static final int SWIPE_VELOCITY_THRESHOLD = 100;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDown(MotionEvent e) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
|
||||||
boolean result = false;
|
|
||||||
try {
|
|
||||||
float diffY = e2.getY() - e1.getY();
|
|
||||||
float diffX = e2.getX() - e1.getX();
|
|
||||||
if (Math.abs(diffX) > Math.abs(diffY)) {
|
|
||||||
if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
|
|
||||||
if (diffX > 0) {
|
|
||||||
onSwipeRight();
|
|
||||||
} else {
|
|
||||||
onSwipeLeft();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) {
|
|
||||||
if (diffY > 0) {
|
|
||||||
onSwipeBottom();
|
|
||||||
} else {
|
|
||||||
onSwipeTop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSwipeTop() {
|
|
||||||
Toast.makeText(mContext, "top", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
public void onSwipeRight() {
|
|
||||||
Toast.makeText(mContext, "right", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
public void onSwipeLeft() {
|
|
||||||
Toast.makeText(mContext, "left", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
public void onSwipeBottom() {
|
|
||||||
Toast.makeText(mContext, "bottom", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
import org.apache.http.client.utils.URLEncodedUtils;
|
import org.apache.http.client.utils.URLEncodedUtils;
|
||||||
import org.apache.http.entity.FileEntity;
|
|
||||||
import org.apache.http.message.BasicNameValuePair;
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
import org.apache.http.protocol.HTTP;
|
import org.apache.http.protocol.HTTP;
|
||||||
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
|
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
|
||||||
|
@ -37,7 +36,6 @@ import org.json.JSONObject;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
@ -46,27 +44,17 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.graphics.BitmapFactory.Options;
|
|
||||||
import android.graphics.Point;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.View.OnTouchListener;
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
import android.webkit.WebView.FindListener;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -74,7 +62,6 @@ import android.widget.MediaController;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.VideoView;
|
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import com.actionbarsherlock.app.SherlockFragment;
|
||||||
import com.owncloud.android.AccountUtils;
|
import com.owncloud.android.AccountUtils;
|
||||||
|
@ -100,8 +87,6 @@ import com.owncloud.android.operations.SynchronizeFileOperation;
|
||||||
import com.owncloud.android.ui.activity.ConflictsResolveActivity;
|
import com.owncloud.android.ui.activity.ConflictsResolveActivity;
|
||||||
import com.owncloud.android.ui.activity.FileDetailActivity;
|
import com.owncloud.android.ui.activity.FileDetailActivity;
|
||||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||||
import com.owncloud.android.ui.OnSwipeTouchListener;
|
|
||||||
import com.owncloud.android.ui.activity.TransferServiceGetter;
|
|
||||||
import com.owncloud.android.ui.activity.PreviewVideoActivity;
|
import com.owncloud.android.ui.activity.PreviewVideoActivity;
|
||||||
import com.owncloud.android.ui.dialog.EditNameDialog;
|
import com.owncloud.android.ui.dialog.EditNameDialog;
|
||||||
import com.owncloud.android.ui.dialog.EditNameDialog.EditNameDialogListener;
|
import com.owncloud.android.ui.dialog.EditNameDialog.EditNameDialogListener;
|
||||||
|
@ -246,7 +231,6 @@ public class FileDetailFragment extends SherlockFragment implements
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
if (mAccount != null) {
|
if (mAccount != null) {
|
||||||
mStorageManager = new FileDataStorageManager(mAccount, getActivity().getApplicationContext().getContentResolver());;
|
mStorageManager = new FileDataStorageManager(mAccount, getActivity().getApplicationContext().getContentResolver());;
|
||||||
mView.setOnTouchListener(new OnSwipeTouchListener(getActivity()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue