@Override public void onTextChanged( final CharSequence s, final int start, final int before, final int count) { mLogger.info("onTextChanged", view); if ((view != null) && (view.getContent() instanceof EditableDrawable)) { final EditableDrawable editable = (EditableDrawable) view.getContent(); if (!editable.isEditing()) return; editable.setText(s.toString()); if (topHv.equals(view)) { editTopButton.setText(s); clearButtonTop.setVisibility( s != null && s.length() > 0 ? View.VISIBLE : View.INVISIBLE); } else if (bottomHv.equals(view)) { editBottomButton.setText(s); clearButtonBottom.setVisibility( s != null && s.length() > 0 ? View.VISIBLE : View.INVISIBLE); } view.forceUpdate(); setIsChanged(true); } }
/** * Terminates an edit view. * * @param hv the hv */ private void endEditView(DrawableHighlightView hv) { EditableDrawable text = (EditableDrawable) hv.getContent(); mLogger.info("endEditView", text.isEditing()); if (text.isEditing()) { text.endEdit(); endEditText(hv); } CharSequence value = text.getText(); if (topHv.equals(hv)) { editTopButton.setText(value); clearButtonTop.setVisibility( value != null && value.length() > 0 ? View.VISIBLE : View.INVISIBLE); } else if (bottomHv.equals(hv)) { editBottomButton.setText(value); clearButtonBottom.setVisibility( value != null && value.length() > 0 ? View.VISIBLE : View.INVISIBLE); } }