Hide emoji button when placing attachment and don't hide mic and camera

This commit is contained in:
Arne 2024-11-21 09:28:59 +01:00
parent 7657f5a04a
commit 567c1643d3
2 changed files with 14 additions and 7 deletions

View file

@ -4464,6 +4464,8 @@ public class ConversationFragment extends XmppFragment
final SendButtonAction action;
if (hasAttachments) {
action = SendButtonAction.TEXT;
binding.emojiButton.setVisibility(GONE);
binding.keyboardButton.setVisibility(GONE);
} else {
action = SendButtonTool.getAction(getActivity(), c, text, binding.textinputSubject.getText().toString());
}
@ -4489,22 +4491,24 @@ public class ConversationFragment extends XmppFragment
final Activity activity = getActivity();
if (activity != null) {
this.binding.textSendButton.setIconResource(
SendButtonTool.getSendButtonImageResource(action, text.length() > 0 || hasAttachments || (c.getThread() != null && binding.textinputSubject.getText().length() > 0)));
SendButtonTool.getSendButtonImageResource(action, !text.isEmpty() || hasAttachments || (c.getThread() != null && binding.textinputSubject.getText().length() > 0)));
}
if (activity == null) return;
final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity);
ViewGroup.LayoutParams params = binding.threadIdenticonLayout.getLayoutParams();
if (identiconWidth < 0) identiconWidth = params.width;
if (hasAttachments || !binding.textinput.getText().toString().isEmpty()) {
if (hasAttachments || !binding.textinput.getText().toString().replaceFirst("^(\\w|[, ])+:\\s*", "").isEmpty()) {
binding.conversationViewPager.setCurrentItem(0);
params.width = conversation.getThread() == null ? 0 : identiconWidth;
binding.quickButtons.setVisibility(GONE);
} else if (pref != null && pref.getBoolean("show_thread_feature", getResources().getBoolean(R.bool.show_thread_feature))) {
params.width = identiconWidth;
binding.quickButtons.setVisibility(VISIBLE);
} else {
params.width = 0;
}
if (!binding.textinput.getText().toString().isEmpty()) {
binding.quickButtons.setVisibility(GONE);
} else {
binding.quickButtons.setVisibility(VISIBLE);
params.width = 0;
}
if (!canWrite()) params.width = 0;
binding.threadIdenticonLayout.setLayoutParams(params);

View file

@ -218,6 +218,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_toEndOf="@id/emojiButton"
android:requiresFadingEdge="horizontal"
android:visibility="gone"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
@ -274,6 +275,8 @@
android:id="@+id/quickButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignBottom="@+id/textinput"
android:orientation="horizontal"
android:animateLayoutChanges="true" >
@ -306,8 +309,8 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/thread_identicon_layout"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"