OLD | NEW |
| (Empty) |
1 /* | |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | |
3 * Copyright (C) 2006-2014 Eyeo GmbH | |
4 * | |
5 * Adblock Plus is free software: you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License version 3 as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 package org.adblockplus.android; | |
19 | |
20 import org.adblockplus.libadblockplus.UpdaterCallback; | |
21 import org.apache.commons.lang.StringUtils; | |
22 | |
23 import android.app.Notification; | |
24 import android.app.NotificationManager; | |
25 import android.content.Context; | |
26 | |
27 public class AndroidUpdaterCallback extends UpdaterCallback | |
28 { | |
29 private final Context context; | |
30 | |
31 public AndroidUpdaterCallback(final Context context) | |
32 { | |
33 this.context = context; | |
34 } | |
35 | |
36 @Override | |
37 public void updaterCallback(final String error) | |
38 { | |
39 // TODO: Check if we need this 'manualUpdate' mechanism (initiated by 'check
ForUpdates()') | |
40 // if (!error.empty()) | |
41 // { | |
42 // jstring jError = jniEnv->NewStringUTF(error.c_str()); | |
43 // if (mid) | |
44 // jniEnv->CallVoidMethod(jniObject, mid, NULL, jError); | |
45 // jniEnv->DeleteLocalRef(jError); | |
46 // } | |
47 // else if (manualUpdate) | |
48 // { | |
49 // if (mid) | |
50 // jniEnv->CallVoidMethod(jniObject, mid, NULL, NULL); | |
51 // } | |
52 | |
53 final Notification notification = Utils.createUpdateNotification(this.contex
t, null, StringUtils.isEmpty(error) ? null : error); | |
54 final NotificationManager notificationManager = (NotificationManager)this.co
ntext.getSystemService(Context.NOTIFICATION_SERVICE); | |
55 notificationManager.notify(AdblockPlus.UPDATE_NOTIFICATION_ID, notification)
; | |
56 } | |
57 } | |
OLD | NEW |