enhance the InputPanel: make it pill-like with rounder corners

This commit is contained in:
adbenitez
2026-06-28 19:30:10 +02:00
parent 36fc2261f9
commit deb650970c
9 changed files with 66 additions and 51 deletions
@@ -1053,7 +1053,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
// apply padding top to avoid drawing behind top bar
ViewUtil.applyWindowInsets(findViewById(R.id.fragment_content), false, true, false, false);
// apply padding to root to avoid collision with system bars
ViewUtil.applyWindowInsets(findViewById(R.id.root_layout), true, false, true, true);
ViewUtil.applyWindowInsets(findViewById(R.id.root_layout), true, false, true, false);
ViewUtil.applyWindowInsets(emojiPickerContainer, false, false, false, true);
container.addOnKeyboardShownListener(this);
container.addOnKeyboardHiddenListener(backgroundView);
@@ -1178,7 +1179,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
beforeSearchAttachmentEditorHidden = isAttachmentHidden;
} else {
inputPanel.setVisibility(inputPanelVisibility);
attachmentManager.setHidden(isAttachmentHidden);
//attachmentManager.setHidden(isAttachmentHidden);
}
}
}
@@ -1916,7 +1917,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
beforeSearchMsgRequestVisibility = messageRequestBottomView.getVisibility();
beforeSearchInputPanelVisibility = inputPanel.getVisibility();
attachmentManager.setHidden(true);
//attachmentManager.setHidden(true);
messageRequestBottomView.setVisibility(View.GONE);
inputPanel.setVisibility(View.GONE);
}
@@ -1927,7 +1928,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
private void searchCollapse() {
synchronized (searchLock) {
searchMenu = null;
attachmentManager.setHidden(beforeSearchAttachmentEditorHidden);
//attachmentManager.setHidden(beforeSearchAttachmentEditorHidden);
messageRequestBottomView.setVisibility(beforeSearchMsgRequestVisibility);
inputPanel.setVisibility(beforeSearchInputPanelVisibility);
}
@@ -77,7 +77,7 @@ public class AttachmentManager {
private static final String TAG = "AttachmentManager";
private final @NonNull Context context;
private final @NonNull Stub<View> attachmentViewStub;
private final @NonNull View attachmentView;
private final @NonNull AttachmentListener attachmentListener;
private RemovableEditableMediaView removableMediaView;
@@ -98,20 +98,16 @@ public class AttachmentManager {
public AttachmentManager(@NonNull Activity activity, @NonNull AttachmentListener listener) {
this.context = activity;
this.attachmentListener = listener;
this.attachmentViewStub = ViewUtil.findStubById(activity, R.id.attachment_editor_stub);
}
private void inflateStub() {
if (!attachmentViewStub.resolved()) {
View root = attachmentViewStub.get();
this.thumbnail = ViewUtil.findById(root, R.id.attachment_thumbnail);
this.audioView = ViewUtil.findById(root, R.id.attachment_audio);
this.documentView = ViewUtil.findById(root, R.id.attachment_document);
this.webxdcView = ViewUtil.findById(root, R.id.attachment_webxdc);
this.vcardView = ViewUtil.findById(root, R.id.attachment_vcard);
// this.mapView = ViewUtil.findById(root, R.id.attachment_location);
this.removableMediaView = ViewUtil.findById(root, R.id.removable_media_view);
this.attachmentView = ViewUtil.findById(activity, R.id.attachment_editor);
if (this.attachmentView != null) {
this.thumbnail = ViewUtil.findById(attachmentView, R.id.attachment_thumbnail);
this.audioView = ViewUtil.findById(attachmentView, R.id.attachment_audio);
this.documentView = ViewUtil.findById(attachmentView, R.id.attachment_document);
this.webxdcView = ViewUtil.findById(attachmentView, R.id.attachment_webxdc);
this.vcardView = ViewUtil.findById(attachmentView, R.id.attachment_vcard);
// this.mapView = ViewUtil.findById(attachmentView, R.id.attachment_location);
this.removableMediaView = ViewUtil.findById(attachmentView, R.id.removable_media_view);
removableMediaView.addRemoveClickListener(new RemoveButtonListener());
removableMediaView.setEditClickListener(new EditButtonListener());
@@ -120,10 +116,10 @@ public class AttachmentManager {
}
public void clear(@NonNull GlideRequests glideRequests, boolean animate) {
if (attachmentViewStub.resolved()) {
if (this.attachmentView != null) {
if (animate) {
ViewUtil.fadeOut(attachmentViewStub.get(), 200)
ViewUtil.fadeOut(attachmentView, 200)
.addListener(
new ListenableFuture.Listener<Boolean>() {
@Override
@@ -229,7 +225,6 @@ public class AttachmentManager {
final int height,
final int chatId,
AudioPlaybackViewModel playbackViewModel) {
inflateStub();
final SettableFuture<Boolean> result = new SettableFuture<>();
@@ -803,9 +798,9 @@ public class AttachmentManager {
} else {
vis = View.GONE;
}
if (vis == View.GONE && !attachmentViewStub.resolved()) {
if (attachmentView == null) {
return;
}
attachmentViewStub.get().setVisibility(vis);
attachmentView.setVisibility(vis);
}
}
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?attr/input_panel_bg_color" />
<corners android:radius="25dp" />
</shape>
@@ -36,20 +36,19 @@
android:layout_height="0dp"
android:layout_weight="1" />
<ViewStub
android:id="@+id/attachment_editor_stub"
android:inflatedId="@+id/attachment_editor"
android:layout="@layout/conversation_activity_attachment_editor_stub"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<org.thoughtcrime.securesms.messagerequests.MessageRequestsBottomView
android:id="@+id/conversation_activity_message_request_bottom_bar"
android:background="?android:attr/windowBackground"
android:background="@drawable/input_panel_rounded_bg"
android:elevation="1dp"
android:outlineProvider="background"
android:visibility="gone"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:paddingLeft="16dp"
android:paddingStart="16dp"
android:paddingRight="16dp"
@@ -5,7 +5,6 @@
android:id="@+id/attachment_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/input_panel_bg_color"
android:gravity="center_horizontal"
android:visibility="gone">
@@ -29,9 +28,9 @@
android:contentDescription="@string/menu_add_attachment"
app:thumbnail_radius="@dimen/message_corner_radius"
app:minWidth="100dp"
app:maxWidth="300dp"
app:maxWidth="200dp"
app:minHeight="100dp"
app:maxHeight="300dp" />
app:maxHeight="200dp" />
<org.thoughtcrime.securesms.components.audioplay.AudioView
android:id="@+id/attachment_audio"
@@ -29,9 +29,9 @@
<View
android:id="@+id/bottom_divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:background="@drawable/compose_divider_background"
android:background="@android:color/transparent"
android:alpha="1" />
<ImageButton
@@ -8,11 +8,18 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:clickable="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:clipChildren="false"
android:clipToPadding="false"
android:background="?attr/input_panel_bg_color">
android:background="@drawable/input_panel_rounded_bg"
android:elevation="1dp"
android:outlineProvider="background"
>
<org.thoughtcrime.securesms.components.QuoteView
android:id="@+id/quote_view"
@@ -25,6 +32,15 @@
app:message_type="preview"
tools:visibility="visible" />
<include
layout="@layout/conversation_activity_attachment_editor_stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/quote_view"
/>
<EditText
android:id="@+id/subject_text"
style="@style/ComposeEditText"
@@ -39,7 +55,7 @@
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/quote_view"
app:layout_constraintTop_toBottomOf="@id/attachment_editor"
tools:visibility="visible" />
<FrameLayout
@@ -69,11 +85,11 @@
android:id="@+id/emoji_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_gravity="bottom"
android:minHeight="40dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:background="@drawable/touch_highlight_background"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:background="@drawable/circle_touch_highlight_background"
android:contentDescription="@string/menu_toggle_keyboard" />
<org.thoughtcrime.securesms.components.ComposeText
@@ -105,11 +121,11 @@
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:src="?quick_camera_icon"
android:paddingLeft="11dp"
android:paddingRight="11dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:background="@drawable/touch_highlight_background"
android:background="@drawable/circle_touch_highlight_background"
android:contentDescription="@string/camera" />
<org.thoughtcrime.securesms.components.MicrophoneRecorderView
@@ -136,15 +152,14 @@
<org.thoughtcrime.securesms.components.AnimatingToggle
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/input_field_frame_layout"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/button_toggle"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="6dp"
android:background="@drawable/send_button_bg"
android:layout_gravity="center_vertical">
android:layout_gravity="bottom">
<ImageButton
android:id="@+id/attach_button"
@@ -4,7 +4,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="8dp"
android:layout_margin="4dp"
android:src="@drawable/conversation_attachment_edit"
android:contentDescription="@string/global_menu_edit_desktop"
android:visibility="gone" />
+1 -1
View File
@@ -24,7 +24,7 @@
<dimen name="message_bubble_bottom_padding">6dp</dimen>
<dimen name="message_bubble_showmore_padding">8dp</dimen>
<dimen name="transparent_footer_padding">2dp</dimen>
<dimen name="media_bubble_remove_button_size">24dp</dimen>
<dimen name="media_bubble_remove_button_size">28dp</dimen>
<dimen name="media_bubble_edit_button_size">24dp</dimen>
<dimen name="media_bubble_default_dimens">210dp</dimen>
<dimen name="media_bubble_min_width">150dp</dimen>