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 90cf54b3..69de150b 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java +++ b/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java @@ -3,6 +3,8 @@ package gr.thmmy.mthmmy.utils; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; +import android.content.res.TypedArray; +import android.support.design.widget.TextInputEditText; import android.support.design.widget.TextInputLayout; import android.support.v7.widget.AppCompatImageButton; import android.text.Editable; @@ -13,7 +15,6 @@ import android.view.LayoutInflater; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; -import android.widget.EditText; import android.widget.LinearLayout; import android.widget.PopupWindow; @@ -24,9 +25,8 @@ import gr.thmmy.mthmmy.R; public class EditorView extends LinearLayout { private SparseArray colors = new SparseArray<>(); - private SparseArray fonts = new SparseArray<>(); - private EditText editText; + private TextInputEditText editText; private AppCompatImageButton emojiButton; private AppCompatImageButton submitButton; private EmojiKeyboard.EmojiKeyboardOwner emojiKeyboardOwner; @@ -52,6 +52,14 @@ public class EditorView extends LinearLayout { setOrientation(VERTICAL); editText = findViewById(R.id.editor_edittext); + + TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.EditorView, 0, 0); + try { + ((TextInputLayout) findViewById(R.id.editor_edittext_wrapper)).setHint(a.getString(R.styleable.EditorView_hint)); + } finally { + a.recycle(); + } + emojiButton = findViewById(R.id.emoji_keyboard_button); editText.setOnTouchListener((v, event) -> { diff --git a/app/src/main/res/layout/activity_test_edit_view.xml b/app/src/main/res/layout/activity_test_edit_view.xml index c5c6ad00..cd65173f 100644 --- a/app/src/main/res/layout/activity_test_edit_view.xml +++ b/app/src/main/res/layout/activity_test_edit_view.xml @@ -3,13 +3,15 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".activities.TestEditView"> + android:layout_alignParentTop="true" + app:hint="Post message"/> - diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index af0f695f..293db5cd 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -3,4 +3,8 @@ + + + + \ No newline at end of file