|
@ -38,7 +38,7 @@ import gr.thmmy.mthmmy.R; |
|
|
|
|
|
|
|
|
public class EditorView extends LinearLayout implements EmojiInputField { |
|
|
public class EditorView extends LinearLayout implements EmojiInputField { |
|
|
|
|
|
|
|
|
private static final int ANIMATION_DURATION = 100; |
|
|
private static final int ANIMATION_DURATION = 200; |
|
|
private SparseArray<String> colors = new SparseArray<>(); |
|
|
private SparseArray<String> colors = new SparseArray<>(); |
|
|
|
|
|
|
|
|
private TextInputLayout edittextWrapper; |
|
|
private TextInputLayout edittextWrapper; |
|
@ -308,24 +308,32 @@ public class EditorView extends LinearLayout implements EmojiInputField { |
|
|
this.emojiKeyboard = emojiKeyboard; |
|
|
this.emojiKeyboard = emojiKeyboard; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void setMarkdownVisible(boolean visible) { |
|
|
|
|
|
formatButtonsRecyclerview.setVisibility(visible ? VISIBLE : GONE); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void showMarkdownOnfocus() { |
|
|
public void showMarkdownOnfocus() { |
|
|
edittextWrapper.setOnClickListener(view -> { |
|
|
edittextWrapper.setOnClickListener(view -> { |
|
|
showMarkdown(); |
|
|
showMarkdown(); |
|
|
}); |
|
|
}); |
|
|
editText.setOnClickListener(view -> { |
|
|
editText.setOnClickListener(view -> { |
|
|
|
|
|
if (!emojiKeyboard.isVisible()) { |
|
|
|
|
|
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Activity.INPUT_METHOD_SERVICE); |
|
|
|
|
|
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); |
|
|
|
|
|
} else { |
|
|
|
|
|
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Activity.INPUT_METHOD_SERVICE); |
|
|
|
|
|
imm.hideSoftInputFromWindow(getWindowToken(), 0); |
|
|
|
|
|
requestEditTextFocus(); |
|
|
|
|
|
} |
|
|
showMarkdown(); |
|
|
showMarkdown(); |
|
|
}); |
|
|
}); |
|
|
edittextWrapper.setOnFocusChangeListener((view, b) -> { |
|
|
edittextWrapper.setOnFocusChangeListener((view, b) -> { |
|
|
if (b) showMarkdown(); |
|
|
if (b) { |
|
|
else hideMarkdown(); |
|
|
emojiKeyboard.onEmojiInputFieldFocused(EditorView.this); |
|
|
|
|
|
showMarkdown(); |
|
|
|
|
|
} else hideMarkdown(); |
|
|
}); |
|
|
}); |
|
|
editText.setOnFocusChangeListener((view, b) -> { |
|
|
editText.setOnFocusChangeListener((view, b) -> { |
|
|
if (b) showMarkdown(); |
|
|
if (b) { |
|
|
else hideMarkdown(); |
|
|
emojiKeyboard.onEmojiInputFieldFocused(EditorView.this); |
|
|
|
|
|
showMarkdown(); |
|
|
|
|
|
} else hideMarkdown(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|