1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.support.v4.app; 18 19import android.app.Notification; 20import android.app.PendingIntent; 21import android.content.Context; 22import android.graphics.Bitmap; 23import android.widget.RemoteViews; 24 25class NotificationCompatHoneycomb { 26 static Notification add(Context context, Notification n, 27 CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo, 28 RemoteViews tickerView, int number, 29 PendingIntent contentIntent, PendingIntent fullScreenIntent, Bitmap largeIcon) { 30 Notification.Builder b = new Notification.Builder(context) 31 .setWhen(n.when) 32 .setSmallIcon(n.icon, n.iconLevel) 33 .setContent(n.contentView) 34 .setTicker(n.tickerText, tickerView) 35 .setSound(n.sound, n.audioStreamType) 36 .setVibrate(n.vibrate) 37 .setLights(n.ledARGB, n.ledOnMS, n.ledOffMS) 38 .setOngoing((n.flags & Notification.FLAG_ONGOING_EVENT) != 0) 39 .setOnlyAlertOnce((n.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0) 40 .setAutoCancel((n.flags & Notification.FLAG_AUTO_CANCEL) != 0) 41 .setDefaults(n.defaults) 42 .setContentTitle(contentTitle) 43 .setContentText(contentText) 44 .setContentInfo(contentInfo) 45 .setContentIntent(contentIntent) 46 .setDeleteIntent(n.deleteIntent) 47 .setFullScreenIntent(fullScreenIntent, 48 (n.flags & Notification.FLAG_HIGH_PRIORITY) != 0) 49 .setLargeIcon(largeIcon) 50 .setNumber(number); 51 52 return b.getNotification(); 53 } 54} 55