Commit 0f7664e9 authored by Michael van Ouwerkerk's avatar Michael van Ouwerkerk Committed by Commit Bot

Set large icon on Shared Clipboard notification.

Bug: 992345
Change-Id: I174c8c4c80a5cfcaa5a3e48845eb6629ab24e87b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1758073Reviewed-by: default avatarRichard Knoll <knollr@chromium.org>
Commit-Queue: Michael van Ouwerkerk <mvanouwerkerk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687638}
parent d25b33fd
......@@ -7,6 +7,8 @@ package org.chromium.chrome.browser.sharing;
import android.app.Notification;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.annotation.DrawableRes;
import android.support.v4.app.NotificationCompat;
......@@ -36,11 +38,12 @@ public final class SharingNotificationUtil {
* @param contentIntent The notification content intent.
* @param contentTitle The notification title text.
* @param contentText The notification content text.
* @param smallIcon The small notification icon.
* @param smallIconId The small notification icon resource id.
* @param largeIconId The large notification icon resource id, 0 if not used.
*/
public static void showNotification(@SystemNotificationType int type, String group, int id,
PendingIntentProvider contentIntent, String contentTitle, String contentText,
@DrawableRes int smallIcon) {
@DrawableRes int smallIconId, @DrawableRes int largeIconId) {
Context context = ContextUtils.getApplicationContext();
Resources resources = context.getResources();
ChromeNotificationBuilder builder =
......@@ -57,9 +60,13 @@ public final class SharingNotificationUtil {
.setGroup(group)
.setPriorityBeforeO(NotificationCompat.PRIORITY_HIGH)
.setVibrate(new long[0])
.setSmallIcon(smallIcon)
.setSmallIcon(smallIconId)
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_ALL);
if (largeIconId != 0) {
Bitmap largeIcon = BitmapFactory.decodeResource(resources, largeIconId);
if (largeIcon != null) builder.setLargeIcon(largeIcon);
}
ChromeNotification notification = builder.buildChromeNotification();
new NotificationManagerProxyImpl(context).notify(notification);
......
......@@ -75,7 +75,7 @@ public class ClickToCallMessageHandler {
NotificationConstants.GROUP_CLICK_TO_CALL,
NotificationConstants.NOTIFICATION_ID_CLICK_TO_CALL, contentIntent, phoneNumber,
context.getResources().getString(R.string.click_to_call_notification_text),
R.drawable.ic_phone_googblue_36dp);
R.drawable.ic_phone_googblue_36dp, /*largeIconId=*/0);
}
/**
......
......@@ -52,6 +52,6 @@ public class SharedClipboardMessageHandler {
NotificationConstants.GROUP_SHARED_CLIPBOARD,
NotificationConstants.NOTIFICATION_ID_SHARED_CLIPBOARD, contentIntent,
notificationTitle, resources.getString(R.string.shared_clipboard_notification_text),
R.drawable.ic_devices_16dp);
R.drawable.ic_devices_16dp, R.drawable.shared_clipboard_40dp);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment