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