List of usage examples for android.widget CalendarView getDate
public long getDate()
From source file:org.ambient.control.home.roomitems.TemperatureChooserDialogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { myContent = (LinearLayout) inflater.inflate(R.layout.fragment_home_room_climate, null); final TemperatureModeView tempChooser = (TemperatureModeView) myContent .findViewById(R.id.temperatureModeView); tempChooser.boostDurationInSeconds = config.boostDurationMins * 60; tempChooser.comfortTemp = config.comfortTemperatur; tempChooser.maxTemp = MaxUtil.MAX_TEMPERATURE; tempChooser.minTemp = MaxUtil.MIN_TEMPERATURE; tempChooser.setTemp(config.temperature); if (config.mode != MaxThermostateMode.BOOST) { tempChooser.setMode(config.mode); } else {/*from www.j ava 2 s .co m*/ long millisToGo = config.boostUntil.getTime() - System.currentTimeMillis(); long secondsToGo = TimeUnit.MILLISECONDS.toSeconds(millisToGo); if (secondsToGo < 0) { secondsToGo = 0; } tempChooser.setBoostMode((int) secondsToGo); } Button okButton = (Button) myContent.findViewById(R.id.buttonTemperatureAccept); okButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (tempChooser.getMode() == MaxThermostateMode.BOOST) { RestClient.setClimateBoostMode(roomName, true); } else if (tempChooser.getMode() == MaxThermostateMode.TEMPORARY) { CalendarView calendar = (CalendarView) myContent.findViewById(R.id.calendarView); Date until = new Date(calendar.getDate()); TemperaturMode newMode = new TemperaturMode(tempChooser.getTemp(), until, tempChooser.getMode()); RestClient.setTemperatureMode(roomName, newMode); } else { TemperaturMode newMode = new TemperaturMode(tempChooser.getTemp(), null, tempChooser.getMode()); RestClient.setTemperatureMode(roomName, newMode); } dismiss(); } }); tempChooser.modeChangeListener = this; return myContent; }