Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
28 changes: 26 additions & 2 deletions demo/src/main/java/com/daimajia/swipedemo/MyActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,43 @@ protected void onCreate(Bundle savedInstanceState) {
//sample1

sample1 = (SwipeLayout) findViewById(R.id.sample1);
sample1.setShowMode(SwipeLayout.ShowMode.LayDown);
sample1.setDragEdge(SwipeLayout.DragEdge.Left);
sample1.setShowMode(SwipeLayout.ShowMode.PullOut);
sample1.setDragEdges(SwipeLayout.DragEdge.Left, SwipeLayout.DragEdge.Right, SwipeLayout.DragEdge.Top);
// When using multiple drag edges it's a good idea to pass the ids of the views that you're using for the left, right, top bottom views (-1 if you're not using a particular view)
sample1.setBottomViewIds(R.id.bottom_wrapper, R.id.bottom_wrapper_2, R.id.starbott, SwipeLayout.EMPTY_LAYOUT);
sample1.addRevealListener(R.id.delete, new SwipeLayout.OnRevealListener() {
@Override
public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) {

}
});

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
Expand Down
3 changes: 2 additions & 1 deletion demo/src/main/res/layout/listview_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion demo/src/main/res/layout/recyclerview_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
62 changes: 61 additions & 1 deletion demo/src/main/res/layout/sample1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/item_selector"
android:layout_width="match_parent" android:layout_height="80dp">
android:layout_width="match_parent"
android:layout_height="80dp">

<LinearLayout
android:tag="Bottom1"
android:background="#66ddff00"
android:id="@+id/bottom_wrapper"
android:layout_width="160dp"
android:weightSum="1"
android:layout_height="match_parent">

<TextView
android:id="@+id/archive"
android:textColor="#fff"
Expand All @@ -19,6 +22,7 @@
android:background="#FF1300"
android:layout_width="wrap_content"
android:layout_height="match_parent" />

<TextView
android:id="@+id/delete"
android:text="Delete"
Expand All @@ -29,15 +33,71 @@
android:layout_height="match_parent" />
</LinearLayout>

<LinearLayout
android:tag="Bottom4"
android:id="@+id/bottom_wrapper_2"
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:tag="Bottom3"
android:id="@+id/starbott"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/bottom_wrapper_child1"
android:background="#BDBEC2"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/star"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/star"
android:layout_width="20dp"
android:layout_height="20dp" />
</RelativeLayout>
</LinearLayout>

<LinearLayout
android:padding="10dp"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:tag="Hover"
android:text="要有最樸素的生活和最遙遠的夢想,即使明天天寒地凍,山高水遠,路遠馬亡。"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

</com.daimajia.swipe.SwipeLayout>
Loading