diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-01-21 16:47:16 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-01-21 16:47:16 +0100 |
commit | 681290fdebef0ee97a40b7dfdde3787795943c6e (patch) | |
tree | 06344a921558af7da435fdfc485b2ab7399cd3ce /src | |
parent | 1efc9573a6b2114dfbad8d3ca6966507a405a77e (diff) |
show hint on top of chatview while sending private messages
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 20 | ||||
-rw-r--r-- | src/main/res/layout/fragment_conversation.xml | 23 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 72ab218e2..509d4d17d 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -97,6 +97,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa private EditMessage mEditMessage; private ImageButton mSendButton; private RelativeLayout snackbar; + private RelativeLayout messagehint; + private TextView messagehint_message; private TextView snackbarMessage; private TextView snackbarAction; private Toast messageLoaderToast; @@ -531,14 +533,20 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa final boolean multi = conversation.getMode() == Conversation.MODE_MULTI; if (conversation.getCorrectingMessage() != null) { this.mEditMessage.setHint(R.string.send_corrected_message); + hideMessageHint(); } else if (multi && conversation.getNextCounterpart() != null) { this.mEditMessage.setHint(getString( R.string.send_private_message_to, conversation.getNextCounterpart().getResourcepart())); + showMessageHint(getString( + R.string.send_private_message_to, + conversation.getNextCounterpart().getResourcepart())); } else if (multi && !conversation.getMucOptions().participating()) { this.mEditMessage.setHint(R.string.you_are_not_participating); + hideMessageHint(); } else { this.mEditMessage.setHint(UIHelper.getMessageHint(activity, conversation)); + hideMessageHint(); getActivity().invalidateOptionsMenu(); } } @@ -584,6 +592,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa snackbarMessage = view.findViewById(R.id.snackbar_message); snackbarAction = view.findViewById(R.id.snackbar_action); + messagehint = view.findViewById(R.id.messagehint); + messagehint_message = view.findViewById(R.id.messagehint_message); + messagesView = view.findViewById(R.id.messages_view); messagesView.setOnScrollListener(mOnScrollListener); messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL); @@ -1510,6 +1521,15 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa snackbar.setVisibility(View.GONE); } + protected void showMessageHint(final String message) { + messagehint.setVisibility(View.VISIBLE); + messagehint_message.setText(message); + } + + protected void hideMessageHint() { + messagehint.setVisibility(View.GONE); + } + protected void sendPlainTextMessage(Message message) { ConversationActivity activity = (ConversationActivity) getActivity(); activity.xmppConnectionService.sendMessage(message); diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml index f75e9a2d8..2ac131d34 100644 --- a/src/main/res/layout/fragment_conversation.xml +++ b/src/main/res/layout/fragment_conversation.xml @@ -11,6 +11,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/snackbar" + android:layout_below="@+id/messagehint" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="@color/grey200" @@ -106,4 +107,26 @@ android:textStyle="bold" /> </RelativeLayout> + <RelativeLayout + android:id="@+id/messagehint" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" + android:background="@drawable/date_bubble" + android:minHeight="48dp" + android:visibility="gone"> + + <TextView + android:id="@+id/messagehint_message" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:paddingLeft="24dp" + android:textColor="@color/realgreen" + android:textSize="?attr/TextSizeBody" /> + </RelativeLayout> + </RelativeLayout>
\ No newline at end of file |