Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/org/adblockplus/android/AndroidUpdateAvailableCallback.java

Issue 5153282527854592: Issue 98 - Use the libadblockplus update mechanism (Closed)
Patch Set: Created Sept. 25, 2014, 3:57 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 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 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 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/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 package org.adblockplus.android; 18 package org.adblockplus.android;
19 19
20 import java.util.List; 20 import org.adblockplus.libadblockplus.UpdateAvailableCallback;
21 21
22 import org.adblockplus.libadblockplus.EventCallback;
23 import org.adblockplus.libadblockplus.JsValue;
24 import org.apache.commons.lang.StringUtils;
25
26 import android.app.Notification;
27 import android.app.NotificationManager;
28 import android.content.Context; 22 import android.content.Context;
29 23
30 public class AndroidUpdateAvailableCallback extends EventCallback 24 public class AndroidUpdateAvailableCallback extends UpdateAvailableCallback
31 { 25 {
32 private final Context context; 26 private final Context context;
33 27
34 public AndroidUpdateAvailableCallback(final Context context) 28 public AndroidUpdateAvailableCallback(final Context context)
35 { 29 {
36 this.context = context; 30 this.context = context;
37 } 31 }
38 32
39 @Override 33 @Override
40 public void eventCallback(final List<JsValue> params) 34 public void updateAvailableCallback(String url)
41 { 35 {
42 final String updateUrl = params.size() > 0 && !params.get(0).isNull() ? para ms.get(0).toString() : ""; 36 Utils.showUpdateNotification(this.context, url, null);
43 if (StringUtils.isNotEmpty(updateUrl))
44 {
45 final Notification notification = Utils.createUpdateNotification(this.cont ext, updateUrl, null);
46 final NotificationManager notificationManager = (NotificationManager)this. context.getSystemService(Context.NOTIFICATION_SERVICE);
47 notificationManager.notify(AdblockPlus.UPDATE_NOTIFICATION_ID, notificatio n);
48 }
49 } 37 }
50 } 38 }
OLDNEW

Powered by Google App Engine
This is Rietveld