From 48604a66201e0c0f403ba1576e35833c7407a7d0 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Wed, 21 Jan 2015 23:00:35 -0500 Subject: Use Material Design Icons on API 21+ --- .../services/NotificationService.java | 23 ++++++++++++++++------ .../conversations/ui/ConversationActivity.java | 9 +++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src/main/java/eu') diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 894af421..2ea0904f 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -270,7 +270,8 @@ public class NotificationService { } if ((message = getFirstDownloadableMessage(messages)) != null) { mBuilder.addAction( - R.drawable.ic_action_download, + Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? + R.drawable.ic_file_download_white_24dp : R.drawable.ic_action_download, mXmppConnectionService.getResources().getString(R.string.download_x_file, UIHelper.getFileDescriptionString(mXmppConnectionService, message)), createDownloadIntent(message) @@ -446,18 +447,24 @@ public class NotificationService { public Notification createForegroundNotification() { final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService); - mBuilder.setSmallIcon(R.drawable.ic_stat_communication_import_export); + mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.conversations_foreground_service)); mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_open_conversations)); - mBuilder.addAction(R.drawable.ic_action_cancel, - mXmppConnectionService.getString(R.string.disable_foreground_service), - createDisableForeground()); mBuilder.setContentIntent(createOpenConversationsIntent()); mBuilder.setWhen(0); mBuilder.setPriority(NotificationCompat.PRIORITY_MIN); + final int cancelIcon; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mBuilder.setCategory(Notification.CATEGORY_SERVICE); + mBuilder.setSmallIcon(R.drawable.ic_import_export_white_48dp); + cancelIcon = R.drawable.ic_cancel_white_24dp; + } else { + mBuilder.setSmallIcon(R.drawable.ic_stat_communication_import_export); + cancelIcon = R.drawable.ic_action_cancel; } + mBuilder.addAction(cancelIcon, + mXmppConnectionService.getString(R.string.disable_foreground_service), + createDisableForeground()); setNotificationColor(mBuilder); return mBuilder.build(); } @@ -487,7 +494,11 @@ public class NotificationService { } mBuilder.setOngoing(true); //mBuilder.setLights(0xffffffff, 2000, 4000); - mBuilder.setSmallIcon(R.drawable.ic_stat_alert_warning); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mBuilder.setSmallIcon(R.drawable.ic_warning_white_36dp); + } else { + mBuilder.setSmallIcon(R.drawable.ic_stat_alert_warning); + } final TaskStackBuilder stackBuilder = TaskStackBuilder.create(mXmppConnectionService); stackBuilder.addParentStack(ConversationActivity.class); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 7aa48c0c..299fb848 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -10,6 +10,7 @@ import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentSender.SendIntentException; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.SystemClock; import android.provider.MediaStore; @@ -296,8 +297,12 @@ public class ConversationActivity extends XmppActivity if (this.getSelectedConversation() != null) { if (this.getSelectedConversation().getLatestMessage() .getEncryption() != Message.ENCRYPTION_NONE) { - menuSecure.setIcon(R.drawable.ic_action_secure); - } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + menuSecure.setIcon(R.drawable.ic_lock_outline_white_48dp); + } else { + menuSecure.setIcon(R.drawable.ic_action_secure); + } + } if (this.getSelectedConversation().getMode() == Conversation.MODE_MULTI) { menuContactDetails.setVisible(false); menuAttach.setVisible(false); -- cgit v1.2.3