fixed message hint
This commit is contained in:
parent
4e791c8a01
commit
07b422d4c8
|
@ -71,19 +71,19 @@ public class ConversationFragment extends Fragment {
|
||||||
private boolean messagesLoaded = false;
|
private boolean messagesLoaded = false;
|
||||||
|
|
||||||
private IntentSender askForPassphraseIntent = null;
|
private IntentSender askForPassphraseIntent = null;
|
||||||
|
|
||||||
private OnEditorActionListener mEditorActionListener = new OnEditorActionListener() {
|
private OnEditorActionListener mEditorActionListener = new OnEditorActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||||
InputMethodManager imm = (InputMethodManager) v.getContext()
|
InputMethodManager imm = (InputMethodManager) v.getContext()
|
||||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,8 +158,7 @@ public class ConversationFragment extends Fragment {
|
||||||
};
|
};
|
||||||
|
|
||||||
private ConversationActivity activity;
|
private ConversationActivity activity;
|
||||||
|
|
||||||
|
|
||||||
private void sendMessage() {
|
private void sendMessage() {
|
||||||
if (mEditMessage.getText().length() < 1) {
|
if (mEditMessage.getText().length() < 1) {
|
||||||
if (this.conversation.getMode() == Conversation.MODE_MULTI) {
|
if (this.conversation.getMode() == Conversation.MODE_MULTI) {
|
||||||
|
@ -187,12 +186,16 @@ public class ConversationFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateChatMsgHint() {
|
public void updateChatMsgHint() {
|
||||||
if (conversation.getNextPresence() != null) {
|
if (conversation.getMode() == Conversation.MODE_MULTI
|
||||||
this.mEditMessage.setHint(getString(R.string.send_private_message_to,conversation.getNextPresence()));
|
&& conversation.getNextPresence() != null) {
|
||||||
|
this.mEditMessage.setHint(getString(
|
||||||
|
R.string.send_private_message_to,
|
||||||
|
conversation.getNextPresence()));
|
||||||
} else {
|
} else {
|
||||||
switch (conversation.getNextEncryption()) {
|
switch (conversation.getNextEncryption()) {
|
||||||
case Message.ENCRYPTION_NONE:
|
case Message.ENCRYPTION_NONE:
|
||||||
mEditMessage.setHint(getString(R.string.send_plain_text_message));
|
mEditMessage
|
||||||
|
.setHint(getString(R.string.send_plain_text_message));
|
||||||
break;
|
break;
|
||||||
case Message.ENCRYPTION_OTR:
|
case Message.ENCRYPTION_OTR:
|
||||||
mEditMessage.setHint(getString(R.string.send_otr_message));
|
mEditMessage.setHint(getString(R.string.send_otr_message));
|
||||||
|
@ -223,13 +226,13 @@ public class ConversationFragment extends Fragment {
|
||||||
});
|
});
|
||||||
mEditMessage.setOnEditorActionListener(mEditorActionListener);
|
mEditMessage.setOnEditorActionListener(mEditorActionListener);
|
||||||
mEditMessage.setOnEnterPressedListener(new OnEnterPressed() {
|
mEditMessage.setOnEnterPressedListener(new OnEnterPressed() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnterPressed() {
|
public void onEnterPressed() {
|
||||||
sendMessage();
|
sendMessage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ImageButton sendButton = (ImageButton) view
|
ImageButton sendButton = (ImageButton) view
|
||||||
.findViewById(R.id.textSendButton);
|
.findViewById(R.id.textSendButton);
|
||||||
sendButton.setOnClickListener(this.mSendButtonListener);
|
sendButton.setOnClickListener(this.mSendButtonListener);
|
||||||
|
@ -241,38 +244,41 @@ public class ConversationFragment extends Fragment {
|
||||||
messagesView = (ListView) view.findViewById(R.id.messages_view);
|
messagesView = (ListView) view.findViewById(R.id.messages_view);
|
||||||
messagesView.setOnScrollListener(mOnScrollListener);
|
messagesView.setOnScrollListener(mOnScrollListener);
|
||||||
messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
|
messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
|
||||||
messageListAdapter = new MessageAdapter((ConversationActivity) getActivity(), this.messageList);
|
messageListAdapter = new MessageAdapter(
|
||||||
messageListAdapter.setOnContactPictureClicked(new OnContactPictureClicked() {
|
(ConversationActivity) getActivity(), this.messageList);
|
||||||
|
messageListAdapter
|
||||||
@Override
|
.setOnContactPictureClicked(new OnContactPictureClicked() {
|
||||||
public void onContactPictureClicked(Message message) {
|
|
||||||
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
|
@Override
|
||||||
if (message.getPresence() != null) {
|
public void onContactPictureClicked(Message message) {
|
||||||
highlightInConference(message.getPresence());
|
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
|
||||||
} else {
|
if (message.getPresence() != null) {
|
||||||
highlightInConference(message.getCounterpart());
|
highlightInConference(message.getPresence());
|
||||||
|
} else {
|
||||||
|
highlightInConference(message.getCounterpart());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
messageListAdapter
|
||||||
});
|
.setOnContactPictureLongClicked(new OnContactPictureLongClicked() {
|
||||||
messageListAdapter.setOnContactPictureLongClicked(new OnContactPictureLongClicked() {
|
|
||||||
|
@Override
|
||||||
@Override
|
public void onContactPictureLongClicked(Message message) {
|
||||||
public void onContactPictureLongClicked(Message message) {
|
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
|
||||||
if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
|
if (message.getPresence() != null) {
|
||||||
if (message.getPresence() != null) {
|
privateMessageWith(message.getPresence());
|
||||||
privateMessageWith(message.getPresence());
|
} else {
|
||||||
} else {
|
privateMessageWith(message.getCounterpart());
|
||||||
privateMessageWith(message.getCounterpart());
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
messagesView.setAdapter(messageListAdapter);
|
messagesView.setAdapter(messageListAdapter);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void privateMessageWith(String counterpart) {
|
protected void privateMessageWith(String counterpart) {
|
||||||
this.mEditMessage.setText("");
|
this.mEditMessage.setText("");
|
||||||
this.conversation.setNextPresence(counterpart);
|
this.conversation.setNextPresence(counterpart);
|
||||||
|
@ -384,15 +390,19 @@ public class ConversationFragment extends Fragment {
|
||||||
final ConversationActivity activity = (ConversationActivity) getActivity();
|
final ConversationActivity activity = (ConversationActivity) getActivity();
|
||||||
if (this.conversation != null) {
|
if (this.conversation != null) {
|
||||||
final Contact contact = this.conversation.getContact();
|
final Contact contact = this.conversation.getContact();
|
||||||
if (!contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
if (!contact.showInRoster()
|
||||||
showSnackbar(R.string.contact_added_you, R.string.add_back, new OnClickListener() {
|
&& contact
|
||||||
|
.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
||||||
@Override
|
showSnackbar(R.string.contact_added_you, R.string.add_back,
|
||||||
public void onClick(View v) {
|
new OnClickListener() {
|
||||||
activity.xmppConnectionService.createContact(contact);
|
|
||||||
activity.switchToContactDetails(contact);
|
@Override
|
||||||
}
|
public void onClick(View v) {
|
||||||
});
|
activity.xmppConnectionService
|
||||||
|
.createContact(contact);
|
||||||
|
activity.switchToContactDetails(contact);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
for (Message message : this.conversation.getMessages()) {
|
for (Message message : this.conversation.getMessages()) {
|
||||||
if ((message.getEncryption() == Message.ENCRYPTION_PGP)
|
if ((message.getEncryption() == Message.ENCRYPTION_PGP)
|
||||||
|
|
Loading…
Reference in a new issue