diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index afd56b52..6c612239 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -7,11 +7,13 @@ import android.app.FragmentTransaction; import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.ClipData; +import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentSender.SendIntentException; import android.content.pm.PackageManager; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -20,6 +22,8 @@ import android.provider.MediaStore; import android.provider.Settings; import android.support.v4.widget.SlidingPaneLayout; import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener; +import android.text.SpannableStringBuilder; +import android.text.style.ImageSpan; import android.util.Log; import android.util.Pair; import android.view.Gravity; @@ -775,6 +779,24 @@ public class ConversationActivity extends XmppActivity builder.create().show(); } + /** + * Moves icons from the PopupMenu's MenuItems' icon fields into the menu title as a Spannable with the icon and title text. + */ + public static void insertMenuItemIcons(Context context, PopupMenu popupMenu) { + Menu menu = popupMenu.getMenu(); + for (int i = 0; i < menu.size(); i++) { + MenuItem menuItem = menu.getItem(i); + Drawable icon = menuItem.getIcon(); + int iconSize = context.getResources().getDimensionPixelSize(R.dimen.menu_item_icon_size); + icon.setBounds(0, 0, iconSize, iconSize); + ImageSpan imageSpan = new ImageSpan(icon); + SpannableStringBuilder ssb = new SpannableStringBuilder(" " + menuItem.getTitle()); + ssb.setSpan(imageSpan, 0, 1, 0); + menuItem.setTitle(ssb); + menuItem.setIcon(null); + } + } + protected void attachFileDialog() { View menuAttachFile = findViewById(R.id.action_attach_file); if (menuAttachFile == null) { @@ -812,6 +834,7 @@ public class ConversationActivity extends XmppActivity return false; } }); + insertMenuItemIcons(getApplicationContext(), attachFilePopup); attachFilePopup.show(); } diff --git a/src/main/res/drawable-hdpi/ic_attach_camera.png b/src/main/res/drawable-hdpi/ic_attach_camera.png new file mode 100644 index 00000000..a11c8235 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_camera.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_camera_white.png b/src/main/res/drawable-hdpi/ic_attach_camera_white.png new file mode 100644 index 00000000..497c88ca Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_camera_white.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_document.png b/src/main/res/drawable-hdpi/ic_attach_document.png new file mode 100644 index 00000000..e0dfc2bf Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_document.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_document_white.png b/src/main/res/drawable-hdpi/ic_attach_document_white.png new file mode 100644 index 00000000..e8f96367 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_document_white.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_location.png b/src/main/res/drawable-hdpi/ic_attach_location.png new file mode 100644 index 00000000..53ba4eca Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_location.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_location_white.png b/src/main/res/drawable-hdpi/ic_attach_location_white.png new file mode 100644 index 00000000..7c281c3f Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_location_white.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_photo.png b/src/main/res/drawable-hdpi/ic_attach_photo.png new file mode 100644 index 00000000..3ccd7702 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_photo.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_photo_white.png b/src/main/res/drawable-hdpi/ic_attach_photo_white.png new file mode 100644 index 00000000..25a9576d Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_photo_white.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_record.png b/src/main/res/drawable-hdpi/ic_attach_record.png new file mode 100644 index 00000000..8c12041c Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_record.png differ diff --git a/src/main/res/drawable-hdpi/ic_attach_record_white.png b/src/main/res/drawable-hdpi/ic_attach_record_white.png new file mode 100644 index 00000000..f316b84b Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_attach_record_white.png differ diff --git a/src/main/res/drawable-hdpi/ic_send_file_offline.png b/src/main/res/drawable-hdpi/ic_send_file_offline.png new file mode 100644 index 00000000..9a192bca Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_send_file_offline.png differ diff --git a/src/main/res/drawable-hdpi/ic_send_file_offline_white.png b/src/main/res/drawable-hdpi/ic_send_file_offline_white.png new file mode 100644 index 00000000..79228c9c Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_send_file_offline_white.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_camera.png b/src/main/res/drawable-mdpi/ic_attach_camera.png new file mode 100644 index 00000000..4f9c27db Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_camera.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_camera_white.png b/src/main/res/drawable-mdpi/ic_attach_camera_white.png new file mode 100644 index 00000000..e8305220 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_camera_white.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_document.png b/src/main/res/drawable-mdpi/ic_attach_document.png new file mode 100644 index 00000000..0ccf7dd6 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_document.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_document_white.png b/src/main/res/drawable-mdpi/ic_attach_document_white.png new file mode 100644 index 00000000..2f36ec39 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_document_white.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_location.png b/src/main/res/drawable-mdpi/ic_attach_location.png new file mode 100644 index 00000000..dbdabfa4 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_location.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_location_white.png b/src/main/res/drawable-mdpi/ic_attach_location_white.png new file mode 100644 index 00000000..933eb514 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_location_white.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_photo.png b/src/main/res/drawable-mdpi/ic_attach_photo.png new file mode 100644 index 00000000..61555797 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_photo.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_photo_white.png b/src/main/res/drawable-mdpi/ic_attach_photo_white.png new file mode 100644 index 00000000..d474bd57 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_photo_white.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_record.png b/src/main/res/drawable-mdpi/ic_attach_record.png new file mode 100644 index 00000000..8dc527d4 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_record.png differ diff --git a/src/main/res/drawable-mdpi/ic_attach_record_white.png b/src/main/res/drawable-mdpi/ic_attach_record_white.png new file mode 100644 index 00000000..87319a6c Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_attach_record_white.png differ diff --git a/src/main/res/drawable-mdpi/ic_send_file_offline.png b/src/main/res/drawable-mdpi/ic_send_file_offline.png new file mode 100644 index 00000000..ab46a680 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_send_file_offline.png differ diff --git a/src/main/res/drawable-mdpi/ic_send_file_offline_white.png b/src/main/res/drawable-mdpi/ic_send_file_offline_white.png new file mode 100644 index 00000000..1e30c5a9 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_send_file_offline_white.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_camera.png b/src/main/res/drawable-xhdpi/ic_attach_camera.png new file mode 100644 index 00000000..0fb33537 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_camera.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_camera_white.png b/src/main/res/drawable-xhdpi/ic_attach_camera_white.png new file mode 100644 index 00000000..be9fb226 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_camera_white.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_document.png b/src/main/res/drawable-xhdpi/ic_attach_document.png new file mode 100644 index 00000000..4d6053c1 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_document.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_document_white.png b/src/main/res/drawable-xhdpi/ic_attach_document_white.png new file mode 100644 index 00000000..53083487 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_document_white.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_location.png b/src/main/res/drawable-xhdpi/ic_attach_location.png new file mode 100644 index 00000000..43c43f3a Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_location.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_location_white.png b/src/main/res/drawable-xhdpi/ic_attach_location_white.png new file mode 100644 index 00000000..814ca8dd Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_location_white.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_photo.png b/src/main/res/drawable-xhdpi/ic_attach_photo.png new file mode 100644 index 00000000..6da91928 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_photo.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_photo_white.png b/src/main/res/drawable-xhdpi/ic_attach_photo_white.png new file mode 100644 index 00000000..2642b9e0 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_photo_white.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_record.png b/src/main/res/drawable-xhdpi/ic_attach_record.png new file mode 100644 index 00000000..6af0b11c Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_record.png differ diff --git a/src/main/res/drawable-xhdpi/ic_attach_record_white.png b/src/main/res/drawable-xhdpi/ic_attach_record_white.png new file mode 100644 index 00000000..9f44db5d Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_attach_record_white.png differ diff --git a/src/main/res/drawable-xhdpi/ic_send_file_offline.png b/src/main/res/drawable-xhdpi/ic_send_file_offline.png new file mode 100644 index 00000000..59edcde2 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_send_file_offline.png differ diff --git a/src/main/res/drawable-xhdpi/ic_send_file_offline_white.png b/src/main/res/drawable-xhdpi/ic_send_file_offline_white.png new file mode 100644 index 00000000..b24d1232 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_send_file_offline_white.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_camera.png b/src/main/res/drawable-xxhdpi/ic_attach_camera.png new file mode 100644 index 00000000..2829a36e Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_camera.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_camera_white.png b/src/main/res/drawable-xxhdpi/ic_attach_camera_white.png new file mode 100644 index 00000000..c8e69dce Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_camera_white.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_document.png b/src/main/res/drawable-xxhdpi/ic_attach_document.png new file mode 100644 index 00000000..49edf950 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_document.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_document_white.png b/src/main/res/drawable-xxhdpi/ic_attach_document_white.png new file mode 100644 index 00000000..9b7071b7 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_document_white.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_location.png b/src/main/res/drawable-xxhdpi/ic_attach_location.png new file mode 100644 index 00000000..1360bd5f Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_location.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_location_white.png b/src/main/res/drawable-xxhdpi/ic_attach_location_white.png new file mode 100644 index 00000000..078b10d4 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_location_white.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_photo.png b/src/main/res/drawable-xxhdpi/ic_attach_photo.png new file mode 100644 index 00000000..f2925e4e Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_photo.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_photo_white.png b/src/main/res/drawable-xxhdpi/ic_attach_photo_white.png new file mode 100644 index 00000000..f9f1defa Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_photo_white.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_record.png b/src/main/res/drawable-xxhdpi/ic_attach_record.png new file mode 100644 index 00000000..9f2d6ca9 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_record.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_attach_record_white.png b/src/main/res/drawable-xxhdpi/ic_attach_record_white.png new file mode 100644 index 00000000..b0389382 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_attach_record_white.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_send_file_offline.png b/src/main/res/drawable-xxhdpi/ic_send_file_offline.png new file mode 100644 index 00000000..a1ddb8ec Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_send_file_offline.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_send_file_offline_white.png b/src/main/res/drawable-xxhdpi/ic_send_file_offline_white.png new file mode 100644 index 00000000..3c311499 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_send_file_offline_white.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_camera.png b/src/main/res/drawable-xxxhdpi/ic_attach_camera.png new file mode 100644 index 00000000..566cba54 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_camera.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_camera_white.png b/src/main/res/drawable-xxxhdpi/ic_attach_camera_white.png new file mode 100644 index 00000000..777658e9 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_camera_white.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_document.png b/src/main/res/drawable-xxxhdpi/ic_attach_document.png new file mode 100644 index 00000000..0831e0e9 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_document.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_document_white.png b/src/main/res/drawable-xxxhdpi/ic_attach_document_white.png new file mode 100644 index 00000000..f89ffeb3 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_document_white.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_location.png b/src/main/res/drawable-xxxhdpi/ic_attach_location.png new file mode 100644 index 00000000..9c21f9d1 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_location.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_location_white.png b/src/main/res/drawable-xxxhdpi/ic_attach_location_white.png new file mode 100644 index 00000000..8bcb6f62 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_location_white.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_photo.png b/src/main/res/drawable-xxxhdpi/ic_attach_photo.png new file mode 100644 index 00000000..a0129784 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_photo.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_photo_white.png b/src/main/res/drawable-xxxhdpi/ic_attach_photo_white.png new file mode 100644 index 00000000..2ffdb55f Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_photo_white.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_record.png b/src/main/res/drawable-xxxhdpi/ic_attach_record.png new file mode 100644 index 00000000..966d4e00 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_record.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_attach_record_white.png b/src/main/res/drawable-xxxhdpi/ic_attach_record_white.png new file mode 100644 index 00000000..2f1e60c5 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_attach_record_white.png differ diff --git a/src/main/res/menu/attachment_choices.xml b/src/main/res/menu/attachment_choices.xml index 6e8fc51d..28372c0a 100644 --- a/src/main/res/menu/attachment_choices.xml +++ b/src/main/res/menu/attachment_choices.xml @@ -3,22 +3,27 @@ + android:title="@string/send_location" + android:icon="?attr/ic_attach_location"/> + android:title="@string/attach_record_voice" + android:icon="?attr/ic_attach_record"/> + android:title="@string/attach_take_picture" + android:icon="?attr/ic_attach_camera"/> + android:title="@string/attach_choose_picture" + android:icon="?attr/ic_attach_photo"/> + android:title="@string/choose_file" + android:icon="?attr/ic_attach_document"/> \ No newline at end of file diff --git a/src/main/res/values-v21/themes.xml b/src/main/res/values-v21/themes.xml index f7ab3e92..bd572740 100644 --- a/src/main/res/values-v21/themes.xml +++ b/src/main/res/values-v21/themes.xml @@ -29,6 +29,12 @@ @drawable/ic_send_text_offline @drawable/ic_send_voice_offline + @drawable/ic_attach_camera + @drawable/ic_attach_document + @drawable/ic_attach_location + @drawable/ic_attach_photo + @drawable/ic_attach_record + @drawable/message_bubble_received_white @drawable/message_bubble_sent @drawable/message_bubble_received @@ -97,6 +103,12 @@ @drawable/ic_send_text_offline_white @drawable/ic_send_voice_offline_white + @drawable/ic_attach_camera_white + @drawable/ic_attach_document_white + @drawable/ic_attach_location_white + @drawable/ic_attach_photo_white + @drawable/ic_attach_record_white + @drawable/message_bubble_received_grey @drawable/message_bubble_sent_grey @drawable/message_bubble_received_dark diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index 39787f36..4a6ce8a1 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -19,6 +19,12 @@ + + + + + + diff --git a/src/main/res/values/dimens.xml b/src/main/res/values/dimens.xml index 4ce44f22..bd749a01 100644 --- a/src/main/res/values/dimens.xml +++ b/src/main/res/values/dimens.xml @@ -6,4 +6,5 @@ 288dp 8dp 11sp + 24dp diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 8ac3793b..1e3c013e 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -25,6 +25,12 @@ @drawable/ic_send_text_offline @drawable/ic_send_voice_offline + @drawable/ic_attach_camera + @drawable/ic_attach_document + @drawable/ic_attach_location + @drawable/ic_attach_photo + @drawable/ic_attach_record + @drawable/ic_action_add_group @drawable/ic_action_add_person @drawable/ic_action_cancel @@ -90,6 +96,12 @@ @drawable/ic_send_text_offline_white @drawable/ic_send_voice_offline_white + @drawable/ic_attach_camera_white + @drawable/ic_attach_document_white + @drawable/ic_attach_location_white + @drawable/ic_attach_photo_white + @drawable/ic_attach_record_white + @drawable/message_bubble_received_grey @drawable/message_bubble_sent_grey @drawable/message_bubble_received_dark