From 997b11dbecc6023ad0679843d8a267d843a2951c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 26 May 2015 05:34:58 +0200 Subject: added choose picture as another quick action. fixes #1221 --- art/ic_send_picture_away.svg | 55 +++++++++++++++++++++ art/ic_send_picture_dnd.svg | 55 +++++++++++++++++++++ art/ic_send_picture_offline.svg | 55 +++++++++++++++++++++ art/ic_send_picture_online.svg | 55 +++++++++++++++++++++ art/render.rb | 4 ++ .../conversations/ui/ConversationActivity.java | 3 ++ .../conversations/ui/ConversationFragment.java | 21 +++++++- .../res/drawable-hdpi/ic_send_picture_away.png | Bin 0 -> 790 bytes src/main/res/drawable-hdpi/ic_send_picture_dnd.png | Bin 0 -> 884 bytes .../res/drawable-hdpi/ic_send_picture_offline.png | Bin 0 -> 657 bytes .../res/drawable-hdpi/ic_send_picture_online.png | Bin 0 -> 867 bytes .../res/drawable-mdpi/ic_send_picture_away.png | Bin 0 -> 512 bytes src/main/res/drawable-mdpi/ic_send_picture_dnd.png | Bin 0 -> 585 bytes .../res/drawable-mdpi/ic_send_picture_offline.png | Bin 0 -> 456 bytes .../res/drawable-mdpi/ic_send_picture_online.png | Bin 0 -> 580 bytes .../res/drawable-xhdpi/ic_send_picture_away.png | Bin 0 -> 899 bytes .../res/drawable-xhdpi/ic_send_picture_dnd.png | Bin 0 -> 1016 bytes .../res/drawable-xhdpi/ic_send_picture_offline.png | Bin 0 -> 799 bytes .../res/drawable-xhdpi/ic_send_picture_online.png | Bin 0 -> 997 bytes .../res/drawable-xxhdpi/ic_send_picture_away.png | Bin 0 -> 1327 bytes .../res/drawable-xxhdpi/ic_send_picture_dnd.png | Bin 0 -> 1516 bytes .../drawable-xxhdpi/ic_send_picture_offline.png | Bin 0 -> 1159 bytes .../res/drawable-xxhdpi/ic_send_picture_online.png | Bin 0 -> 1493 bytes .../res/drawable-xxxhdpi/ic_send_picture_away.png | Bin 0 -> 1632 bytes .../res/drawable-xxxhdpi/ic_send_picture_dnd.png | Bin 0 -> 1784 bytes .../drawable-xxxhdpi/ic_send_picture_offline.png | Bin 0 -> 1428 bytes .../drawable-xxxhdpi/ic_send_picture_online.png | Bin 0 -> 1800 bytes src/main/res/values/arrays.xml | 2 + 28 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 art/ic_send_picture_away.svg create mode 100644 art/ic_send_picture_dnd.svg create mode 100644 art/ic_send_picture_offline.svg create mode 100644 art/ic_send_picture_online.svg create mode 100644 src/main/res/drawable-hdpi/ic_send_picture_away.png create mode 100644 src/main/res/drawable-hdpi/ic_send_picture_dnd.png create mode 100644 src/main/res/drawable-hdpi/ic_send_picture_offline.png create mode 100644 src/main/res/drawable-hdpi/ic_send_picture_online.png create mode 100644 src/main/res/drawable-mdpi/ic_send_picture_away.png create mode 100644 src/main/res/drawable-mdpi/ic_send_picture_dnd.png create mode 100644 src/main/res/drawable-mdpi/ic_send_picture_offline.png create mode 100644 src/main/res/drawable-mdpi/ic_send_picture_online.png create mode 100644 src/main/res/drawable-xhdpi/ic_send_picture_away.png create mode 100644 src/main/res/drawable-xhdpi/ic_send_picture_dnd.png create mode 100644 src/main/res/drawable-xhdpi/ic_send_picture_offline.png create mode 100644 src/main/res/drawable-xhdpi/ic_send_picture_online.png create mode 100644 src/main/res/drawable-xxhdpi/ic_send_picture_away.png create mode 100644 src/main/res/drawable-xxhdpi/ic_send_picture_dnd.png create mode 100644 src/main/res/drawable-xxhdpi/ic_send_picture_offline.png create mode 100644 src/main/res/drawable-xxhdpi/ic_send_picture_online.png create mode 100644 src/main/res/drawable-xxxhdpi/ic_send_picture_away.png create mode 100644 src/main/res/drawable-xxxhdpi/ic_send_picture_dnd.png create mode 100644 src/main/res/drawable-xxxhdpi/ic_send_picture_offline.png create mode 100644 src/main/res/drawable-xxxhdpi/ic_send_picture_online.png diff --git a/art/ic_send_picture_away.svg b/art/ic_send_picture_away.svg new file mode 100644 index 000000000..a85a1eecb --- /dev/null +++ b/art/ic_send_picture_away.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/art/ic_send_picture_dnd.svg b/art/ic_send_picture_dnd.svg new file mode 100644 index 000000000..0c7d06356 --- /dev/null +++ b/art/ic_send_picture_dnd.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/art/ic_send_picture_offline.svg b/art/ic_send_picture_offline.svg new file mode 100644 index 000000000..048508a35 --- /dev/null +++ b/art/ic_send_picture_offline.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/art/ic_send_picture_online.svg b/art/ic_send_picture_online.svg new file mode 100644 index 000000000..06181bbda --- /dev/null +++ b/art/ic_send_picture_online.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/art/render.rb b/art/render.rb index ad53b1f4f..698abea5b 100755 --- a/art/render.rb +++ b/art/render.rb @@ -30,6 +30,10 @@ images = { 'ic_send_cancel_offline.svg' => ['ic_send_cancel_offline', 36], 'ic_send_cancel_away.svg' => ['ic_send_cancel_away', 36], 'ic_send_cancel_dnd.svg' => ['ic_send_cancel_dnd', 36], + 'ic_send_picture_online.svg' => ['ic_send_picture_online', 36], + 'ic_send_picture_offline.svg' => ['ic_send_picture_offline', 36], + 'ic_send_picture_away.svg' => ['ic_send_picture_away', 36], + 'ic_send_picture_dnd.svg' => ['ic_send_picture_dnd', 36] } images.each do |source, result| resolutions.each do |name, factor| diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index d9f56c5db..c48b5865c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -479,6 +479,9 @@ public class ConversationActivity extends XmppActivity case ATTACHMENT_CHOICE_TAKE_PHOTO: getPreferences().edit().putString("recently_used_quick_action","photo").apply(); break; + case ATTACHMENT_CHOICE_CHOOSE_IMAGE: + getPreferences().edit().putString("recently_used_quick_action","picture").apply(); + break; } final Conversation conversation = getSelectedConversation(); final int encryption = conversation.getNextEncryption(forceEncryption()); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 02f664db5..a817b27bf 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -256,6 +256,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa case RECORD_VOICE: activity.attachFile(ConversationActivity.ATTACHMENT_CHOICE_RECORD_VOICE); break; + case CHOOSE_PICTURE: + activity.attachFile(ConversationActivity.ATTACHMENT_CHOICE_CHOOSE_IMAGE); + break; case CANCEL: if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) { conversation.setNextCounterpart(null); @@ -818,7 +821,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa updateChatMsgHint(); } - enum SendButtonAction {TEXT, TAKE_PHOTO, SEND_LOCATION, RECORD_VOICE, CANCEL} + enum SendButtonAction {TEXT, TAKE_PHOTO, SEND_LOCATION, RECORD_VOICE, CANCEL, CHOOSE_PICTURE} private int getSendButtonImageResource(SendButtonAction action, int status) { switch (action) { @@ -887,6 +890,19 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa default: return R.drawable.ic_send_cancel_offline; } + case CHOOSE_PICTURE: + switch (status) { + case Presences.CHAT: + case Presences.ONLINE: + return R.drawable.ic_send_picture_online; + case Presences.AWAY: + return R.drawable.ic_send_picture_away; + case Presences.XA: + case Presences.DND: + return R.drawable.ic_send_picture_dnd; + default: + return R.drawable.ic_send_picture_offline; + } } return R.drawable.ic_send_text_offline; } @@ -920,6 +936,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa case "voice": action = SendButtonAction.RECORD_VOICE; break; + case "picture": + action = SendButtonAction.CHOOSE_PICTURE; + break; default: action = SendButtonAction.TEXT; break; diff --git a/src/main/res/drawable-hdpi/ic_send_picture_away.png b/src/main/res/drawable-hdpi/ic_send_picture_away.png new file mode 100644 index 000000000..09d1c7b7a Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_send_picture_away.png differ diff --git a/src/main/res/drawable-hdpi/ic_send_picture_dnd.png b/src/main/res/drawable-hdpi/ic_send_picture_dnd.png new file mode 100644 index 000000000..77964b5b5 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_send_picture_dnd.png differ diff --git a/src/main/res/drawable-hdpi/ic_send_picture_offline.png b/src/main/res/drawable-hdpi/ic_send_picture_offline.png new file mode 100644 index 000000000..28135e25b Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_send_picture_offline.png differ diff --git a/src/main/res/drawable-hdpi/ic_send_picture_online.png b/src/main/res/drawable-hdpi/ic_send_picture_online.png new file mode 100644 index 000000000..feb926c6f Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_send_picture_online.png differ diff --git a/src/main/res/drawable-mdpi/ic_send_picture_away.png b/src/main/res/drawable-mdpi/ic_send_picture_away.png new file mode 100644 index 000000000..d3ebca535 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_send_picture_away.png differ diff --git a/src/main/res/drawable-mdpi/ic_send_picture_dnd.png b/src/main/res/drawable-mdpi/ic_send_picture_dnd.png new file mode 100644 index 000000000..1d293f20d Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_send_picture_dnd.png differ diff --git a/src/main/res/drawable-mdpi/ic_send_picture_offline.png b/src/main/res/drawable-mdpi/ic_send_picture_offline.png new file mode 100644 index 000000000..95d5621e6 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_send_picture_offline.png differ diff --git a/src/main/res/drawable-mdpi/ic_send_picture_online.png b/src/main/res/drawable-mdpi/ic_send_picture_online.png new file mode 100644 index 000000000..be4194d34 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_send_picture_online.png differ diff --git a/src/main/res/drawable-xhdpi/ic_send_picture_away.png b/src/main/res/drawable-xhdpi/ic_send_picture_away.png new file mode 100644 index 000000000..f9aa21dc8 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_send_picture_away.png differ diff --git a/src/main/res/drawable-xhdpi/ic_send_picture_dnd.png b/src/main/res/drawable-xhdpi/ic_send_picture_dnd.png new file mode 100644 index 000000000..95e4acce7 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_send_picture_dnd.png differ diff --git a/src/main/res/drawable-xhdpi/ic_send_picture_offline.png b/src/main/res/drawable-xhdpi/ic_send_picture_offline.png new file mode 100644 index 000000000..75ff2fc4e Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_send_picture_offline.png differ diff --git a/src/main/res/drawable-xhdpi/ic_send_picture_online.png b/src/main/res/drawable-xhdpi/ic_send_picture_online.png new file mode 100644 index 000000000..0f68d5f52 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_send_picture_online.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_send_picture_away.png b/src/main/res/drawable-xxhdpi/ic_send_picture_away.png new file mode 100644 index 000000000..7898ed4fb Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_send_picture_away.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_send_picture_dnd.png b/src/main/res/drawable-xxhdpi/ic_send_picture_dnd.png new file mode 100644 index 000000000..ccffabbef Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_send_picture_dnd.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_send_picture_offline.png b/src/main/res/drawable-xxhdpi/ic_send_picture_offline.png new file mode 100644 index 000000000..7b5687e42 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_send_picture_offline.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_send_picture_online.png b/src/main/res/drawable-xxhdpi/ic_send_picture_online.png new file mode 100644 index 000000000..82eab70c0 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_send_picture_online.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_send_picture_away.png b/src/main/res/drawable-xxxhdpi/ic_send_picture_away.png new file mode 100644 index 000000000..1daa8ecce Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_send_picture_away.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_send_picture_dnd.png b/src/main/res/drawable-xxxhdpi/ic_send_picture_dnd.png new file mode 100644 index 000000000..d8257aad0 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_send_picture_dnd.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_send_picture_offline.png b/src/main/res/drawable-xxxhdpi/ic_send_picture_offline.png new file mode 100644 index 000000000..d487709be Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_send_picture_offline.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_send_picture_online.png b/src/main/res/drawable-xxxhdpi/ic_send_picture_online.png new file mode 100644 index 000000000..c095d7959 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_send_picture_online.png differ diff --git a/src/main/res/values/arrays.xml b/src/main/res/values/arrays.xml index fec077ccc..5be352d1c 100644 --- a/src/main/res/values/arrays.xml +++ b/src/main/res/values/arrays.xml @@ -44,6 +44,7 @@ @string/none @string/recently_used @string/attach_take_picture + @string/attach_choose_picture @string/attach_record_voice @string/send_location @@ -52,6 +53,7 @@ none recent photo + picture voice location -- cgit v1.2.3