44import android .content .Intent ;
55import android .graphics .Color ;
66import android .os .Bundle ;
7+ import android .util .Log ;
78import android .view .Menu ;
89import android .view .MenuItem ;
910import android .view .View ;
@@ -28,16 +29,31 @@ protected void onCreate(Bundle savedInstanceState) {
2829
2930 sample1 = (SwipeLayout ) findViewById (R .id .sample1 );
3031 sample1 .setShowMode (SwipeLayout .ShowMode .PullOut );
31- sample1 .setDragEdges (SwipeLayout .DragEdge .Left , SwipeLayout .DragEdge .Right , SwipeLayout .DragEdge .Top );
32+ // sample1.setDragEdges(SwipeLayout.DragEdge.Left, SwipeLayout.DragEdge.Right, SwipeLayout.DragEdge.Top);
3233 // 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)
33- sample1 .setBottomViewIds (R .id .bottom_wrapper , R .id .bottom_wrapper_2 , R .id .starbott , SwipeLayout . EMPTY_LAYOUT );
34+ sample1 .setBottomViewIds (R .id .bottom_wrapper , R .id .bottom_wrapper_2 , R .id .starbott , R . id . starbott );
3435 sample1 .addRevealListener (R .id .delete , new SwipeLayout .OnRevealListener () {
3536 @ Override
3637 public void onReveal (View child , SwipeLayout .DragEdge edge , float fraction , int distance ) {
3738
3839 }
3940 });
4041
42+ sample1 .getSurfaceView ().setOnClickListener (new View .OnClickListener () {
43+ @ Override
44+ public void onClick (View v ) {
45+ Toast .makeText (MyActivity .this , "Click on surface" , Toast .LENGTH_SHORT ).show ();
46+ Log .d (MyActivity .class .getName (), "click on surface" );
47+ }
48+ });
49+ sample1 .getSurfaceView ().setOnLongClickListener (new View .OnLongClickListener () {
50+ @ Override
51+ public boolean onLongClick (View v ) {
52+ Toast .makeText (MyActivity .this , "longClick on surface" , Toast .LENGTH_SHORT ).show ();
53+ Log .d (MyActivity .class .getName (), "longClick on surface" );
54+ return true ;
55+ }
56+ });
4157 sample1 .findViewById (R .id .star2 ).setOnClickListener (new View .OnClickListener () {
4258 @ Override
4359 public void onClick (View v ) {
@@ -103,6 +119,12 @@ public void onClick(View v) {
103119 Toast .makeText (MyActivity .this , "Yo" , Toast .LENGTH_SHORT ).show ();
104120 }
105121 });
122+ sample2 .getSurfaceView ().setOnClickListener (new View .OnClickListener () {
123+ @ Override
124+ public void onClick (View v ) {
125+ Toast .makeText (MyActivity .this , "Click on surface" , Toast .LENGTH_SHORT ).show ();
126+ }
127+ });
106128
107129 //sample3
108130
@@ -120,12 +142,18 @@ public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int
120142 child .setBackgroundColor (c );
121143 }
122144 });
123- sample3 .findViewById (R .id .star ).setOnClickListener (new View .OnClickListener () {
145+ sample3 .findViewById (R .id .bottom_wrapper_child1 ).setOnClickListener (new View .OnClickListener () {
124146 @ Override
125147 public void onClick (View v ) {
126148 Toast .makeText (MyActivity .this , "Yo!" , Toast .LENGTH_SHORT ).show ();
127149 }
128150 });
151+ sample3 .getSurfaceView ().setOnClickListener (new View .OnClickListener () {
152+ @ Override
153+ public void onClick (View v ) {
154+ Toast .makeText (MyActivity .this , "Click on surface" , Toast .LENGTH_SHORT ).show ();
155+ }
156+ });
129157
130158 }
131159
0 commit comments