diff --git a/astrid/src/com/todoroo/astrid/ui/EditNotesControlSet.java b/astrid/src/com/todoroo/astrid/ui/EditNotesControlSet.java index 67ec040c9..c2e7a1312 100644 --- a/astrid/src/com/todoroo/astrid/ui/EditNotesControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/EditNotesControlSet.java @@ -1,9 +1,12 @@ package com.todoroo.astrid.ui; import android.app.Activity; +import android.content.Context; import android.graphics.Color; import android.text.TextUtils; import android.text.util.Linkify; +import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.TextView; @@ -19,6 +22,8 @@ public class EditNotesControlSet extends PopupControlSet { super(activity, viewLayout, displayViewLayout, R.string.TEA_note_label); editText = (EditText) getView().findViewById(R.id.notes); notesPreview = (TextView) getDisplayView().findViewById(R.id.notes_display); + dialog.getWindow() + .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); } @Override @@ -48,6 +53,20 @@ public class EditNotesControlSet extends PopupControlSet { return null; } + @Override + protected void onOkClick() { + super.onOkClick(); + InputMethodManager imm = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); + } + + @Override + protected void onCancelClick() { + super.onCancelClick(); + InputMethodManager imm = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); + } + public boolean hasNotes() { return !TextUtils.isEmpty(editText.getText()); } diff --git a/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java b/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java index 146932084..d2be65a7a 100644 --- a/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java @@ -32,14 +32,14 @@ public abstract class PopupControlSet extends TaskEditControlSet { final DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface d, int which) { - refreshDisplayView(); + onOkClick(); } }; final DialogInterface.OnCancelListener cancelListener = new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface d) { - refreshDisplayView(); + onCancelClick(); } }; @@ -94,5 +94,13 @@ public abstract class PopupControlSet extends TaskEditControlSet { }; } + protected void onOkClick() { + refreshDisplayView(); + } + + protected void onCancelClick() { + refreshDisplayView(); + } + protected abstract void refreshDisplayView(); }