Show keyboard when opening TimeDialog. fixes #436

This commit is contained in:
daniel oeh 2014-06-15 20:35:50 +02:00
parent 5ede220e63
commit 8a951d0dbf
2 changed files with 100 additions and 90 deletions

View File

@ -20,7 +20,7 @@
android:inputType="number"
android:maxLength="2" >
<requestFocus />
</EditText>
<Spinner

View File

@ -8,6 +8,7 @@ import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.*;
import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
@ -26,8 +27,8 @@ public abstract class TimeDialog extends Dialog {
private Button butConfirm;
private Button butCancel;
private TimeUnit[] units = { TimeUnit.SECONDS, TimeUnit.MINUTES,
TimeUnit.HOURS };
private TimeUnit[] units = {TimeUnit.SECONDS, TimeUnit.MINUTES,
TimeUnit.HOURS};
public TimeDialog(Context context, int titleTextId, int leftButtonTextId) {
super(context);
@ -102,6 +103,15 @@ public abstract class TimeDialog extends Dialog {
}
});
checkInputLength(etxtTime.getText().length());
etxtTime.postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(etxtTime, InputMethodManager.SHOW_IMPLICIT);
}
}, 100);
}