| | |
| | | import android.view.inputmethod.InputMethodManager; |
| | | import android.widget.EditText; |
| | | |
| | | import com.basic.security.activity.MainActivity; |
| | | import com.basic.security.base.BaseApplication; |
| | | import com.basic.security.fragment.helper.HomeGridViewAdapter; |
| | | |
| | | public class KeyboardUtil { |
| | | |
| | | public static void showKeyboard() { |
| | | InputMethodManager imm = (InputMethodManager)BaseApplication.getApplication().activity.getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | InputMethodManager imm = (InputMethodManager) BaseApplication.getApplication().activity.getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); |
| | | } |
| | | |
| | | |
| | | |
| | | public static void setupUI(final View view) { |
| | | if (1!=1) { |
| | | return; |
| | | } |
| | | // if (1!=1) { |
| | | // return; |
| | | // } |
| | | // Set up touch listener for non-text box views to hide keyboard. |
| | | if (!(view instanceof EditText)) { |
| | | view.setOnTouchListener(new View.OnTouchListener() { |
| | | public boolean onTouch(View v, MotionEvent event) { |
| | | System.out.println("KeyboardUtil.onTouch setOnTouchListener view="+v); |
| | | // System.out.println("KeyboardUtil.onTouch setOnTouchListener view="+v + ", parent="+view.getParent()); |
| | | KeyboardUtil.hideSoftKeyboard(); |
| | | return false; |
| | | } |