close keyboard when sleep time has been selected
This commit is contained in:
parent
9e1c50ea63
commit
22e9a9af7e
@ -1,5 +1,6 @@
|
|||||||
package de.danoeh.antennapod.dialog;
|
package de.danoeh.antennapod.dialog;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -137,6 +138,7 @@ public class SleepTimerDialog extends DialogFragment {
|
|||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
controller.setSleepTimer(time);
|
controller.setSleepTimer(time);
|
||||||
}
|
}
|
||||||
|
closeKeyboard(content);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Snackbar.make(content, R.string.time_dialog_invalid_input, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(content, R.string.time_dialog_invalid_input, Snackbar.LENGTH_LONG).show();
|
||||||
@ -153,4 +155,9 @@ public class SleepTimerDialog extends DialogFragment {
|
|||||||
timeDisplay.setVisibility(controller.sleepTimerActive() ? View.VISIBLE : View.GONE);
|
timeDisplay.setVisibility(controller.sleepTimerActive() ? View.VISIBLE : View.GONE);
|
||||||
time.setText(Converter.getDurationStringLong((int) controller.getSleepTimerTimeLeft()));
|
time.setText(Converter.getDurationStringLong((int) controller.getSleepTimerTimeLeft()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void closeKeyboard(View content) {
|
||||||
|
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
|
imm.hideSoftInputFromWindow(content.getWindowToken(), 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user