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: Adressed first batch of review issues. Created April 16, 2014, 5:36 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
(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
25 import com.github.rjeschke.neetutils.Strings;
26
27 import android.app.Notification;
28 import android.app.NotificationManager;
29 import android.content.Context;
30
31 public class AndroidUpdateAvailableCallback extends EventCallback
32 {
33 private final Context context;
34
35 public AndroidUpdateAvailableCallback(final Context context)
36 {
37 this.context = context;
38 }
39
40 @Override
41 public void eventCallback(final List<JsValue> params)
42 {
43 final String updateUrl = params.size() > 0 && !params.get(0).isNull() ? para ms.get(0).toString() : "";
44 if (!Strings.isEmpty(updateUrl))
45 {
46 final Notification notification = Utils.createUpdateNotification(this.cont ext, updateUrl, null);
47 final NotificationManager notificationManager = (NotificationManager)this. context.getSystemService(Context.NOTIFICATION_SERVICE);
48 notificationManager.notify(AdblockPlus.UPDATE_NOTIFICATION_ID, notificatio n);
49 }
50 }
51 }
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