android.text.method.ArrowKeyMovementMethod Java Examples
The following examples show how to use
android.text.method.ArrowKeyMovementMethod.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: mongol-library Author: suragch File: MongolInputMethodManager.java License: MIT License | 6 votes |
private void setAllowSystemKeyboardOnEditText(EditText editText, boolean allowSystemKeyboard) { // TODO this needs to be tested on lower versions! // https://stackoverflow.com/a/45229457 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // api 21+ editText.setShowSoftInputOnFocus(allowSystemKeyboard); } else { // api 11+ if (allowSystemKeyboard) { // re-enable keyboard (see https://stackoverflow.com/a/45228867) // FIXME this does not necessarily always work editText.setTextIsSelectable(false); editText.setFocusable(true); editText.setFocusableInTouchMode(true); editText.setClickable(true); editText.setLongClickable(true); editText.setMovementMethod(ArrowKeyMovementMethod.getInstance()); editText.setText(editText.getText(), TextView.BufferType.SPANNABLE); } else { // disable keyboard editText.setTextIsSelectable(true); } } }
Example #2
Source Project: litho Author: facebook File: TextInputSpecTest.java License: Apache License 2.0 | 5 votes |
@Test public void testDefaultMovementMethod() { Component.Builder component = TextInput.create(mContext); final android.widget.EditText editText = getEditText(component); assertThat(editText.getMovementMethod()).isInstanceOf(ArrowKeyMovementMethod.class); assertThat(new EditText(getApplicationContext()).getMovementMethod()) .isInstanceOf(ArrowKeyMovementMethod.class); }
Example #3
Source Project: SmileEssence Author: lacolaco File: PostFragment.java License: MIT License | 5 votes |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Logger.debug("PostFragment CreateView"); MainActivity activity = (MainActivity) getActivity(); PostState.getState().setListener(this); UserPreferenceHelper preferenceHelper = new UserPreferenceHelper(activity); View v = inflater.inflate(R.layout.fragment_post, null); buttonTweet = getTweetButton(v); buttonTweet.setOnClickListener(this); editText = getEditText(v); textViewCount = getCountTextView(v); int textSize = preferenceHelper.getValue(R.string.key_setting_text_size, 10); editText.addTextChangedListener(this); editText.setOnFocusChangeListener(this); editText.setTextSize(textSize + 4); editText.setMovementMethod(new ArrowKeyMovementMethod() { @Override protected boolean right(TextView widget, Spannable buffer) { //Don't back to Home return widget.getSelectionEnd() == widget.length() || super.right(widget, buffer); } }); ImageButton imageButtonDeleteText = (ImageButton) v.findViewById(R.id.button_post_delete); imageButtonDeleteText.setOnClickListener(this); ImageButton imageButtonMedia = (ImageButton) v.findViewById(R.id.button_post_media); imageButtonMedia.setOnClickListener(this); ImageButton imageButtonMenu = (ImageButton) v.findViewById(R.id.button_post_menu); imageButtonMenu.setOnClickListener(this); //Reply view viewGroupReply = getReplyViewGroup(v); ImageButton imageButtonDeleteReply = (ImageButton) viewGroupReply.findViewById(R.id.button_post_reply_delete); imageButtonDeleteReply.setOnClickListener(this); //Media view viewGroupMedia = getMediaViewGroup(v); ImageView imageViewMedia = (ImageView) viewGroupMedia.findViewById(R.id.image_post_media); ImageButton imageButtonDeleteMedia = (ImageButton) viewGroupMedia.findViewById(R.id.button_post_media_delete); imageViewMedia.setOnClickListener(this); imageButtonDeleteMedia.setOnClickListener(this); editText.requestFocus(); return v; }
Example #4
Source Project: android_9.0.0_r45 Author: lulululbj File: EditText.java License: Apache License 2.0 | 4 votes |
@Override protected MovementMethod getDefaultMovementMethod() { return ArrowKeyMovementMethod.getInstance(); }
Example #5
Source Project: java-n-IDE-for-Android Author: shenghuntianlang File: HighlightEditor.java License: Apache License 2.0 | 4 votes |
@Override protected MovementMethod getDefaultMovementMethod() { return ArrowKeyMovementMethod.getInstance(); }
Example #6
Source Project: Android-Music-Player Author: KishanV File: FMedittext.java License: MIT License | 4 votes |
@Override protected MovementMethod getDefaultMovementMethod() { return ArrowKeyMovementMethod.getInstance(); }