diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index afd56b528..6c612239f 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 000000000..a11c82357 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 000000000..497c88ca8 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 000000000..e0dfc2bf6 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 000000000..e8f96367c 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 000000000..53ba4eca4 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 000000000..7c281c3f5 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 000000000..3ccd77022 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 000000000..25a9576dd 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 000000000..8c12041ca 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 000000000..f316b84b7 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 000000000..9a192bcab 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 000000000..79228c9c8 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 000000000..4f9c27db1 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 000000000..e83052200 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 000000000..0ccf7dd68 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 000000000..2f36ec397 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 000000000..dbdabfa49 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 000000000..933eb5148 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 000000000..615557977 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 000000000..d474bd577 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 000000000..8dc527d4c 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 000000000..87319a6cc 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 000000000..ab46a6802 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 000000000..1e30c5a93 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 000000000..0fb33537d 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 000000000..be9fb226a 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 000000000..4d6053c10 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 000000000..53083487f 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 000000000..43c43f3a0 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 000000000..814ca8ddc 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 000000000..6da919287 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 000000000..2642b9e09 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 000000000..6af0b11c2 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 000000000..9f44db5d2 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 000000000..59edcde2f 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 000000000..b24d12323 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 000000000..2829a36ec 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 000000000..c8e69dceb 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 000000000..49edf9509 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 000000000..9b7071b71 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 000000000..1360bd5f8 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 000000000..078b10d4f 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 000000000..f2925e4ef 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 000000000..f9f1defa6 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 000000000..9f2d6ca9e 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 000000000..b0389382e 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 000000000..a1ddb8ec2 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 000000000..3c3114999 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 000000000..566cba549 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 000000000..777658e95 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 000000000..0831e0e96 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 000000000..f89ffeb30 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 000000000..9c21f9d19 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 000000000..8bcb6f620 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 000000000..a0129784b 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 000000000..2ffdb55f2 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 000000000..966d4e005 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 000000000..2f1e60c55 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 6e8fc51d3..28372c0a3 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 f7ab3e92e..bd5727403 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 39787f362..4a6ce8a12 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 4ce44f224..bd749a017 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 8ac3793b4..1e3c013ed 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