diff --git a/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java b/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java
index dd710e6f..3bfa3b6c 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java
@@ -1,10 +1,101 @@
package gr.thmmy.mthmmy.utils;
import android.content.Context;
+import android.inputmethodservice.Keyboard;
+import android.inputmethodservice.KeyboardView;
+import android.support.design.widget.TextInputLayout;
+import android.support.v7.widget.AppCompatImageButton;
+import android.text.Editable;
+import android.view.LayoutInflater;
+import android.widget.EditText;
import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+
+import gr.thmmy.mthmmy.R;
+
+public class EditorView extends RelativeLayout {
+
+ private EditText editText;
+ private AppCompatImageButton submitButton;
-public class EditorView extends LinearLayout {
public EditorView(Context context) {
super(context);
+
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ inflater.inflate(R.layout.editor_view, this, true);
+
+ LinearLayout controls = (LinearLayout) getChildAt(0);
+ LinearLayout ediTextKeyboardAndSubmit = (LinearLayout) getChildAt(1);
+ editText = ((TextInputLayout) ediTextKeyboardAndSubmit.getChildAt(0)).getEditText();
+ submitButton = (AppCompatImageButton) ediTextKeyboardAndSubmit.getChildAt(1);
+
+ Keyboard emojiKeyboard = new Keyboard(context, R.xml.emoji_keyboard);
+ KeyboardView emojiKeyboardView= (KeyboardView) getChildAt(2);
+ emojiKeyboardView.setKeyboard(emojiKeyboard);
+ emojiKeyboardView.setPreviewEnabled(false);
+ emojiKeyboardView.setOnKeyboardActionListener(new EmojiKeyboardListener());
+ }
+
+ public Editable getText() {
+ return editText.getText();
+ }
+
+ public void setOnSubmitListener(OnClickListener onSubmitListener) {
+ submitButton.setOnClickListener(onSubmitListener);
+ }
+
+ class EmojiKeyboardListener implements KeyboardView.OnKeyboardActionListener {
+
+ public final static int SMILE = 10;
+
+ @Override
+ public void onPress(int primaryCode) {
+
+ }
+
+ @Override
+ public void onRelease(int primaryCode) {
+
+ }
+
+ @Override
+ public void onKey(int primaryCode, int[] keyCodes) {
+ Editable editable = editText.getText();
+ if (editText.hasSelection())
+ editable.delete(editText.getSelectionStart(), editText.getSelectionEnd());
+ int cursorIndex = editText.getSelectionStart();
+ String appendedText = "";
+ switch (primaryCode) {
+ case SMILE:
+ appendedText = "^:)^";
+ break;
+ }
+ editable.insert(cursorIndex, appendedText);
+ }
+
+ @Override
+ public void onText(CharSequence text) {
+
+ }
+
+ @Override
+ public void swipeLeft() {
+
+ }
+
+ @Override
+ public void swipeRight() {
+
+ }
+
+ @Override
+ public void swipeDown() {
+
+ }
+
+ @Override
+ public void swipeUp() {
+
+ }
}
-}
+ }
diff --git a/app/src/main/res/layout/editor_view.xml b/app/src/main/res/layout/editor_view.xml
index 7a6e4251..fcf709c7 100644
--- a/app/src/main/res/layout/editor_view.xml
+++ b/app/src/main/res/layout/editor_view.xml
@@ -1,13 +1,11 @@
-
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml-keyssoft/emoji_keyboard.xml b/app/src/main/res/xml-keyssoft/emoji_keyboard.xml
new file mode 100644
index 00000000..59d49623
--- /dev/null
+++ b/app/src/main/res/xml-keyssoft/emoji_keyboard.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
\ No newline at end of file