Merge branch 'master' of https://github.com/linfaxin/AndroidSwipeLayout into linfaxin
This commit is contained in:
commit
feafd6a835
|
|
@ -68,7 +68,7 @@ public class ListViewExample extends Activity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
Toast.makeText(mContext, "OnItemLongClickListener", Toast.LENGTH_SHORT).show();
|
Toast.makeText(mContext, "OnItemLongClickListener", Toast.LENGTH_SHORT).show();
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
@ -28,9 +29,9 @@ public class MyActivity extends Activity {
|
||||||
|
|
||||||
sample1 = (SwipeLayout) findViewById(R.id.sample1);
|
sample1 = (SwipeLayout) findViewById(R.id.sample1);
|
||||||
sample1.setShowMode(SwipeLayout.ShowMode.PullOut);
|
sample1.setShowMode(SwipeLayout.ShowMode.PullOut);
|
||||||
sample1.setDragEdges(SwipeLayout.DragEdge.Left, SwipeLayout.DragEdge.Right, SwipeLayout.DragEdge.Top);
|
// 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)
|
// 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.setBottomViewIds(R.id.bottom_wrapper, R.id.bottom_wrapper_2, R.id.starbott, R.id.starbott);
|
||||||
sample1.addRevealListener(R.id.delete, new SwipeLayout.OnRevealListener() {
|
sample1.addRevealListener(R.id.delete, new SwipeLayout.OnRevealListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) {
|
public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) {
|
||||||
|
|
@ -38,6 +39,21 @@ public class MyActivity extends Activity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sample1.getSurfaceView().setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(MyActivity.this, "Click on surface", Toast.LENGTH_SHORT).show();
|
||||||
|
Log.d(MyActivity.class.getName(), "click on surface");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sample1.getSurfaceView().setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
Toast.makeText(MyActivity.this, "longClick on surface", Toast.LENGTH_SHORT).show();
|
||||||
|
Log.d(MyActivity.class.getName(), "longClick on surface");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
sample1.findViewById(R.id.star2).setOnClickListener(new View.OnClickListener() {
|
sample1.findViewById(R.id.star2).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
@ -103,6 +119,12 @@ public class MyActivity extends Activity {
|
||||||
Toast.makeText(MyActivity.this, "Yo", Toast.LENGTH_SHORT).show();
|
Toast.makeText(MyActivity.this, "Yo", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
sample2.getSurfaceView().setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(MyActivity.this, "Click on surface", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//sample3
|
//sample3
|
||||||
|
|
||||||
|
|
@ -120,12 +142,18 @@ public class MyActivity extends Activity {
|
||||||
child.setBackgroundColor(c);
|
child.setBackgroundColor(c);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sample3.findViewById(R.id.star).setOnClickListener(new View.OnClickListener() {
|
sample3.findViewById(R.id.bottom_wrapper_child1).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Toast.makeText(MyActivity.this, "Yo!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(MyActivity.this, "Yo!", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
sample3.getSurfaceView().setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(MyActivity.this, "Click on surface", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,12 @@ public class ListViewAdapter extends BaseSwipeAdapter {
|
||||||
Toast.makeText(mContext, "DoubleClick", Toast.LENGTH_SHORT).show();
|
Toast.makeText(mContext, "DoubleClick", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
v.findViewById(R.id.delete).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Toast.makeText(mContext, "click delete", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@color/dark_gray_press" android:state_pressed="true"/>
|
||||||
|
<item android:drawable="@color/dark_gray_press" android:state_focused="true"/>
|
||||||
|
<item android:drawable="@color/dark_gray"/>
|
||||||
|
|
||||||
|
</selector>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@color/red_press" android:state_pressed="true"/>
|
||||||
|
<item android:drawable="@color/red_press" android:state_focused="true"/>
|
||||||
|
<item android:drawable="@color/red"/>
|
||||||
|
|
||||||
|
</selector>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:drawable="@android:color/darker_gray" android:state_pressed="true"/>
|
||||||
|
<item android:drawable="@android:color/darker_gray" android:state_focused="true"/>
|
||||||
|
<item android:drawable="@android:color/white"/>
|
||||||
|
|
||||||
|
</selector>
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_weight="4"
|
android:layout_weight="4"
|
||||||
android:background="#ffffff"
|
android:background="@drawable/white"
|
||||||
android:text="Yes,Delete"
|
android:text="Yes,Delete"
|
||||||
android:textColor="#FF5534" />
|
android:textColor="#FF5534" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<com.daimajia.swipe.SwipeLayout
|
<com.daimajia.swipe.SwipeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/godfather"
|
android:id="@+id/godfather"
|
||||||
android:layout_width="match_parent" android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
app:drag_edge="bottom">
|
android:layout_height="match_parent">
|
||||||
|
<ImageView
|
||||||
|
android:layout_gravity="left|right|top"
|
||||||
|
android:src="@drawable/bird"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/bird_bottom"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.daimajia.swipe.SwipeLayout
|
||||||
android:background="@drawable/item_selector"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp">
|
android:layout_height="80dp"
|
||||||
|
app:clickToClose="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:tag="Bottom1"
|
android:tag="Bottom1"
|
||||||
|
|
@ -19,7 +21,8 @@
|
||||||
android:text="Archive"
|
android:text="Archive"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="#FF1300"
|
android:clickable="true"
|
||||||
|
android:background="@drawable/red"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
|
@ -61,7 +64,7 @@
|
||||||
android:id="@+id/trash2"
|
android:id="@+id/trash2"
|
||||||
android:src="@drawable/trash"
|
android:src="@drawable/trash"
|
||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:background="#FF3B30"
|
android:background="@drawable/red"
|
||||||
android:paddingLeft="25dp"
|
android:paddingLeft="25dp"
|
||||||
android:paddingRight="25dp"
|
android:paddingRight="25dp"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
@ -74,7 +77,8 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/bottom_wrapper_child1"
|
android:id="@+id/bottom_wrapper_child1"
|
||||||
android:background="#4C535B"
|
android:background="@drawable/dark_gray"
|
||||||
|
android:clickable="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
@ -87,17 +91,12 @@
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:background="#ffffff"
|
android:background="@drawable/white"
|
||||||
|
android:tag="Hover"
|
||||||
|
android:text="要有最樸素的生活和最遙遠的夢想,即使明天天寒地凍,山高水遠,路遠馬亡。"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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>
|
</com.daimajia.swipe.SwipeLayout>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
android:id="@+id/trash"
|
android:id="@+id/trash"
|
||||||
android:src="@drawable/trash"
|
android:src="@drawable/trash"
|
||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:background="#FF3B30"
|
android:background="@drawable/red"
|
||||||
android:paddingLeft="25dp"
|
android:paddingLeft="25dp"
|
||||||
android:paddingRight="25dp"
|
android:paddingRight="25dp"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="#ffffff"
|
android:background="@drawable/white"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,11 @@
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:background="#ffffff"
|
android:background="#ffffff"
|
||||||
|
android:tag="Hover"
|
||||||
|
android:text="None is of freedom or of life deserving unless he daily conquers it anew. "
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent" />
|
||||||
<TextView
|
|
||||||
android:tag="Hover"
|
|
||||||
android:text="None is of freedom or of life deserving unless he daily conquers it anew. "
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</LinearLayout>
|
|
||||||
</com.daimajia.swipe.SwipeLayout>
|
</com.daimajia.swipe.SwipeLayout>
|
||||||
|
|
@ -2,4 +2,8 @@
|
||||||
<resources>
|
<resources>
|
||||||
<color name="backgroundColor">#E8E8E0</color>
|
<color name="backgroundColor">#E8E8E0</color>
|
||||||
<color name="backgroundColorPress">#DBDBD3</color>
|
<color name="backgroundColorPress">#DBDBD3</color>
|
||||||
|
<color name="red">#FF3B00</color>
|
||||||
|
<color name="red_press">#990000</color>
|
||||||
|
<color name="dark_gray">#4C535B</color>
|
||||||
|
<color name="dark_gray_press">#ff7e8a97</color>
|
||||||
</resources>
|
</resources>
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -15,5 +15,6 @@
|
||||||
<enum name="lay_down" value="0" />
|
<enum name="lay_down" value="0" />
|
||||||
<enum name="pull_out" value="1" />
|
<enum name="pull_out" value="1" />
|
||||||
</attr>
|
</attr>
|
||||||
|
<attr name="clickToClose" format="boolean" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue