put PM hint above edittext. fixes #3432

This commit is contained in:
Daniel Gultsch 2019-04-26 10:23:26 +02:00
parent 182a81e3ef
commit 8a1a9f4f55
3 changed files with 70 additions and 50 deletions

View file

@ -424,11 +424,13 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets); setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets);
} }
//TODO store uuid in attribute
public boolean setCorrectingMessage(Message correctingMessage) { public boolean setCorrectingMessage(Message correctingMessage) {
this.correctingMessage = correctingMessage; this.correctingMessage = correctingMessage;
return correctingMessage == null && draftMessage != null; return correctingMessage == null && draftMessage != null;
} }
//TODO: dynamically find by uuid
public Message getCorrectingMessage() { public Message getCorrectingMessage() {
return this.correctingMessage; return this.correctingMessage;
} }

View file

@ -778,14 +778,19 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
public void updateChatMsgHint() { public void updateChatMsgHint() {
final boolean multi = conversation.getMode() == Conversation.MODE_MULTI; final boolean multi = conversation.getMode() == Conversation.MODE_MULTI;
if (conversation.getCorrectingMessage() != null) { if (conversation.getCorrectingMessage() != null) {
this.binding.textInputHint.setVisibility(View.GONE);
this.binding.textinput.setHint(R.string.send_corrected_message); this.binding.textinput.setHint(R.string.send_corrected_message);
} else if (multi && conversation.getNextCounterpart() != null) { } else if (multi && conversation.getNextCounterpart() != null) {
this.binding.textinput.setHint(getString( this.binding.textinput.setHint(R.string.send_unencrypted_message);
this.binding.textInputHint.setVisibility(View.VISIBLE);
this.binding.textInputHint.setText(getString(
R.string.send_private_message_to, R.string.send_private_message_to,
conversation.getNextCounterpart().getResource())); conversation.getNextCounterpart().getResource()));
} else if (multi && !conversation.getMucOptions().participating()) { } else if (multi && !conversation.getMucOptions().participating()) {
this.binding.textInputHint.setVisibility(View.GONE);
this.binding.textinput.setHint(R.string.you_are_not_participating); this.binding.textinput.setHint(R.string.you_are_not_participating);
} else { } else {
this.binding.textInputHint.setVisibility(View.GONE);
this.binding.textinput.setHint(UIHelper.getMessageHint(getActivity(), conversation)); this.binding.textinput.setHint(UIHelper.getMessageHint(getActivity(), conversation));
getActivity().invalidateOptionsMenu(); getActivity().invalidateOptionsMenu();
} }

View file

@ -2,8 +2,7 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout <RelativeLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/color_background_secondary"> android:background="?attr/color_background_secondary">
@ -14,6 +13,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/snackbar" android:layout_above="@+id/snackbar"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:background="?attr/color_background_secondary" android:background="?attr/color_background_secondary"
android:divider="@null" android:divider="@null"
@ -21,23 +21,21 @@
android:listSelector="@android:color/transparent" android:listSelector="@android:color/transparent"
android:stackFromBottom="true" android:stackFromBottom="true"
android:transcriptMode="normal" android:transcriptMode="normal"
tools:listitem="@layout/message_sent" tools:listitem="@layout/message_sent"></ListView>
android:layout_alignParentLeft="true">
</ListView>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/scroll_to_bottom_button" android:id="@+id/scroll_to_bottom_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignBottom="@+id/messages_view" android:layout_alignBottom="@+id/messages_view"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:alpha="0.85" android:alpha="0.85"
app:backgroundTint="?attr/color_background_primary"
android:src="?attr/icon_scroll_down" android:src="?attr/icon_scroll_down"
app:fabSize="mini"
android:visibility="gone" android:visibility="gone"
app:useCompatPadding="true" app:backgroundTint="?attr/color_background_primary"
android:layout_alignParentRight="true" /> app:fabSize="mini"
app:useCompatPadding="true" />
<eu.siacs.conversations.ui.widget.UnreadCountCustomView <eu.siacs.conversations.ui.widget.UnreadCountCustomView
android:id="@+id/unread_count_custom_view" android:id="@+id/unread_count_custom_view"
@ -45,75 +43,90 @@
android:layout_height="?attr/IconSize" android:layout_height="?attr/IconSize"
android:layout_alignTop="@+id/scroll_to_bottom_button" android:layout_alignTop="@+id/scroll_to_bottom_button"
android:layout_alignEnd="@+id/scroll_to_bottom_button" android:layout_alignEnd="@+id/scroll_to_bottom_button"
android:layout_alignRight="@+id/scroll_to_bottom_button"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:elevation="8dp" android:elevation="8dp"
android:visibility="gone" android:visibility="gone"
app:backgroundColor="?attr/unread_count" app:backgroundColor="?attr/unread_count"
android:layout_alignRight="@+id/scroll_to_bottom_button" tools:ignore="RtlCompat" />
tools:ignore="RtlCompat"
android:layout_marginRight="8dp" />
<RelativeLayout <RelativeLayout
android:id="@+id/textsend" android:id="@+id/textsend"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="?attr/color_background_primary" android:layout_alignParentLeft="true"
android:layout_alignParentLeft="true"> android:layout_alignParentBottom="true"
android:background="?attr/color_background_primary">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:visibility="gone"
android:id="@+id/media_preview" android:id="@+id/media_preview"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_toStartOf="@+id/textSendButton" android:layout_toStartOf="@+id/textSendButton"
tools:listitem="@layout/media_preview" android:layout_toLeftOf="@+id/textSendButton"
android:orientation="horizontal" android:orientation="horizontal"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:paddingTop="8dp" android:paddingTop="8dp"
android:requiresFadingEdge="horizontal" android:requiresFadingEdge="horizontal"
android:layout_alignParentLeft="true" android:visibility="gone"
android:layout_toLeftOf="@+id/textSendButton"> app:layoutManager="android.support.v7.widget.LinearLayoutManager"
tools:listitem="@layout/media_preview">
</android.support.v7.widget.RecyclerView> </android.support.v7.widget.RecyclerView>
<eu.siacs.conversations.ui.widget.EditMessage <LinearLayout
android:id="@+id/textinput"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_toStartOf="@+id/textSendButton" android:layout_toStartOf="@+id/textSendButton"
android:layout_toLeftOf="@+id/textSendButton"
android:orientation="vertical">
<TextView
android:id="@+id/text_input_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:maxLines="1"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textAppearance="@style/TextAppearance.Conversations.Caption.Highlight"
android:visibility="gone" />
<eu.siacs.conversations.ui.widget.EditMessage
android:id="@+id/textinput"
style="@style/Widget.Conversations.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/color_background_primary" android:background="?attr/color_background_primary"
android:ems="10" android:ems="10"
style="@style/Widget.Conversations.EditText"
android:imeOptions="flagNoExtractUi|actionSend" android:imeOptions="flagNoExtractUi|actionSend"
android:inputType="textShortMessage|textMultiLine|textCapSentences" android:inputType="textShortMessage|textMultiLine|textCapSentences"
android:maxLines="8" android:maxLines="8"
android:minHeight="48dp" android:minHeight="48dp"
android:minLines="1" android:minLines="1"
android:paddingBottom="12dp" android:padding="8dp">
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="12dp"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/textSendButton">
<requestFocus/> <requestFocus />
</eu.siacs.conversations.ui.widget.EditMessage> </eu.siacs.conversations.ui.widget.EditMessage>
</LinearLayout>
<ImageButton <ImageButton
android:id="@+id/textSendButton" android:id="@+id/textSendButton"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?attr/color_background_primary" android:background="?attr/color_background_primary"
android:contentDescription="@string/send_message" android:contentDescription="@string/send_message"
android:src="?attr/ic_send_text_offline" android:src="?attr/ic_send_text_offline" />
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@ -121,9 +134,9 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/textsend" android:layout_above="@+id/textsend"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_marginBottom="4dp"
android:background="@drawable/snackbar" android:background="@drawable/snackbar"
android:minHeight="48dp" android:minHeight="48dp"
android:visibility="gone"> android:visibility="gone">
@ -133,28 +146,28 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toStartOf="@+id/snackbar_action" android:layout_toStartOf="@+id/snackbar_action"
android:layout_toLeftOf="@+id/snackbar_action"
android:paddingStart="24dp" android:paddingStart="24dp"
android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark"
android:layout_alignParentLeft="true"
android:paddingLeft="24dp" android:paddingLeft="24dp"
android:layout_toLeftOf="@+id/snackbar_action" /> android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark" />
<TextView <TextView
android:id="@+id/snackbar_action" android:id="@+id/snackbar_action"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingBottom="16dp"
android:paddingLeft="24dp" android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="16dp" android:paddingTop="16dp"
android:paddingRight="24dp"
android:paddingBottom="16dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark" android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark"
android:textStyle="bold" android:textStyle="bold" />
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>