| OLD | NEW |
| 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.android.configurators.NativeProxyConfigurator; | |
| 21 import org.adblockplus.android.updater.UpdaterActivity; | 20 import org.adblockplus.android.updater.UpdaterActivity; |
| 22 import org.adblockplus.libadblockplus.JsValue; | 21 import org.adblockplus.libadblockplus.JsValue; |
| 23 import org.adblockplus.libadblockplus.Subscription; | 22 import org.adblockplus.libadblockplus.Subscription; |
| 24 import org.apache.commons.lang.StringUtils; | 23 import org.apache.commons.lang.StringUtils; |
| 25 | 24 |
| 26 import android.app.Notification; | 25 import android.app.Notification; |
| 27 import android.app.PendingIntent; | 26 import android.app.PendingIntent; |
| 28 import android.content.Context; | 27 import android.content.Context; |
| 29 import android.content.Intent; | 28 import android.content.Intent; |
| 30 import android.support.v4.app.NotificationCompat; | 29 import android.support.v4.app.NotificationCompat; |
| 31 | 30 |
| 32 public final class Utils | 31 public final class Utils |
| 33 { | 32 { |
| 34 private static boolean nativeProxySupportChecked = false; | |
| 35 private static boolean nativeProxySupported = false; | |
| 36 | |
| 37 private Utils() | 33 private Utils() |
| 38 { | 34 { |
| 39 // | 35 // |
| 40 } | 36 } |
| 41 | 37 |
| 42 public static synchronized boolean isNativeProxySupported(final Context contex
t) | |
| 43 { | |
| 44 if (!nativeProxySupportChecked) | |
| 45 { | |
| 46 nativeProxySupported = NativeProxyConfigurator.canUse(context); | |
| 47 nativeProxySupportChecked = true; | |
| 48 } | |
| 49 | |
| 50 return nativeProxySupported; | |
| 51 } | |
| 52 | |
| 53 public static String getTag(final Class<?> clazz) | 38 public static String getTag(final Class<?> clazz) |
| 54 { | 39 { |
| 55 return clazz.getSimpleName(); | 40 return clazz.getSimpleName(); |
| 56 } | 41 } |
| 57 | 42 |
| 58 public static String capitalizeString(final String s) | 43 public static String capitalizeString(final String s) |
| 59 { | 44 { |
| 60 if (s == null || s.length() == 0) | 45 if (s == null || s.length() == 0) |
| 61 { | 46 { |
| 62 return ""; | 47 return ""; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 time = lastDownload; | 111 time = lastDownload; |
| 127 status = "synchronize_last_at"; | 112 status = "synchronize_last_at"; |
| 128 } | 113 } |
| 129 | 114 |
| 130 context.sendBroadcast(new Intent(AdblockPlus.BROADCAST_SUBSCRIPTION_STATUS) | 115 context.sendBroadcast(new Intent(AdblockPlus.BROADCAST_SUBSCRIPTION_STATUS) |
| 131 .putExtra("url", sub.getProperty("url").toString()) | 116 .putExtra("url", sub.getProperty("url").toString()) |
| 132 .putExtra("status", status) | 117 .putExtra("status", status) |
| 133 .putExtra("time", time * 1000L)); | 118 .putExtra("time", time * 1000L)); |
| 134 } | 119 } |
| 135 } | 120 } |
| OLD | NEW |