@@ -0,0 +1,2353 @@
+package com.ganxin.codebase.utils.app;%0A%0Aimport android.app.Activity;%0Aimport android.content.Context;%0Aimport android.view.View;%0Aimport android.view.inputmethod.InputMethodManager;%0A%0A/**%0A * Description : %E9%94%AE%E7%9B%98%E6%98%BE%E7%A4%BA%E5%B7%A5%E5%85%B7%E7%B1%BB  %3Cbr/%3E%0A * author : WangGanxin %3Cbr/%3E%0A * date : 2016/9/22 %3Cbr/%3E%0A * email : ganxinvip@163.com %3Cbr/%3E%0A */%0Apublic class KeyboardUtil %7B%0A%0A    /**%0A     * @param context%0A     * @param editText%0A     */%0A    public static void openKeyboard(Context context, View editText) %7B%0A        try %7B%0A            if (context == null) %7B%0A                return;%0A            %7D%0A%0A            if (editText != null) %7B%0A                InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);%0A                imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED);%0A%0A                //%E5%A6%82%E6%9E%9C%E4%B8%8A%E9%9D%A2%E7%9A%84%E6%97%A0%E6%95%88%EF%BC%8C%E8%AF%95%E8%AF%95%E8%BF%99%E4%B8%AA%0A                //imm.showSoftInput(editText, InputMethodManager.RESULT_SHOWN);%0A                //imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);%0A            %7D%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A        %7D%0A%0A    %7D%0A%0A    /**%0A     * @param context%0A     * @param view%0A     */%0A    public static void hideKeyboard(Context context, View view) %7B%0A        try %7B%0A            if (context == null) %7B%0A                return;%0A            %7D%0A%0A            if (view != null && view.getWindowToken() != null) %7B%0A%0A                InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);%0A                imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN);%0A            %7D%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%0A    /**%0A     * @param activity%0A     */%0A    public static void hideKeyboard(Activity activity) %7B%0A        try %7B%0A            if (activity == null) %7B%0A                return;%0A            %7D%0A%0A            View view = activity.getWindow().peekDecorView();%0A%0A            if (view != null && view.getWindowToken() != null) %7B%0A%0A                InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);%0A                imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN);%0A%0A            %7D%0A%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%7D%0A

add KeyboardUtil