1 package com.xtremelabs.robolectric.shadows; 2 3 import android.view.KeyEvent; 4 import android.widget.Gallery; 5 import com.xtremelabs.robolectric.internal.Implementation; 6 import com.xtremelabs.robolectric.internal.Implements; 7 import com.xtremelabs.robolectric.internal.RealObject; 8 9 @Implements(Gallery.class) 10 public class ShadowGallery extends ShadowAbsSpinner { 11 12 @RealObject Gallery gallery; 13 14 @Implementation onKeyDown(int keyCode, KeyEvent event)15 public boolean onKeyDown(int keyCode, KeyEvent event) { 16 switch (keyCode) { 17 case KeyEvent.KEYCODE_DPAD_RIGHT: 18 case KeyEvent.KEYCODE_DPAD_LEFT: 19 if (onKeyListener != null) { 20 onKeyListener.onKey(gallery, keyCode, event); 21 } 22 return true; 23 } 24 return false; 25 } 26 27 } 28