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

Side by Side Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/android/ConnectionType.java

Issue 29671734: Issue 6265 - Create shared AdblockEngine instance in AdblockWebView in background (Closed)
Patch Set: Sergey's comments Created Jan. 22, 2018, 6:19 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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.libadblockplus.android.settings; 18 package org.adblockplus.libadblockplus.android;
19 19
20 import android.net.ConnectivityManager; 20 import android.net.ConnectivityManager;
21 21
22 public enum ConnectionType { 22 public enum ConnectionType {
23 23
24 // All WiFi networks 24 // All WiFi networks
25 WIFI("wifi") 25 WIFI("wifi")
26 { 26 {
27 @Override 27 @Override
28 public boolean isRequiredConnection(ConnectivityManager manager) 28 public boolean isRequiredConnection(ConnectivityManager manager)
29 { 29 {
30 return manager.getActiveNetworkInfo().getType() == ConnectivityManager.TYP E_WIFI; 30 return manager.getActiveNetworkInfo().getType() == ConnectivityManager.TYP E_WIFI;
31 } 31 }
32 }, 32 },
33 33
34 // Non-metered WiFi networks 34 // Non-metered WiFi networks
35 WIFI_NON_METERED("wifi_non_metered") 35 WIFI_NON_METERED("wifi_non_metered")
36 { 36 {
37 @Override 37 @Override
38 public boolean isRequiredConnection(ConnectivityManager manager) 38 public boolean isRequiredConnection(ConnectivityManager manager)
39 { 39 {
40 return 40 return
41 manager.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIF I && 41 manager.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIF I &&
42 !manager.isActiveNetworkMetered(); 42 !manager.isActiveNetworkMetered(); // make minSdkVersion 16
43 } 43 }
44 }, 44 },
45 45
46 // Any connection 46 // Any connection
47 ANY("any") 47 ANY("any")
48 { 48 {
49 @Override 49 @Override
50 public boolean isRequiredConnection(ConnectivityManager manager) 50 public boolean isRequiredConnection(ConnectivityManager manager)
51 { 51 {
52 return true; 52 return true;
(...skipping 27 matching lines...) Expand all
80 if (eachConnectionType.getValue().equals(value)) 80 if (eachConnectionType.getValue().equals(value))
81 { 81 {
82 return eachConnectionType; 82 return eachConnectionType;
83 } 83 }
84 } 84 }
85 85
86 // not found 86 // not found
87 return null; 87 return null;
88 } 88 }
89 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld