Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Dec 17, 2024
2 parents c125d4f + e647401 commit 490f1ef
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 11 deletions.
25 changes: 18 additions & 7 deletions src/main/java/org/thoughtcrime/securesms/ConversationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -177,7 +179,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
private AttachmentTypeSelector attachmentTypeSelector;
private AttachmentManager attachmentManager;
private AudioRecorder audioRecorder;
private Stub<MediaKeyboard> emojiDrawerStub;
private FrameLayout emojiPickerContainer;
private MediaKeyboard emojiPicker;
protected HidingLinearLayout quickAttachmentToggle;
private QuickAttachmentDrawer quickAttachmentDrawer;
private InputPanel inputPanel;
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.components.emoji.MediaKeyboard
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">

<androidx.emoji2.emojipicker.EmojiPickerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/emoji_picker"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?emoji_drawer_background"
app:emojiGridColumns="12"/>

</org.thoughtcrime.securesms.components.emoji.MediaKeyboard>
14 changes: 14 additions & 0 deletions src/main/res/layout-land/reaction_picker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.emoji2.emojipicker.EmojiPickerView
android:id="@+id/emoji_picker"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:emojiGridColumns="10"/>
</RelativeLayout>
7 changes: 3 additions & 4 deletions src/main/res/layout/conversation_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@

<include layout="@layout/conversation_input_panel"/>

<ViewStub
android:id="@+id/emoji_drawer_stub"
<FrameLayout
android:id="@+id/emoji_picker_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inflatedId="@+id/emoji_drawer"
android:layout="@layout/conversation_activity_emojidrawer_stub" />
/>

</LinearLayout>
</org.thoughtcrime.securesms.components.camera.QuickAttachmentDrawer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: on modifications also update the layout-land folder. -->
<org.thoughtcrime.securesms.components.emoji.MediaKeyboard
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/emoji_drawer"
Expand Down
1 change: 1 addition & 0 deletions src/main/res/layout/reaction_picker.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: on modifications also update the layout-land folder. -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
Expand Down

0 comments on commit 490f1ef

Please sign in to comment.