aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-05-03 09:30:30 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-05-03 09:30:30 +0200
commit43db9cdf4b300183cfd58ad9c7b3ad57ee63ad31 (patch)
tree1b9e8ecd8bd0407e44f23c5828fdd46d596b7d59 /src
parentc4bfffe6a9027d041cccf610b448cb6c1367c83d (diff)
turn send button in cancel button while in whisper mode
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java42
-rw-r--r--src/main/res/drawable-hdpi/ic_send_cancel_away.pngbin0 -> 1396 bytes
-rw-r--r--src/main/res/drawable-hdpi/ic_send_cancel_dnd.pngbin0 -> 1559 bytes
-rw-r--r--src/main/res/drawable-hdpi/ic_send_cancel_offline.pngbin0 -> 1206 bytes
-rw-r--r--src/main/res/drawable-hdpi/ic_send_cancel_online.pngbin0 -> 1531 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_send_cancel_away.pngbin0 -> 901 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_send_cancel_dnd.pngbin0 -> 1040 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_send_cancel_offline.pngbin0 -> 837 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_send_cancel_online.pngbin0 -> 1052 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_send_cancel_away.pngbin0 -> 1724 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_send_cancel_dnd.pngbin0 -> 1940 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_send_cancel_offline.pngbin0 -> 1519 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_send_cancel_online.pngbin0 -> 1978 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_send_cancel_away.pngbin0 -> 2583 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_send_cancel_dnd.pngbin0 -> 2911 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_send_cancel_offline.pngbin0 -> 2290 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_send_cancel_online.pngbin0 -> 2998 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_send_cancel_away.pngbin0 -> 3377 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_send_cancel_dnd.pngbin0 -> 3791 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_send_cancel_offline.pngbin0 -> 2956 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_send_cancel_online.pngbin0 -> 3835 bytes
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 37ae00a3..6b11d310 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
new file mode 100644
index 00000000..9525c040
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_send_cancel_away.png
Binary files differ
diff --git a/src/main/res/drawable-hdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-hdpi/ic_send_cancel_dnd.png
new file mode 100644
index 00000000..cbfd8e76
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_send_cancel_dnd.png
Binary files differ
diff --git a/src/main/res/drawable-hdpi/ic_send_cancel_offline.png b/src/main/res/drawable-hdpi/ic_send_cancel_offline.png
new file mode 100644
index 00000000..2cb4f4f3
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_send_cancel_offline.png
Binary files differ
diff --git a/src/main/res/drawable-hdpi/ic_send_cancel_online.png b/src/main/res/drawable-hdpi/ic_send_cancel_online.png
new file mode 100644
index 00000000..cb3bc3b5
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_send_cancel_online.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_send_cancel_away.png b/src/main/res/drawable-mdpi/ic_send_cancel_away.png
new file mode 100644
index 00000000..bbc86b45
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_send_cancel_away.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-mdpi/ic_send_cancel_dnd.png
new file mode 100644
index 00000000..e4fa38a3
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_send_cancel_dnd.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_send_cancel_offline.png b/src/main/res/drawable-mdpi/ic_send_cancel_offline.png
new file mode 100644
index 00000000..604dfefa
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_send_cancel_offline.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_send_cancel_online.png b/src/main/res/drawable-mdpi/ic_send_cancel_online.png
new file mode 100644
index 00000000..1b0d1811
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_send_cancel_online.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_send_cancel_away.png b/src/main/res/drawable-xhdpi/ic_send_cancel_away.png
new file mode 100644
index 00000000..44b5f096
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_send_cancel_away.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-xhdpi/ic_send_cancel_dnd.png
new file mode 100644
index 00000000..276ad024
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_send_cancel_dnd.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_send_cancel_offline.png b/src/main/res/drawable-xhdpi/ic_send_cancel_offline.png
new file mode 100644
index 00000000..53a9ac90
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_send_cancel_offline.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_send_cancel_online.png b/src/main/res/drawable-xhdpi/ic_send_cancel_online.png
new file mode 100644
index 00000000..23a5f263
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_send_cancel_online.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_send_cancel_away.png b/src/main/res/drawable-xxhdpi/ic_send_cancel_away.png
new file mode 100644
index 00000000..07113f02
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_send_cancel_away.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-xxhdpi/ic_send_cancel_dnd.png
new file mode 100644
index 00000000..93fbc44d
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_send_cancel_dnd.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_send_cancel_offline.png b/src/main/res/drawable-xxhdpi/ic_send_cancel_offline.png
new file mode 100644
index 00000000..10412fab
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_send_cancel_offline.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_send_cancel_online.png b/src/main/res/drawable-xxhdpi/ic_send_cancel_online.png
new file mode 100644
index 00000000..6fa18239
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_send_cancel_online.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_send_cancel_away.png b/src/main/res/drawable-xxxhdpi/ic_send_cancel_away.png
new file mode 100644
index 00000000..a9340a88
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_send_cancel_away.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_send_cancel_dnd.png b/src/main/res/drawable-xxxhdpi/ic_send_cancel_dnd.png
new file mode 100644
index 00000000..02ab1d0f
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_send_cancel_dnd.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_send_cancel_offline.png b/src/main/res/drawable-xxxhdpi/ic_send_cancel_offline.png
new file mode 100644
index 00000000..abd3af2c
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_send_cancel_offline.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_send_cancel_online.png b/src/main/res/drawable-xxxhdpi/ic_send_cancel_online.png
new file mode 100644
index 00000000..80be8edf
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_send_cancel_online.png
Binary files differ