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

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

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Patch Set: Even more review issues fixed. Created April 28, 2014, 10:18 a.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
(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 java.util.List;
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;
29
30 public class AndroidUpdateAvailableCallback extends EventCallback
31 {
32 private final Context context;
33
34 public AndroidUpdateAvailableCallback(final Context context)
35 {
36 this.context = context;
37 }
38
39 @Override
40 public void eventCallback(final List<JsValue> params)
41 {
42 final String updateUrl = params.size() > 0 && !params.get(0).isNull() ? para ms.get(0).toString() : "";
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 }
50 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/android/AndroidLogSystem.java ('k') | src/org/adblockplus/android/AndroidUpdaterCallback.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld