/** * Try to start keyboard mode with the specified key, as long as the timepicker is not in the * middle of a touch-event. * @param keyCode The key to use as the first press. Keyboard mode will not be started if the * key is not legal to start with. Or, pass in -1 to get into keyboard mode without a starting * key. */ private void tryStartingKbMode(int keyCode) { if (mTimePicker.trySettingInputEnabled(false) && (keyCode == -1 || addKeyIfLegal(keyCode))) { mInKbMode = true; mDoneButton.setEnabled(false); updateDisplay(false); } }
/** * Get out of keyboard mode. If there is nothing in typedTimes, revert to TimePicker's time. * @param changeDisplays If true, update the displays with the relevant time. */ private void finishKbMode(boolean updateDisplays) { mInKbMode = false; if (!mTypedTimes.isEmpty()) { int values[] = getEnteredTime(null); mTimePicker.setTime(values[0], values[1]); if (!mIs24HourMode) { mTimePicker.setAmOrPm(values[2]); } mTypedTimes.clear(); } if (updateDisplays) { updateDisplay(false); mTimePicker.trySettingInputEnabled(true); } }
updateDisplay(true); updateDisplay(false);
/** * Get out of keyboard mode. If there is nothing in typedTimes, revert to TimePicker's time. * @param changeDisplays If true, update the displays with the relevant time. */ private void finishKbMode(boolean updateDisplays) { mInKbMode = false; if (!mTypedTimes.isEmpty()) { int values[] = getEnteredTime(null); mTimePicker.setTime(values[0], values[1]); if (!mIs24HourMode) { mTimePicker.setAmOrPm(values[2]); } mTypedTimes.clear(); } if (updateDisplays) { updateDisplay(false); mTimePicker.trySettingInputEnabled(true); } }
/** * Try to start keyboard mode with the specified key, as long as the timepicker is not in the * middle of a touch-event. * @param keyCode The key to use as the first press. Keyboard mode will not be started if the * key is not legal to start with. Or, pass in -1 to get into keyboard mode without a starting * key. */ private void tryStartingKbMode(int keyCode) { if (mTimePicker.trySettingInputEnabled(false) && (keyCode == -1 || addKeyIfLegal(keyCode))) { mInKbMode = true; mDoneButton.setEnabled(false); updateDisplay(false); } }
updateDisplay(true); updateDisplay(false);