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)" />
|
android:text="160/160 (1)" />
|
||||||
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
|
<ViewStub
|
||||||
android:id="@+id/emoji_drawer"
|
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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"/>
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</org.thoughtcrime.securesms.components.camera.QuickAttachmentDrawer>
|
</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 AudioRecorder audioRecorder;
|
||||||
private BroadcastReceiver securityUpdateReceiver;
|
private BroadcastReceiver securityUpdateReceiver;
|
||||||
private BroadcastReceiver recipientsStaleReceiver;
|
private BroadcastReceiver recipientsStaleReceiver;
|
||||||
private EmojiDrawer emojiDrawer;
|
private Stub<EmojiDrawer> emojiDrawerStub;
|
||||||
protected HidingLinearLayout quickAttachmentToggle;
|
protected HidingLinearLayout quickAttachmentToggle;
|
||||||
private QuickAttachmentDrawer quickAttachmentDrawer;
|
private QuickAttachmentDrawer quickAttachmentDrawer;
|
||||||
private InputPanel inputPanel;
|
private InputPanel inputPanel;
|
||||||
@ -326,7 +326,10 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
composeText.setTransport(sendButton.getSelectedTransport());
|
composeText.setTransport(sendButton.getSelectedTransport());
|
||||||
quickAttachmentDrawer.onConfigurationChanged();
|
quickAttachmentDrawer.onConfigurationChanged();
|
||||||
if (container.getCurrentInput() == emojiDrawer) container.hideAttachedInput(true);
|
|
||||||
|
if (emojiDrawerStub.resolved() && container.getCurrentInput() == emojiDrawerStub.get()) {
|
||||||
|
container.hideAttachedInput(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -987,7 +990,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
attachButton = ViewUtil.findById(this, R.id.attach_button);
|
attachButton = ViewUtil.findById(this, R.id.attach_button);
|
||||||
composeText = ViewUtil.findById(this, R.id.embedded_text_editor);
|
composeText = ViewUtil.findById(this, R.id.embedded_text_editor);
|
||||||
charactersLeft = ViewUtil.findById(this, R.id.space_left);
|
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);
|
unblockButton = ViewUtil.findById(this, R.id.unblock_button);
|
||||||
makeDefaultSmsButton = ViewUtil.findById(this, R.id.make_default_sms_button);
|
makeDefaultSmsButton = ViewUtil.findById(this, R.id.make_default_sms_button);
|
||||||
composePanel = ViewUtil.findById(this, R.id.bottom_panel);
|
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);
|
View composeBubble = ViewUtil.findById(this, R.id.compose_bubble);
|
||||||
|
|
||||||
container.addOnKeyboardShownListener(this);
|
container.addOnKeyboardShownListener(this);
|
||||||
inputPanel.setListener(this, emojiDrawer);
|
inputPanel.setListener(this);
|
||||||
inputPanel.setMediaListener(this);
|
inputPanel.setMediaListener(this);
|
||||||
|
|
||||||
int[] attributes = new int[]{R.attr.conversation_item_bubble_background};
|
int[] attributes = new int[]{R.attr.conversation_item_bubble_background};
|
||||||
@ -1017,7 +1020,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
SendButtonListener sendButtonListener = new SendButtonListener();
|
SendButtonListener sendButtonListener = new SendButtonListener();
|
||||||
ComposeKeyPressedListener composeKeyPressedListener = new ComposeKeyPressedListener();
|
ComposeKeyPressedListener composeKeyPressedListener = new ComposeKeyPressedListener();
|
||||||
|
|
||||||
emojiDrawer.setEmojiEventListener(inputPanel);
|
|
||||||
composeText.setOnEditorActionListener(sendButtonListener);
|
composeText.setOnEditorActionListener(sendButtonListener);
|
||||||
attachButton.setOnClickListener(new AttachButtonListener());
|
attachButton.setOnClickListener(new AttachButtonListener());
|
||||||
attachButton.setOnLongClickListener(new AttachButtonLongClickListener());
|
attachButton.setOnLongClickListener(new AttachButtonLongClickListener());
|
||||||
@ -1624,8 +1626,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEmojiToggle() {
|
public void onEmojiToggle() {
|
||||||
if (container.getCurrentInput() == emojiDrawer) container.showSoftkey(composeText);
|
if (!emojiDrawerStub.resolved()) {
|
||||||
else container.show(composeText, emojiDrawer);
|
inputPanel.setEmojiDrawer(emojiDrawerStub.get());
|
||||||
|
emojiDrawerStub.get().setEmojiEventListener(inputPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (container.getCurrentInput() == emojiDrawerStub.get()) {
|
||||||
|
container.showSoftkey(composeText);
|
||||||
|
} else {
|
||||||
|
container.show(composeText, emojiDrawerStub.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
|||||||
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
||||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||||
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
|
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
|
||||||
|
import org.thoughtcrime.securesms.util.views.Stub;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
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;
|
this.listener = listener;
|
||||||
|
|
||||||
emojiToggle.attach(emojiDrawer);
|
|
||||||
emojiToggle.setOnClickListener(new OnClickListener() {
|
emojiToggle.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -115,6 +115,10 @@ public class InputPanel extends LinearLayout
|
|||||||
composeText.setMediaListener(listener);
|
composeText.setMediaListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEmojiDrawer(@NonNull EmojiDrawer emojiDrawer) {
|
||||||
|
emojiToggle.attach(emojiDrawer);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRecordPressed(float startPositionX) {
|
public void onRecordPressed(float startPositionX) {
|
||||||
if (listener != null) listener.onRecorderStarted();
|
if (listener != null) listener.onRecorderStarted();
|
||||||
|
Loading…
Reference in New Issue
Block a user