Initial commit
[fonbot.git] / lib / android / support / v4 / app / NotificationCompatIceCreamSandwich.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.ICE_CREAM_SANDWICH)
28 class NotificationCompatIceCreamSandwich {
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 int mProgressMax, int mProgress, boolean mProgressIndeterminate) {
35 Notification.Builder b = new Notification.Builder(context)
36 .setWhen(n.when)
37 .setSmallIcon(n.icon, n.iconLevel)
38 .setContent(n.contentView)
39 .setTicker(n.tickerText, tickerView)
40 .setSound(n.sound, n.audioStreamType)
41 .setVibrate(n.vibrate)
42 .setLights(n.ledARGB, n.ledOnMS, n.ledOffMS)
43 .setOngoing((n.flags & Notification.FLAG_ONGOING_EVENT) != 0)
44 .setOnlyAlertOnce((n.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0)
45 .setAutoCancel((n.flags & Notification.FLAG_AUTO_CANCEL) != 0)
46 .setDefaults(n.defaults)
47 .setContentTitle(contentTitle)
48 .setContentText(contentText)
49 .setContentInfo(contentInfo)
50 .setContentIntent(contentIntent)
51 .setDeleteIntent(n.deleteIntent)
52 .setFullScreenIntent(fullScreenIntent,
53 (n.flags & Notification.FLAG_HIGH_PRIORITY) != 0)
54 .setLargeIcon(largeIcon)
55 .setNumber(number)
56 .setProgress(mProgressMax, mProgress, mProgressIndeterminate);
57
58 return b.getNotification();
59 }
60 }
This page took 0.021395 seconds and 4 git commands to generate.