android.view.inputmethod.InputMethodManager#isAcceptingText ( )源码实例Demo

下面列出了android.view.inputmethod.InputMethodManager#isAcceptingText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: smartcoins-wallet   文件: LockableActivity.java
public void showKeyboard(View view) {
    InputMethodManager imm = (InputMethodManager)
            getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);

    if (imm.isAcceptingText()) {
        Log.d(TAG, "Software Keyboard was shown");
    } else {
        Log.d(TAG, "Software Keyboard was not shown.");
        //Sometimes the android doesn't show the keyboard at start up. Scheduling a new open solved for all tested cases
        if (view.getVisibility() == View.VISIBLE) {
            Log.d(TAG, "View is still visible. Scheduling a new input opening attempt...");
            final View runnableView = view;
            view.postDelayed(new Runnable() {
                public void run() {
                    // do work
                    showKeyboard(runnableView);
                }
            }, 100);
        }
    }
}
 
源代码2 项目: mollyim-android   文件: HiddenEditText.java
@Override
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
  boolean focus = super.requestFocus(direction, previouslyFocusedRect);

  if (currentTextEntity != null && focus) {
    currentTextEntity.setFocused(true);
    InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);
    if (!imm.isAcceptingText()) {
      imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_IMPLICIT_ONLY);
    }
  }

  return focus;
}
 
源代码3 项目: Game   文件: GameActivity.java
public void drawKeyboard() {
      InputMethodManager imm = (InputMethodManager) this
              .getSystemService(Context.INPUT_METHOD_SERVICE);
      Objects.requireNonNull(imm).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
      if (imm.isAcceptingText()) osConfig.F_SHOWING_KEYBOARD = true;
      if (Config.S_SIDE_MENU_TOGGLE) {
      	hadSideMenu = mudclient.getOptionSideMenu();
	mudclient.setOptionSideMenu(false);
}
  }
 
源代码4 项目: simpleSDL   文件: SDLActivity.java
/**
 * This method is called by SDL using JNI.
 */
public static boolean isScreenKeyboardShown() 
{
    if (mTextEdit == null) {
        return false;
    }

    if (!mScreenKeyboardShown) {
        return false;
    }

    InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    return imm.isAcceptingText();

}
 
源代码5 项目: Primary   文件: MainActivity.java
private void goAwayKeys(EditText input) {
    InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);

    if(imm!=null && imm.isAcceptingText()) { // verify if the soft keyboard is open
        if (input!=null) {
            imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
        } else if (getCurrentFocus()!=null){
            imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
        }
    }
}
 
源代码6 项目: journaldev   文件: MainActivity.java
private void hideSoftKeyBoard() {
    InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);

    if (imm.isAcceptingText()) {
        // verify if the soft keyboard is open
        imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
    }
}
 
源代码7 项目: deltachat-android   文件: HiddenEditText.java
@Override
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
  boolean focus = super.requestFocus(direction, previouslyFocusedRect);

  if (currentTextEntity != null && focus) {
    currentTextEntity.setFocused(true);
    InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);
    if (!imm.isAcceptingText()) {
      imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_IMPLICIT_ONLY);
    }
  }

  return focus;
}
 
源代码8 项目: AutoAP   文件: MainActivity.java
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.save_button:
            ssid = ssidEditText.getText().toString();
            password = passwordEditText.getText().toString();

            if (TextUtils.isEmpty(ssid)) {
                ssidEditText.setError("Network SSID is empty");
                return;
            }
            if (TextUtils.isEmpty(password) || password.length() < WifiAPUtils.PASS_MIN_LENGTH) {
                passwordEditText.setError("You must have 8 characters in password");
                return;
            }

            SharedPreferences.Editor editor = mSharedPrefs.edit();
            editor.putString(Constants.PREFS_SSID, ssid);
            editor.putString(Constants.PREFS_SECURITY, securityType);
            editor.putString(Constants.PREFS_PASSWORD, password);
            editor.commit();

            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            if (inputMethodManager.isAcceptingText()) {
                inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
            }

            Toast.makeText(MainActivity.this, "Network Info saved", Toast.LENGTH_SHORT).show();
            break;
        case R.id.tethering_image:
            if (mSwitch.isChecked()) {
                mSwitch.setChecked(false);
            } else {
                mSwitch.setChecked(true);
            }
            break;
    }
}
 
源代码9 项目: QuickLyric   文件: LyricsViewFragment.java
private void exitEditTagsMode() {
    ((ImageButton) getActivity().findViewById(R.id.edit_tags_btn)).setImageResource(R.drawable.ic_done_anim);
    Drawable editIcon = ((ImageButton) getActivity().findViewById(R.id.edit_tags_btn)).getDrawable();
    ((Animatable) editIcon).start();

    if (getActivity().getCurrentFocus() != null) {
        InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm.isAcceptingText())
            imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
    }

    EditText songTV = getActivity().findViewById(R.id.song);
    EditText artistTV = getActivity().findViewById(R.id.artist);
    EditText newLyrics = getActivity().findViewById(R.id.edit_lyrics);

    songTV.setInputType(InputType.TYPE_NULL);
    artistTV.setInputType(InputType.TYPE_NULL);
    songTV.setBackgroundColor(Color.TRANSPARENT);
    artistTV.setBackgroundColor(Color.TRANSPARENT);

    String txt = mLrcThread == null ? null : mLyrics.getText();
    if (txt == null)
        txt = "";

    File musicFile = Id3Reader.getFile(getActivity(), mLyrics.getOriginalArtist(), mLyrics.getOriginalTitle(), true);

    if (!mLyrics.getArtist().equals(artistTV.getText().toString())
            || !mLyrics.getTitle().equals(songTV.getText().toString())
            || !Html.fromHtml(txt).toString().equals(newLyrics.getText().toString())) {
        mLyrics.setArtist(artistTV.getText().toString());
        mLyrics.setTitle(songTV.getText().toString());
        mLyrics.setText(newLyrics.getText().toString().replaceAll("\n", "<br/>"));
        if (PermissionsChecker.requestPermission(getActivity(),
                "android.permission.WRITE_EXTERNAL_STORAGE", 0, Id3Writer.REQUEST_CODE))
            new Id3Writer(this).execute(mLyrics, musicFile);
    } else
        new Id3Writer(this).onPreExecute();
    update(mLyrics, getView(), false);
}
 
源代码10 项目: android-port   文件: SDLActivity.java
/**
 * This method is called by SDL using JNI.
 */
public static boolean isScreenKeyboardShown() 
{
    if (mTextEdit == null) {
        return false;
    }

    if (!mScreenKeyboardShown) {
        return false;
    }

    InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    return imm.isAcceptingText();

}
 
源代码11 项目: ResearchStack   文件: ViewTaskActivity.java
private void hideKeyboard() {
    InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
    if (imm.isActive() && imm.isAcceptingText()) {
        imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
    }
}