Initial commit
[fonbot.git] / lib / android / support / v4 / app / NotificationCompatHoneycomb.java
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
17 package android.support.v4.app;
18
19 import android.annotation.TargetApi;
20 import android.app.Notification;
21 import android.app.PendingIntent;
22 import android.content.Context;
23 import android.graphics.Bitmap;
24 import android.os.Build;
25 import android.widget.RemoteViews;
26
27 @TargetApi(Build.VERSION_CODES.HONEYCOMB)
28 class NotificationCompatHoneycomb {
29 @SuppressWarnings("deprecation")
30 static Notification add(Context context, Notification n,
31 CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo,
32 RemoteViews tickerView, int number,
33 PendingIntent contentIntent, PendingIntent fullScreenIntent, Bitmap largeIcon) {
34 Notification.Builder b = new Notification.Builder(context)
35 .setWhen(n.when)
36 .setSmallIcon(n.icon, n.iconLevel)
37 .setContent(n.contentView)
38 .setTicker(n.tickerText, tickerView)
39 .setSound(n.sound, n.audioStreamType)
40 .setVibrate(n.vibrate)
41 .setLights(n.ledARGB, n.ledOnMS, n.ledOffMS)
42 .setOngoing((n.flags & Notification.FLAG_ONGOING_EVENT) != 0)
43 .setOnlyAlertOnce((n.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0)
44 .setAutoCancel((n.flags & Notification.FLAG_AUTO_CANCEL) != 0)
45 .setDefaults(n.defaults)
46 .setContentTitle(contentTitle)
47 .setContentText(contentText)
48 .setContentInfo(contentInfo)
49 .setContentIntent(contentIntent)
50 .setDeleteIntent(n.deleteIntent)
51 .setFullScreenIntent(fullScreenIntent,
52 (n.flags & Notification.FLAG_HIGH_PRIORITY) != 0)
53 .setLargeIcon(largeIcon)
54 .setNumber(number);
55
56 return b.getNotification();
57 }
58 }
This page took 0.021349 seconds and 4 git commands to generate.