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

Delta Between Two Patch Sets: src/org/adblockplus/android/AndroidUpdateAvailableCallback.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Left Patch Set: Adressed first batch of review issues. Created April 16, 2014, 5:36 p.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 java.util.List;
21 21
22 import org.adblockplus.libadblockplus.EventCallback; 22 import org.adblockplus.libadblockplus.EventCallback;
23 import org.adblockplus.libadblockplus.JsValue; 23 import org.adblockplus.libadblockplus.JsValue;
24 24 import org.apache.commons.lang.StringUtils;
25 import com.github.rjeschke.neetutils.Strings;
26 25
27 import android.app.Notification; 26 import android.app.Notification;
28 import android.app.NotificationManager; 27 import android.app.NotificationManager;
29 import android.content.Context; 28 import android.content.Context;
30 29
31 public class AndroidUpdateAvailableCallback extends EventCallback 30 public class AndroidUpdateAvailableCallback extends EventCallback
32 { 31 {
33 private final Context context; 32 private final Context context;
34 33
35 public AndroidUpdateAvailableCallback(final Context context) 34 public AndroidUpdateAvailableCallback(final Context context)
36 { 35 {
37 this.context = context; 36 this.context = context;
38 } 37 }
39 38
40 @Override 39 @Override
41 public void eventCallback(final List<JsValue> params) 40 public void eventCallback(final List<JsValue> params)
42 { 41 {
43 final String updateUrl = params.size() > 0 && !params.get(0).isNull() ? para ms.get(0).toString() : ""; 42 final String updateUrl = params.size() > 0 && !params.get(0).isNull() ? para ms.get(0).toString() : "";
44 if (!Strings.isEmpty(updateUrl)) 43 if (StringUtils.isNotEmpty(updateUrl))
45 { 44 {
46 final Notification notification = Utils.createUpdateNotification(this.cont ext, updateUrl, null); 45 final Notification notification = Utils.createUpdateNotification(this.cont ext, updateUrl, null);
47 final NotificationManager notificationManager = (NotificationManager)this. context.getSystemService(Context.NOTIFICATION_SERVICE); 46 final NotificationManager notificationManager = (NotificationManager)this. context.getSystemService(Context.NOTIFICATION_SERVICE);
48 notificationManager.notify(AdblockPlus.UPDATE_NOTIFICATION_ID, notificatio n); 47 notificationManager.notify(AdblockPlus.UPDATE_NOTIFICATION_ID, notificatio n);
49 } 48 }
50 } 49 }
51 } 50 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld