bug 650209 - Allow DOMDesktopNotification to use a custom icon in the expanded android notification r=dougt

This commit is contained in:
Brad Lassey
2011-04-28 15:34:50 -04:00
parent a6d3772082
commit 6f41b55468
5 changed files with 69 additions and 9 deletions

View File

@@ -829,6 +829,7 @@ public class GeckoAppShell
Field f = drawableClass.getField(resource);
icon = f.getInt(null);
} catch (Exception e) {} // just means the resource doesn't exist
imageUri = null;
}
int notificationID = aAlertName.hashCode();
@@ -836,8 +837,10 @@ public class GeckoAppShell
// Remove the old notification with the same ID, if any
removeNotification(notificationID);
AlertNotification notification = new AlertNotification(GeckoApp.mAppContext,
notificationID, icon, aAlertTitle, aAlertText, System.currentTimeMillis());
AlertNotification notification =
new AlertNotification(GeckoApp.mAppContext,notificationID, icon,
aAlertTitle, aAlertText,
System.currentTimeMillis());
// The intent to launch when the user clicks the expanded notification
Intent notificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLICK);
@@ -850,7 +853,7 @@ public class GeckoAppShell
PendingIntent contentIntent = PendingIntent.getBroadcast(GeckoApp.mAppContext, 0, notificationIntent, 0);
notification.setLatestEventInfo(GeckoApp.mAppContext, aAlertTitle, aAlertText, contentIntent);
notification.setCustomIcon(imageUri);
// The intent to execute when the status entry is deleted by the user with the "Clear All Notifications" button
Intent clearNotificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLEAR);
clearNotificationIntent.setClassName(GeckoApp.mAppContext,