Enabling both side swipe

This commit is contained in:
unknown 2014-12-22 17:48:51 +05:30
parent b3fe10cf33
commit 71ef2ad7e8
5 changed files with 947 additions and 626 deletions

View File

@ -28,7 +28,8 @@ public class MyActivity extends Activity {
sample1 = (SwipeLayout) findViewById(R.id.sample1);
sample1.setShowMode(SwipeLayout.ShowMode.LayDown);
sample1.setDragEdge(SwipeLayout.DragEdge.Left);
sample1.setDragEdges(SwipeLayout.DragEdge.Left, SwipeLayout.DragEdge.Right);
Toast.makeText(this, sample1.getDragEdge() + " is the drag edge", Toast.LENGTH_LONG).show();
sample1.addRevealListener(R.id.delete, new SwipeLayout.OnRevealListener() {
@Override
public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) {
@ -36,10 +37,32 @@ public class MyActivity extends Activity {
}
});
sample1.findViewById(R.id.star2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MyActivity.this, "Star", Toast.LENGTH_SHORT).show();
}
});
sample1.findViewById(R.id.trash2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MyActivity.this, "Trash Bin", Toast.LENGTH_SHORT).show();
}
});
sample1.findViewById(R.id.magnifier2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MyActivity.this, "Magnifier", Toast.LENGTH_SHORT).show();
}
});
//sample2
sample2 = (SwipeLayout) findViewById(R.id.sample2);
sample2.setShowMode(SwipeLayout.ShowMode.LayDown);
sample2.setDragEdge(SwipeLayout.DragEdge.Right);
// sample2.setShowMode(SwipeLayout.ShowMode.PullOut);
sample2.findViewById(R.id.star).setOnClickListener(new View.OnClickListener() {
@Override

View File

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

View File

@ -29,6 +29,36 @@
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:tag="Bottom4"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/magnifier2"
android:src="@drawable/magnifier"
android:layout_width="70dp"
android:background="#f7e79c"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/star2"
android:src="@drawable/star"
android:layout_width="70dp"
android:background="#4cd964"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/trash2"
android:src="@drawable/trash"
android:layout_width="70dp"
android:background="#FF3B30"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:padding="10dp"
android:background="#ffffff"
@ -40,4 +70,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</com.daimajia.swipe.SwipeLayout>

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SwipeLayout">
<attr name="drag_edge" format="enum">
<enum name="left" value="0"/>
<enum name="right" value="1"/>
<enum name="top" value="2"/>
<enum name="bottom" value="3"/>
<attr name="drag_edge">
<flag name="left" value="1"/>
<flag name="right" value="2"/>
<flag name="top" value="4"/>
<flag name="bottom" value="8"/>
</attr>
<attr name="horizontalSwipeOffset" format="dimension"/>
<attr name="verticalSwipeOffset" format="dimension"/>
<attr name="leftEdgeSwipeOffset" format="dimension"/>
<attr name="rightEdgeSwipeOffset" format="dimension"/>
<attr name="topEdgeSwipeOffset" format="dimension"/>
<attr name="bottomEdgeSwipeOffset" format="dimension"/>
<attr name="show_mode" format="enum">
<enum name="lay_down" value="0"/>
<enum name="pull_out" value="1"/>