List of usage examples for android.text InputType TYPE_TEXT_FLAG_IME_MULTI_LINE
int TYPE_TEXT_FLAG_IME_MULTI_LINE
To view the source code for android.text InputType TYPE_TEXT_FLAG_IME_MULTI_LINE.
Click Source Link
From source file:sharedcode.turboeditor.activity.MainActivity.java
public void onEvent(EventBusEvents.APreferenceValueWasChanged event) { if (event.hasType(EventBusEvents.APreferenceValueWasChanged.Type.THEME_CHANGE)) { ThemeUtils.setWindowsBackground(this); }/* w ww . j ava2 s.co m*/ if (event.hasType(WRAP_CONTENT)) { if (PreferenceHelper.getWrapContent(this)) { horizontalScroll.removeView(mEditor); verticalScroll.removeView(horizontalScroll); verticalScroll.addView(mEditor); } else { verticalScroll.removeView(mEditor); verticalScroll.addView(horizontalScroll); horizontalScroll.addView(mEditor); } } else if (event.hasType(LINE_NUMERS)) { mEditor.disableTextChangedListener(); mEditor.replaceTextKeepCursor(null, true); mEditor.enableTextChangedListener(); if (PreferenceHelper.getLineNumbers(this)) { mEditor.setPadding( EditTextPadding.getPaddingWithLineNumbers(this, PreferenceHelper.getFontSize(this)), EditTextPadding.getPaddingTop(this), 0, 0); } else { mEditor.setPadding(EditTextPadding.getPaddingWithoutLineNumbers(this), EditTextPadding.getPaddingTop(this), 0, 0); } } else if (event.hasType(SYNTAX)) { mEditor.disableTextChangedListener(); mEditor.replaceTextKeepCursor(null, true); mEditor.enableTextChangedListener(); } else if (event.hasType(MONOSPACE)) { if (PreferenceHelper.getUseMonospace(this)) mEditor.setTypeface(Typeface.MONOSPACE); else mEditor.setTypeface(Typeface.DEFAULT); } else if (event.hasType(THEME_CHANGE)) { if (PreferenceHelper.getLightTheme(this)) { mEditor.setTextColor(getResources().getColor(R.color.textColorInverted)); } else { mEditor.setTextColor(getResources().getColor(R.color.textColor)); } } else if (event.hasType(TEXT_SUGGESTIONS) || event.hasType(READ_ONLY)) { if (PreferenceHelper.getReadOnly(this)) { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); mEditor.setReadOnly(true); } else { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED); mEditor.setReadOnly(false); if (PreferenceHelper.getSuggestionActive(this)) { mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE); } else { mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE); } } // sometimes it becomes monospace after setting the input type if (PreferenceHelper.getUseMonospace(this)) mEditor.setTypeface(Typeface.MONOSPACE); else mEditor.setTypeface(Typeface.DEFAULT); } else if (event.hasType(FONT_SIZE)) { if (PreferenceHelper.getLineNumbers(this)) { mEditor.setPadding( EditTextPadding.getPaddingWithLineNumbers(this, PreferenceHelper.getFontSize(this)), EditTextPadding.getPaddingTop(this), 0, 0); } else { mEditor.setPadding(EditTextPadding.getPaddingWithoutLineNumbers(this), EditTextPadding.getPaddingTop(this), 0, 0); } mEditor.setTextSize(PreferenceHelper.getFontSize(this)); } else if (event.hasType(ENCODING)) { String oldEncoding, newEncoding; oldEncoding = currentEncoding; newEncoding = PreferenceHelper.getEncoding(this); try { final byte[] oldText = mEditor.getText().toString().getBytes(oldEncoding); mEditor.disableTextChangedListener(); mEditor.replaceTextKeepCursor(new String(oldText, newEncoding), true); mEditor.enableTextChangedListener(); currentEncoding = newEncoding; } catch (UnsupportedEncodingException ignored) { try { final byte[] oldText = mEditor.getText().toString().getBytes(oldEncoding); mEditor.disableTextChangedListener(); mEditor.replaceTextKeepCursor(new String(oldText, "UTF-8"), true); mEditor.enableTextChangedListener(); } catch (UnsupportedEncodingException ignored2) { } } } }
From source file:com.maskyn.fileeditorpro.activity.MainActivity.java
void aPreferenceValueWasChanged(List<PreferenceChangeType> types) { if (types.contains(PreferenceChangeType.THEME_CHANGE)) { ThemeUtils.setWindowsBackground(this); AccessoryView accessoryView = (AccessoryView) findViewById(R.id.accessoryView); accessoryView.updateTextColors(); }/*from w w w. j a va 2 s. c om*/ if (types.contains(PreferenceChangeType.WRAP_CONTENT)) { if (PreferenceHelper.getWrapContent(this)) { horizontalScroll.removeView(mEditor); verticalScroll.removeView(horizontalScroll); verticalScroll.addView(mEditor); } else { verticalScroll.removeView(mEditor); verticalScroll.addView(horizontalScroll); horizontalScroll.addView(mEditor); } } else if (types.contains(PreferenceChangeType.LINE_NUMERS)) { mEditor.disableTextChangedListener(); mEditor.replaceTextKeepCursor(null); mEditor.enableTextChangedListener(); mEditor.updatePadding(); } else if (types.contains(PreferenceChangeType.SYNTAX)) { mEditor.disableTextChangedListener(); mEditor.replaceTextKeepCursor(mEditor.getText().toString()); mEditor.enableTextChangedListener(); } else if (types.contains(PreferenceChangeType.MONOSPACE)) { if (PreferenceHelper.getUseMonospace(this)) mEditor.setTypeface(Typeface.MONOSPACE); else mEditor.setTypeface(Typeface.DEFAULT); } else if (types.contains(PreferenceChangeType.THEME_CHANGE)) { if (PreferenceHelper.getLightTheme(this)) { mEditor.setTextColor(getResources().getColor(R.color.textColorInverted)); } else { mEditor.setTextColor(getResources().getColor(R.color.textColor)); } } else if (types.contains(PreferenceChangeType.TEXT_SUGGESTIONS) || types.contains(PreferenceChangeType.READ_ONLY)) { if (PreferenceHelper.getReadOnly(this)) { mEditor.setReadOnly(true); } else { mEditor.setReadOnly(false); if (PreferenceHelper.getSuggestionActive(this)) { mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE); } else { mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE); } } // sometimes it becomes monospace after setting the input type if (PreferenceHelper.getUseMonospace(this)) mEditor.setTypeface(Typeface.MONOSPACE); else mEditor.setTypeface(Typeface.DEFAULT); } else if (types.contains(PreferenceChangeType.FONT_SIZE)) { mEditor.updatePadding(); mEditor.setTextSize(PreferenceHelper.getFontSize(this)); } else if (types.contains(PreferenceChangeType.ACCESSORY_VIEW)) { HorizontalScrollView parentAccessoryView = (HorizontalScrollView) findViewById( R.id.parent_accessory_view); ViewUtils.setVisible(parentAccessoryView, PreferenceHelper.getUseAccessoryView(this)); mEditor.updatePadding(); } else if (types.contains(PreferenceChangeType.ENCODING)) { String oldEncoding, newEncoding; oldEncoding = currentEncoding; newEncoding = PreferenceHelper.getEncoding(this); try { final byte[] oldText = mEditor.getText().toString().getBytes(oldEncoding); mEditor.disableTextChangedListener(); mEditor.replaceTextKeepCursor(new String(oldText, newEncoding)); mEditor.enableTextChangedListener(); currentEncoding = newEncoding; } catch (UnsupportedEncodingException ignored) { try { final byte[] oldText = mEditor.getText().toString().getBytes(oldEncoding); mEditor.disableTextChangedListener(); mEditor.replaceTextKeepCursor(new String(oldText, "UTF-16")); mEditor.enableTextChangedListener(); } catch (UnsupportedEncodingException ignored2) { } } } }