From d51596681a111febac1fed8be98f40ae1a4eacd3 Mon Sep 17 00:00:00 2001
From: Thodoris1999 <teotyrov@gmail.com>
Date: Wed, 29 Aug 2018 13:38:14 +0300
Subject: [PATCH] parametrize editor background drawable

---
 app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java   | 8 +++++++-
 .../main/res/layout/activity_topic_quick_reply_row.xml    | 3 ++-
 app/src/main/res/layout/editor_view.xml                   | 4 +---
 3 files changed, 10 insertions(+), 5 deletions(-)

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 4cd206cb..6ee24b8b 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java
@@ -4,7 +4,7 @@ import android.app.Activity;
 import android.app.AlertDialog;
 import android.content.Context;
 import android.content.res.TypedArray;
-import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
 import android.support.annotation.Nullable;
 import android.support.design.widget.TextInputEditText;
 import android.support.design.widget.TextInputLayout;
@@ -65,6 +65,12 @@ public class EditorView extends LinearLayout {
             a.recycle();
         }
 
+        // without this, the editor gets default window background
+        Drawable background = getBackground();
+        for (int i = 0; i < getChildCount(); i++) {
+            getChildAt(i).setBackground(background);
+        }
+
         emojiButton = findViewById(R.id.emoji_keyboard_button);
 
         editText.setOnTouchListener((v, event) -> {
diff --git a/app/src/main/res/layout/activity_topic_quick_reply_row.xml b/app/src/main/res/layout/activity_topic_quick_reply_row.xml
index 8ba43925..63b0cdf6 100644
--- a/app/src/main/res/layout/activity_topic_quick_reply_row.xml
+++ b/app/src/main/res/layout/activity_topic_quick_reply_row.xml
@@ -84,7 +84,8 @@
                 android:id="@+id/reply_editorview"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                card_view:hint="Post message"/>
+                android:background="@color/card_background"
+                card_view:hint="Post message" />
         </LinearLayout>
     </android.support.v7.widget.CardView>
 </FrameLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/editor_view.xml b/app/src/main/res/layout/editor_view.xml
index 018d908a..4d4cfd77 100644
--- a/app/src/main/res/layout/editor_view.xml
+++ b/app/src/main/res/layout/editor_view.xml
@@ -8,8 +8,7 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
-        app:columnWidth="36dp"
-        android:background="@color/card_background">
+        app:columnWidth="36dp">
         <!--bold, italic, etc buttons-->
         <android.support.v7.widget.AppCompatImageButton
             android:id="@+id/bold_button"
@@ -121,7 +120,6 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
-        android:background="@color/card_background"
         android:paddingLeft="16dp"
         android:paddingRight="16dp">