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

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

Issue 5153282527854592: Issue 98 - Use the libadblockplus update mechanism (Closed)
Patch Set: Reduce scope of UPDATE_NOTIFICATION_ID and move network error logging to AndroidUpdateCheckDoneCall… Created Sept. 26, 2014, 1:03 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 org.adblockplus.libadblockplus.UpdateCheckDoneCallback; 20 import org.adblockplus.libadblockplus.UpdateCheckDoneCallback;
21 import org.apache.commons.lang.StringUtils; 21 import org.apache.commons.lang.StringUtils;
22 22
23 import android.app.Notification;
24 import android.app.NotificationManager;
25 import android.content.Context; 23 import android.content.Context;
24 import android.util.Log;
26 25
27 public class AndroidUpdateCheckDoneCallback extends UpdateCheckDoneCallback 26 public class AndroidUpdateCheckDoneCallback extends UpdateCheckDoneCallback
28 { 27 {
29 private final Context context; 28 private final Context context;
30 29
31 public AndroidUpdateCheckDoneCallback(final Context context) 30 public AndroidUpdateCheckDoneCallback(final Context context)
32 { 31 {
33 this.context = context; 32 this.context = context;
34 } 33 }
35 34
36 @Override 35 @Override
37 public void updateCheckDoneCallback(final String error) 36 public void updateCheckDoneCallback(final String error)
38 { 37 {
39 // TODO: Check if we need this 'manualUpdate' mechanism (initiated by 'check ForUpdates()') 38 if (StringUtils.isEmpty(error))
40 // if (!error.empty()) 39 return;
41 // { 40 Log.e(Utils.getTag(AndroidUpdateCheckDoneCallback.class), "Update check fail ed: " + error);
René Jeschke 2014/09/26 13:10:52 Could you please extract the 'tag' into a private/
Felix Dahlke 2014/09/26 13:15:31 Done.
42 // jstring jError = jniEnv->NewStringUTF(error.c_str()); 41 Utils.showUpdateNotification(this.context, null, error);
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 } 42 }
57 } 43 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/android/AndroidUpdateAvailableCallback.java ('k') | src/org/adblockplus/android/Preferences.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld