fixing bug from horizontal swipe offset and adding preliminary code to restrict particular drag edges

This commit is contained in:
HarshEvilGeek 2015-02-11 17:53:10 +05:30
parent ee02941dd8
commit ea5a0156dc
4 changed files with 40 additions and 3 deletions

View File

@ -7,7 +7,6 @@ repositories {
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)

View File

@ -5,7 +5,8 @@
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="wrap_content"
swipe:horizontalSwipeOffset="0dp">
swipe:leftEdgeSwipeOffset="0dp"
swipe:rightEdgeSwipeOffset="0dp">
<LinearLayout
android:layout_width="match_parent"

View File

@ -7,7 +7,8 @@
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="wrap_content"
swipe:horizontalSwipeOffset="0dp">
swipe:leftEdgeSwipeOffset="0dp"
swipe:rightEdgeSwipeOffset="0dp">
<LinearLayout
android:layout_width="match_parent"

View File

@ -60,6 +60,10 @@ public class SwipeLayout extends FrameLayout {
private DoubleClickListener mDoubleClickListener;
private boolean mSwipeEnabled = true;
private boolean mLeftSwipeEnabled = true;
private boolean mRightSwipeEnabled = true;
private boolean mTopSwipeEnabled = true;
private boolean mBottomSwipeEnabled = true;
public static enum DragEdge {
Left,
@ -948,6 +952,38 @@ public class SwipeLayout extends FrameLayout {
return mSwipeEnabled;
}
public boolean isLeftSwipeEnabled() {
return mLeftSwipeEnabled;
}
public void setLeftSwipeEnabled(boolean leftSwipeEnabled) {
this.mLeftSwipeEnabled = leftSwipeEnabled;
}
public boolean isRightSwipeEnabled() {
return mRightSwipeEnabled;
}
public void setRightSwipeEnabled(boolean rightSwipeEnabled) {
this.mRightSwipeEnabled = rightSwipeEnabled;
}
public boolean isTopSwipeEnabled() {
return mTopSwipeEnabled;
}
public void setTopSwipeEnabled(boolean topSwipeEnabled) {
this.mTopSwipeEnabled = topSwipeEnabled;
}
public boolean isBottomSwipeEnabled() {
return mBottomSwipeEnabled;
}
public void setBottomSwipeEnabled(boolean bottomSwipeEnabled) {
this.mBottomSwipeEnabled = bottomSwipeEnabled;
}
private boolean insideAdapterView() {
return getAdapterView() != null;
}