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