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/main/java | |
parent | 1efc9573a6b2114dfbad8d3ca6966507a405a77e (diff) |
show hint on top of chatview while sending private messages
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 20 |
1 files changed, 20 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); |