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

Unified Diff: src/org/adblockplus/android/AndroidUpdaterCallback.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Patch Set: Removed another whitespace change Created April 28, 2014, 8:36 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/org/adblockplus/android/AndroidUpdaterCallback.java
diff --git a/src/org/adblockplus/android/AndroidUpdaterCallback.java b/src/org/adblockplus/android/AndroidUpdaterCallback.java
new file mode 100644
index 0000000000000000000000000000000000000000..18f425299d7bd0aff9c462a32d9dce78f5f47154
--- /dev/null
+++ b/src/org/adblockplus/android/AndroidUpdaterCallback.java
@@ -0,0 +1,57 @@
+/*
+ * This file is part of Adblock Plus <http://adblockplus.org/>,
+ * Copyright (C) 2006-2014 Eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.adblockplus.android;
+
+import org.adblockplus.libadblockplus.UpdaterCallback;
+import org.apache.commons.lang.StringUtils;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.content.Context;
+
+public class AndroidUpdaterCallback extends UpdaterCallback
+{
+ private final Context context;
+
+ public AndroidUpdaterCallback(final Context context)
+ {
+ this.context = context;
+ }
+
+ @Override
+ public void updaterCallback(final String error)
+ {
+ // TODO: Check if we need this 'manualUpdate' mechanism (initiated by 'checkForUpdates()')
+ // if (!error.empty())
+ // {
+ // jstring jError = jniEnv->NewStringUTF(error.c_str());
+ // if (mid)
+ // jniEnv->CallVoidMethod(jniObject, mid, NULL, jError);
+ // jniEnv->DeleteLocalRef(jError);
+ // }
+ // else if (manualUpdate)
+ // {
+ // if (mid)
+ // jniEnv->CallVoidMethod(jniObject, mid, NULL, NULL);
+ // }
+
+ final Notification notification = Utils.createUpdateNotification(this.context, null, StringUtils.isEmpty(error) ? null : error);
+ final NotificationManager notificationManager = (NotificationManager)this.context.getSystemService(Context.NOTIFICATION_SERVICE);
+ notificationManager.notify(AdblockPlus.UPDATE_NOTIFICATION_ID, notification);
+ }
+}
« no previous file with comments | « src/org/adblockplus/android/AndroidUpdateAvailableCallback.java ('k') | src/org/adblockplus/android/AndroidWebRequest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld