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 NotificationCompatIceCreamSandwich {
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            int mProgressMax, int mProgress, boolean mProgressIndeterminate) {
31        Notification.Builder b = new Notification.Builder(context)
32                .setWhen(n.when)
33                .setSmallIcon(n.icon, n.iconLevel)
34                .setContent(n.contentView)
35                .setTicker(n.tickerText, tickerView)
36                .setSound(n.sound, n.audioStreamType)
37                .setVibrate(n.vibrate)
38                .setLights(n.ledARGB, n.ledOnMS, n.ledOffMS)
39                .setOngoing((n.flags & Notification.FLAG_ONGOING_EVENT) != 0)
40                .setOnlyAlertOnce((n.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0)
41                .setAutoCancel((n.flags & Notification.FLAG_AUTO_CANCEL) != 0)
42                .setDefaults(n.defaults)
43                .setContentTitle(contentTitle)
44                .setContentText(contentText)
45                .setContentInfo(contentInfo)
46                .setContentIntent(contentIntent)
47                .setDeleteIntent(n.deleteIntent)
48                .setFullScreenIntent(fullScreenIntent,
49                        (n.flags & Notification.FLAG_HIGH_PRIORITY) != 0)
50                .setLargeIcon(largeIcon)
51                .setNumber(number)
52                .setProgress(mProgressMax, mProgress, mProgressIndeterminate);
53
54        return b.getNotification();
55    }
56}
57