Home | History | Annotate | Download | only in shadows
      1 package com.xtremelabs.robolectric.shadows;
      2 
      3 import com.xtremelabs.robolectric.internal.Implementation;
      4 import com.xtremelabs.robolectric.internal.Implements;
      5 
      6 import android.view.View;
      7 import android.widget.AbsSpinner;
      8 import android.widget.SpinnerAdapter;
      9 
     10 @SuppressWarnings({"UnusedDeclaration"})
     11 @Implements(AbsSpinner.class)
     12 public class ShadowAbsSpinner extends ShadowAdapterView {
     13 
     14 	private boolean animatedTransition;
     15 
     16 	@Implementation
     17     public void setAdapter(SpinnerAdapter adapter) {
     18         super.setAdapter(adapter);
     19     }
     20 
     21     @Override @Implementation
     22     public SpinnerAdapter getAdapter() {
     23         return (SpinnerAdapter) super.getAdapter();
     24     }
     25 
     26     @Implementation
     27     public void setSelection(int position, boolean animate) {
     28     	super.setSelection(position);
     29     	animatedTransition = animate;
     30     }
     31 
     32     @Implementation
     33     public View getSelectedView() {
     34         int selectedItemPosition = getSelectedItemPosition();
     35         if (getCount() == 0 || selectedItemPosition < 0) {
     36             return null;
     37         } else {
     38             return getChildAt(selectedItemPosition);
     39         }
     40     }
     41 
     42     // Non-implementation helper method
     43     public boolean isAnimatedTransition() {
     44     	return animatedTransition;
     45     }
     46 }
     47