/** Configure nap duration pickers with correct ranges and default values */ private void configurePickers() { mHourPicker = (NumberPicker) findViewById(R.id.nap_hour); mHourPicker.setRange(0, 23); mHourPicker.setCurrent(DEFAULT_NAP_HOURS); mMinutePicker = (NumberPicker) findViewById(R.id.nap_minute); mMinutePicker.setRange(0, 59); mMinutePicker.setCurrent(DEFAULT_NAP_MINUTES); }
/** * Computes the total nap duration * * @return the nap duration, in minutes */ public int getNapDuration() { return mHourPicker.getCurrent() * 60 + mMinutePicker.getCurrent(); }