From 3aced6ac9c188c183310acfefeff6b602bdc54c4 Mon Sep 17 00:00:00 2001 From: Thodoris1999 Date: Wed, 29 Aug 2018 13:28:51 +0300 Subject: [PATCH] fixes: color picker scrollbar, correct viewholder update on backpress with emoji keyboard visible --- .../activities/topic/TopicActivity.java | 2 +- .../gr/thmmy/mthmmy/utils/EditorView.java | 6 +- .../res/layout/editor_view_color_picker.xml | 98 +++++++++++++++---- 3 files changed, 85 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java index 02cc60a8..99be894c 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java @@ -264,7 +264,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo if (viewModel.isEditingPost()) topicAdapter.notifyItemChanged(viewModel.getPostBeingEditedPosition()); if (viewModel.isWritingReply()) - topicAdapter.notifyItemChanged(viewModel.postCount() - 1); + topicAdapter.notifyItemChanged(viewModel.postCount()); return; } else if (viewModel.isWritingReply()) { postsList.remove(postsList.size() - 1); 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 70175858..4cd206cb 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java +++ b/app/src/main/java/gr/thmmy/mthmmy/utils/EditorView.java @@ -19,6 +19,7 @@ import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import android.widget.LinearLayout; import android.widget.PopupWindow; +import android.widget.ScrollView; import java.util.Objects; @@ -133,8 +134,9 @@ public class EditorView extends LinearLayout { popupWindow.setHeight(LayoutParams.WRAP_CONTENT); popupWindow.setWidth(LayoutParams.WRAP_CONTENT); popupWindow.setFocusable(true); - LinearLayout colorPicker = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.editor_view_color_picker, null); - popupWindow.setContentView(colorPicker); + ScrollView colorPickerScrollview = (ScrollView) LayoutInflater.from(context).inflate(R.layout.editor_view_color_picker, null); + LinearLayout colorPicker = (LinearLayout) colorPickerScrollview.getChildAt(0); + popupWindow.setContentView(colorPickerScrollview); for (int i = 0; i < colorPicker.getChildCount(); i++) { colorPicker.getChildAt(i).setOnClickListener(v -> { if (editText.hasSelection()) diff --git a/app/src/main/res/layout/editor_view_color_picker.xml b/app/src/main/res/layout/editor_view_color_picker.xml index 7ac8a236..0ac2d71b 100644 --- a/app/src/main/res/layout/editor_view_color_picker.xml +++ b/app/src/main/res/layout/editor_view_color_picker.xml @@ -1,21 +1,83 @@ - - - - - - - - - - - - - - - - \ No newline at end of file + android:layout_height="wrap_content"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file