fixes #1200 : Added icons for the attach options according to material design guidlines
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
BIN
src/main/res/drawable-hdpi/ic_attach_camera.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
src/main/res/drawable-hdpi/ic_attach_camera_white.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
src/main/res/drawable-hdpi/ic_attach_document.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
src/main/res/drawable-hdpi/ic_attach_document_white.png
Normal file
After Width: | Height: | Size: 180 B |
BIN
src/main/res/drawable-hdpi/ic_attach_location.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/main/res/drawable-hdpi/ic_attach_location_white.png
Normal file
After Width: | Height: | Size: 371 B |
BIN
src/main/res/drawable-hdpi/ic_attach_photo.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/res/drawable-hdpi/ic_attach_photo_white.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
src/main/res/drawable-hdpi/ic_attach_record.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
src/main/res/drawable-hdpi/ic_attach_record_white.png
Normal file
After Width: | Height: | Size: 363 B |
BIN
src/main/res/drawable-hdpi/ic_send_file_offline.png
Normal file
After Width: | Height: | Size: 412 B |
BIN
src/main/res/drawable-hdpi/ic_send_file_offline_white.png
Normal file
After Width: | Height: | Size: 356 B |
BIN
src/main/res/drawable-mdpi/ic_attach_camera.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/res/drawable-mdpi/ic_attach_camera_white.png
Normal file
After Width: | Height: | Size: 240 B |
BIN
src/main/res/drawable-mdpi/ic_attach_document.png
Normal file
After Width: | Height: | Size: 1,021 B |
BIN
src/main/res/drawable-mdpi/ic_attach_document_white.png
Normal file
After Width: | Height: | Size: 143 B |
BIN
src/main/res/drawable-mdpi/ic_attach_location.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/res/drawable-mdpi/ic_attach_location_white.png
Normal file
After Width: | Height: | Size: 265 B |
BIN
src/main/res/drawable-mdpi/ic_attach_photo.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
src/main/res/drawable-mdpi/ic_attach_photo_white.png
Normal file
After Width: | Height: | Size: 185 B |
BIN
src/main/res/drawable-mdpi/ic_attach_record.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/res/drawable-mdpi/ic_attach_record_white.png
Normal file
After Width: | Height: | Size: 245 B |
BIN
src/main/res/drawable-mdpi/ic_send_file_offline.png
Normal file
After Width: | Height: | Size: 282 B |
BIN
src/main/res/drawable-mdpi/ic_send_file_offline_white.png
Normal file
After Width: | Height: | Size: 248 B |
BIN
src/main/res/drawable-xhdpi/ic_attach_camera.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/main/res/drawable-xhdpi/ic_attach_camera_white.png
Normal file
After Width: | Height: | Size: 446 B |
BIN
src/main/res/drawable-xhdpi/ic_attach_document.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/res/drawable-xhdpi/ic_attach_document_white.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
src/main/res/drawable-xhdpi/ic_attach_location.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/main/res/drawable-xhdpi/ic_attach_location_white.png
Normal file
After Width: | Height: | Size: 456 B |
BIN
src/main/res/drawable-xhdpi/ic_attach_photo.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/res/drawable-xhdpi/ic_attach_photo_white.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
src/main/res/drawable-xhdpi/ic_attach_record.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/main/res/drawable-xhdpi/ic_attach_record_white.png
Normal file
After Width: | Height: | Size: 436 B |
BIN
src/main/res/drawable-xhdpi/ic_send_file_offline.png
Normal file
After Width: | Height: | Size: 429 B |
BIN
src/main/res/drawable-xhdpi/ic_send_file_offline_white.png
Normal file
After Width: | Height: | Size: 380 B |
BIN
src/main/res/drawable-xxhdpi/ic_attach_camera.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
src/main/res/drawable-xxhdpi/ic_attach_camera_white.png
Normal file
After Width: | Height: | Size: 666 B |
BIN
src/main/res/drawable-xxhdpi/ic_attach_document.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
src/main/res/drawable-xxhdpi/ic_attach_document_white.png
Normal file
After Width: | Height: | Size: 295 B |
BIN
src/main/res/drawable-xxhdpi/ic_attach_location.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
src/main/res/drawable-xxhdpi/ic_attach_location_white.png
Normal file
After Width: | Height: | Size: 675 B |
BIN
src/main/res/drawable-xxhdpi/ic_attach_photo.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/main/res/drawable-xxhdpi/ic_attach_photo_white.png
Normal file
After Width: | Height: | Size: 450 B |
BIN
src/main/res/drawable-xxhdpi/ic_attach_record.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
src/main/res/drawable-xxhdpi/ic_attach_record_white.png
Normal file
After Width: | Height: | Size: 606 B |
BIN
src/main/res/drawable-xxhdpi/ic_send_file_offline.png
Normal file
After Width: | Height: | Size: 750 B |
BIN
src/main/res/drawable-xxhdpi/ic_send_file_offline_white.png
Normal file
After Width: | Height: | Size: 669 B |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_camera.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_camera_white.png
Normal file
After Width: | Height: | Size: 894 B |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_document.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_document_white.png
Normal file
After Width: | Height: | Size: 378 B |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_location.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_location_white.png
Normal file
After Width: | Height: | Size: 869 B |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_photo.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_photo_white.png
Normal file
After Width: | Height: | Size: 570 B |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_record.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
src/main/res/drawable-xxxhdpi/ic_attach_record_white.png
Normal file
After Width: | Height: | Size: 819 B |
|
@ -3,22 +3,27 @@
|
|||
|
||||
<item
|
||||
android:id="@+id/attach_location"
|
||||
android:title="@string/send_location"/>
|
||||
android:title="@string/send_location"
|
||||
android:icon="?attr/ic_attach_location"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/attach_record_voice"
|
||||
android:title="@string/attach_record_voice"/>
|
||||
android:title="@string/attach_record_voice"
|
||||
android:icon="?attr/ic_attach_record"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/attach_take_picture"
|
||||
android:title="@string/attach_take_picture"/>
|
||||
android:title="@string/attach_take_picture"
|
||||
android:icon="?attr/ic_attach_camera"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/attach_choose_picture"
|
||||
android:title="@string/attach_choose_picture"/>
|
||||
android:title="@string/attach_choose_picture"
|
||||
android:icon="?attr/ic_attach_photo"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/attach_choose_file"
|
||||
android:title="@string/choose_file"/>
|
||||
android:title="@string/choose_file"
|
||||
android:icon="?attr/ic_attach_document"/>
|
||||
|
||||
</menu>
|
|
@ -29,6 +29,12 @@
|
|||
<item name="attr/ic_send_text_offline">@drawable/ic_send_text_offline</item>
|
||||
<item name="attr/ic_send_voice_offline">@drawable/ic_send_voice_offline</item>
|
||||
|
||||
<item name="attr/ic_attach_camera">@drawable/ic_attach_camera</item>
|
||||
<item name="attr/ic_attach_document">@drawable/ic_attach_document</item>
|
||||
<item name="attr/ic_attach_location">@drawable/ic_attach_location</item>
|
||||
<item name="attr/ic_attach_photo">@drawable/ic_attach_photo</item>
|
||||
<item name="attr/ic_attach_record">@drawable/ic_attach_record</item>
|
||||
|
||||
<item name="attr/message_bubble_received_monochrome">@drawable/message_bubble_received_white</item>
|
||||
<item name="attr/message_bubble_sent">@drawable/message_bubble_sent</item>
|
||||
<item name="attr/message_bubble_received_green">@drawable/message_bubble_received</item>
|
||||
|
@ -97,6 +103,12 @@
|
|||
<item name="attr/ic_send_text_offline">@drawable/ic_send_text_offline_white</item>
|
||||
<item name="attr/ic_send_voice_offline">@drawable/ic_send_voice_offline_white</item>
|
||||
|
||||
<item name="attr/ic_attach_camera">@drawable/ic_attach_camera_white</item>
|
||||
<item name="attr/ic_attach_document">@drawable/ic_attach_document_white</item>
|
||||
<item name="attr/ic_attach_location">@drawable/ic_attach_location_white</item>
|
||||
<item name="attr/ic_attach_photo">@drawable/ic_attach_photo_white</item>
|
||||
<item name="attr/ic_attach_record">@drawable/ic_attach_record_white</item>
|
||||
|
||||
<item name="attr/message_bubble_received_monochrome">@drawable/message_bubble_received_grey</item>
|
||||
<item name="attr/message_bubble_sent">@drawable/message_bubble_sent_grey</item>
|
||||
<item name="attr/message_bubble_received_green">@drawable/message_bubble_received_dark</item>
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
<attr name="ic_send_text_offline" format="reference"/>
|
||||
<attr name="ic_send_voice_offline" format="reference"/>
|
||||
|
||||
<attr name="ic_attach_camera" format="reference"/>
|
||||
<attr name="ic_attach_document" format="reference"/>
|
||||
<attr name="ic_attach_location" format="reference"/>
|
||||
<attr name="ic_attach_photo" format="reference"/>
|
||||
<attr name="ic_attach_record" format="reference"/>
|
||||
|
||||
<attr name="message_bubble_received_monochrome" format="reference"/>
|
||||
<attr name="message_bubble_sent" format="reference"/>
|
||||
<attr name="message_bubble_received_green" format="reference"/>
|
||||
|
|
|
@ -6,4 +6,5 @@
|
|||
<dimen name="conversations_overview_width">288dp</dimen>
|
||||
<dimen name="image_button_padding">8dp</dimen>
|
||||
<dimen name="fineprint_size">11sp</dimen>
|
||||
<dimen name="menu_item_icon_size">24dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -25,6 +25,12 @@
|
|||
<item name="attr/ic_send_text_offline">@drawable/ic_send_text_offline</item>
|
||||
<item name="attr/ic_send_voice_offline">@drawable/ic_send_voice_offline</item>
|
||||
|
||||
<item name="attr/ic_attach_camera">@drawable/ic_attach_camera</item>
|
||||
<item name="attr/ic_attach_document">@drawable/ic_attach_document</item>
|
||||
<item name="attr/ic_attach_location">@drawable/ic_attach_location</item>
|
||||
<item name="attr/ic_attach_photo">@drawable/ic_attach_photo</item>
|
||||
<item name="attr/ic_attach_record">@drawable/ic_attach_record</item>
|
||||
|
||||
<item name="attr/icon_add_group">@drawable/ic_action_add_group</item>
|
||||
<item name="attr/icon_add_person">@drawable/ic_action_add_person</item>
|
||||
<item name="attr/icon_cancel">@drawable/ic_action_cancel</item>
|
||||
|
@ -90,6 +96,12 @@
|
|||
<item name="attr/ic_send_text_offline">@drawable/ic_send_text_offline_white</item>
|
||||
<item name="attr/ic_send_voice_offline">@drawable/ic_send_voice_offline_white</item>
|
||||
|
||||
<item name="attr/ic_attach_camera">@drawable/ic_attach_camera_white</item>
|
||||
<item name="attr/ic_attach_document">@drawable/ic_attach_document_white</item>
|
||||
<item name="attr/ic_attach_location">@drawable/ic_attach_location_white</item>
|
||||
<item name="attr/ic_attach_photo">@drawable/ic_attach_photo_white</item>
|
||||
<item name="attr/ic_attach_record">@drawable/ic_attach_record_white</item>
|
||||
|
||||
<item name="attr/message_bubble_received_monochrome">@drawable/message_bubble_received_grey</item>
|
||||
<item name="attr/message_bubble_sent">@drawable/message_bubble_sent_grey</item>
|
||||
<item name="attr/message_bubble_received_green">@drawable/message_bubble_received_dark</item>
|
||||
|
|