void paste (String content, boolean fireChangeEvent) { if (content == null) return; StringBuilder buffer = new StringBuilder(); int textLength = text.length(); if (hasSelection) textLength -= Math.abs(cursor - selectionStart); BitmapFontData data = style.font.getData(); for (int i = 0, n = content.length(); i < n; i++) { if (!withinMaxLength(textLength + buffer.length())) break; char c = content.charAt(i); if (!(writeEnters && (c == ENTER_ANDROID || c == ENTER_DESKTOP))) { if (c == '\r' || c == '\n') continue; if (onlyFontChars && !data.hasGlyph(c)) continue; if (filter != null && !filter.acceptChar(this, c)) continue; } buffer.append(c); } content = buffer.toString(); if (hasSelection) cursor = delete(fireChangeEvent); if (fireChangeEvent) changeText(text, insert(cursor, content, text)); else text = insert(cursor, content, text); updateDisplayText(); cursor += content.length(); }
boolean backspace = character == BACKSPACE; boolean enter = character == ENTER_DESKTOP || character == ENTER_ANDROID; boolean add = enter ? writeEnters : (!onlyFontChars || style.font.getData().hasGlyph(character)); boolean remove = backspace || delete; if (add || remove) {
boolean backspace = character == BACKSPACE; boolean enter = character == ENTER_DESKTOP || character == ENTER_ANDROID; boolean add = enter ? writeEnters : (!onlyFontChars || style.font.getData().hasGlyph(character)); boolean remove = backspace || delete; if (add || remove) {
boolean backspace = character == BACKSPACE; boolean enter = character == ENTER_DESKTOP || character == ENTER_ANDROID; boolean add = enter ? writeEnters : (!onlyFontChars || style.font.getData().hasGlyph(character)); boolean remove = backspace || delete; if (add || remove) {
if (c == '\r' || c == '\n') continue; if (onlyFontChars && !data.hasGlyph(c)) continue; if (filter != null && !filter.acceptChar(this, c))
void paste (String content, boolean fireChangeEvent) { if (content == null) return; StringBuilder buffer = new StringBuilder(); int textLength = text.length(); if (hasSelection) textLength -= Math.abs(cursor - selectionStart); BitmapFontData data = style.font.getData(); for (int i = 0, n = content.length(); i < n; i++) { if (!withinMaxLength(textLength + buffer.length())) break; char c = content.charAt(i); if (!(writeEnters && (c == ENTER_ANDROID || c == ENTER_DESKTOP))) { if (c == '\r' || c == '\n') continue; if (onlyFontChars && !data.hasGlyph(c)) continue; if (filter != null && !filter.acceptChar(this, c)) continue; } buffer.append(c); } content = buffer.toString(); if (hasSelection) cursor = delete(fireChangeEvent); if (fireChangeEvent) changeText(text, insert(cursor, content, text)); else text = insert(cursor, content, text); updateDisplayText(); cursor += content.length(); }
void paste (String content, boolean fireChangeEvent) { if (content == null) return; StringBuilder buffer = new StringBuilder(); int textLength = text.length(); if (hasSelection) textLength -= Math.abs(cursor - selectionStart); BitmapFontData data = style.font.getData(); for (int i = 0, n = content.length(); i < n; i++) { if (!withinMaxLength(textLength + buffer.length())) break; char c = content.charAt(i); if (!(writeEnters && (c == ENTER_ANDROID || c == ENTER_DESKTOP))) { if (c == '\r' || c == '\n') continue; if (onlyFontChars && !data.hasGlyph(c)) continue; if (filter != null && !filter.acceptChar(this, c)) continue; } buffer.append(c); } content = buffer.toString(); if (hasSelection) cursor = delete(fireChangeEvent); if (fireChangeEvent) changeText(text, insert(cursor, content, text)); else text = insert(cursor, content, text); updateDisplayText(); cursor += content.length(); }
boolean backspace = character == BACKSPACE; boolean enter = character == ENTER_DESKTOP || character == ENTER_ANDROID; boolean add = enter ? writeEnters : (!onlyFontChars || style.font.getData().hasGlyph(character)); boolean remove = backspace || delete; if (add || remove) {
boolean backspace = character == BACKSPACE; boolean enter = character == ENTER_DESKTOP || character == ENTER_ANDROID; boolean add = enter ? writeEnters : (!onlyFontChars || style.font.getData().hasGlyph(character)); boolean remove = backspace || delete; if (add || remove) {
void paste (String content, boolean fireChangeEvent) { if (content == null) return; StringBuilder buffer = new StringBuilder(); int textLength = text.length(); if (hasSelection) textLength -= Math.abs(cursor - selectionStart); BitmapFontData data = style.font.getData(); for (int i = 0, n = content.length(); i < n; i++) { if (!withinMaxLength(textLength + buffer.length())) break; char c = content.charAt(i); if (!(writeEnters && (c == ENTER_ANDROID || c == ENTER_DESKTOP))) { if (c == '\r' || c == '\n') continue; if (onlyFontChars && !data.hasGlyph(c)) continue; if (filter != null && !filter.acceptChar(this, c)) continue; } buffer.append(c); } content = buffer.toString(); if (hasSelection) cursor = delete(fireChangeEvent); if (fireChangeEvent) changeText(text, insert(cursor, content, text)); else text = insert(cursor, content, text); updateDisplayText(); cursor += content.length(); }