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

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

Issue 29678581: Issue 6000 - Rename "libadblockplus-android" (Closed)
Patch Set: addressed comments Created Jan. 29, 2018, 11:04 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: libadblockplus-android/src/org/adblockplus/libadblockplus/android/ConnectionType.java
diff --git a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/ConnectionType.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/ConnectionType.java
deleted file mode 100644
index 1f6540519322bd97cbd7848bdc1130e1704d70a3..0000000000000000000000000000000000000000
--- a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/ConnectionType.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-present 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.libadblockplus.android;
-
-import android.net.ConnectivityManager;
-
-public enum ConnectionType {
-
- // All WiFi networks
- WIFI("wifi")
- {
- @Override
- public boolean isRequiredConnection(ConnectivityManager manager)
- {
- return manager.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
- }
- },
-
- // Non-metered WiFi networks
- WIFI_NON_METERED("wifi_non_metered")
- {
- @Override
- public boolean isRequiredConnection(ConnectivityManager manager)
- {
- return
- manager.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI &&
- !manager.isActiveNetworkMetered(); // make minSdkVersion 16
- }
- },
-
- // Any connection
- ANY("any")
- {
- @Override
- public boolean isRequiredConnection(ConnectivityManager manager)
- {
- return true;
- }
- };
-
- private String value;
-
- public String getValue()
- {
- return value;
- }
-
- // check if current device connection type is equal to this concrete connection type
- public abstract boolean isRequiredConnection(ConnectivityManager manager);
-
- ConnectionType(String value)
- {
- this.value = value;
- }
-
- public static ConnectionType findByValue(String value)
- {
- if (value == null)
- {
- return null;
- }
-
- for (ConnectionType eachConnectionType : ConnectionType.values())
- {
- if (eachConnectionType.getValue().equals(value))
- {
- return eachConnectionType;
- }
- }
-
- // not found
- return null;
- }
-}

Powered by Google App Engine
This is Rietveld