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: Only append the revision to the version for devbuilds Created Sept. 26, 2014, 2:54 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 {
28 private static final String TAG = Utils.getTag(AndroidUpdateCheckDoneCallback. class);
29
29 private final Context context; 30 private final Context context;
30 31
31 public AndroidUpdateCheckDoneCallback(final Context context) 32 public AndroidUpdateCheckDoneCallback(final Context context)
32 { 33 {
33 this.context = context; 34 this.context = context;
34 } 35 }
35 36
36 @Override 37 @Override
37 public void updateCheckDoneCallback(final String error) 38 public void updateCheckDoneCallback(final String error)
38 { 39 {
39 // TODO: Check if we need this 'manualUpdate' mechanism (initiated by 'check ForUpdates()') 40 if (StringUtils.isEmpty(error))
40 // if (!error.empty()) 41 return;
41 // { 42 Log.e(TAG, "Update check failed: " + error);
42 // jstring jError = jniEnv->NewStringUTF(error.c_str()); 43 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 } 44 }
57 } 45 }
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