summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/util
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-07-22 12:41:17 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-07-22 12:41:17 +0200
commitf0edc0558b19bd8185e84876a233d1930c5867f5 (patch)
tree4284284b2dae1ae6575812e4ac14dc473d91138a /src/de/danoeh/antennapod/util
parent581e8af135570ba4fc8b3fdbad536d59a9ce20d3 (diff)
downloadAntennaPod-f0edc0558b19bd8185e84876a233d1930c5867f5.zip
Added DEBUG logging condition0.8_RC3
Diffstat (limited to 'src/de/danoeh/antennapod/util')
-rw-r--r--src/de/danoeh/antennapod/util/ConnectionTester.java10
-rw-r--r--src/de/danoeh/antennapod/util/FeedMenuHandler.java3
-rw-r--r--src/de/danoeh/antennapod/util/FlattrServiceCreator.java6
-rw-r--r--src/de/danoeh/antennapod/util/FlattrUtils.java15
-rw-r--r--src/de/danoeh/antennapod/util/URLChecker.java5
5 files changed, 23 insertions, 16 deletions
diff --git a/src/de/danoeh/antennapod/util/ConnectionTester.java b/src/de/danoeh/antennapod/util/ConnectionTester.java
index d50e63f00..8d5e189f4 100644
--- a/src/de/danoeh/antennapod/util/ConnectionTester.java
+++ b/src/de/danoeh/antennapod/util/ConnectionTester.java
@@ -6,6 +6,8 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import de.danoeh.antennapod.BuildConfig;
+
import android.content.Context;
import android.util.Log;
@@ -32,22 +34,22 @@ public class ConnectionTester implements Runnable {
@Override
public void run() {
- Log.d(TAG, "Testing connection");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Testing connection");
try {
URL url = new URL(strUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.connect();
callback.onConnectionSuccessful();
- Log.d(TAG, "Connection seems to work");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Connection seems to work");
} catch (MalformedURLException e) {
e.printStackTrace();
reason = DownloadError.ERROR_CONNECTION_ERROR;
- Log.d(TAG, "Connection failed");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Connection failed");
callback.onConnectionFailure();
} catch (IOException e) {
e.printStackTrace();
reason = DownloadError.ERROR_CONNECTION_ERROR;
- Log.d(TAG, "Connection failed");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Connection failed");
callback.onConnectionFailure();
}
}
diff --git a/src/de/danoeh/antennapod/util/FeedMenuHandler.java b/src/de/danoeh/antennapod/util/FeedMenuHandler.java
index 3f001adf1..6c87b2313 100644
--- a/src/de/danoeh/antennapod/util/FeedMenuHandler.java
+++ b/src/de/danoeh/antennapod/util/FeedMenuHandler.java
@@ -17,6 +17,7 @@ import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.service.DownloadService;
import de.danoeh.antennapod.storage.DownloadRequester;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
/** Handles interactions with the FeedItemMenu. */
@@ -29,7 +30,7 @@ public class FeedMenuHandler {
}
public static boolean onPrepareOptionsMenu(Menu menu, Feed selectedFeed) {
- Log.d(TAG, "Preparing options menu");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Preparing options menu");
if (selectedFeed.getPaymentLink() != null) {
menu.findItem(R.id.support_item).setVisible(true);
}
diff --git a/src/de/danoeh/antennapod/util/FlattrServiceCreator.java b/src/de/danoeh/antennapod/util/FlattrServiceCreator.java
index 50e2c531c..28c64e093 100644
--- a/src/de/danoeh/antennapod/util/FlattrServiceCreator.java
+++ b/src/de/danoeh/antennapod/util/FlattrServiceCreator.java
@@ -4,6 +4,8 @@ import org.shredzone.flattr4j.FlattrFactory;
import org.shredzone.flattr4j.FlattrService;
import org.shredzone.flattr4j.oauth.AccessToken;
+import de.danoeh.antennapod.BuildConfig;
+
import android.util.Log;
/** Ensures that only one instance of the FlattrService class exists at a time */
@@ -14,7 +16,7 @@ public class FlattrServiceCreator {
public static FlattrService getService(AccessToken token) {
if (flattrService == null) {
- Log.d(TAG, "Creating new instance of Flattr Service");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Creating new instance of Flattr Service");
FlattrFactory factory = FlattrFactory.getInstance();
flattrService = factory.createFlattrService(token);
}
@@ -22,7 +24,7 @@ public class FlattrServiceCreator {
}
public static void deleteFlattrService() {
- Log.d(TAG, "Deleting service instance");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Deleting service instance");
flattrService = null;
}
}
diff --git a/src/de/danoeh/antennapod/util/FlattrUtils.java b/src/de/danoeh/antennapod/util/FlattrUtils.java
index 54872f07a..0c16dbd7b 100644
--- a/src/de/danoeh/antennapod/util/FlattrUtils.java
+++ b/src/de/danoeh/antennapod/util/FlattrUtils.java
@@ -23,6 +23,7 @@ import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.activity.FlattrAuthActivity;
import de.danoeh.antennapod.asynctask.FlattrTokenFetcher;
@@ -63,15 +64,15 @@ public class FlattrUtils {
*/
private static AccessToken retrieveToken() {
if (cachedToken == null) {
- Log.d(TAG, "Retrieving access token");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Retrieving access token");
String token = PreferenceManager.getDefaultSharedPreferences(
PodcastApp.getInstance())
.getString(PREF_ACCESS_TOKEN, null);
if (token != null) {
- Log.d(TAG, "Found access token. Caching.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Found access token. Caching.");
cachedToken = new AccessToken(token);
} else {
- Log.d(TAG, "No access token found");
+ if (BuildConfig.DEBUG) Log.d(TAG, "No access token found");
return null;
}
}
@@ -86,7 +87,7 @@ public class FlattrUtils {
/** Stores the token as a preference */
public static void storeToken(AccessToken token) {
- Log.d(TAG, "Storing token");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Storing token");
SharedPreferences.Editor editor = PreferenceManager
.getDefaultSharedPreferences(PodcastApp.getInstance()).edit();
if (token != null) {
@@ -99,7 +100,7 @@ public class FlattrUtils {
}
public static void deleteToken() {
- Log.d(TAG, "Deleting flattr token");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Deleting flattr token");
storeToken(null);
}
@@ -132,7 +133,7 @@ public class FlattrUtils {
}
public static void revokeAccessToken(Context context) {
- Log.d(TAG, "Revoking access token");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Revoking access token");
deleteToken();
FlattrServiceCreator.deleteFlattrService();
showRevokeDialog(context);
@@ -155,7 +156,7 @@ public class FlattrUtils {
}
public static void showNoTokenDialog(final Context context, final String url) {
- Log.d(TAG, "Creating showNoTokenDialog");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Creating showNoTokenDialog");
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.no_flattr_token_title);
builder.setMessage(R.string.no_flattr_token_msg);
diff --git a/src/de/danoeh/antennapod/util/URLChecker.java b/src/de/danoeh/antennapod/util/URLChecker.java
index f5e202946..338401060 100644
--- a/src/de/danoeh/antennapod/util/URLChecker.java
+++ b/src/de/danoeh/antennapod/util/URLChecker.java
@@ -1,5 +1,6 @@
package de.danoeh.antennapod.util;
+import de.danoeh.antennapod.BuildConfig;
import android.util.Log;
/** Provides methods for checking and editing a URL.*/
@@ -25,12 +26,12 @@ public final class URLChecker {
if (!url.startsWith("http")) {
builder.append("http://");
- Log.d(TAG, "Missing http; appending");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Missing http; appending");
}
builder.append(url);
if (url.contains(FEEDBURNER_URL)) {
- Log.d(TAG,
+ if (BuildConfig.DEBUG) Log.d(TAG,
"URL seems to be Feedburner URL; appending prefix");
builder.append(FEEDBURNER_PREFIX);
}