| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 /* | 
|  | 2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 
|  | 3  * Copyright (C) 2006-2014 Eyeo GmbH | 
|  | 4  * | 
|  | 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 | 
|  | 7  * published by the Free Software Foundation. | 
|  | 8  * | 
|  | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
|  | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12  * GNU General Public License for more details. | 
|  | 13  * | 
|  | 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/>. | 
|  | 16  */ | 
|  | 17 | 
|  | 18 package org.adblockplus.android; | 
|  | 19 | 
|  | 20 import org.adblockplus.libadblockplus.UpdaterCallback; | 
|  | 21 | 
|  | 22 import com.github.rjeschke.neetutils.Strings; | 
|  | 23 | 
|  | 24 import android.app.Notification; | 
|  | 25 import android.app.NotificationManager; | 
|  | 26 import android.content.Context; | 
|  | 27 | 
|  | 28 public class AndroidUpdaterCallback extends UpdaterCallback | 
|  | 29 { | 
|  | 30   private final Context context; | 
|  | 31 | 
|  | 32   public AndroidUpdaterCallback(final Context context) | 
|  | 33   { | 
|  | 34     this.context = context; | 
|  | 35   } | 
|  | 36 | 
|  | 37   @Override | 
|  | 38   public void updaterCallback(final String error) | 
|  | 39   { | 
|  | 40     // TODO: Check if we need this 'manualUpdate' mechanism (initiated by 'check
    ForUpdates()') | 
|  | 41     // if (!error.empty()) | 
|  | 42     // { | 
|  | 43     // jstring jError = jniEnv->NewStringUTF(error.c_str()); | 
|  | 44     // if (mid) | 
|  | 45     // jniEnv->CallVoidMethod(jniObject, mid, NULL, jError); | 
|  | 46     // jniEnv->DeleteLocalRef(jError); | 
|  | 47     // } | 
|  | 48     // else if (manualUpdate) | 
|  | 49     // { | 
|  | 50     // if (mid) | 
|  | 51     // jniEnv->CallVoidMethod(jniObject, mid, NULL, NULL); | 
|  | 52     // } | 
|  | 53 | 
|  | 54     final Notification notification = Utils.createUpdateNotification(this.contex
    t, null, Strings.isEmpty(error) ? null : error); | 
|  | 55     final NotificationManager notificationManager = (NotificationManager)this.co
    ntext.getSystemService(Context.NOTIFICATION_SERVICE); | 
|  | 56     notificationManager.notify(AdblockPlus.UPDATE_NOTIFICATION_ID, notification)
    ; | 
|  | 57   } | 
|  | 58 } | 
| OLD | NEW | 
|---|