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

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

Issue 6245218638626816: Issue 1424 - Update libadblockplus-binaries to 6f79af14ad4e (Closed)
Patch Set: Created Sept. 22, 2014, 4:44 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/AndroidUpdateCheckDoneCallback.java
===================================================================
new file mode 100644
--- /dev/null
+++ b/src/org/adblockplus/android/AndroidUpdateCheckDoneCallback.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.UpdateCheckDoneCallback;
+import org.apache.commons.lang.StringUtils;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.content.Context;
+
+public class AndroidUpdateCheckDoneCallback extends UpdateCheckDoneCallback
+{
+ private final Context context;
+
+ public AndroidUpdateCheckDoneCallback(final Context context)
+ {
+ this.context = context;
+ }
+
+ @Override
+ public void updateCheckDoneCallback(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);
+ }
+}

Powered by Google App Engine
This is Rietveld