/**
  * @param activity the context of the activity
  * @brief methods for showing the soft keyboard by forced
  */
 public static void showSoftKeyboard(Activity activity) {
   if (activity.getCurrentFocus() != null) {
     InputMethodManager inputMethodManager =
         (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
     inputMethodManager.showSoftInput(activity.getCurrentFocus(), 0);
   }
 }
Exemplo n.º 2
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.btn_title_bar_back:
       finish();
       break;
     case R.id.btn_send:
       send();
       break;
     case R.id.ll_input_root:
     case R.id.et_forward_content:
       faceKeyboard.setImageResource(R.drawable.happy_face);
       faceGrid.setVisibility(View.GONE);
       inputMethodManager.showSoftInput(replyContent, InputMethodManager.SHOW_IMPLICIT);
       break;
     case R.id.btn_face_keyboard:
       if (faceGrid.getVisibility() == View.GONE) { // 先关闭输入法,再打开表情面板
         faceKeyboard.setImageResource(R.drawable.keyboard);
         inputMethodManager.hideSoftInputFromWindow(
             getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
         faceGrid.setVisibility(View.VISIBLE);
       } else { // 先关闭面板,再打开输入法
         faceKeyboard.setImageResource(R.drawable.happy_face);
         faceGrid.setVisibility(View.GONE);
         inputMethodManager.showSoftInput(replyContent, InputMethodManager.SHOW_IMPLICIT);
       }
       break;
   }
 }
Exemplo n.º 3
0
  /**
   * 显示软键盘
   *
   * @author [email protected] 2013-10-12 下午3:47:19
   * @param view
   * @param resultReceiver
   * @return void
   */
  public static void showSoftkeyboard(View view, ResultReceiver resultReceiver) {
    Configuration config = view.getContext().getResources().getConfiguration();
    if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
      InputMethodManager imm =
          (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

      if (resultReceiver != null) {
        imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT, resultReceiver);
      } else {
        imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
      }
    }
  }
 private static void showSoftInput() {
   final InputMethodManager imm = getInputMethodManager();
   if (imm != null) {
     final View v = getView();
     imm.showSoftInput(v, 0);
   }
 }
