mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
ViewStub for EmojiDrawer
// FREEBIE
This commit is contained in:
parent
508a666e76
commit
41c9bed155
@ -67,11 +67,12 @@
|
||||
android:text="160/160 (1)" />
|
||||
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
|
||||
android:id="@+id/emoji_drawer"
|
||||
<ViewStub
|
||||
android:id="@+id/emoji_drawer_stub"
|
||||
android:layout="@layout/conversation_activity_emojidrawer_stub"
|
||||
android:inflatedId="@+id/emoji_drawer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
</org.thoughtcrime.securesms.components.camera.QuickAttachmentDrawer>
|
||||
|
7
res/layout/conversation_activity_emojidrawer_stub.xml
Normal file
7
res/layout/conversation_activity_emojidrawer_stub.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/emoji_drawer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
@ -214,7 +214,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
private AudioRecorder audioRecorder;
|
||||
private BroadcastReceiver securityUpdateReceiver;
|
||||
private BroadcastReceiver recipientsStaleReceiver;
|
||||
private EmojiDrawer emojiDrawer;
|
||||
private Stub<EmojiDrawer> emojiDrawerStub;
|
||||
protected HidingLinearLayout quickAttachmentToggle;
|
||||
private QuickAttachmentDrawer quickAttachmentDrawer;
|
||||
private InputPanel inputPanel;
|
||||
@ -326,7 +326,10 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
super.onConfigurationChanged(newConfig);
|
||||
composeText.setTransport(sendButton.getSelectedTransport());
|
||||
quickAttachmentDrawer.onConfigurationChanged();
|
||||
if (container.getCurrentInput() == emojiDrawer) container.hideAttachedInput(true);
|
||||
|
||||
if (emojiDrawerStub.resolved() && container.getCurrentInput() == emojiDrawerStub.get()) {
|
||||
container.hideAttachedInput(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -987,7 +990,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
attachButton = ViewUtil.findById(this, R.id.attach_button);
|
||||
composeText = ViewUtil.findById(this, R.id.embedded_text_editor);
|
||||
charactersLeft = ViewUtil.findById(this, R.id.space_left);
|
||||
emojiDrawer = ViewUtil.findById(this, R.id.emoji_drawer);
|
||||
emojiDrawerStub = ViewUtil.findStubById(this, R.id.emoji_drawer_stub);
|
||||
unblockButton = ViewUtil.findById(this, R.id.unblock_button);
|
||||
makeDefaultSmsButton = ViewUtil.findById(this, R.id.make_default_sms_button);
|
||||
composePanel = ViewUtil.findById(this, R.id.bottom_panel);
|
||||
@ -1001,7 +1004,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
View composeBubble = ViewUtil.findById(this, R.id.compose_bubble);
|
||||
|
||||
container.addOnKeyboardShownListener(this);
|
||||
inputPanel.setListener(this, emojiDrawer);
|
||||
inputPanel.setListener(this);
|
||||
inputPanel.setMediaListener(this);
|
||||
|
||||
int[] attributes = new int[]{R.attr.conversation_item_bubble_background};
|
||||
@ -1017,7 +1020,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
SendButtonListener sendButtonListener = new SendButtonListener();
|
||||
ComposeKeyPressedListener composeKeyPressedListener = new ComposeKeyPressedListener();
|
||||
|
||||
emojiDrawer.setEmojiEventListener(inputPanel);
|
||||
composeText.setOnEditorActionListener(sendButtonListener);
|
||||
attachButton.setOnClickListener(new AttachButtonListener());
|
||||
attachButton.setOnLongClickListener(new AttachButtonLongClickListener());
|
||||
@ -1624,8 +1626,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
@Override
|
||||
public void onEmojiToggle() {
|
||||
if (container.getCurrentInput() == emojiDrawer) container.showSoftkey(composeText);
|
||||
else container.show(composeText, emojiDrawer);
|
||||
if (!emojiDrawerStub.resolved()) {
|
||||
inputPanel.setEmojiDrawer(emojiDrawerStub.get());
|
||||
emojiDrawerStub.get().setEmojiEventListener(inputPanel);
|
||||
}
|
||||
|
||||
if (container.getCurrentInput() == emojiDrawerStub.get()) {
|
||||
container.showSoftkey(composeText);
|
||||
} else {
|
||||
container.show(composeText, emojiDrawerStub.get());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
|
||||
import org.thoughtcrime.securesms.util.views.Stub;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -99,10 +100,9 @@ public class InputPanel extends LinearLayout
|
||||
}
|
||||
}
|
||||
|
||||
public void setListener(final @NonNull Listener listener, @NonNull EmojiDrawer emojiDrawer) {
|
||||
public void setListener(final @NonNull Listener listener) {
|
||||
this.listener = listener;
|
||||
|
||||
emojiToggle.attach(emojiDrawer);
|
||||
emojiToggle.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -115,6 +115,10 @@ public class InputPanel extends LinearLayout
|
||||
composeText.setMediaListener(listener);
|
||||
}
|
||||
|
||||
public void setEmojiDrawer(@NonNull EmojiDrawer emojiDrawer) {
|
||||
emojiToggle.attach(emojiDrawer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecordPressed(float startPositionX) {
|
||||
if (listener != null) listener.onRecorderStarted();
|
||||
|
Loading…
Reference in New Issue
Block a user