use of org.thoughtcrime.securesms.scribbles.widget.entity.TextEntity in project Signal-Android by WhisperSystems.
the class ScribbleActivity method addTextSticker.
protected void addTextSticker() {
TextLayer textLayer = createTextLayer();
TextEntity textEntity = new TextEntity(textLayer, scribbleView.getWidth(), scribbleView.getHeight());
scribbleView.addEntityAndPosition(textEntity);
// move text sticker up so that its not hidden under keyboard
PointF center = textEntity.absoluteCenter();
center.y = center.y * 0.5F;
textEntity.moveCenterTo(center);
// redraw
scribbleView.invalidate();
startTextEntityEditing();
changeTextEntityColor(toolbar.getToolColor());
}
use of org.thoughtcrime.securesms.scribbles.widget.entity.TextEntity in project Signal-Android by WhisperSystems.
the class MotionView method selectEntity.
private void selectEntity(@Nullable MotionEntity entity, boolean updateCallback) {
if (selectedEntity != null) {
selectedEntity.setIsSelected(false);
if (selectedEntity instanceof TextEntity) {
editText.clearComposingText();
editText.clearFocus();
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
}
if (entity != null) {
entity.setIsSelected(true);
}
selectedEntity = entity;
invalidate();
if (updateCallback && motionViewCallback != null) {
motionViewCallback.onEntitySelected(entity);
}
}
use of org.thoughtcrime.securesms.scribbles.widget.entity.TextEntity in project Signal-Android by signalapp.
the class MotionView method selectEntity.
private void selectEntity(@Nullable MotionEntity entity, boolean updateCallback) {
if (selectedEntity != null) {
selectedEntity.setIsSelected(false);
if (selectedEntity instanceof TextEntity) {
editText.clearComposingText();
editText.clearFocus();
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
}
if (entity != null) {
entity.setIsSelected(true);
}
selectedEntity = entity;
invalidate();
if (updateCallback && motionViewCallback != null) {
motionViewCallback.onEntitySelected(entity);
}
}
use of org.thoughtcrime.securesms.scribbles.widget.entity.TextEntity in project Signal-Android by signalapp.
the class ScribbleActivity method addTextSticker.
protected void addTextSticker() {
TextLayer textLayer = createTextLayer();
TextEntity textEntity = new TextEntity(textLayer, scribbleView.getWidth(), scribbleView.getHeight());
scribbleView.addEntityAndPosition(textEntity);
// move text sticker up so that its not hidden under keyboard
PointF center = textEntity.absoluteCenter();
center.y = center.y * 0.5F;
textEntity.moveCenterTo(center);
// redraw
scribbleView.invalidate();
startTextEntityEditing();
changeTextEntityColor(toolbar.getToolColor());
}
use of org.thoughtcrime.securesms.scribbles.widget.entity.TextEntity in project Signal-Android by WhisperSystems.
the class MotionView method afterTextChanged.
@Override
public void afterTextChanged(Editable s) {
String text = s.toString();
MotionEntity entity = getSelectedEntity();
if (entity != null && entity instanceof TextEntity) {
TextEntity textEntity = (TextEntity) entity;
if (!textEntity.getLayer().getText().equals(text)) {
textEntity.getLayer().setText(text);
textEntity.updateEntity();
MotionView.this.invalidate();
}
}
}
Aggregations