summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod
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
parent581e8af135570ba4fc8b3fdbad536d59a9ce20d3 (diff)
downloadAntennaPod-f0edc0558b19bd8185e84876a233d1930c5867f5.zip
Added DEBUG logging condition0.8_RC3
Diffstat (limited to 'src/de/danoeh/antennapod')
-rw-r--r--src/de/danoeh/antennapod/PodcastApp.java6
-rw-r--r--src/de/danoeh/antennapod/activity/AddFeedActivity.java7
-rw-r--r--src/de/danoeh/antennapod/activity/DownloadActivity.java11
-rw-r--r--src/de/danoeh/antennapod/activity/FeedInfoActivity.java5
-rw-r--r--src/de/danoeh/antennapod/activity/FlattrAuthActivity.java7
-rw-r--r--src/de/danoeh/antennapod/activity/ItemviewActivity.java7
-rw-r--r--src/de/danoeh/antennapod/activity/MainActivity.java3
-rw-r--r--src/de/danoeh/antennapod/activity/MediaplayerActivity.java51
-rw-r--r--src/de/danoeh/antennapod/activity/StorageErrorActivity.java5
-rw-r--r--src/de/danoeh/antennapod/asynctask/DownloadObserver.java9
-rw-r--r--src/de/danoeh/antennapod/asynctask/FeedImageLoader.java5
-rw-r--r--src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java5
-rw-r--r--src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java3
-rw-r--r--src/de/danoeh/antennapod/feed/FeedManager.java25
-rw-r--r--src/de/danoeh/antennapod/fragment/FeedlistFragment.java7
-rw-r--r--src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java5
-rw-r--r--src/de/danoeh/antennapod/fragment/ItemlistFragment.java3
-rw-r--r--src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java5
-rw-r--r--src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java3
-rw-r--r--src/de/danoeh/antennapod/receiver/PlayerWidget.java3
-rw-r--r--src/de/danoeh/antennapod/service/DownloadService.java33
-rw-r--r--src/de/danoeh/antennapod/service/PlaybackService.java53
-rw-r--r--src/de/danoeh/antennapod/service/PlayerWidgetService.java13
-rw-r--r--src/de/danoeh/antennapod/storage/DownloadRequester.java13
-rw-r--r--src/de/danoeh/antennapod/storage/PodDBAdapter.java9
-rw-r--r--src/de/danoeh/antennapod/syndication/handler/SyndHandler.java9
-rw-r--r--src/de/danoeh/antennapod/syndication/handler/TypeGetter.java9
-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
32 files changed, 193 insertions, 160 deletions
diff --git a/src/de/danoeh/antennapod/PodcastApp.java b/src/de/danoeh/antennapod/PodcastApp.java
index 946751d44..8bb5713e4 100644
--- a/src/de/danoeh/antennapod/PodcastApp.java
+++ b/src/de/danoeh/antennapod/PodcastApp.java
@@ -60,7 +60,7 @@ public class PodcastApp extends Application implements
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
- Log.d(TAG, "Registered change of application preferences");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Registered change of application preferences");
if (key.equals(PREF_UPDATE_INTERVALL)) {
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
int hours = Integer.parseInt(sharedPreferences.getString(
@@ -72,9 +72,9 @@ public class PodcastApp extends Application implements
long newIntervall = TimeUnit.HOURS.toMillis(hours);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
newIntervall, newIntervall, updateIntent);
- Log.d(TAG, "Changed alarm to new intervall");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Changed alarm to new intervall");
} else {
- Log.d(TAG, "Automatic update was deactivated");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Automatic update was deactivated");
}
}
}
diff --git a/src/de/danoeh/antennapod/activity/AddFeedActivity.java b/src/de/danoeh/antennapod/activity/AddFeedActivity.java
index 76478480b..d558043bd 100644
--- a/src/de/danoeh/antennapod/activity/AddFeedActivity.java
+++ b/src/de/danoeh/antennapod/activity/AddFeedActivity.java
@@ -12,6 +12,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.DownloadObserver;
import de.danoeh.antennapod.asynctask.DownloadStatus;
@@ -103,12 +104,12 @@ public class AddFeedActivity extends SherlockActivity {
StorageUtils.checkStorageAvailability(this);
Intent intent = getIntent();
if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_SEND)) {
- Log.d(TAG, "Was started with ACTION_SEND intent");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Was started with ACTION_SEND intent");
String text = intent.getStringExtra(Intent.EXTRA_TEXT);
if (text != null) {
etxtFeedurl.setText(text);
} else {
- Log.d(TAG, "No text was sent");
+ if (BuildConfig.DEBUG) Log.d(TAG, "No text was sent");
}
}
@@ -117,7 +118,7 @@ public class AddFeedActivity extends SherlockActivity {
@Override
protected void onStop() {
super.onStop();
- Log.d(TAG, "Stopping Activity");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity");
}
@Override
diff --git a/src/de/danoeh/antennapod/activity/DownloadActivity.java b/src/de/danoeh/antennapod/activity/DownloadActivity.java
index 180a1b643..2b72b86b8 100644
--- a/src/de/danoeh/antennapod/activity/DownloadActivity.java
+++ b/src/de/danoeh/antennapod/activity/DownloadActivity.java
@@ -7,6 +7,7 @@ import de.danoeh.antennapod.feed.FeedFile;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.service.DownloadService;
import de.danoeh.antennapod.storage.DownloadRequester;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.ActionMode;
@@ -42,7 +43,7 @@ public class DownloadActivity extends SherlockListActivity implements
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Log.d(TAG, "Creating Activity");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Creating Activity");
requester = DownloadRequester.getInstance();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@@ -60,14 +61,14 @@ public class DownloadActivity extends SherlockListActivity implements
@Override
protected void onResume() {
super.onResume();
- Log.d(TAG, "Trying to bind service");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Trying to bind service");
bindService(new Intent(this, DownloadService.class), mConnection, 0);
}
@Override
protected void onStop() {
super.onStop();
- Log.d(TAG, "Stopping Activity");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity");
}
@Override
@@ -161,7 +162,7 @@ public class DownloadActivity extends SherlockListActivity implements
public void onServiceConnected(ComponentName className, IBinder service) {
downloadService = ((DownloadService.LocalBinder) service)
.getService();
- Log.d(TAG, "Connection to service established");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Connection to service established");
dla = new DownloadlistAdapter(DownloadActivity.this, 0,
downloadService.getDownloadObserver().getStatusList());
setListAdapter(dla);
@@ -183,7 +184,7 @@ public class DownloadActivity extends SherlockListActivity implements
@Override
public void onFinish() {
- Log.d(TAG, "Observer has finished, clearing adapter");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Observer has finished, clearing adapter");
dla.clear();
dla.notifyDataSetInvalidated();
}
diff --git a/src/de/danoeh/antennapod/activity/FeedInfoActivity.java b/src/de/danoeh/antennapod/activity/FeedInfoActivity.java
index 23e3e0c09..9b0915bb3 100644
--- a/src/de/danoeh/antennapod/activity/FeedInfoActivity.java
+++ b/src/de/danoeh/antennapod/activity/FeedInfoActivity.java
@@ -15,6 +15,7 @@ import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.util.FeedMenuHandler;
import de.danoeh.antennapod.util.LangUtils;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
/** Displays information about a feed. */
@@ -40,8 +41,8 @@ public class FeedInfoActivity extends SherlockActivity {
FeedManager manager = FeedManager.getInstance();
feed = manager.getFeed(feedId);
if (feed != null) {
- Log.d(TAG, "Language is " + feed.getLanguage());
- Log.d(TAG, "Author is " + feed.getAuthor());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Language is " + feed.getLanguage());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Author is " + feed.getAuthor());
imgvCover = (ImageView) findViewById(R.id.imgvCover);
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
txtvDescription = (TextView) findViewById(R.id.txtvDescription);
diff --git a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java b/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java
index 5e500d73d..e73c3daac 100644
--- a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java
+++ b/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java
@@ -16,6 +16,7 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import de.danoeh.antennapod.util.FlattrUtils;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
/** Guides the user through the authentication process */
@@ -35,7 +36,7 @@ public class FlattrAuthActivity extends SherlockActivity {
super.onCreate(savedInstanceState);
singleton = this;
authSuccessful = false;
- Log.d(TAG, "Activity created");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Activity created");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.flattr_auth);
txtvExplanation = (TextView) findViewById(R.id.txtvExplanation);
@@ -69,10 +70,10 @@ public class FlattrAuthActivity extends SherlockActivity {
@Override
protected void onResume() {
super.onResume();
- Log.d(TAG, "Activity resumed");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Activity resumed");
Uri uri = getIntent().getData();
if (uri != null) {
- Log.d(TAG, "Received uri");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received uri");
FlattrUtils.handleCallback(this, uri);
}
}
diff --git a/src/de/danoeh/antennapod/activity/ItemviewActivity.java b/src/de/danoeh/antennapod/activity/ItemviewActivity.java
index 2e071134c..4bf05e6ea 100644
--- a/src/de/danoeh/antennapod/activity/ItemviewActivity.java
+++ b/src/de/danoeh/antennapod/activity/ItemviewActivity.java
@@ -24,6 +24,7 @@ import de.danoeh.antennapod.fragment.ItemDescriptionFragment;
import de.danoeh.antennapod.fragment.ItemlistFragment;
import de.danoeh.antennapod.util.FeedItemMenuHandler;
import de.danoeh.antennapod.util.StorageUtils;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
/** Displays a single FeedItem and provides various actions */
@@ -58,7 +59,7 @@ public class ItemviewActivity extends SherlockFragmentActivity {
@Override
public void onStop() {
super.onStop();
- Log.d(TAG, "Stopping Activity");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity");
}
/** Extracts FeedItem object the activity is supposed to display */
@@ -72,8 +73,8 @@ public class ItemviewActivity extends SherlockFragmentActivity {
}
Feed feed = manager.getFeed(feedId);
item = manager.getFeedItem(itemId, feed);
- Log.d(TAG, "Title of item is " + item.getTitle());
- Log.d(TAG, "Title of feed is " + item.getFeed().getTitle());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Title of item is " + item.getTitle());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Title of feed is " + item.getFeed().getTitle());
}
private void populateUI() {
diff --git a/src/de/danoeh/antennapod/activity/MainActivity.java b/src/de/danoeh/antennapod/activity/MainActivity.java
index 8ef7a1a62..ae7e1a27a 100644
--- a/src/de/danoeh/antennapod/activity/MainActivity.java
+++ b/src/de/danoeh/antennapod/activity/MainActivity.java
@@ -25,6 +25,7 @@ import de.danoeh.antennapod.fragment.UnreadItemlistFragment;
import de.danoeh.antennapod.service.DownloadService;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.StorageUtils;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
public class MainActivity extends SherlockFragmentActivity {
@@ -71,7 +72,7 @@ public class MainActivity extends SherlockFragmentActivity {
private BroadcastReceiver contentUpdate = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "Received contentUpdate Intent.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
updateProgressBarVisibility();
}
};
diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
index a66e49ac9..35a86d402 100644
--- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
@@ -41,6 +41,7 @@ import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.viewpagerindicator.TabPageIndicator;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedManager;
@@ -97,7 +98,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
protected void onStop() {
super.onStop();
- Log.d(TAG, "Activity stopped");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Activity stopped");
try {
unregisterReceiver(statusUpdate);
} catch (IllegalArgumentException e) {
@@ -156,7 +157,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
protected void onResume() {
super.onResume();
- Log.d(TAG, "Resuming Activity");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Resuming Activity");
StorageUtils.checkStorageAvailability(this);
bindToService();
@@ -165,7 +166,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
- Log.d(TAG, "Configuration changed");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Configuration changed");
orientation = newConfig.orientation;
if (positionObserver != null) {
positionObserver.cancel(true);
@@ -191,7 +192,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Log.d(TAG, "Creating Activity");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Creating Activity");
StorageUtils.checkStorageAvailability(this);
orientation = getResources().getConfiguration().orientation;
@@ -205,7 +206,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
Intent serviceIntent = new Intent(this, PlaybackService.class);
boolean bound = false;
if (!PlaybackService.isRunning) {
- Log.d(TAG, "Trying to restore last played media");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Trying to restore last played media");
SharedPreferences prefs = getApplicationContext()
.getSharedPreferences(PodcastApp.PREF_NAME, 0);
long mediaId = prefs.getLong(PlaybackService.PREF_LAST_PLAYED_ID,
@@ -224,7 +225,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
bound = bindService(serviceIntent, mConnection,
Context.BIND_AUTO_CREATE);
} else {
- Log.d(TAG, "No last played media found");
+ if (BuildConfig.DEBUG) Log.d(TAG, "No last played media found");
status = PlayerStatus.STOPPED;
setupGUI();
handleStatus();
@@ -232,7 +233,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
} else {
bound = bindService(serviceIntent, mConnection, 0);
}
- Log.d(TAG, "Result for service binding: " + bound);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Result for service binding: " + bound);
}
private void handleStatus() {
@@ -272,7 +273,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
setStatusMsg(R.string.player_seeking_msg, View.VISIBLE);
break;
case AWAITING_VIDEO_SURFACE:
- Log.d(TAG, "Preparing video playback");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Preparing video playback");
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}
@@ -289,7 +290,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@SuppressLint("NewApi")
private void setupPositionObserver() {
if (positionObserver == null || positionObserver.isCancelled()) {
- Log.d(TAG, "Setting up position observer");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Setting up position observer");
positionObserver = new MediaPositionObserver() {
@Override
@@ -317,7 +318,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
}
private void updateProgressbarPosition() {
- Log.d(TAG, "Updating progressbar info");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Updating progressbar info");
MediaPlayer player = playbackService.getPlayer();
float progress = ((float) player.getCurrentPosition())
/ player.getDuration();
@@ -326,7 +327,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
private void loadMediaInfo() {
if (!mediaInfoLoaded) {
- Log.d(TAG, "Loading media info");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Loading media info");
if (media != null) {
getSupportActionBar().setSubtitle(media.getItem().getTitle());
getSupportActionBar().setTitle(
@@ -524,13 +525,13 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
PlaybackService.ACTION_PLAYER_NOTIFICATION));
queryService();
- Log.d(TAG, "Connection to Service established");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Connection to Service established");
}
@Override
public void onServiceDisconnected(ComponentName name) {
playbackService = null;
- Log.d(TAG, "Disconnected from Service");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Disconnected from Service");
}
};
@@ -540,7 +541,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
* information has to be refreshed
*/
private void queryService() {
- Log.d(TAG, "Querying service info");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Querying service info");
if (playbackService != null) {
int requestedOrientation;
status = playbackService.getStatus();
@@ -557,11 +558,11 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
// check if orientation is correct
if ((requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && orientation == Configuration.ORIENTATION_LANDSCAPE)
|| (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT && orientation == Configuration.ORIENTATION_PORTRAIT)) {
- Log.d(TAG, "Orientation correct");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Orientation correct");
setupGUI();
handleStatus();
} else {
- Log.d(TAG,
+ if (BuildConfig.DEBUG) Log.d(TAG,
"Orientation incorrect, waiting for orientation change");
}
} else {
@@ -573,7 +574,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
private BroadcastReceiver statusUpdate = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "Received statusUpdate Intent.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received statusUpdate Intent.");
status = playbackService.getStatus();
handleStatus();
}
@@ -611,7 +612,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
}
} else {
- Log.d(TAG, "Bad arguments. Won't handle intent");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Bad arguments. Won't handle intent");
}
}
@@ -629,7 +630,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
public void surfaceCreated(SurfaceHolder holder) {
holderCreated = true;
- Log.d(TAG, "Videoview holder created");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Videoview holder created");
if (status == PlayerStatus.AWAITING_VIDEO_SURFACE) {
if (playbackService != null) {
playbackService.setVideoSurface(holder);
@@ -718,19 +719,19 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
protected void onCancelled() {
- Log.d(TAG, "Task was cancelled");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Task was cancelled");
}
@Override
protected Void doInBackground(MediaPlayer... p) {
- Log.d(TAG, "Background Task started");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Background Task started");
player = p[0];
try {
while (player.isPlaying() && !isCancelled()) {
try {
Thread.sleep(WAITING_INTERVALL);
} catch (InterruptedException e) {
- Log.d(TAG,
+ if (BuildConfig.DEBUG) Log.d(TAG,
"Thread was interrupted while waiting. Finishing now");
return null;
}
@@ -738,9 +739,9 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
}
} catch (IllegalStateException e) {
- Log.d(TAG, "player is in illegal state, exiting now");
+ if (BuildConfig.DEBUG) Log.d(TAG, "player is in illegal state, exiting now");
}
- Log.d(TAG, "Background Task finished");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Background Task finished");
return null;
}
}
@@ -763,7 +764,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
protected void onProgressUpdate(Void... values) {
if (videoControlsShowing) {
- Log.d(TAG, "Hiding video controls");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Hiding video controls");
getSupportActionBar().hide();
videoOverlay.setVisibility(View.GONE);
videoControlsShowing = false;
diff --git a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java b/src/de/danoeh/antennapod/activity/StorageErrorActivity.java
index 6e2d1b0cf..2974fa877 100644
--- a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java
+++ b/src/de/danoeh/antennapod/activity/StorageErrorActivity.java
@@ -10,6 +10,7 @@ import android.util.Log;
import com.actionbarsherlock.app.SherlockActivity;
import de.danoeh.antennapod.util.StorageUtils;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
public class StorageErrorActivity extends SherlockActivity {
@@ -53,10 +54,10 @@ public class StorageErrorActivity extends SherlockActivity {
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED)) {
if (intent.getBooleanExtra("read-only", true)) {
- Log.d(TAG, "Media was mounted; Finishing activity");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Media was mounted; Finishing activity");
leaveErrorState();
} else {
- Log.d(TAG, "Media seemed to have been mounted read only");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Media seemed to have been mounted read only");
}
}
}
diff --git a/src/de/danoeh/antennapod/asynctask/DownloadObserver.java b/src/de/danoeh/antennapod/asynctask/DownloadObserver.java
index 1aca934ed..3a5672c82 100644
--- a/src/de/danoeh/antennapod/asynctask/DownloadObserver.java
+++ b/src/de/danoeh/antennapod/asynctask/DownloadObserver.java
@@ -11,6 +11,7 @@ import android.os.AsyncTask;
import android.util.Log;
import de.danoeh.antennapod.feed.FeedFile;
import de.danoeh.antennapod.storage.DownloadRequester;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
/** Observes the status of a specific Download */
@@ -44,7 +45,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
@Override
protected void onCancelled() {
- Log.d(TAG, "Task was cancelled.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Task was cancelled.");
statusList.clear();
for (DownloadObserver.Callback callback : observer) {
callback.onFinish();
@@ -53,7 +54,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
@Override
protected void onPostExecute(Void result) {
- Log.d(TAG, "Background task has finished");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Background task has finished");
statusList.clear();
for (DownloadObserver.Callback callback : observer) {
callback.onFinish();
@@ -61,7 +62,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
}
protected Void doInBackground(Void... params) {
- Log.d(TAG, "Background Task started.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Background Task started.");
while (downloadsLeft() && !isCancelled()) {
refreshStatuslist();
publishProgress();
@@ -71,7 +72,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
Log.w(TAG, "Thread was interrupted while waiting.");
}
}
- Log.d(TAG, "Background Task finished.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Background Task finished.");
return null;
}
diff --git a/src/de/danoeh/antennapod/asynctask/FeedImageLoader.java b/src/de/danoeh/antennapod/asynctask/FeedImageLoader.java
index 297e54ed0..6439ab565 100644
--- a/src/de/danoeh/antennapod/asynctask/FeedImageLoader.java
+++ b/src/de/danoeh/antennapod/asynctask/FeedImageLoader.java
@@ -2,6 +2,7 @@ package de.danoeh.antennapod.asynctask;
import java.io.File;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.feed.FeedImage;
import de.danoeh.antennapod.feed.FeedManager;
@@ -35,7 +36,7 @@ public class FeedImageLoader {
private LruCache<Long, Bitmap> imageCache;
private FeedImageLoader() {
- Log.d(TAG, "Creating cache with size " + cacheSize);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Creating cache with size " + cacheSize);
imageCache = new LruCache<Long, Bitmap>(cacheSize) {
@SuppressLint("NewApi")
@@ -165,7 +166,7 @@ public class FeedImageLoader {
PREFERRED_LENGTH, PREFERRED_LENGTH, false);
addBitmapToCache(params[0].getId(), bitmap);
- Log.d(TAG, "Finished loading bitmaps");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Finished loading bitmaps");
} else {
Log.e(TAG,
"FeedImage has no valid file url. Using default image");
diff --git a/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java b/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java
index 195a25b02..fd1b53425 100644
--- a/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java
+++ b/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java
@@ -8,6 +8,7 @@ import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.util.FlattrUtils;
@@ -61,7 +62,7 @@ public class FlattrClickWorker extends AsyncTask<Void, Void, Void> {
@Override
protected void onPostExecute(Void result) {
- Log.d(TAG, "Exit code was " + exitCode);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Exit code was " + exitCode);
if (progDialog != null) {
progDialog.dismiss();
}
@@ -85,7 +86,7 @@ public class FlattrClickWorker extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
- Log.d(TAG, "Starting background work");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Starting background work");
if (FlattrUtils.hasToken()) {
try {
FlattrUtils.clickUrl(context, url);
diff --git a/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java b/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java
index 5c6797c71..62f9e64b2 100644
--- a/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java
+++ b/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java
@@ -10,6 +10,7 @@ import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.FlattrAuthActivity;
import de.danoeh.antennapod.util.FlattrUtils;
@@ -71,7 +72,7 @@ public class FlattrTokenFetcher extends AsyncTask<Void, Void, AccessToken> {
return null;
}
if (token != null) {
- Log.d(TAG, "Successfully got token");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Successfully got token");
FlattrUtils.storeToken(token);
return token;
} else {
diff --git a/src/de/danoeh/antennapod/feed/FeedManager.java b/src/de/danoeh/antennapod/feed/FeedManager.java
index a0f475eff..9fd9b8d20 100644
--- a/src/de/danoeh/antennapod/feed/FeedManager.java
+++ b/src/de/danoeh/antennapod/feed/FeedManager.java
@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.activity.MediaplayerActivity;
import de.danoeh.antennapod.asynctask.DownloadStatus;
import de.danoeh.antennapod.service.PlaybackService;
@@ -109,7 +110,7 @@ public class FeedManager {
media.setFile_url(null);
setFeedMedia(context, media);
}
- Log.d(TAG, "Deleting File. Result: " + result);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Deleting File. Result: " + result);
return result;
}
@@ -168,7 +169,7 @@ public class FeedManager {
* instead of the setters of FeedItem.
*/
public void markItemRead(Context context, FeedItem item, boolean read) {
- Log.d(TAG, "Setting item with title " + item.getTitle()
+ if (BuildConfig.DEBUG) Log.d(TAG, "Setting item with title " + item.getTitle()
+ " as read/unread");
item.read = read;
setFeedItem(context, item);
@@ -196,7 +197,7 @@ public class FeedManager {
/** Marks all items in the unread items list as read */
public void markAllItemsRead(Context context) {
- Log.d(TAG, "marking all items as read");
+ if (BuildConfig.DEBUG) Log.d(TAG, "marking all items as read");
PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open();
for (FeedItem item : unreadItems) {
@@ -209,7 +210,7 @@ public class FeedManager {
}
public void refreshAllFeeds(Context context) {
- Log.d(TAG, "Refreshing all feeds.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Refreshing all feeds.");
for (Feed feed : feeds) {
refreshFeed(context, feed);
}
@@ -255,7 +256,7 @@ public class FeedManager {
/** Removes all items in queue */
public void clearQueue(Context context) {
- Log.d(TAG, "Clearing queue");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Clearing queue");
PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open();
queue.clear();
@@ -286,7 +287,7 @@ public class FeedManager {
}
public void moveQueueItem(Context context, FeedItem item, int delta) {
- Log.d(TAG, "Moving queue item");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Moving queue item");
int itemIndex = queue.indexOf(item);
int newIndex = itemIndex + delta;
if (newIndex >= 0 && newIndex < queue.size()) {
@@ -330,7 +331,7 @@ public class FeedManager {
// Look up feed in the feedslist
final Feed savedFeed = searchFeedByLink(newFeed.getLink());
if (savedFeed == null) {
- Log.d(TAG,
+ if (BuildConfig.DEBUG) Log.d(TAG,
"Found no existing Feed with title " + newFeed.getTitle()
+ ". Adding as new one.");
// Add a new Feed
@@ -339,7 +340,7 @@ public class FeedManager {
return newFeed;
} else {
- Log.d(TAG, "Feed with title " + newFeed.getTitle()
+ if (BuildConfig.DEBUG) Log.d(TAG, "Feed with title " + newFeed.getTitle()
+ " already exists. Syncing new with existing one.");
// Look for new or updated Items
for (int idx = 0; idx < newFeed.getItems().size(); idx++) {
@@ -560,7 +561,7 @@ public class FeedManager {
}
private void extractFeedlistFromCursor(Context context, PodDBAdapter adapter) {
- Log.d(TAG, "Extracting Feedlist");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Extracting Feedlist");
Cursor feedlistCursor = adapter.getAllFeedsCursor();
if (feedlistCursor.moveToFirst()) {
do {
@@ -595,7 +596,7 @@ public class FeedManager {
private ArrayList<FeedItem> extractFeedItemsFromCursor(Context context,
Feed feed, Cursor itemlistCursor, PodDBAdapter adapter) {
- Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle());
ArrayList<FeedItem> items = new ArrayList<FeedItem>();
ArrayList<String> mediaIds = new ArrayList<String>();
@@ -689,7 +690,7 @@ public class FeedManager {
private void extractDownloadLogFromCursor(Context context,
PodDBAdapter adapter) {
- Log.d(TAG, "Extracting DownloadLog");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Extracting DownloadLog");
Cursor logCursor = adapter.getDownloadLogCursor();
if (logCursor.moveToFirst()) {
do {
@@ -721,7 +722,7 @@ public class FeedManager {
}
private void extractQueueFromCursor(Context context, PodDBAdapter adapter) {
- Log.d(TAG, "Extracting Queue");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Extracting Queue");
Cursor cursor = adapter.getQueueCursor();
if (cursor.moveToFirst()) {
do {
diff --git a/src/de/danoeh/antennapod/fragment/FeedlistFragment.java b/src/de/danoeh/antennapod/fragment/FeedlistFragment.java
index b296293ce..13c86537f 100644
--- a/src/de/danoeh/antennapod/fragment/FeedlistFragment.java
+++ b/src/de/danoeh/antennapod/fragment/FeedlistFragment.java
@@ -7,6 +7,7 @@ import de.danoeh.antennapod.feed.*;
import de.danoeh.antennapod.service.DownloadService;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.FeedMenuHandler;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -58,7 +59,7 @@ public class FeedlistFragment extends SherlockListFragment implements
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Log.d(TAG, "Creating");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Creating");
manager = FeedManager.getInstance();
fla = new FeedlistAdapter(pActivity, 0, manager.getFeeds());
setListAdapter(fla);
@@ -81,7 +82,7 @@ public class FeedlistFragment extends SherlockListFragment implements
public boolean onItemLongClick(AdapterView<?> parent, View view,
int position, long id) {
Feed selection = fla.getItem(position);
- Log.d(TAG, "Selected Feed with title " + selection.getTitle());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Selected Feed with title " + selection.getTitle());
if (selection != null) {
if (mActionMode != null) {
mActionMode.finish();
@@ -123,7 +124,7 @@ public class FeedlistFragment extends SherlockListFragment implements
private BroadcastReceiver contentUpdate = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "Received contentUpdate Intent.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
fla.notifyDataSetChanged();
}
};
diff --git a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
index 4cd2902d2..f20e8a45f 100644
--- a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
+++ b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
@@ -17,6 +17,7 @@ import android.webkit.WebView;
import com.actionbarsherlock.app.SherlockFragment;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedManager;
@@ -131,7 +132,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
"utf-8", "about:blank");
getSherlockActivity()
.setSupportProgressBarIndeterminateVisibility(false);
- Log.d(TAG, "Webview loaded");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Webview loaded");
webViewLoader = null;
}
@@ -144,7 +145,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
@Override
protected Void doInBackground(Void... params) {
- Log.d(TAG, "Loading Webview");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Loading Webview");
data = "";
if (item.getContentEncoded() == null
&& item.getDescription() != null) {
diff --git a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
index db13bba87..291d17f02 100644
--- a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
+++ b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java
@@ -28,6 +28,7 @@ import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.service.DownloadService;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.FeedItemMenuHandler;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
/** Displays a list of FeedItems. */
@@ -139,7 +140,7 @@ public class ItemlistFragment extends SherlockListFragment implements
private BroadcastReceiver contentUpdate = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "Received contentUpdate Intent.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
fila.notifyDataSetChanged();
updateProgressBarVisibility();
}
diff --git a/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java b/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java
index d4ce74db3..eabd12632 100644
--- a/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java
+++ b/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java
@@ -1,5 +1,6 @@
package de.danoeh.antennapod.receiver;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.feed.FeedManager;
import android.content.BroadcastReceiver;
@@ -18,7 +19,7 @@ public class FeedUpdateReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ACTION_REFRESH_FEEDS)) {
- Log.d(TAG, "Received intent");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received intent");
boolean mobileUpdate = PreferenceManager
.getDefaultSharedPreferences(
context.getApplicationContext()).getBoolean(
@@ -26,7 +27,7 @@ public class FeedUpdateReceiver extends BroadcastReceiver {
if (mobileUpdate || connectedToWifi(context)) {
FeedManager.getInstance().refreshAllFeeds(context);
} else {
- Log.d(TAG,
+ if (BuildConfig.DEBUG) Log.d(TAG,
"Blocking automatic update: no wifi available / no mobile updates allowed");
}
}
diff --git a/src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java b/src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java
index 003f9434b..76041ec2e 100644
--- a/src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java
+++ b/src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java
@@ -1,5 +1,6 @@
package de.danoeh.antennapod.receiver;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.service.PlaybackService;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -19,7 +20,7 @@ public class MediaButtonReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "Received intent");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received intent");
KeyEvent event = (KeyEvent) intent.getExtras().get(
Intent.EXTRA_KEY_EVENT);
if (event.getAction() == KeyEvent.ACTION_DOWN) {
diff --git a/src/de/danoeh/antennapod/receiver/PlayerWidget.java b/src/de/danoeh/antennapod/receiver/PlayerWidget.java
index 328e14c63..0f3c0aa7e 100644
--- a/src/de/danoeh/antennapod/receiver/PlayerWidget.java
+++ b/src/de/danoeh/antennapod/receiver/PlayerWidget.java
@@ -1,5 +1,6 @@
package de.danoeh.antennapod.receiver;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.service.PlayerWidgetService;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
@@ -24,7 +25,7 @@ public class PlayerWidget extends AppWidgetProvider {
@Override
public void onEnabled(Context context) {
super.onEnabled(context);
- Log.d(TAG, "Widget enabled");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Widget enabled");
}
diff --git a/src/de/danoeh/antennapod/service/DownloadService.java b/src/de/danoeh/antennapod/service/DownloadService.java
index d25b61328..e30695f4d 100644
--- a/src/de/danoeh/antennapod/service/DownloadService.java
+++ b/src/de/danoeh/antennapod/service/DownloadService.java
@@ -16,6 +16,7 @@ import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.activity.DownloadActivity;
import de.danoeh.antennapod.activity.MediaplayerActivity;
import de.danoeh.antennapod.activity.MainActivity;
@@ -100,7 +101,7 @@ public class DownloadService extends Service {
@SuppressLint("NewApi")
@Override
public void onCreate() {
- Log.d(TAG, "Service started");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Service started");
isRunning = true;
completedDownloads = new ArrayList<DownloadStatus>();
registerReceiver(downloadReceiver, createIntentFilter());
@@ -125,7 +126,7 @@ public class DownloadService extends Service {
@Override
public void onDestroy() {
- Log.d(TAG, "Service shutting down");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Service shutting down");
isRunning = false;
sendBroadcast(new Intent(ACTION_FEED_SYNC_COMPLETED));
mediaplayer.release();
@@ -142,17 +143,17 @@ public class DownloadService extends Service {
/** Shuts down Executor service and prepares for shutdown */
private void initiateShutdown() {
- Log.d(TAG, "Initiating shutdown");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Initiating shutdown");
// Wait until PoolExecutor is done
Thread waiter = new Thread() {
@Override
public void run() {
syncExecutor.shutdown();
try {
- Log.d(TAG, "Starting to wait for termination");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Starting to wait for termination");
boolean b = syncExecutor.awaitTermination(20L,
TimeUnit.SECONDS);
- Log.d(TAG, "Stopping waiting for termination; Result : "
+ if (BuildConfig.DEBUG) Log.d(TAG, "Stopping waiting for termination; Result : "
+ b);
stopSelf();
@@ -179,7 +180,7 @@ public class DownloadService extends Service {
.setSmallIcon(android.R.drawable.stat_notify_sync_noanim);
startForeground(NOTIFICATION_ID, notificationBuilder.getNotification());
- Log.d(TAG, "Notification set up");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Notification set up");
}
private BroadcastReceiver downloadReceiver = new BroadcastReceiver() {
@@ -188,7 +189,7 @@ public class DownloadService extends Service {
int status = -1;
boolean successful = false;
int reason = 0;
- Log.d(TAG, "Received 'Download Complete' - message.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received 'Download Complete' - message.");
long downloadId = intent.getLongExtra(
DownloadManager.EXTRA_DOWNLOAD_ID, 0);
// get status
@@ -282,7 +283,7 @@ public class DownloadService extends Service {
}
}
if (createReport) {
- Log.d(TAG, "Creating report");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Creating report");
int successfulDownloads = 0;
int failedDownloads = 0;
for (DownloadStatus status : completedDownloads) {
@@ -313,7 +314,7 @@ public class DownloadService extends Service {
nm.notify(REPORT_ID, notification);
} else {
- Log.d(TAG, "No report is created");
+ if (BuildConfig.DEBUG) Log.d(TAG, "No report is created");
}
}
@@ -334,21 +335,21 @@ public class DownloadService extends Service {
/** Is called whenever a Feed is downloaded */
private void handleCompletedFeedDownload(Context context, Feed feed) {
- Log.d(TAG, "Handling completed Feed Download");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed Feed Download");
syncExecutor.execute(new FeedSyncThread(feed, this));
}
/** Is called whenever a Feed-Image is downloaded */
private void handleCompletedImageDownload(Context context, FeedImage image) {
- Log.d(TAG, "Handling completed Image Download");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed Image Download");
syncExecutor.execute(new ImageHandlerThread(image, this));
}
/** Is called whenever a FeedMedia is downloaded. */
private void handleCompletedFeedMediaDownload(Context context,
FeedMedia media) {
- Log.d(TAG, "Handling completed FeedMedia Download");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed FeedMedia Download");
syncExecutor.execute(new MediaHandlerThread(media, this));
}
@@ -380,14 +381,14 @@ public class DownloadService extends Service {
try {
feed = handler.parseFeed(feed);
- Log.d(TAG, feed.getTitle() + " parsed");
+ if (BuildConfig.DEBUG) Log.d(TAG, feed.getTitle() + " parsed");
feed.setDownloadId(0);
// Save information of feed in DB
savedFeed = manager.updateFeed(service, feed);
// Download Feed Image if provided and not downloaded
if (savedFeed.getImage().isDownloaded() == false) {
- Log.d(TAG, "Feed has image; Downloading....");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Feed has image; Downloading....");
imageId = requester.downloadImage(service, feed.getImage());
hasImage = true;
}
@@ -424,7 +425,7 @@ public class DownloadService extends Service {
/** Delete files that aren't needed anymore */
private void cleanup() {
if (new File(feed.getFile_url()).delete())
- Log.d(TAG, "Successfully deleted cache file.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Successfully deleted cache file.");
else
Log.e(TAG, "Failed to delete cache file.");
feed.setFile_url(null);
@@ -480,7 +481,7 @@ public class DownloadService extends Service {
e.printStackTrace();
}
media.setDuration(mediaplayer.getDuration());
- Log.d(TAG, "Duration of file is " + media.getDuration());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Duration of file is " + media.getDuration());
mediaplayer.reset();
long statusId = saveDownloadStatus(new DownloadStatus(media, 0,
true));
diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java
index 341245cf9..7a32d7786 100644
--- a/src/de/danoeh/antennapod/service/PlaybackService.java
+++ b/src/de/danoeh/antennapod/service/PlaybackService.java
@@ -24,6 +24,7 @@ import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MediaplayerActivity;
@@ -110,7 +111,7 @@ public class PlaybackService extends Service {
isRunning = true;
pausedBecauseOfTransientAudiofocusLoss = false;
status = PlayerStatus.STOPPED;
- Log.d(TAG, "Service created.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Service created.");
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
manager = FeedManager.getInstance();
player = new MediaPlayer();
@@ -132,7 +133,7 @@ public class PlaybackService extends Service {
super.onDestroy();
isRunning = false;
unregisterReceiver(headsetDisconnected);
- Log.d(TAG, "Service is about to be destroyed");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Service is about to be destroyed");
audioManager.unregisterMediaButtonEventReceiver(mediaButtonReceiver);
audioManager.abandonAudioFocus(audioFocusChangeListener);
player.release();
@@ -151,24 +152,24 @@ public class PlaybackService extends Service {
public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_LOSS:
- Log.d(TAG, "Lost audio focus");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus");
pause(true);
stopSelf();
break;
case AudioManager.AUDIOFOCUS_GAIN:
- Log.d(TAG, "Gained audio focus");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Gained audio focus");
if (pausedBecauseOfTransientAudiofocusLoss) {
play();
}
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
- Log.d(TAG, "Lost audio focus temporarily. Ducking...");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Ducking...");
audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_LOWER, 0);
pausedBecauseOfTransientAudiofocusLoss = true;
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
- Log.d(TAG, "Lost audio focus temporarily. Pausing...");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Pausing...");
pause(false);
pausedBecauseOfTransientAudiofocusLoss = true;
}
@@ -179,7 +180,7 @@ public class PlaybackService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
int keycode = intent.getIntExtra(MediaButtonReceiver.EXTRA_KEYCODE, -1);
if (keycode != -1) {
- Log.d(TAG, "Received media button event");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Received media button event");
handleKeycode(keycode);
} else {
@@ -256,7 +257,7 @@ public class PlaybackService extends Service {
* mediaplayer.
*/
public void setVideoSurface(SurfaceHolder sh) {
- Log.d(TAG, "Setting display");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Setting display");
player.setDisplay(null);
player.setDisplay(sh);
if (status == PlayerStatus.STOPPED
@@ -359,7 +360,7 @@ public class PlaybackService extends Service {
private MediaPlayer.OnPreparedListener preparedListener = new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
- Log.d(TAG, "Resource prepared");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Resource prepared");
mp.seekTo(media.getPosition());
setStatus(PlayerStatus.PREPARED);
if (startWhenPrepared) {
@@ -398,7 +399,7 @@ public class PlaybackService extends Service {
@Override
public void onCompletion(MediaPlayer mp) {
- Log.d(TAG, "Playback completed");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Playback completed");
// Save state
positionSaver.cancel(true);
media.setPosition(0);
@@ -415,14 +416,14 @@ public class PlaybackService extends Service {
.getBoolean(PodcastApp.PREF_FOLLOW_QUEUE, false);
FeedItem nextItem = manager.getFirstQueueItem();
if (isInQueue && followQueue && nextItem != null) {
- Log.d(TAG, "Loading next item in queue");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Loading next item in queue");
media = nextItem.getMedia();
feed = nextItem.getFeed();
shouldStream = !media.isDownloaded();
resetVideoSurface();
sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, 0);
} else {
- Log.d(TAG, "Stopping playback");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Stopping playback");
stopWidgetUpdater();
setStatus(PlayerStatus.STOPPED);
stopForeground(true);
@@ -448,7 +449,7 @@ public class PlaybackService extends Service {
*/
public void pause(boolean abandonFocus) {
if (player.isPlaying()) {
- Log.d(TAG, "Pausing playback.");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Pausing playback.");
player.pause();
if (abandonFocus) {
audioManager.abandonAudioFocus(audioFocusChangeListener);
@@ -477,8 +478,8 @@ public class PlaybackService extends Service {
AudioManager.AUDIOFOCUS_GAIN);
if (focusGained == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
- Log.d(TAG, "Audiofocus successfully requested");
- Log.d(TAG, "Resuming/Starting playback");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Audiofocus successfully requested");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Resuming/Starting playback");
SharedPreferences.Editor editor = getApplicationContext()
.getSharedPreferences(PodcastApp.PREF_NAME, 0).edit();
editor.putLong(PREF_LAST_PLAYED_ID, media.getId());
@@ -494,13 +495,13 @@ public class PlaybackService extends Service {
setupNotification();
pausedBecauseOfTransientAudiofocusLoss = false;
} else {
- Log.d(TAG, "Failed to request Audiofocus");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Failed to request Audiofocus");
}
}
}
private void setStatus(PlayerStatus newStatus) {
- Log.d(TAG, "Setting status to " + newStatus);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Setting status to " + newStatus);
status = newStatus;
sendBroadcast(new Intent(ACTION_PLAYER_STATUS_CHANGED));
updateWidget();
@@ -528,7 +529,7 @@ public class PlaybackService extends Service {
.setSmallIcon(R.drawable.ic_stat_antenna);
startForeground(NOTIFICATION_ID, notificationBuilder.getNotification());
- Log.d(TAG, "Notification set up");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Notification set up");
}
/**
@@ -542,7 +543,7 @@ public class PlaybackService extends Service {
}
public void seek(int i) {
- Log.d(TAG, "Seeking position " + i);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Seeking position " + i);
if (shouldStream) {
statusBeforeSeek = status;
setStatus(PlayerStatus.SEEKING);
@@ -553,7 +554,7 @@ public class PlaybackService extends Service {
/** Saves the current position of the media file to the DB */
private synchronized void saveCurrentPosition() {
- Log.d(TAG, "Saving current position to " + player.getCurrentPosition());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Saving current position to " + player.getCurrentPosition());
media.setPosition(player.getCurrentPosition());
manager.setFeedMedia(this, media);
}
@@ -576,7 +577,7 @@ public class PlaybackService extends Service {
}
private void updateWidget() {
- Log.d(TAG, "Sending widget update request");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Sending widget update request");
PlaybackService.this.sendBroadcast(new Intent(
PlayerWidget.FORCE_WIDGET_UPDATE));
}
@@ -594,18 +595,18 @@ public class PlaybackService extends Service {
if (intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) {
int state = intent.getIntExtra("state", -1);
if (state != -1) {
- Log.d(TAG, "Headset plug event. State is " + state);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Headset plug event. State is " + state);
boolean pauseOnDisconnect = PreferenceManager
.getDefaultSharedPreferences(
getApplicationContext())
.getBoolean(
PodcastApp.PREF_PAUSE_ON_HEADSET_DISCONNECT,
false);
- Log.d(TAG, "pauseOnDisconnect preference is "
+ if (BuildConfig.DEBUG) Log.d(TAG, "pauseOnDisconnect preference is "
+ pauseOnDisconnect);
if (state == UNPLUGGED && pauseOnDisconnect
&& status == PlayerStatus.PLAYING) {
- Log.d(TAG,
+ if (BuildConfig.DEBUG) Log.d(TAG,
"Pausing playback because headset was disconnected");
pause(true);
}
@@ -627,11 +628,11 @@ public class PlaybackService extends Service {
Thread.sleep(WAITING_INTERVALL);
saveCurrentPosition();
} catch (InterruptedException e) {
- Log.d(TAG,
+ if (BuildConfig.DEBUG) Log.d(TAG,
"Thread was interrupted while waiting. Finishing now...");
return null;
} catch (IllegalStateException e) {
- Log.d(TAG, "Player is in illegal state. Finishing now");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Player is in illegal state. Finishing now");
return null;
}
diff --git a/src/de/danoeh/antennapod/service/PlayerWidgetService.java b/src/de/danoeh/antennapod/service/PlayerWidgetService.java
index e68395062..f85a1e2d3 100644
--- a/src/de/danoeh/antennapod/service/PlayerWidgetService.java
+++ b/src/de/danoeh/antennapod/service/PlayerWidgetService.java
@@ -17,6 +17,7 @@ import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.receiver.MediaButtonReceiver;
import de.danoeh.antennapod.receiver.PlayerWidget;
import de.danoeh.antennapod.util.Converter;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
/** Updates the state of the player widget */
@@ -33,7 +34,7 @@ public class PlayerWidgetService extends Service {
@Override
public void onCreate() {
super.onCreate();
- Log.d(TAG, "Service created");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Service created");
isUpdating = false;
}
@@ -54,14 +55,14 @@ public class PlayerWidgetService extends Service {
isUpdating = false;
}
} else {
- Log.d(TAG,
+ if (BuildConfig.DEBUG) Log.d(TAG,
"Service was called while updating. Ignoring update request");
}
return Service.START_NOT_STICKY;
}
private void updateViews() {
- Log.d(TAG, "Updating widget views");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Updating widget views");
ComponentName playerWidget = new ComponentName(this, PlayerWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
RemoteViews views = new RemoteViews(getPackageName(),
@@ -87,7 +88,7 @@ public class PlayerWidgetService extends Service {
views.setOnClickPendingIntent(R.id.butPlay,
createMediaButtonIntent());
} else {
- Log.d(TAG, "No media playing. Displaying defaultt views");
+ if (BuildConfig.DEBUG) Log.d(TAG, "No media playing. Displaying defaultt views");
views.setViewVisibility(R.id.txtvProgress, View.INVISIBLE);
views.setTextViewText(R.id.txtvTitle,
this.getString(R.string.no_media_playing_label));
@@ -117,7 +118,7 @@ public class PlayerWidgetService extends Service {
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
- Log.d(TAG, "Connection to service established");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Connection to service established");
playbackService = ((PlaybackService.LocalBinder) service)
.getService();
updateViews();
@@ -127,7 +128,7 @@ public class PlayerWidgetService extends Service {
@Override
public void onServiceDisconnected(ComponentName name) {
playbackService = null;
- Log.d(TAG, "Disconnected from service");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Disconnected from service");
}
};
diff --git a/src/de/danoeh/antennapod/storage/DownloadRequester.java b/src/de/danoeh/antennapod/storage/DownloadRequester.java
index e5a980f22..6a06ccfcf 100644
--- a/src/de/danoeh/antennapod/storage/DownloadRequester.java
+++ b/src/de/danoeh/antennapod/storage/DownloadRequester.java
@@ -9,6 +9,7 @@ import java.util.concurrent.Callable;
import de.danoeh.antennapod.feed.*;
import de.danoeh.antennapod.service.DownloadService;
import de.danoeh.antennapod.util.NumberGenerator;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import android.util.Log;
@@ -60,15 +61,15 @@ public class DownloadRequester {// TODO handle externalstorage missing
private long download(Context context, FeedFile item, File dest) {
if (!isDownloadingFile(item)) {
if (dest.exists()) {
- Log.d(TAG, "File already exists. Deleting !");
+ if (BuildConfig.DEBUG) Log.d(TAG, "File already exists. Deleting !");
dest.delete();
}
- Log.d(TAG, "Requesting download of url " + item.getDownload_url());
+ if (BuildConfig.DEBUG) Log.d(TAG, "Requesting download of url " + item.getDownload_url());
downloads.add(item);
DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(item.getDownload_url())).setDestinationUri(Uri
.fromFile(dest));
- Log.d(TAG, "Version is " + currentApi);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Version is " + currentApi);
if (currentApi >= 11) {
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
} else {
@@ -117,7 +118,7 @@ public class DownloadRequester {// TODO handle externalstorage missing
* ID of the download to cancel
* */
public void cancelDownload(final Context context, final long id) {
- Log.d(TAG, "Cancelling download with id " + id);
+ if (BuildConfig.DEBUG) Log.d(TAG, "Cancelling download with id " + id);
DownloadManager dm = (DownloadManager) context
.getSystemService(Context.DOWNLOAD_SERVICE);
int removed = dm.remove(id);
@@ -134,7 +135,7 @@ public class DownloadRequester {// TODO handle externalstorage missing
/** Cancels all running downloads */
public void cancelAllDownloads(Context context) {
- Log.d(TAG, "Cancelling all running downloads");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Cancelling all running downloads");
DownloadManager dm = (DownloadManager) context
.getSystemService(Context.DOWNLOAD_SERVICE);
for (FeedFile f : downloads) {
@@ -229,7 +230,7 @@ public class DownloadRequester {// TODO handle externalstorage missing
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
mService = ((DownloadService.LocalBinder) service).getService();
- Log.d(TAG, "Connection to service established");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Connection to service established");
mService.queryDownloads();
mContext.unbindService(mConnection);
}
diff --git a/src/de/danoeh/antennapod/storage/PodDBAdapter.java b/src/de/danoeh/antennapod/storage/PodDBAdapter.java
index 8afb0af7d..7d0a48631 100644
--- a/src/de/danoeh/antennapod/storage/PodDBAdapter.java
+++ b/src/de/danoeh/antennapod/storage/PodDBAdapter.java
@@ -2,6 +2,7 @@ package de.danoeh.antennapod.storage;
import java.util.ArrayList;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.asynctask.DownloadStatus;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.feed.FeedCategory;
@@ -196,7 +197,7 @@ public class PodDBAdapter {
public PodDBAdapter open() {
if (db == null || !db.isOpen() || db.isReadOnly()) {
- Log.d(TAG, "Opening DB");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Opening DB");
try {
db = helper.getWritableDatabase();
} catch (SQLException ex) {
@@ -208,7 +209,7 @@ public class PodDBAdapter {
}
public void close() {
- Log.d(TAG, "Closing DB");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Closing DB");
db.close();
}
@@ -238,10 +239,10 @@ public class PodDBAdapter {
values.put(KEY_LASTUPDATE, feed.getLastUpdate().getTime());
if (feed.getId() == 0) {
// Create new entry
- Log.d(this.toString(), "Inserting new Feed into db");
+ if (BuildConfig.DEBUG) Log.d(this.toString(), "Inserting new Feed into db");
feed.setId(db.insert(TABLE_NAME_FEEDS, null, values));
} else {
- Log.d(this.toString(), "Updating existing Feed in db");
+ if (BuildConfig.DEBUG) Log.d(this.toString(), "Updating existing Feed in db");
db.update(TABLE_NAME_FEEDS, values, KEY_ID + "=?",
new String[] { Long.toString(feed.getId()) });
}
diff --git a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
index 396f170c5..808b3f0f9 100644
--- a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
+++ b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java
@@ -6,6 +6,7 @@ import org.xml.sax.helpers.DefaultHandler;
import android.util.Log;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.syndication.namespace.Namespace;
import de.danoeh.antennapod.syndication.namespace.SyndElement;
@@ -82,17 +83,17 @@ public class SyndHandler extends DefaultHandler {
state.defaultNamespaces.push(new NSAtom());
} else if (prefix.equals(NSAtom.NSTAG)) {
state.namespaces.put(uri, new NSAtom());
- Log.d(TAG, "Recognized Atom namespace");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Recognized Atom namespace");
}
} else if (uri.equals(NSContent.NSURI) && prefix.equals(NSContent.NSTAG)) {
state.namespaces.put(uri, new NSContent());
- Log.d(TAG, "Recognized Content namespace");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Recognized Content namespace");
} else if (uri.equals(NSITunes.NSURI) && prefix.equals(NSITunes.NSTAG)) {
state.namespaces.put(uri, new NSITunes());
- Log.d(TAG, "Recognized ITunes namespace");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Recognized ITunes namespace");
} else if (uri.equals(NSSimpleChapters.NSURI) && prefix.equals(NSSimpleChapters.NSTAG)) {
state.namespaces.put(uri, new NSSimpleChapters());
- Log.d(TAG, "Recognized SimpleChapters namespace");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Recognized SimpleChapters namespace");
}
}
diff --git a/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java b/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java
index 7e346ca5c..4a706311e 100644
--- a/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java
+++ b/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java
@@ -12,6 +12,7 @@ import org.xmlpull.v1.XmlPullParserFactory;
import android.util.Log;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.feed.Feed;
/** Gets the type of a specific feed by reading the root element. */
@@ -38,15 +39,15 @@ public class TypeGetter {
if (eventType == XmlPullParser.START_TAG) {
String tag = xpp.getName();
if (tag.equals(ATOM_ROOT)) {
- Log.d(TAG, "Recognized type Atom");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Recognized type Atom");
return Type.ATOM;
} else if (tag.equals(RSS_ROOT)
&& (xpp.getAttributeValue(null, "version")
.equals("2.0"))) {
- Log.d(TAG, "Recognized type RSS 2.0");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Recognized type RSS 2.0");
return Type.RSS20;
} else {
- Log.d(TAG, "Type is invalid");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Type is invalid");
throw new UnsupportedFeedtypeException(Type.INVALID);
}
} else {
@@ -59,7 +60,7 @@ public class TypeGetter {
} catch (IOException e) {
e.printStackTrace();
}
- Log.d(TAG, "Type is invalid");
+ if (BuildConfig.DEBUG) Log.d(TAG, "Type is invalid");
throw new UnsupportedFeedtypeException(Type.INVALID);
}
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);
}