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 ;
@@ -20,6 +21,9 @@ public class MyActivity extends Activity {
2021 protected void onCreate (Bundle savedInstanceState ) {
2122 super .onCreate (savedInstanceState );
2223 setContentView (R .layout .main );
24+ SwipeLayout godfatherSwipe = (SwipeLayout ) findViewById (R .id .godfather );
25+ godfatherSwipe .setDragEdges (SwipeLayout .DragEdge .Left , SwipeLayout .DragEdge .Right , SwipeLayout .DragEdge .Top , SwipeLayout .DragEdge .Bottom );
26+ godfatherSwipe .setBottomViewIds (R .id .bird_left , R .id .bird_right , R .id .bird_top , R .id .bird_bottom );
2327
2428// SwipeLayout swipeLayout = (SwipeLayout)findViewById(R.id.godfather);
2529// swipeLayout.setDragEdge(SwipeLayout.DragEdge.Bottom); // Set in XML
@@ -38,6 +42,21 @@ public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int
3842 }
3943 });
4044
45+ sample1 .getSurfaceView ().setOnClickListener (new View .OnClickListener () {
46+ @ Override
47+ public void onClick (View v ) {
48+ Toast .makeText (MyActivity .this , "Click on surface" , Toast .LENGTH_SHORT ).show ();
49+ Log .d (MyActivity .class .getName (), "click on surface" );
50+ }
51+ });
52+ sample1 .getSurfaceView ().setOnLongClickListener (new View .OnLongClickListener () {
53+ @ Override
54+ public boolean onLongClick (View v ) {
55+ Toast .makeText (MyActivity .this , "longClick on surface" , Toast .LENGTH_SHORT ).show ();
56+ Log .d (MyActivity .class .getName (), "longClick on surface" );
57+ return true ;
58+ }
59+ });
4160 sample1 .findViewById (R .id .star2 ).setOnClickListener (new View .OnClickListener () {
4261 @ Override
4362 public void onClick (View v ) {
@@ -103,6 +122,12 @@ public void onClick(View v) {
103122 Toast .makeText (MyActivity .this , "Yo" , Toast .LENGTH_SHORT ).show ();
104123 }
105124 });
125+ sample2 .getSurfaceView ().setOnClickListener (new View .OnClickListener () {
126+ @ Override
127+ public void onClick (View v ) {
128+ Toast .makeText (MyActivity .this , "Click on surface" , Toast .LENGTH_SHORT ).show ();
129+ }
130+ });
106131
107132 //sample3
108133
@@ -120,12 +145,18 @@ public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int
120145 child .setBackgroundColor (c );
121146 }
122147 });
123- sample3 .findViewById (R .id .star ).setOnClickListener (new View .OnClickListener () {
148+ sample3 .findViewById (R .id .bottom_wrapper_child1 ).setOnClickListener (new View .OnClickListener () {
124149 @ Override
125150 public void onClick (View v ) {
126151 Toast .makeText (MyActivity .this , "Yo!" , Toast .LENGTH_SHORT ).show ();
127152 }
128153 });
154+ sample3 .getSurfaceView ().setOnClickListener (new View .OnClickListener () {
155+ @ Override
156+ public void onClick (View v ) {
157+ Toast .makeText (MyActivity .this , "Click on surface" , Toast .LENGTH_SHORT ).show ();
158+ }
159+ });
129160
130161 }
131162
0 commit comments