diff --git a/src/main/java/org/thoughtcrime/securesms/ConversationActivity.java b/src/main/java/org/thoughtcrime/securesms/ConversationActivity.java index 62a2b3f31..0e5af41ec 100644 --- a/src/main/java/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/main/java/org/thoughtcrime/securesms/ConversationActivity.java @@ -42,6 +42,7 @@ import android.util.Log; import android.util.Pair; import android.view.KeyEvent; +import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -50,6 +51,7 @@ import android.view.View.OnKeyListener; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; +import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; @@ -177,7 +179,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity private AttachmentTypeSelector attachmentTypeSelector; private AttachmentManager attachmentManager; private AudioRecorder audioRecorder; - private Stub emojiDrawerStub; + private FrameLayout emojiPickerContainer; + private MediaKeyboard emojiPicker; protected HidingLinearLayout quickAttachmentToggle; private QuickAttachmentDrawer quickAttachmentDrawer; private InputPanel inputPanel; @@ -321,10 +324,11 @@ public void onConfigurationChanged(Configuration newConfig) { composeText.setTransport(sendButton.getSelectedTransport()); quickAttachmentDrawer.onConfigurationChanged(); - if (emojiDrawerStub.resolved() && container.getCurrentInput() == emojiDrawerStub.get()) { + if (emojiPicker != null && container.getCurrentInput() == emojiPicker) { container.hideAttachedInput(true); } + emojiPicker = null; // force reloading next time onEmojiToggle() is called initializeBackground(); } @@ -812,7 +816,7 @@ private void initializeViews() { sendButton = ViewUtil.findById(this, R.id.send_button); attachButton = ViewUtil.findById(this, R.id.attach_button); composeText = ViewUtil.findById(this, R.id.embedded_text_editor); - emojiDrawerStub = ViewUtil.findStubById(this, R.id.emoji_drawer_stub); + emojiPickerContainer = ViewUtil.findById(this, R.id.emoji_picker_container); composePanel = ViewUtil.findById(this, R.id.bottom_panel); container = ViewUtil.findById(this, R.id.layout_container); quickAttachmentDrawer = ViewUtil.findById(this, R.id.quick_attachment_drawer); @@ -1277,16 +1281,23 @@ public void onFailure(ExecutionException e) {} }); } + private void reloadEmojiPicker() { + emojiPickerContainer.removeAllViews(); + emojiPicker = (MediaKeyboard) LayoutInflater.from(this).inflate(R.layout.conversation_activity_emojidrawer_stub, emojiPickerContainer, false); + emojiPickerContainer.addView(emojiPicker); + inputPanel.setMediaKeyboard(emojiPicker); + } + @Override public void onEmojiToggle() { - if (!emojiDrawerStub.resolved()) { - inputPanel.setMediaKeyboard(emojiDrawerStub.get()); + if (emojiPicker == null) { + reloadEmojiPicker(); } - if (container.getCurrentInput() == emojiDrawerStub.get()) { + if (container.getCurrentInput() == emojiPicker) { container.showSoftkey(composeText); } else { - container.show(composeText, emojiDrawerStub.get()); + container.show(composeText, emojiPicker); } } diff --git a/src/main/res/layout-land/conversation_activity_emojidrawer_stub.xml b/src/main/res/layout-land/conversation_activity_emojidrawer_stub.xml new file mode 100644 index 000000000..9417360bf --- /dev/null +++ b/src/main/res/layout-land/conversation_activity_emojidrawer_stub.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/src/main/res/layout-land/reaction_picker.xml b/src/main/res/layout-land/reaction_picker.xml new file mode 100644 index 000000000..0115e91fa --- /dev/null +++ b/src/main/res/layout-land/reaction_picker.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/src/main/res/layout/conversation_activity.xml b/src/main/res/layout/conversation_activity.xml index 84dbe644c..c775db827 100644 --- a/src/main/res/layout/conversation_activity.xml +++ b/src/main/res/layout/conversation_activity.xml @@ -57,12 +57,11 @@ - + /> diff --git a/src/main/res/layout/conversation_activity_emojidrawer_stub.xml b/src/main/res/layout/conversation_activity_emojidrawer_stub.xml index 390d15011..742adefaf 100644 --- a/src/main/res/layout/conversation_activity_emojidrawer_stub.xml +++ b/src/main/res/layout/conversation_activity_emojidrawer_stub.xml @@ -1,4 +1,5 @@ + +