Home | History | Annotate | Download | only in shadows
      1 package org.robolectric.shadows;
      2 
      3 import static org.robolectric.util.ReflectionHelpers.ClassParameter;
      4 
      5 import android.app.TimePickerDialog;
      6 import android.content.Context;
      7 import org.robolectric.annotation.Implementation;
      8 import org.robolectric.annotation.Implements;
      9 import org.robolectric.annotation.RealObject;
     10 import org.robolectric.shadow.api.Shadow;
     11 
     12 @Implements(value = TimePickerDialog.class)
     13 public class ShadowTimePickerDialog extends ShadowAlertDialog {
     14   @RealObject
     15   protected TimePickerDialog realTimePickerDialog;
     16   private int hourOfDay;
     17   private int minute;
     18 
     19   @Implementation
     20   protected void __constructor__(
     21       Context context,
     22       int theme,
     23       TimePickerDialog.OnTimeSetListener callBack,
     24       int hourOfDay,
     25       int minute,
     26       boolean is24HourView) {
     27     this.hourOfDay = hourOfDay;
     28     this.minute = minute;
     29 
     30     Shadow.invokeConstructor(TimePickerDialog.class, realTimePickerDialog,
     31         ClassParameter.from(Context.class, context),
     32         ClassParameter.from(int.class, theme),
     33         ClassParameter.from(TimePickerDialog.OnTimeSetListener.class, callBack),
     34         ClassParameter.from(int.class, hourOfDay),
     35         ClassParameter.from(int.class, minute),
     36         ClassParameter.from(boolean.class, is24HourView));
     37   }
     38 
     39   public int getHourOfDay() {
     40     return hourOfDay;
     41   }
     42 
     43   public int getMinute() {
     44     return minute;
     45   }
     46 }
     47