Exemplo n.º 5
0
        @Override
        public void onClick(View view) {
          // TODO Auto-generated method stub
          switch (view.getId()) {
            case R.id.tv_cancel_create_room:
              mIMM.hideSoftInputFromWindow(mCreateRoom.getWindowToken(), 0);

              mCreateRoom.setVisibility(View.GONE);
              mRoomCancel.setVisibility(View.GONE);
              mGetRoom.setVisibility(View.VISIBLE);
              break;

            case R.id.btn_get_room:
              mRoomCancel.setVisibility(View.VISIBLE);
              mCreateRoom.setVisibility(view.VISIBLE);
              mCreateRoom.setText("");

              mCreateRoom.setFocusable(true);
              mCreateRoom.setFocusableInTouchMode(true);
              mCreateRoom.requestFocus();
              mIMM.showSoftInput(mCreateRoom, 0);
              mCreateRoom.setOnEditorActionListener(editorActionListener);

              break;

            default:
              break;
          }
        }
  /**
   * Show keyboard
   *
   * @param context context
   * @param view The currently focused view, which would like to receive soft keyboard input.
   */
  public static void showSoftInput(Context context, View view) {
    if (view == null) return;

    InputMethodManager inputMethodManager =
        (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.showSoftInput(view, 0);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ViewGroup container = (ViewGroup) findViewById(R.id.Content);
    ViewGroup.inflate(this, R.layout.search, container);

    searchText = (EditText) findViewById(R.id.SearchText);
    searchText.setOnKeyListener(this);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    // only will trigger it if no physical keyboard is open
    if (inputMethodManager != null) {
      inputMethodManager.showSoftInput(searchText, InputMethodManager.SHOW_IMPLICIT);
    }

    ImageButton searchButton = (ImageButton) findViewById(R.id.search_go_button);
    searchButton.setOnClickListener(this);

    endDate = new GregorianCalendar();
    startDate = (Calendar) endDate.clone();
    startDate.add(Calendar.DATE, -7);

    startDateButton = (Button) findViewById(R.id.StartDateButton);
    endDateButton = (Button) findViewById(R.id.EndDateButton);
    startDateButton.setText(dateFormat.format(startDate.getTime()));
    endDateButton.setText(dateFormat.format(endDate.getTime()));
    startDateButton.setOnClickListener(this);
    endDateButton.setOnClickListener(this);
  }
 public void initEditView() {
   // 处理回车键输入和返回键关闭
   input = (EditText) findViewById(R.id.editText1);
   input.getBackground().setAlpha(222);
   input.setOnKeyListener(
       new OnKeyListener() {
         @Override
         public boolean onKey(View v, int keyCode, KeyEvent event) {
           System.out.println("yzj111 onKey");
           // TODO Auto-generated method stub
           if (keyCode == KeyEvent.KEYCODE_ENTER) {
             System.out.println("yzj enter");
             try {
               test00TuringAndTrans();
             } catch (JSONException e) {
               e.printStackTrace();
             }
             return true;
           } else if (keyCode == KeyEvent.KEYCODE_BACK) {
             closeSelf();
           }
           return false;
         }
       });
   input.setInputType(InputType.TYPE_CLASS_TEXT);
   InputMethodManager imm =
       (InputMethodManager) tempContext.getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.showSoftInput(this, 0);
 }
 private void showInputMethod(View view) {
   final InputMethodManager imm =
       (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   if (imm != null) {
     imm.showSoftInput(view, 0);
   }
 }
Exemplo n.º 10
0
 public void showSoftKeyboard(View view) {
   if (view.requestFocus()) {
     InputMethodManager imm =
         (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
   }
 }
Exemplo n.º 11
0
 /**
  * Show soft keyboard (if no hardware keyboard).
  *
  * @param context the context
  * @param view the focused view
  */
 public static void showKeyboard(Activity context, View view) {
   InputMethodManager imm =
       (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
   if (imm != null) {
     imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
   }
 }
Exemplo n.º 12
0
  public void onScreenUiEngineAttached(final TnScreen screen, int attached) {
    int type = this.model.getInt(KEY_I_PLACE_OPERATION_TYPE);
    int state = this.model.getState();
    if ((type == ICommonConstants.PLACE_OPERATION_TYPE_EDIT
            || type == ICommonConstants.PLACE_OPERATION_TYPE_ADD)
        && state == STATE_CUSTOM_PLACE) {
      if (screen != null && attached == ITnScreenAttachedListener.AFTER_ATTACHED) {
        TeleNavDelegate.getInstance().setOrientation(TeleNavDelegate.ORIENTATION_UNSPECIFIED);
        TeleNavDelegate.getInstance()
            .callAppNativeFeature(
                TeleNavDelegate.FEATURE_UPDATE_WINDOW_SOFT_INPUT_MODE,
                new Object[] {PrimitiveTypeCache.valueOf(false), PrimitiveTypeCache.valueOf(true)});

        try {
          if (addressEditView != null) {
            EditText editText =
                (EditText) addressEditView.getDropDownField().getNativeUiComponent();
            AndroidActivity androidActivity =
                (AndroidActivity) AndroidPersistentContext.getInstance().getContext();
            InputMethodManager imm =
                (InputMethodManager) androidActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
          }
        } catch (Exception e) {

        }
      } else if (attached == DETTACHED) {
        TeleNavDelegate.getInstance()
            .callAppNativeFeature(TeleNavDelegate.FEATURE_UPDATE_WINDOW_SOFT_INPUT_MODE, null);
      }
    }
  }
Exemplo n.º 13
0
 /**
  * @param show
  * @param InputMethodManagerFlags 0 for regular (good for regular hide). or can use something like
  *     InputMethodManager.SHOW_FORCED or InputMethodManager.SHOW_IMPLICIT
  */
 public void hideShowKeyboard(boolean show, int InputMethodManagerFlags) {
   if (inputMethodManager == null) inputMethodManager = superTextActivity.getInputMethodManager();
   if (show) inputMethodManager.showSoftInput(autoCompleteTextView, InputMethodManagerFlags);
   else
     inputMethodManager.hideSoftInputFromWindow(
         autoCompleteTextView.getWindowToken(), InputMethodManagerFlags);
 }
Exemplo n.º 14
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);

    // TODO: create layout
    mHistoryAdapter = new SearchHistoryAdapter(this);
    mResultAdapter = new SearchResultAdapter(this);

    mSearchText = (EditText) findViewById(R.id.search_text);
    mSearchText.setOnEditorActionListener(searchTextListener);
    mSearchText.addTextChangedListener(searchTextWatcher);

    final Intent queryIntent = getIntent();
    final String queryAction = queryIntent.getAction();
    if (Intent.ACTION_SEARCH.equals(queryAction)) {
      String query = queryIntent.getStringExtra(SearchManager.QUERY);
      mSearchText.setText(query);
      mSearchText.setSelection(query.length());
    } else {
      InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.showSoftInput(mSearchText, InputMethodManager.RESULT_SHOWN);
      showSearchHistory();
    }

    mSearchText.requestFocus();
  }
Exemplo n.º 15
0
 public static void showInputMethod(View view) {
   InputMethodManager imm =
       (InputMethodManager) view.getContext().getSystemService("input_method");
   if (imm != null) {
     imm.showSoftInput(view, 0);
   }
 }
Exemplo n.º 16
0
 /**
  * 打开输入法面板
  *
  * @param activity
  */
 public static void showInputMethod(final Activity activity) {
   if (activity == null) return;
   InputMethodManager inputMethodManager =
       ((InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE));
   if (activity.getCurrentFocus() != null) {
     inputMethodManager.showSoftInput(activity.getCurrentFocus(), 0);
   }
 }
Exemplo n.º 17
0
 public static void showSoft(final EditText editText) {
   editText.requestFocus();
   InputMethodManager inputManager =
       (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
   inputManager.showSoftInput(editText, InputMethodManager.RESULT_SHOWN);
   // inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,
   // InputMethodManager.HIDE_IMPLICIT_ONLY);
 }
Exemplo n.º 18
0
 private void setKeyboardVisibilityForUrl(boolean visible) {
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   if (visible) {
     imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT);
   } else {
     imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0);
   }
 }
Exemplo n.º 19
0
  public void showKeyBoard() {
    InputMethodManager mgr =
        (InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    mgr.showSoftInput(webView, InputMethodManager.SHOW_IMPLICIT);

    ((InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE))
        .showSoftInput(webView, 0);
  }
 private void showInputMethod(View view) {
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   if (imm != null) {
     if (!imm.showSoftInput(view, 0)) {
       Log.w(TAG, "Failed to show soft input method.");
     }
   }
 }
Exemplo n.º 21
0
 /**
  * 动态显示软键盘
  *
  * @param context 上下文
  * @param edit 输入框
  */
 public static void showSoftInput(Context context, EditText edit) {
   edit.setFocusable(true);
   edit.setFocusableInTouchMode(true);
   edit.requestFocus();
   InputMethodManager imm =
       (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.showSoftInput(edit, 0);
 }
Exemplo n.º 22
0
 public void setFocus(Context context) {
   // Put focus on text input field and display soft keyboard if
   // appropriate.
   this.requestFocus();
   InputMethodManager inputManager =
       (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
   inputManager.showSoftInput(this, 0);
 }
Exemplo n.º 23
0
 public static boolean showSoftInput(Activity activity) {
   View view = activity.getCurrentFocus();
   if (view != null) {
     InputMethodManager imm =
         (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
     return imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
   }
   return false;
 }
Exemplo n.º 24
0
 private void showKeyboard(View view) {
   if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1 && view.hasFocus()) {
     view.clearFocus();
   }
   view.requestFocus();
   InputMethodManager imm =
       (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.showSoftInput(view, 0);
 }
Exemplo n.º 25
0
 public static void popSoftkeyboard(Context ctx, View view, boolean wantPop) {
   InputMethodManager imm =
       (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
   if (wantPop) {
     imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
   } else {
     imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
   }
 }
Exemplo n.º 26
0
 /**
  * 显示软键盘
  *
  * @param editText
  */
 private void showKeyboard(EditText editText) {
   editText.requestFocus();
   InputMethodManager imm =
       (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
   if (imm != null) {
     imm.showSoftInput(editText, 0);
   }
   moveCursor(editText);
 }
Exemplo n.º 27
0
 @Override
 public boolean onTouchEvent(MotionEvent event) {
   InputMethodManager imm =
       (InputMethodManager) this.mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
   if (imm != null) {
     imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);
   }
   return super.onTouchEvent(event);
 }
Exemplo n.º 28
0
 public void showKeyboard(View view, boolean isShowed) {
   InputMethodManager inputMethodManager =
       (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   if (isShowed) {
     inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
   } else {
     inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
   }
 }
  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);

    if (searchBox != null) {
      InputMethodManager imm =
          (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.showSoftInput(searchBox, InputMethodManager.SHOW_IMPLICIT);
    }
  }
Exemplo n.º 30
0
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case SHOW_SI:
              mImm.showSoftInput(mEditCityName, 0);
              break;

            default:
              break;
          }
        }