diff options
Diffstat (limited to 'src')
21 files changed, 30 insertions, 12 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 37ae00a30..6b11d3109 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -245,6 +245,13 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa case RECORD_VOICE: activity.attachFile(ConversationActivity.ATTACHMENT_CHOICE_RECORD_VOICE); break; + case CANCEL: + if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) { + conversation.setNextCounterpart(null); + updateChatMsgHint(); + updateSendButton(); + } + break; default: sendMessage(); } @@ -257,8 +264,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa @Override public void onClick(View v) { - Intent intent = new Intent(getActivity(), - ConferenceDetailsActivity.class); + Intent intent = new Intent(getActivity(), ConferenceDetailsActivity.class); intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC); intent.putExtra("uuid", conversation.getUuid()); startActivity(intent); @@ -271,13 +277,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa if (this.conversation == null) { return; } - if (mEditMessage.getText().length() < 1) { - if (this.conversation.getMode() == Conversation.MODE_MULTI) { - conversation.setNextCounterpart(null); - updateChatMsgHint(); - } - return; - } Message message = new Message(conversation, mEditMessage.getText() .toString(), conversation.getNextEncryption(activity .forceEncryption())); @@ -558,6 +557,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa this.mEditMessage.setText(""); this.conversation.setNextCounterpart(counterpart); updateChatMsgHint(); + updateSendButton(); } protected void highlightInConference(String nick) { @@ -808,7 +808,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa updateChatMsgHint(); } - enum SendButtonAction {TEXT, TAKE_PHOTO, SEND_LOCATION, RECORD_VOICE} + enum SendButtonAction {TEXT, TAKE_PHOTO, SEND_LOCATION, RECORD_VOICE, CANCEL} private int getSendButtonImageResource(SendButtonAction action, int status) { switch (action) { @@ -864,6 +864,19 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa default: return R.drawable.ic_send_location_offline; } + case CANCEL: + switch (status) { + case Presences.CHAT: + case Presences.ONLINE: + return R.drawable.ic_send_cancel_online; + case Presences.AWAY: + return R.drawable.ic_send_cancel_away; + case Presences.XA: + case Presences.DND: + return R.drawable.ic_send_cancel_dnd; + default: + return R.drawable.ic_send_cancel_offline; + } } return R.drawable.ic_send_text_offline; } @@ -872,10 +885,15 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa final Conversation c = this.conversation; final SendButtonAction action; final int status; + final boolean empty = this.mEditMessage == null || this.mEditMessage.getText().length() == 0; if (c.getMode() == Conversation.MODE_MULTI) { - action = SendButtonAction.TEXT; + if (empty && c.getNextCounterpart() != null) { + action = SendButtonAction.CANCEL; + } else { + action = SendButtonAction.TEXT; + } } else { - if (this.mEditMessage == null || this.mEditMessage.getText().length() == 0) { + if (empty) { String setting = activity.getPreferences().getString("quick_action","recent"); if (setting.equals("recent")) { setting = activity.getPreferences().getString("recently_used_quick_action","text"); diff --git a/src/main/res/drawable-hdpi/ic_send_cancel_away.png b/src/main/res/drawable-hdpi/ic_send_cancel_away.png Binary files differnew file mode 100644 index 000000000..9525c040f --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_send_cancel_away.png diff --git a/src/main/res/drawable-hdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-hdpi/ic_send_cancel_dnd.png Binary files differnew file mode 100644 index 000000000..cbfd8e76c --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_send_cancel_dnd.png diff --git a/src/main/res/drawable-hdpi/ic_send_cancel_offline.png b/src/main/res/drawable-hdpi/ic_send_cancel_offline.png Binary files differnew file mode 100644 index 000000000..2cb4f4f38 --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_send_cancel_offline.png diff --git a/src/main/res/drawable-hdpi/ic_send_cancel_online.png b/src/main/res/drawable-hdpi/ic_send_cancel_online.png Binary files differnew file mode 100644 index 000000000..cb3bc3b56 --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_send_cancel_online.png diff --git a/src/main/res/drawable-mdpi/ic_send_cancel_away.png b/src/main/res/drawable-mdpi/ic_send_cancel_away.png Binary files differnew file mode 100644 index 000000000..bbc86b45a --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_send_cancel_away.png diff --git a/src/main/res/drawable-mdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-mdpi/ic_send_cancel_dnd.png Binary files differnew file mode 100644 index 000000000..e4fa38a3e --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_send_cancel_dnd.png diff --git a/src/main/res/drawable-mdpi/ic_send_cancel_offline.png b/src/main/res/drawable-mdpi/ic_send_cancel_offline.png Binary files differnew file mode 100644 index 000000000..604dfefaf --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_send_cancel_offline.png diff --git a/src/main/res/drawable-mdpi/ic_send_cancel_online.png b/src/main/res/drawable-mdpi/ic_send_cancel_online.png Binary files differnew file mode 100644 index 000000000..1b0d1811f --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_send_cancel_online.png diff --git a/src/main/res/drawable-xhdpi/ic_send_cancel_away.png b/src/main/res/drawable-xhdpi/ic_send_cancel_away.png Binary files differnew file mode 100644 index 000000000..44b5f0963 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_send_cancel_away.png diff --git a/src/main/res/drawable-xhdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-xhdpi/ic_send_cancel_dnd.png Binary files differnew file mode 100644 index 000000000..276ad0242 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_send_cancel_dnd.png diff --git a/src/main/res/drawable-xhdpi/ic_send_cancel_offline.png b/src/main/res/drawable-xhdpi/ic_send_cancel_offline.png Binary files differnew file mode 100644 index 000000000..53a9ac909 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_send_cancel_offline.png diff --git a/src/main/res/drawable-xhdpi/ic_send_cancel_online.png b/src/main/res/drawable-xhdpi/ic_send_cancel_online.png Binary files differnew file mode 100644 index 000000000..23a5f2632 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_send_cancel_online.png diff --git a/src/main/res/drawable-xxhdpi/ic_send_cancel_away.png b/src/main/res/drawable-xxhdpi/ic_send_cancel_away.png Binary files differnew file mode 100644 index 000000000..07113f020 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_send_cancel_away.png diff --git a/src/main/res/drawable-xxhdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-xxhdpi/ic_send_cancel_dnd.png Binary files differnew file mode 100644 index 000000000..93fbc44d4 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_send_cancel_dnd.png diff --git a/src/main/res/drawable-xxhdpi/ic_send_cancel_offline.png b/src/main/res/drawable-xxhdpi/ic_send_cancel_offline.png Binary files differnew file mode 100644 index 000000000..10412faba --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_send_cancel_offline.png diff --git a/src/main/res/drawable-xxhdpi/ic_send_cancel_online.png b/src/main/res/drawable-xxhdpi/ic_send_cancel_online.png Binary files differnew file mode 100644 index 000000000..6fa18239a --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_send_cancel_online.png diff --git a/src/main/res/drawable-xxxhdpi/ic_send_cancel_away.png b/src/main/res/drawable-xxxhdpi/ic_send_cancel_away.png Binary files differnew file mode 100644 index 000000000..a9340a886 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_send_cancel_away.png diff --git a/src/main/res/drawable-xxxhdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-xxxhdpi/ic_send_cancel_dnd.png Binary files differnew file mode 100644 index 000000000..02ab1d0fb --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_send_cancel_dnd.png diff --git a/src/main/res/drawable-xxxhdpi/ic_send_cancel_offline.png b/src/main/res/drawable-xxxhdpi/ic_send_cancel_offline.png Binary files differnew file mode 100644 index 000000000..abd3af2c2 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_send_cancel_offline.png diff --git a/src/main/res/drawable-xxxhdpi/ic_send_cancel_online.png b/src/main/res/drawable-xxxhdpi/ic_send_cancel_online.png Binary files differnew file mode 100644 index 000000000..80be8edfc --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_send_cancel_online.png |