• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.robolectric.shadows;
2 
3 import static org.robolectric.shadow.api.Shadow.directlyOn;
4 
5 import android.widget.NumberPicker;
6 import org.robolectric.annotation.Implementation;
7 import org.robolectric.annotation.Implements;
8 import org.robolectric.annotation.RealObject;
9 
10 @Implements(value = NumberPicker.class)
11 public class ShadowNumberPicker extends ShadowLinearLayout {
12   @RealObject private NumberPicker realNumberPicker;
13   private int value;
14   private int minValue;
15   private int maxValue;
16   private boolean wrapSelectorWheel;
17   private String[] displayedValues;
18   private NumberPicker.OnValueChangeListener onValueChangeListener;
19 
20   @Implementation
setValue(int value)21   protected void setValue(int value) {
22     this.value = value;
23   }
24 
25   @Implementation
getValue()26   protected int getValue() {
27     return value;
28   }
29 
30   @Implementation
setDisplayedValues(String[] displayedValues)31   protected void setDisplayedValues(String[] displayedValues) {
32     this.displayedValues = displayedValues;
33   }
34 
35   @Implementation
getDisplayedValues()36   protected String[] getDisplayedValues() {
37     return displayedValues;
38   }
39 
40   @Implementation
setMinValue(int minValue)41   protected void setMinValue(int minValue) {
42     this.minValue = minValue;
43   }
44 
45   @Implementation
setMaxValue(int maxValue)46   protected void setMaxValue(int maxValue) {
47     this.maxValue = maxValue;
48   }
49 
50   @Implementation
getMinValue()51   protected int getMinValue() {
52     return this.minValue;
53   }
54 
55   @Implementation
getMaxValue()56   protected int getMaxValue() {
57     return this.maxValue;
58   }
59 
60   @Implementation
setWrapSelectorWheel(boolean wrapSelectorWheel)61   protected void setWrapSelectorWheel(boolean wrapSelectorWheel) {
62     this.wrapSelectorWheel = wrapSelectorWheel;
63   }
64 
65   @Implementation
getWrapSelectorWheel()66   protected boolean getWrapSelectorWheel() {
67     return wrapSelectorWheel;
68   }
69 
70   @Implementation
setOnValueChangedListener(NumberPicker.OnValueChangeListener listener)71   protected void setOnValueChangedListener(NumberPicker.OnValueChangeListener listener) {
72     directlyOn(realNumberPicker, NumberPicker.class).setOnValueChangedListener(listener);
73     this.onValueChangeListener = listener;
74   }
75 
getOnValueChangeListener()76   public NumberPicker.OnValueChangeListener getOnValueChangeListener() {
77     return onValueChangeListener;
78   }
79 }
80