diff options
Diffstat (limited to 'src')
141 files changed, 712 insertions, 864 deletions
diff --git a/src/de/danoeh/antennapod/AppConfig.java b/src/de/danoeh/antennapod/AppConfig.java index c5b771e1b..98a231330 100644 --- a/src/de/danoeh/antennapod/AppConfig.java +++ b/src/de/danoeh/antennapod/AppConfig.java @@ -1,8 +1,6 @@ package de.danoeh.antennapod; public final class AppConfig { - /** Should be used for debug logging. */ - public final static boolean DEBUG = true; /** Should be used when setting User-Agent header for HTTP-requests. */ public final static String USER_AGENT = "AntennaPod/0.9.8.3"; } diff --git a/src/de/danoeh/antennapod/activity/AboutActivity.java b/src/de/danoeh/antennapod/activity/AboutActivity.java index 27fdbe241..cf7de1709 100644 --- a/src/de/danoeh/antennapod/activity/AboutActivity.java +++ b/src/de/danoeh/antennapod/activity/AboutActivity.java @@ -4,8 +4,6 @@ import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.webkit.WebView; import android.webkit.WebViewClient; - - import de.danoeh.antennapod.R; /** Displays the 'about' screen */ diff --git a/src/de/danoeh/antennapod/activity/AddFeedActivity.java b/src/de/danoeh/antennapod/activity/AddFeedActivity.java index 47d8564b1..a77689ddb 100644 --- a/src/de/danoeh/antennapod/activity/AddFeedActivity.java +++ b/src/de/danoeh/antennapod/activity/AddFeedActivity.java @@ -11,7 +11,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.gpoddernet.GpodnetMainActivity; import de.danoeh.antennapod.preferences.UserPreferences; @@ -34,7 +34,7 @@ public class AddFeedActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Was started with Intent " + getIntent().getAction() + " and Data " + getIntent().getDataString()); setTheme(UserPreferences.getTheme()); @@ -99,13 +99,13 @@ public class AddFeedActivity extends ActionBarActivity { Intent intent = getIntent(); if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_SEND)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Resuming with ACTION_SEND intent"); String text = intent.getStringExtra(Intent.EXTRA_TEXT); if (text != null) { etxtFeedurl.setText(text); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "No text was sent"); } } @@ -115,7 +115,7 @@ public class AddFeedActivity extends ActionBarActivity { @Override protected void onStop() { super.onStop(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity"); } diff --git a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java b/src/de/danoeh/antennapod/activity/AudioplayerActivity.java index 888f1a726..de989fa46 100644 --- a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/AudioplayerActivity.java @@ -15,7 +15,7 @@ import android.view.View.OnLongClickListener; import android.view.Window; import android.widget.*; import android.widget.ImageView.ScaleType; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.ChapterListAdapter; import de.danoeh.antennapod.asynctask.ImageLoader; @@ -67,29 +67,29 @@ public class AudioplayerActivity extends MediaplayerActivity { FragmentTransaction fT = getSupportFragmentManager().beginTransaction(); if (coverFragment != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Removing cover fragment"); fT.remove(coverFragment); } if (descriptionFragment != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Removing description fragment"); fT.remove(descriptionFragment); } if (chapterFragment != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Removing chapter fragment"); fT.remove(chapterFragment); } if (currentlyShownFragment != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Removing currently shown fragment"); fT.remove(currentlyShownFragment); } for (int i = 0; i < detachedFragments.length; i++) { Fragment f = detachedFragments[i]; if (f != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Removing detached fragment"); fT.remove(f); } @@ -106,7 +106,7 @@ public class AudioplayerActivity extends MediaplayerActivity { @Override protected void onStop() { super.onStop(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "onStop"); } @@ -120,7 +120,7 @@ public class AudioplayerActivity extends MediaplayerActivity { } private void savePreferences() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Saving preferences"); SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); @@ -147,7 +147,7 @@ public class AudioplayerActivity extends MediaplayerActivity { @Override protected void onSaveInstanceState(Bundle outState) { // super.onSaveInstanceState(outState); would cause crash - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "onSaveInstanceState"); } @@ -171,7 +171,7 @@ public class AudioplayerActivity extends MediaplayerActivity { * @return true if restoreFromPrefernces changed the activity's state */ private boolean restoreFromPreferences() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Restoring instance state"); SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); int savedPosition = prefs.getInt(PREF_KEY_SELECTED_FRAGMENT_POSITION, @@ -186,11 +186,11 @@ public class AudioplayerActivity extends MediaplayerActivity { switchToFragment(savedPosition); return true; } else if (controller == null || controller.getMedia() == null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Couldn't restore from preferences: controller or media was null"); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Couldn't restore from preferences: savedPosition was -1 or saved identifier and playable identifier didn't match.\nsavedPosition: " + savedPosition + ", id: " + playableId); @@ -205,7 +205,7 @@ public class AudioplayerActivity extends MediaplayerActivity { if (getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_VIEW)) { Intent intent = getIntent(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received VIEW intent: " + intent.getData().getPath()); ExternalMedia media = new ExternalMedia(intent.getData().getPath(), @@ -233,7 +233,7 @@ public class AudioplayerActivity extends MediaplayerActivity { @Override protected void onAwaitingVideoSurface() { - if (AppConfig.DEBUG) Log.d(TAG, "onAwaitingVideoSurface was called in audio player -> switching to video player"); + if (BuildConfig.DEBUG) Log.d(TAG, "onAwaitingVideoSurface was called in audio player -> switching to video player"); startActivity(new Intent(this, VideoplayerActivity.class)); } @@ -255,7 +255,7 @@ public class AudioplayerActivity extends MediaplayerActivity { * @param pos Must be POS_COVER, POS_DESCR, or POS_CHAPTERS */ private void switchToFragment(int pos) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Switching contentView to position " + pos); if (currentlyShownPosition != pos && controller != null) { Playable media = controller.getMedia(); @@ -305,7 +305,7 @@ public class AudioplayerActivity extends MediaplayerActivity { if (currentlyShownFragment != null) { currentlyShownPosition = pos; if (detachedFragments[pos] != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Reattaching fragment at position " + pos); ft.attach(detachedFragments[pos]); @@ -523,7 +523,7 @@ public class AudioplayerActivity extends MediaplayerActivity { @Override protected void onReloadNotification(int notificationCode) { if (notificationCode == PlaybackService.EXTRA_CODE_VIDEO) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "ReloadNotification received, switching to Videoplayer now"); finish(); diff --git a/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java b/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java index c734b2768..06a11c775 100644 --- a/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java +++ b/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java @@ -1,10 +1,5 @@ package de.danoeh.antennapod.activity; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; - import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; @@ -20,19 +15,17 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.widget.AdapterView; +import android.widget.*; import android.widget.AdapterView.OnItemClickListener; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.ImageButton; -import android.widget.ListView; -import android.widget.TextView; -import android.widget.Toast; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.preferences.UserPreferences; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; + /** * Let's the user choose a directory on the storage device. The selected folder * will be sent back to the starting activity as an activity result. @@ -127,7 +120,7 @@ public class DirectoryChooserActivity extends ActionBarActivity { @Override public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Selected index: " + position); if (filesInDir != null && position >= 0 && position < filesInDir.length) { @@ -160,7 +153,7 @@ public class DirectoryChooserActivity extends ActionBarActivity { * selected folder can also be null. */ private void returnSelectedFolder() { - if (selectedDir != null && AppConfig.DEBUG) + if (selectedDir != null && BuildConfig.DEBUG) Log.d(TAG, "Returning " + selectedDir.getAbsolutePath() + " as result"); Intent resultData = new Intent(); @@ -222,19 +215,19 @@ public class DirectoryChooserActivity extends ActionBarActivity { listDirectoriesAdapter.notifyDataSetChanged(); fileObserver = createFileObserver(dir.getAbsolutePath()); fileObserver.startWatching(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Changed directory to " + dir.getAbsolutePath()); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Could not change folder: contents of dir were null"); } } else { if (dir == null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Could not change folder: dir was null"); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Could not change folder: dir is no directory"); } } @@ -266,7 +259,7 @@ public class DirectoryChooserActivity extends ActionBarActivity { @Override public void onEvent(int event, String path) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "FileObserver received event " + event); runOnUiThread(new Runnable() { diff --git a/src/de/danoeh/antennapod/activity/DownloadActivity.java b/src/de/danoeh/antennapod/activity/DownloadActivity.java index f5986baf5..996929cdb 100644 --- a/src/de/danoeh/antennapod/activity/DownloadActivity.java +++ b/src/de/danoeh/antennapod/activity/DownloadActivity.java @@ -14,7 +14,7 @@ import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ListView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.DownloadlistAdapter; import de.danoeh.antennapod.asynctask.DownloadObserver; @@ -53,7 +53,7 @@ public class DownloadActivity extends ActionBarActivity implements listview = (ListView) findViewById(R.id.listview); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating Activity"); requester = DownloadRequester.getInstance(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -78,7 +78,7 @@ public class DownloadActivity extends ActionBarActivity implements @Override protected void onStop() { super.onStop(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity"); } diff --git a/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java b/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java index 65b324af0..4b8420e45 100644 --- a/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java +++ b/src/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java @@ -9,7 +9,7 @@ import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.service.download.DownloadRequest; @@ -89,7 +89,7 @@ public class DownloadAuthenticationActivity extends ActionBarActivity { setResult(Activity.RESULT_OK, result); if (sendToDownloadRequester) { - if (AppConfig.DEBUG) Log.d(TAG, "Sending request to DownloadRequester"); + if (BuildConfig.DEBUG) Log.d(TAG, "Sending request to DownloadRequester"); DownloadRequester.getInstance().download(DownloadAuthenticationActivity.this, request); } finish(); diff --git a/src/de/danoeh/antennapod/activity/DownloadLogActivity.java b/src/de/danoeh/antennapod/activity/DownloadLogActivity.java index 395e9357b..4629b8670 100644 --- a/src/de/danoeh/antennapod/activity/DownloadLogActivity.java +++ b/src/de/danoeh/antennapod/activity/DownloadLogActivity.java @@ -2,10 +2,8 @@ package de.danoeh.antennapod.activity; import android.os.AsyncTask; import android.os.Bundle; - import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBarActivity; - import android.util.Log; import android.view.Menu; import android.view.MenuItem; diff --git a/src/de/danoeh/antennapod/activity/FeedInfoActivity.java b/src/de/danoeh/antennapod/activity/FeedInfoActivity.java index 37932daf9..db0755ccd 100644 --- a/src/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/src/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -11,7 +11,7 @@ import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.TextView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.ImageLoader; import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; @@ -65,9 +65,9 @@ public class FeedInfoActivity extends ActionBarActivity { protected void onPostExecute(Feed result) { if (result != null) { feed = result; - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Language is " + feed.getLanguage()); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Author is " + feed.getAuthor()); imgvCover.post(new Runnable() { diff --git a/src/de/danoeh/antennapod/activity/FeedItemlistActivity.java b/src/de/danoeh/antennapod/activity/FeedItemlistActivity.java index 78d6bcec4..d0305eada 100644 --- a/src/de/danoeh/antennapod/activity/FeedItemlistActivity.java +++ b/src/de/danoeh/antennapod/activity/FeedItemlistActivity.java @@ -2,7 +2,6 @@ package de.danoeh.antennapod.activity; import android.annotation.SuppressLint; import android.app.SearchManager; -import android.app.SearchableInfo; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -17,12 +16,10 @@ import android.support.v4.view.MenuItemCompat; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.SearchView; import android.util.Log; - import android.view.Menu; -import android.view.MenuInflater; import android.view.MenuItem; import android.view.Window; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.FeedRemover; import de.danoeh.antennapod.dialog.ConfirmationDialog; @@ -81,7 +78,7 @@ public class FeedItemlistActivity extends ActionBarActivity { @Override protected Feed doInBackground(Long... longs) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading feed data in background"); return DBReader.getFeed(FeedItemlistActivity.this, longs[0]); } @@ -89,14 +86,14 @@ public class FeedItemlistActivity extends ActionBarActivity { @Override protected void onCancelled(Feed feed) { super.onCancelled(feed); - if (AppConfig.DEBUG) Log.d(TAG, "load task was cancelled"); + if (BuildConfig.DEBUG) Log.d(TAG, "load task was cancelled"); } @Override protected void onPostExecute(Feed result) { super.onPostExecute(result); if (result != null) { - if (AppConfig.DEBUG) Log.d(TAG, "Finished loading feed data"); + if (BuildConfig.DEBUG) Log.d(TAG, "Finished loading feed data"); feed = result; setTitle(feed.getTitle()); diff --git a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java b/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java index a8335c79a..8dde14d3b 100644 --- a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java +++ b/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java @@ -1,24 +1,22 @@ package de.danoeh.antennapod.activity; -import android.support.v7.app.ActionBarActivity; -import android.view.Menu; -import android.view.MenuItem; -import org.shredzone.flattr4j.exception.FlattrException; - import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.util.flattr.FlattrUtils; +import org.shredzone.flattr4j.exception.FlattrException; /** Guides the user through the authentication process */ @@ -39,7 +37,7 @@ public class FlattrAuthActivity extends ActionBarActivity { super.onCreate(savedInstanceState); singleton = this; authSuccessful = false; - if (AppConfig.DEBUG) 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); @@ -74,10 +72,10 @@ public class FlattrAuthActivity extends ActionBarActivity { @Override protected void onResume() { super.onResume(); - if (AppConfig.DEBUG) Log.d(TAG, "Activity resumed"); + if (BuildConfig.DEBUG) Log.d(TAG, "Activity resumed"); Uri uri = getIntent().getData(); if (uri != null) { - if (AppConfig.DEBUG) 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 f08686004..699ba84ea 100644 --- a/src/de/danoeh/antennapod/activity/ItemviewActivity.java +++ b/src/de/danoeh/antennapod/activity/ItemviewActivity.java @@ -13,7 +13,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.Window; import android.widget.TextView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.feed.EventDistributor; @@ -75,7 +75,7 @@ public class ItemviewActivity extends ActionBarActivity { if (currentLoadTask != null) { currentLoadTask.cancel(true); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity"); } @@ -93,7 +93,7 @@ public class ItemviewActivity extends ActionBarActivity { @Override protected void onCancelled(FeedItem feedItem) { super.onCancelled(feedItem); - if (AppConfig.DEBUG) Log.d(TAG, "loadTask was cancelled"); + if (BuildConfig.DEBUG) Log.d(TAG, "loadTask was cancelled"); } @Override @@ -192,7 +192,7 @@ public class ItemviewActivity extends ActionBarActivity { @Override public void update(EventDistributor eventDistributor, Integer arg) { if ((EVENTS & arg) != 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent."); if (item != null) { loadData(item.getId()); diff --git a/src/de/danoeh/antennapod/activity/MainActivity.java b/src/de/danoeh/antennapod/activity/MainActivity.java index 9edb312de..29e36abc8 100644 --- a/src/de/danoeh/antennapod/activity/MainActivity.java +++ b/src/de/danoeh/antennapod/activity/MainActivity.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.activity; -import java.util.ArrayList; - import android.app.SearchManager; import android.app.SearchableInfo; import android.content.Context; @@ -17,25 +15,26 @@ import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.SearchView; import android.util.Log; - import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.Window; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.EventDistributor; import de.danoeh.antennapod.fragment.EpisodesFragment; import de.danoeh.antennapod.fragment.ExternalPlayerFragment; import de.danoeh.antennapod.fragment.FeedlistFragment; import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.service.playback.PlaybackService; import de.danoeh.antennapod.service.download.DownloadService; +import de.danoeh.antennapod.service.playback.PlaybackService; import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.storage.DBTasks; import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.util.StorageUtils; +import java.util.ArrayList; + /** The activity that is shown when the user launches the app. */ public class MainActivity extends ActionBarActivity { private static final String TAG = "MainActivity"; @@ -121,7 +120,7 @@ public class MainActivity extends ActionBarActivity { @Override public void update(EventDistributor eventDistributor, Integer arg) { if ((EVENTS & arg) != 0) { - if (AppConfig.DEBUG) + 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 8e659af14..fc70f4c05 100644 --- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -16,7 +16,7 @@ import android.widget.ImageButton; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.dialog.TimeDialog; import de.danoeh.antennapod.feed.FeedItem; @@ -164,7 +164,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity protected void onCreate(Bundle savedInstanceState) { chooseTheme(); super.onCreate(savedInstanceState); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating Activity"); StorageUtils.checkStorageAvailability(this); setVolumeControlStream(AudioManager.STREAM_MUSIC); @@ -222,7 +222,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity @Override protected void onStop() { super.onStop(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Activity stopped"); if (controller != null) { controller.release(); @@ -232,7 +232,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity @Override protected void onDestroy() { super.onDestroy(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Activity destroyed"); } @@ -355,7 +355,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity @Override protected void onResume() { super.onResume(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Resuming Activity"); StorageUtils.checkStorageAvailability(this); controller.init(); @@ -390,7 +390,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity } private void updateProgressbarPosition(int position, int duration) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Updating progressbar info"); float progress = ((float) position) / duration; sbPosition.setProgress((int) (progress * sbPosition.getMax())); @@ -403,7 +403,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity * FeedMedia object. */ protected boolean loadMediaInfo() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading media info"); Playable media = controller.getMedia(); if (media != null) { diff --git a/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java index b5947b41c..6d732b9ff 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java @@ -8,7 +8,6 @@ import android.support.v4.app.NavUtils; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBarActivity; import android.util.Log; - import android.view.Menu; import android.view.MenuItem; import de.danoeh.antennapod.R; diff --git a/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java index f1f26a69e..96c8385ce 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideChannelViewActivity.java @@ -1,8 +1,5 @@ package de.danoeh.antennapod.activity; -import java.util.Date; -import java.util.List; - import android.annotation.SuppressLint; import android.content.Intent; import android.net.Uri; @@ -15,13 +12,8 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.widget.ListView; -import android.widget.ProgressBar; -import android.widget.RelativeLayout; -import android.widget.TextView; -import android.widget.Toast; - -import de.danoeh.antennapod.AppConfig; +import android.widget.*; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter; import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; @@ -34,6 +26,9 @@ import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.storage.DownloadRequestException; import de.danoeh.antennapod.storage.DownloadRequester; +import java.util.Date; +import java.util.List; + /** * Displays information about one channel and lets the user add this channel to * his library. @@ -95,7 +90,7 @@ public class MiroGuideChannelViewActivity extends ActionBarActivity { @Override protected Void doInBackground(Void... params) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting background task"); feeds = DBReader.getFeedList(MiroGuideChannelViewActivity.this); MiroGuideService service = new MiroGuideService(); @@ -111,7 +106,7 @@ public class MiroGuideChannelViewActivity extends ActionBarActivity { @SuppressLint("NewApi") @Override protected void onPostExecute(Void result) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading finished"); if (exception == null) { txtvTitle.setText(channel.getName()); diff --git a/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java index 66ac09fa5..9f74e77b6 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java @@ -2,7 +2,6 @@ package de.danoeh.antennapod.activity; import android.annotation.SuppressLint; import android.app.SearchManager; -import android.app.SearchableInfo; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; @@ -19,8 +18,7 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.miroguide.conn.MiroGuideException; import de.danoeh.antennapod.miroguide.conn.MiroGuideService; @@ -89,7 +87,7 @@ public class MiroGuideMainActivity extends ActionBarActivity implements AdapterV @Override protected void onPostExecute(Void result) { if (exception == null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Successfully loaded categories"); categories = c; createAdapter(); diff --git a/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java index c2d88061d..e20253dc6 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideSearchActivity.java @@ -7,10 +7,9 @@ import android.support.v4.app.FragmentTransaction; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.ActionBarActivity; import android.util.Log; - import android.view.Menu; import android.view.MenuItem; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.fragment.MiroGuideChannellistFragment; import de.danoeh.antennapod.preferences.UserPreferences; @@ -47,7 +46,7 @@ public class MiroGuideSearchActivity extends ActionBarActivity { } private void handleSearchRequest(String query) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Performing search"); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); listFragment = MiroGuideChannellistFragment.newInstance("name", query, diff --git a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index 4a70a558a..6bd5e4eb9 100644 --- a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -8,11 +8,10 @@ import android.content.DialogInterface.OnCancelListener; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.util.Log; -import android.view.Gravity; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.dialog.AuthenticationDialog; import de.danoeh.antennapod.feed.Feed; @@ -70,7 +69,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { throw new IllegalArgumentException( "Activity must be started with feedurl argument!"); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Activity was started with url " + feedUrl); setLoadingLayout(); if (savedInstanceState == null) { @@ -103,7 +102,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { @Override public void run() { - if (AppConfig.DEBUG) Log.d(TAG, "Download was completed"); + if (BuildConfig.DEBUG) Log.d(TAG, "Download was completed"); DownloadStatus status = downloader.getResult(); if (status != null) { if (!status.isCancelled()) { @@ -135,7 +134,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { } private void startFeedDownload(String url, String username, String password) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting feed download"); url = URLChecker.prepareURL(url); feed = new Feed(url, new Date()); @@ -187,7 +186,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { "feed must be non-null and downloaded when parseFeed is called"); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Parsing feed"); Thread thread = new Thread() { @@ -214,7 +213,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { reasonDetailed = e.getMessage(); } finally { boolean rc = new File(feed.getFile_url()).delete(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Deleted feed source file. Result: " + rc); } diff --git a/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java b/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java index 8f2558c2e..5f2ea0401 100644 --- a/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java @@ -1,8 +1,5 @@ package de.danoeh.antennapod.activity; -import java.util.ArrayList; -import java.util.List; - import android.content.Intent; import android.os.Bundle; import android.support.v4.view.MenuItemCompat; @@ -15,11 +12,13 @@ import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; - import de.danoeh.antennapod.R; import de.danoeh.antennapod.opml.OpmlElement; import de.danoeh.antennapod.preferences.UserPreferences; +import java.util.ArrayList; +import java.util.List; + /** * Displays the feeds that the OPML-Importer has read and lets the user choose * which feeds he wants to import. diff --git a/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java index 905183aa2..d3fd3949c 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlImportBaseActivity.java @@ -1,17 +1,16 @@ package de.danoeh.antennapod.activity; -import java.io.Reader; -import java.util.ArrayList; - import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.util.Log; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.asynctask.OpmlFeedQueuer; import de.danoeh.antennapod.asynctask.OpmlImportWorker; import de.danoeh.antennapod.opml.OpmlElement; +import java.io.Reader; +import java.util.ArrayList; + /** * Base activity for Opml Import - e.g. with code what to do afterwards * */ @@ -26,10 +25,10 @@ public class OpmlImportBaseActivity extends ActionBarActivity { */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received result"); if (resultCode == RESULT_CANCELED) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Activity was cancelled"); if (finishWhenCanceled()) finish(); @@ -51,7 +50,7 @@ public class OpmlImportBaseActivity extends ActionBarActivity { }; queuer.executeAsync(); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "No items were selected"); } } @@ -67,14 +66,14 @@ public class OpmlImportBaseActivity extends ActionBarActivity { protected void onPostExecute(ArrayList<OpmlElement> result) { super.onPostExecute(result); if (result != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Parsing was successful"); OpmlImportHolder.setReadElements(result); startActivityForResult(new Intent( OpmlImportBaseActivity.this, OpmlFeedChooserActivity.class), 0); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Parser error occurred"); } } diff --git a/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java index 58e3a96dd..16e663fac 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java @@ -1,14 +1,14 @@ package de.danoeh.antennapod.activity; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; - import android.app.AlertDialog; import android.os.Bundle; import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.util.LangUtils; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; + /** Lets the user start the OPML-import process. */ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { diff --git a/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java index a3d679773..94f100321 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java @@ -1,12 +1,5 @@ package de.danoeh.antennapod.activity; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.Reader; - import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; @@ -18,13 +11,14 @@ import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.util.LangUtils; import de.danoeh.antennapod.util.StorageUtils; +import java.io.*; + /** * Lets the user start the OPML-import process from a path */ @@ -70,7 +64,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { File importDir = UserPreferences.getDataFolder(this, IMPORT_DIR); boolean success = true; if (!importDir.exists()) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Import directory doesn't exist. Creating..."); success = importDir.mkdir(); if (!success) { @@ -112,7 +106,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { if (dir.isDirectory()) { File[] fileList = dir.listFiles(); if (fileList.length == 1) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Found one file, choosing that one."); startImport(fileList[0]); } else if (fileList.length > 1) { @@ -133,7 +127,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { try { mReader = new InputStreamReader(new FileInputStream(file), LangUtils.UTF_8); - if (AppConfig.DEBUG) Log.d(TAG, "Parsing " + file.toString()); + if (BuildConfig.DEBUG) Log.d(TAG, "Parsing " + file.toString()); startImport(mReader); } catch (FileNotFoundException e) { Log.d(TAG, "File not found which really should be there"); @@ -156,7 +150,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { @Override public void onClick(DialogInterface dialog, int which) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Dialog was cancelled"); dialog.dismiss(); } @@ -165,7 +159,7 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { @Override public void onClick(DialogInterface dialog, int which) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "File at index " + which + " was chosen"); dialog.dismiss(); startImport(fileList[which]); diff --git a/src/de/danoeh/antennapod/activity/OpmlImportHolder.java b/src/de/danoeh/antennapod/activity/OpmlImportHolder.java index 8d51eb3de..ec53ed7b6 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportHolder.java +++ b/src/de/danoeh/antennapod/activity/OpmlImportHolder.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.activity; -import java.util.ArrayList; - import de.danoeh.antennapod.opml.OpmlElement; +import java.util.ArrayList; + /** * Hold infos gathered by Ompl-Import * <p/> diff --git a/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java b/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java index 5ed1dd09a..6e2cf597f 100644 --- a/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java +++ b/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java @@ -5,18 +5,13 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; -import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBarActivity; -import android.view.*; import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; +import android.view.*; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; - import com.mobeta.android.dslv.DragSortListView; import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.ImageLoader; diff --git a/src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java b/src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java index 0460458eb..ba3d12105 100644 --- a/src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java +++ b/src/de/danoeh/antennapod/activity/PlaybackHistoryActivity.java @@ -1,16 +1,13 @@ package de.danoeh.antennapod.activity; -import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; -import android.support.v4.app.NavUtils; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.ActionBarActivity; import android.util.Log; - import android.view.Menu; import android.view.MenuItem; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.fragment.PlaybackHistoryFragment; import de.danoeh.antennapod.preferences.UserPreferences; @@ -46,7 +43,7 @@ public class PlaybackHistoryActivity extends ActionBarActivity { setTheme(UserPreferences.getTheme()); super.onCreate(arg0); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Activity created"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.playbackhistory_activity); diff --git a/src/de/danoeh/antennapod/activity/PreferenceActivity.java b/src/de/danoeh/antennapod/activity/PreferenceActivity.java index 4a8dc1882..1070c71f8 100644 --- a/src/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/src/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -19,7 +19,7 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.FlattrClickWorker; import de.danoeh.antennapod.asynctask.OpmlExportWorker; @@ -362,7 +362,7 @@ public class PreferenceActivity extends android.preference.PreferenceActivity { if (resultCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) { String dir = data .getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Setting data folder"); UserPreferences.setDataFolder(dir); } @@ -392,7 +392,7 @@ public class PreferenceActivity extends android.preference.PreferenceActivity { .getAutodownloadSelectedNetworks())); boolean newValue = ((CheckBoxPreference) preference) .isChecked(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Selected network " + key + ". New state: " + newValue); diff --git a/src/de/danoeh/antennapod/activity/SearchActivity.java b/src/de/danoeh/antennapod/activity/SearchActivity.java index c31cec434..f330aeb7d 100644 --- a/src/de/danoeh/antennapod/activity/SearchActivity.java +++ b/src/de/danoeh/antennapod/activity/SearchActivity.java @@ -1,8 +1,5 @@ package de.danoeh.antennapod.activity; -import java.util.ArrayList; -import java.util.List; - import android.annotation.SuppressLint; import android.app.Activity; import android.app.SearchManager; @@ -17,17 +14,19 @@ import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.adapter.SearchlistAdapter; import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.storage.FeedSearcher; import de.danoeh.antennapod.feed.SearchResult; import de.danoeh.antennapod.fragment.FeedlistFragment; import de.danoeh.antennapod.fragment.ItemlistFragment; import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.storage.FeedSearcher; + +import java.util.ArrayList; +import java.util.List; /** * Displays the results when the user searches for FeedItems or Feeds. @@ -75,11 +74,11 @@ public class SearchActivity extends ActionBarActivity implements AdapterView.OnI Intent intent = getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { if (intent.hasExtra(SearchActivity.EXTRA_FEED_ID)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Found bundle extra"); feedID = intent.getLongExtra(SearchActivity.EXTRA_FEED_ID, 0); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting search"); String query = intent.getStringExtra(SearchManager.QUERY); getSupportActionBar() @@ -149,9 +148,9 @@ public class SearchActivity extends ActionBarActivity implements AdapterView.OnI @Override public void run() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Background work finished"); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Found " + result.size() + " results"); diff --git a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java b/src/de/danoeh/antennapod/activity/StorageErrorActivity.java index 33277ebc9..2cd56ba8b 100644 --- a/src/de/danoeh/antennapod/activity/StorageErrorActivity.java +++ b/src/de/danoeh/antennapod/activity/StorageErrorActivity.java @@ -7,8 +7,7 @@ import android.content.IntentFilter; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.util.Log; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.util.StorageUtils; @@ -57,11 +56,11 @@ public class StorageErrorActivity extends ActionBarActivity { public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED)) { if (intent.getBooleanExtra("read-only", true)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Media was mounted; Finishing activity"); leaveErrorState(); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Media seemed to have been mounted read only"); } diff --git a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java index a3a542753..c45a3d162 100644 --- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -14,7 +14,7 @@ import android.view.animation.AnimationUtils; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.SeekBar; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.MediaType; import de.danoeh.antennapod.service.playback.PlaybackService; @@ -72,7 +72,7 @@ public class VideoplayerActivity extends MediaplayerActivity { if (getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_VIEW)) { Intent intent = getIntent(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received VIEW intent: " + intent.getData().getPath()); ExternalMedia media = new ExternalMedia(intent.getData().getPath(), @@ -120,13 +120,13 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override protected void onAwaitingVideoSurface() { if (videoSurfaceCreated) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Videosurface already created, setting videosurface now"); Pair<Integer, Integer> videoSize = controller.getVideoSize(); if (videoSize != null && videoSize.first > 0 && videoSize.second > 0) { - if (AppConfig.DEBUG) Log.d(TAG, "Width,height of video: " + videoSize.first + ", " + videoSize.second); + if (BuildConfig.DEBUG) Log.d(TAG, "Width,height of video: " + videoSize.first + ", " + videoSize.second); videoview.setVideoSize(videoSize.first, videoSize.second); } else { Log.e(TAG, "Could not determine video size"); @@ -215,7 +215,7 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override protected void onProgressUpdate(Void... values) { if (videoControlsShowing) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Hiding video controls"); getSupportActionBar().hide(); hideVideoControls(); @@ -245,7 +245,7 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override public void surfaceCreated(SurfaceHolder holder) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Videoview holder created"); videoSurfaceCreated = true; if (controller.getStatus() == PlayerStatus.PLAYING) { @@ -261,7 +261,7 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override public void surfaceDestroyed(SurfaceHolder holder) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Videosurface was destroyed"); videoSurfaceCreated = false; controller.notifyVideoSurfaceAbandoned(); @@ -272,7 +272,7 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override protected void onReloadNotification(int notificationCode) { if (notificationCode == PlaybackService.EXTRA_CODE_AUDIO) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "ReloadNotification received, switching to Audioplayer now"); finish(); diff --git a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java index e5a00923a..05048f079 100644 --- a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java +++ b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java @@ -12,7 +12,7 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.widget.*; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.gpoddernet.GpodnetService; @@ -113,7 +113,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity { final String usernameStr = username.getText().toString(); final String passwordStr = password.getText().toString(); - if (AppConfig.DEBUG) Log.d(TAG, "Checking login credentials"); + if (BuildConfig.DEBUG) Log.d(TAG, "Checking login credentials"); new AsyncTask<GpodnetService, Void, Void>() { volatile Exception exception; @@ -333,7 +333,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity { } private void writeLoginCredentials() { - if (AppConfig.DEBUG) Log.d(TAG, "Writing login credentials"); + if (BuildConfig.DEBUG) Log.d(TAG, "Writing login credentials"); GpodnetPreferences.setUsername(username); GpodnetPreferences.setPassword(password); GpodnetPreferences.setDeviceID(selectedDevice.getId()); diff --git a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java index 9535e9d32..e77a6a7a3 100644 --- a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java +++ b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetMainActivity.java @@ -11,7 +11,6 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.fragment.gpodnet.PodcastTopListFragment; import de.danoeh.antennapod.fragment.gpodnet.SuggestionListFragment; import de.danoeh.antennapod.fragment.gpodnet.TagListFragment; -import de.danoeh.antennapod.preferences.GpodnetPreferences; /** * Created by daniel on 22.08.13. diff --git a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java index f3922f7aa..14897c60c 100644 --- a/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java +++ b/src/de/danoeh/antennapod/activity/gpoddernet/GpodnetTagActivity.java @@ -7,7 +7,6 @@ import android.support.v4.app.NavUtils; import android.view.MenuItem; import de.danoeh.antennapod.R; import de.danoeh.antennapod.fragment.gpodnet.PodcastListFragment; -import de.danoeh.antennapod.fragment.gpodnet.SearchListFragment; import de.danoeh.antennapod.gpoddernet.GpodnetService; import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; diff --git a/src/de/danoeh/antennapod/adapter/ChapterListAdapter.java b/src/de/danoeh/antennapod/adapter/ChapterListAdapter.java index 116c39ddf..72ad6774f 100644 --- a/src/de/danoeh/antennapod/adapter/ChapterListAdapter.java +++ b/src/de/danoeh/antennapod/adapter/ChapterListAdapter.java @@ -1,13 +1,10 @@ package de.danoeh.antennapod.adapter; -import java.util.List; - import android.content.Context; import android.text.Layout; import android.text.Selection; import android.text.Spannable; import android.text.Spanned; -import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.text.util.Linkify; import android.util.Log; @@ -24,6 +21,8 @@ import de.danoeh.antennapod.util.ChapterUtils; import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.util.playback.Playable; +import java.util.List; + public class ChapterListAdapter extends ArrayAdapter<Chapter> { private static final String TAG = "ChapterListAdapter"; diff --git a/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java b/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java index c067ac5d2..e97d69494 100644 --- a/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java +++ b/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java @@ -12,7 +12,6 @@ import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.feed.FeedImage; import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.util.DownloadError; /** Displays a list of DownloadStatus entries. */ public class DownloadLogAdapter extends BaseAdapter { diff --git a/src/de/danoeh/antennapod/adapter/DownloadlistAdapter.java b/src/de/danoeh/antennapod/adapter/DownloadlistAdapter.java index 75e837969..2739d2f27 100644 --- a/src/de/danoeh/antennapod/adapter/DownloadlistAdapter.java +++ b/src/de/danoeh/antennapod/adapter/DownloadlistAdapter.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.adapter; -import java.util.List; - import android.content.Context; import android.view.LayoutInflater; import android.view.View; @@ -10,16 +8,14 @@ import android.widget.ArrayAdapter; import android.widget.ProgressBar; import android.widget.TextView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.feed.FeedFile; -import de.danoeh.antennapod.feed.FeedImage; -import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.service.download.DownloadRequest; import de.danoeh.antennapod.service.download.DownloadStatus; import de.danoeh.antennapod.service.download.Downloader; import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.util.ThemeUtils; +import java.util.List; + public class DownloadlistAdapter extends ArrayAdapter<Downloader> { private int selectedItemIndex; diff --git a/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java b/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java index aed988b59..aa724f991 100644 --- a/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java +++ b/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java @@ -6,11 +6,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.widget.BaseExpandableListAdapter; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; +import android.widget.*; import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.ImageLoader; import de.danoeh.antennapod.feed.FeedItem; diff --git a/src/de/danoeh/antennapod/adapter/InternalFeedItemlistAdapter.java b/src/de/danoeh/antennapod/adapter/InternalFeedItemlistAdapter.java index 238ae29c6..4681284f5 100644 --- a/src/de/danoeh/antennapod/adapter/InternalFeedItemlistAdapter.java +++ b/src/de/danoeh/antennapod/adapter/InternalFeedItemlistAdapter.java @@ -7,11 +7,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.widget.Adapter; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; +import android.widget.*; import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedMedia; @@ -20,8 +16,6 @@ import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.util.ThemeUtils; -import java.util.Iterator; - /** List adapter for items of feeds that the user has already subscribed to. */ public class InternalFeedItemlistAdapter extends DefaultFeedItemlistAdapter { diff --git a/src/de/danoeh/antennapod/adapter/MiroGuideChannelListAdapter.java b/src/de/danoeh/antennapod/adapter/MiroGuideChannelListAdapter.java index 0ac58e7a4..4361b3af8 100644 --- a/src/de/danoeh/antennapod/adapter/MiroGuideChannelListAdapter.java +++ b/src/de/danoeh/antennapod/adapter/MiroGuideChannelListAdapter.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.adapter; -import java.util.List; - import android.content.Context; import android.view.LayoutInflater; import android.view.View; @@ -11,6 +9,8 @@ import android.widget.TextView; import de.danoeh.antennapod.R; import de.danoeh.antennapod.miroguide.model.MiroGuideChannel; +import java.util.List; + public class MiroGuideChannelListAdapter extends ArrayAdapter<MiroGuideChannel> { public MiroGuideChannelListAdapter(Context context, int textViewResourceId, diff --git a/src/de/danoeh/antennapod/adapter/MiroGuideItemlistAdapter.java b/src/de/danoeh/antennapod/adapter/MiroGuideItemlistAdapter.java index f12345f84..18a4b42cc 100644 --- a/src/de/danoeh/antennapod/adapter/MiroGuideItemlistAdapter.java +++ b/src/de/danoeh/antennapod/adapter/MiroGuideItemlistAdapter.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.adapter; -import java.util.List; - import android.content.Context; import android.text.format.DateUtils; import android.view.LayoutInflater; @@ -12,6 +10,8 @@ import android.widget.TextView; import de.danoeh.antennapod.R; import de.danoeh.antennapod.miroguide.model.MiroGuideItem; +import java.util.List; + public class MiroGuideItemlistAdapter extends ArrayAdapter<MiroGuideItem> { public MiroGuideItemlistAdapter(Context context, int textViewResourceId, diff --git a/src/de/danoeh/antennapod/adapter/SearchlistAdapter.java b/src/de/danoeh/antennapod/adapter/SearchlistAdapter.java index 129289d30..926a5a5ad 100644 --- a/src/de/danoeh/antennapod/adapter/SearchlistAdapter.java +++ b/src/de/danoeh/antennapod/adapter/SearchlistAdapter.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.adapter; -import java.util.List; - import android.content.Context; import android.view.LayoutInflater; import android.view.View; @@ -16,6 +14,8 @@ import de.danoeh.antennapod.feed.FeedComponent; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.SearchResult; +import java.util.List; + /** List adapter for search activity. */ public class SearchlistAdapter extends ArrayAdapter<SearchResult> { diff --git a/src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java b/src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java index ef70c1e64..43118c3af 100644 --- a/src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java +++ b/src/de/danoeh/antennapod/asynctask/BitmapDecodeWorkerTask.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.asynctask; -import android.content.res.TypedArray; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; @@ -8,7 +7,7 @@ import android.graphics.drawable.TransitionDrawable; import android.os.Handler; import android.util.Log; import android.widget.ImageView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.ImageLoader.ImageWorkerTaskResource; @@ -65,7 +64,7 @@ public class BitmapDecodeWorkerTask extends Thread { target.setImageDrawable(transitionDrawable); transitionDrawable.startTransition(FADE_DURATION); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Not displaying image"); } } @@ -82,7 +81,7 @@ public class BitmapDecodeWorkerTask extends Thread { target.getResources(), defaultCoverResource), PREFERRED_LENGTH); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Finished loading bitmaps"); endBackgroundTask(); diff --git a/src/de/danoeh/antennapod/asynctask/DownloadObserver.java b/src/de/danoeh/antennapod/asynctask/DownloadObserver.java index 26e405615..40388cde5 100644 --- a/src/de/danoeh/antennapod/asynctask/DownloadObserver.java +++ b/src/de/danoeh/antennapod/asynctask/DownloadObserver.java @@ -5,7 +5,7 @@ import android.content.*; import android.os.Handler; import android.os.IBinder; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.service.download.DownloadService; import de.danoeh.antennapod.service.download.Downloader; @@ -55,13 +55,13 @@ public class DownloadObserver { } public void onResume() { - if (AppConfig.DEBUG) Log.d(TAG, "DownloadObserver resumed"); + if (BuildConfig.DEBUG) Log.d(TAG, "DownloadObserver resumed"); activity.registerReceiver(contentChangedReceiver, new IntentFilter(DownloadService.ACTION_DOWNLOADS_CONTENT_CHANGED)); activity.bindService(new Intent(activity, DownloadService.class), mConnection, 0); } public void onPause() { - if (AppConfig.DEBUG) Log.d(TAG, "DownloadObserver paused"); + if (BuildConfig.DEBUG) Log.d(TAG, "DownloadObserver paused"); activity.unregisterReceiver(contentChangedReceiver); activity.unbindService(mConnection); stopRefresher(); @@ -93,7 +93,7 @@ public class DownloadObserver { downloadService = ((DownloadService.LocalBinder) service) .getService(); mIsBound.set(true); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Connection to service established"); List<Downloader> downloaderList = downloadService.getDownloads(); if (downloaderList != null && !downloaderList.isEmpty()) { diff --git a/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java b/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java index 5f483625a..e9aa79ac1 100644 --- a/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java +++ b/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java @@ -13,7 +13,7 @@ import android.os.AsyncTask; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.widget.Toast; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.storage.DBReader; @@ -23,7 +23,6 @@ import de.danoeh.antennapod.util.flattr.FlattrUtils; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.Executor; /** * Performs a click action in a background thread. @@ -200,7 +199,7 @@ public class FlattrClickWorker extends AsyncTask<Void, String, Void> { @Override protected void onPostExecute(Void result) { - if (AppConfig.DEBUG) Log.d(TAG, "Exit code was " + exitCode); + if (BuildConfig.DEBUG) Log.d(TAG, "Exit code was " + exitCode); switch (exitCode) { case NO_TOKEN: @@ -234,7 +233,7 @@ public class FlattrClickWorker extends AsyncTask<Void, String, Void> { @Override protected Void doInBackground(Void... params) { - if (AppConfig.DEBUG) Log.d(TAG, "Starting background work"); + if (BuildConfig.DEBUG) Log.d(TAG, "Starting background work"); exitCode = EXIT_DEFAULT; diff --git a/src/de/danoeh/antennapod/asynctask/FlattrStatusFetcher.java b/src/de/danoeh/antennapod/asynctask/FlattrStatusFetcher.java index 4974c6b56..04d349671 100644 --- a/src/de/danoeh/antennapod/asynctask/FlattrStatusFetcher.java +++ b/src/de/danoeh/antennapod/asynctask/FlattrStatusFetcher.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.asynctask; import android.content.Context; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.storage.DBWriter; import de.danoeh.antennapod.util.flattr.FlattrUtils; import org.shredzone.flattr4j.exception.FlattrException; @@ -26,7 +26,7 @@ public class FlattrStatusFetcher extends Thread { @Override public void run() { - if (AppConfig.DEBUG) Log.d(TAG, "Starting background work: Retrieving Flattr status"); + if (BuildConfig.DEBUG) Log.d(TAG, "Starting background work: Retrieving Flattr status"); Thread.currentThread().setPriority(Thread.MIN_PRIORITY); @@ -42,6 +42,6 @@ public class FlattrStatusFetcher extends Thread { e.printStackTrace(); } - if (AppConfig.DEBUG) Log.d(TAG, "Finished background work: Retrieved Flattr status"); + if (BuildConfig.DEBUG) Log.d(TAG, "Finished background work: Retrieved Flattr status"); } } diff --git a/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java b/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java index b56e83d25..0dcf832f7 100644 --- a/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java +++ b/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java @@ -1,20 +1,19 @@ package de.danoeh.antennapod.asynctask; -import org.shredzone.flattr4j.exception.FlattrException; -import org.shredzone.flattr4j.oauth.AccessToken; -import org.shredzone.flattr4j.oauth.AndroidAuthenticator; - import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.Context; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.FlattrAuthActivity; import de.danoeh.antennapod.util.flattr.FlattrUtils; +import org.shredzone.flattr4j.exception.FlattrException; +import org.shredzone.flattr4j.oauth.AccessToken; +import org.shredzone.flattr4j.oauth.AndroidAuthenticator; /** Fetches the access token in the background in order to avoid networkOnMainThread exception. */ @@ -76,7 +75,7 @@ public class FlattrTokenFetcher extends AsyncTask<Void, Void, AccessToken> { return null; } if (token != null) { - if (AppConfig.DEBUG) Log.d(TAG, "Successfully got token"); + if (BuildConfig.DEBUG) Log.d(TAG, "Successfully got token"); return token; } else { Log.w(TAG, "Flattr token was null"); diff --git a/src/de/danoeh/antennapod/asynctask/ImageDiskCache.java b/src/de/danoeh/antennapod/asynctask/ImageDiskCache.java index ae8bf8b87..b90d78c14 100644 --- a/src/de/danoeh/antennapod/asynctask/ImageDiskCache.java +++ b/src/de/danoeh/antennapod/asynctask/ImageDiskCache.java @@ -4,7 +4,7 @@ import android.os.Handler; import android.util.Log; import android.util.Pair; import android.widget.ImageView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.R; import de.danoeh.antennapod.service.download.DownloadRequest; @@ -89,7 +89,7 @@ public class ImageDiskCache { private synchronized void initCacheFolder() { if (diskCache == null) { - if (AppConfig.DEBUG) Log.d(TAG, "Initializing cache folder"); + if (BuildConfig.DEBUG) Log.d(TAG, "Initializing cache folder"); File cacheFile = new File(cacheFolder, CACHE_FILE_NAME); if (cacheFile.exists()) { try { @@ -242,7 +242,7 @@ public class ImageDiskCache { if (diskCache == null) { initCacheFolder(); } - if (AppConfig.DEBUG) Log.d(TAG, "Adding new image to disk cache: " + url); + if (BuildConfig.DEBUG) Log.d(TAG, "Adding new image to disk cache: " + url); diskCache.put(url, obj); cacheSize += obj.size; if (cacheSize > maxCacheSize) { @@ -313,7 +313,7 @@ public class ImageDiskCache { dco = new DiskCacheObject(newFile.getAbsolutePath(), size); addToDiskCache(downloadUrl, dco); - if (AppConfig.DEBUG) Log.d(TAG, "Image was downloaded"); + if (BuildConfig.DEBUG) Log.d(TAG, "Image was downloaded"); } else { Log.w(TAG, "Download of url " + downloadUrl + " failed. Reason: " + result.getResult().getReasonDetailed() + "(" + result.getResult().getReason() + ")"); } diff --git a/src/de/danoeh/antennapod/asynctask/ImageLoader.java b/src/de/danoeh/antennapod/asynctask/ImageLoader.java index b50502ea8..6c60b7b1f 100644 --- a/src/de/danoeh/antennapod/asynctask/ImageLoader.java +++ b/src/de/danoeh/antennapod/asynctask/ImageLoader.java @@ -7,7 +7,7 @@ import android.os.Handler; import android.support.v4.util.LruCache; import android.util.Log; import android.widget.ImageView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.R; @@ -176,7 +176,7 @@ public class ImageLoader { public void clearExecutorQueue() { executor.shutdownNow(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Executor was shut down."); executor = createExecutor(); diff --git a/src/de/danoeh/antennapod/asynctask/OpmlExportWorker.java b/src/de/danoeh/antennapod/asynctask/OpmlExportWorker.java index 745bc7079..4abb1a67d 100644 --- a/src/de/danoeh/antennapod/asynctask/OpmlExportWorker.java +++ b/src/de/danoeh/antennapod/asynctask/OpmlExportWorker.java @@ -1,11 +1,5 @@ package de.danoeh.antennapod.asynctask; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.util.Arrays; - import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.ProgressDialog; @@ -17,8 +11,13 @@ import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.R; import de.danoeh.antennapod.opml.OpmlWriter; import de.danoeh.antennapod.preferences.UserPreferences; -import de.danoeh.antennapod.util.LangUtils; import de.danoeh.antennapod.storage.DBReader; +import de.danoeh.antennapod.util.LangUtils; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; /** Writes an OPML file into the export directory in the background. */ public class OpmlExportWorker extends AsyncTask<Void, Void, Void> { diff --git a/src/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java b/src/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java index 64e678086..038b8dcc5 100644 --- a/src/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java +++ b/src/de/danoeh/antennapod/asynctask/OpmlFeedQueuer.java @@ -1,8 +1,5 @@ package de.danoeh.antennapod.asynctask; -import java.util.Arrays; -import java.util.Date; - import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.Context; @@ -14,6 +11,9 @@ import de.danoeh.antennapod.opml.OpmlElement; import de.danoeh.antennapod.storage.DownloadRequestException; import de.danoeh.antennapod.storage.DownloadRequester; +import java.util.Arrays; +import java.util.Date; + /** Queues items for download in the background. */ public class OpmlFeedQueuer extends AsyncTask<Void, Void, Void> { private Context context; diff --git a/src/de/danoeh/antennapod/asynctask/OpmlImportWorker.java b/src/de/danoeh/antennapod/asynctask/OpmlImportWorker.java index 4816c25ab..13534fa64 100644 --- a/src/de/danoeh/antennapod/asynctask/OpmlImportWorker.java +++ b/src/de/danoeh/antennapod/asynctask/OpmlImportWorker.java @@ -1,11 +1,5 @@ package de.danoeh.antennapod.asynctask; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; - -import org.xmlpull.v1.XmlPullParserException; - import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.ProgressDialog; @@ -14,10 +8,15 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.AsyncTask; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.opml.OpmlElement; import de.danoeh.antennapod.opml.OpmlReader; +import org.xmlpull.v1.XmlPullParserException; + +import java.io.IOException; +import java.io.Reader; +import java.util.ArrayList; public class OpmlImportWorker extends AsyncTask<Void, Void, ArrayList<OpmlElement>> { @@ -38,7 +37,7 @@ public class OpmlImportWorker extends @Override protected ArrayList<OpmlElement> doInBackground(Void... params) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting background work"); if (mReader==null) { @@ -73,7 +72,7 @@ public class OpmlImportWorker extends } progDialog.dismiss(); if (exception != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "An error occured while trying to parse the opml document"); AlertDialog.Builder alert = new AlertDialog.Builder(context); diff --git a/src/de/danoeh/antennapod/dialog/ConfirmationDialog.java b/src/de/danoeh/antennapod/dialog/ConfirmationDialog.java index f4890ed53..df71fff77 100644 --- a/src/de/danoeh/antennapod/dialog/ConfirmationDialog.java +++ b/src/de/danoeh/antennapod/dialog/ConfirmationDialog.java @@ -4,7 +4,7 @@ import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; /** @@ -25,7 +25,7 @@ public abstract class ConfirmationDialog { } public void onCancelButtonPressed(DialogInterface dialog) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Dialog was cancelled"); dialog.dismiss(); } diff --git a/src/de/danoeh/antennapod/dialog/TimeDialog.java b/src/de/danoeh/antennapod/dialog/TimeDialog.java index fb5a72931..353a50adb 100644 --- a/src/de/danoeh/antennapod/dialog/TimeDialog.java +++ b/src/de/danoeh/antennapod/dialog/TimeDialog.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.dialog; -import java.util.concurrent.TimeUnit; - import android.app.Dialog; import android.content.Context; import android.os.Bundle; @@ -10,14 +8,12 @@ import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.view.Window; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.EditText; -import android.widget.Spinner; -import android.widget.Toast; -import de.danoeh.antennapod.AppConfig; +import android.widget.*; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; +import java.util.concurrent.TimeUnit; + public abstract class TimeDialog extends Dialog { private static final String TAG = "TimeDialog"; @@ -108,11 +104,11 @@ public abstract class TimeDialog extends Dialog { private void checkInputLength(int length) { if (length > 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Length is larger than 0, enabling confirm button"); butConfirm.setEnabled(true); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Length is smaller than 0, disabling confirm button"); butConfirm.setEnabled(false); } diff --git a/src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java b/src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java index e6cbe37d1..b009e76a7 100644 --- a/src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java +++ b/src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java @@ -1,8 +1,5 @@ package de.danoeh.antennapod.dialog; -import java.util.Arrays; -import java.util.List; - import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.Context; @@ -12,6 +9,9 @@ import android.net.Uri; import de.danoeh.antennapod.R; import de.danoeh.antennapod.preferences.UserPreferences; +import java.util.Arrays; +import java.util.List; + public class VariableSpeedDialog { private VariableSpeedDialog() { } diff --git a/src/de/danoeh/antennapod/feed/EventDistributor.java b/src/de/danoeh/antennapod/feed/EventDistributor.java index 56333da52..85a9b5727 100644 --- a/src/de/danoeh/antennapod/feed/EventDistributor.java +++ b/src/de/danoeh/antennapod/feed/EventDistributor.java @@ -1,14 +1,14 @@ package de.danoeh.antennapod.feed; +import android.os.Handler; +import android.util.Log; +import de.danoeh.antennapod.BuildConfig; + import java.util.AbstractQueue; import java.util.Observable; import java.util.Observer; import java.util.concurrent.ConcurrentLinkedQueue; -import android.os.Handler; -import android.util.Log; -import de.danoeh.antennapod.AppConfig; - /** * Notifies its observers about changes in the feed database. Observers can * register by retrieving an instance of this class and registering an @@ -67,7 +67,7 @@ public class EventDistributor extends Observable { private void processEventQueue() { Integer result = 0; - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Processing event queue. Number of events: " + events.size()); @@ -76,12 +76,12 @@ public class EventDistributor extends Observable { result |= current; } if (result != 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Notifying observers. Data: " + result); setChanged(); notifyObservers(result); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Event queue didn't contain any new events. Observers will not be notified."); } diff --git a/src/de/danoeh/antennapod/feed/Feed.java b/src/de/danoeh/antennapod/feed/Feed.java index 19030d73e..9e423ff8b 100644 --- a/src/de/danoeh/antennapod/feed/Feed.java +++ b/src/de/danoeh/antennapod/feed/Feed.java @@ -1,18 +1,16 @@ package de.danoeh.antennapod.feed; import android.content.Context; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; - import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.storage.DBWriter; import de.danoeh.antennapod.util.EpisodeFilter; import de.danoeh.antennapod.util.flattr.FlattrStatus; import de.danoeh.antennapod.util.flattr.FlattrThing; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + /** * Data Object for a whole feed * diff --git a/src/de/danoeh/antennapod/feed/FeedImage.java b/src/de/danoeh/antennapod/feed/FeedImage.java index c50ea8514..9c9170294 100644 --- a/src/de/danoeh/antennapod/feed/FeedImage.java +++ b/src/de/danoeh/antennapod/feed/FeedImage.java @@ -1,14 +1,13 @@ package de.danoeh.antennapod.feed; +import de.danoeh.antennapod.asynctask.ImageLoader; +import org.apache.commons.io.IOUtils; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; -import org.apache.commons.io.IOUtils; - -import de.danoeh.antennapod.asynctask.ImageLoader; - public class FeedImage extends FeedFile implements diff --git a/src/de/danoeh/antennapod/feed/FeedItem.java b/src/de/danoeh/antennapod/feed/FeedItem.java index 27fd0dc2c..921a03bff 100644 --- a/src/de/danoeh/antennapod/feed/FeedItem.java +++ b/src/de/danoeh/antennapod/feed/FeedItem.java @@ -6,7 +6,6 @@ import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.util.ShownotesProvider; import de.danoeh.antennapod.util.flattr.FlattrStatus; import de.danoeh.antennapod.util.flattr.FlattrThing; -import org.apache.commons.lang3.StringUtils; import java.io.InputStream; import java.util.Date; diff --git a/src/de/danoeh/antennapod/feed/VorbisCommentChapter.java b/src/de/danoeh/antennapod/feed/VorbisCommentChapter.java index 544e762d3..59844ae1f 100644 --- a/src/de/danoeh/antennapod/feed/VorbisCommentChapter.java +++ b/src/de/danoeh/antennapod/feed/VorbisCommentChapter.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.feed; -import java.util.concurrent.TimeUnit; - import de.danoeh.antennapod.util.vorbiscommentreader.VorbisCommentReaderException; +import java.util.concurrent.TimeUnit; + public class VorbisCommentChapter extends Chapter { public static final int CHAPTERTYPE_VORBISCOMMENT_CHAPTER = 3; diff --git a/src/de/danoeh/antennapod/fragment/CoverFragment.java b/src/de/danoeh/antennapod/fragment/CoverFragment.java index 791315719..0e1fe35e0 100644 --- a/src/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/src/de/danoeh/antennapod/fragment/CoverFragment.java @@ -7,8 +7,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.AudioplayerActivity.AudioplayerContentFragment; import de.danoeh.antennapod.asynctask.ImageLoader; @@ -74,11 +73,11 @@ public class CoverFragment extends Fragment implements @Override public void onStart() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "On Start"); super.onStart(); if (media != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading media info"); loadMediaInfo(); } else { diff --git a/src/de/danoeh/antennapod/fragment/EpisodesFragment.java b/src/de/danoeh/antennapod/fragment/EpisodesFragment.java index 6b228662f..3c79a8c10 100644 --- a/src/de/danoeh/antennapod/fragment/EpisodesFragment.java +++ b/src/de/danoeh/antennapod/fragment/EpisodesFragment.java @@ -10,8 +10,7 @@ import android.view.*; import android.view.ContextMenu.ContextMenuInfo; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.ItemviewActivity; import de.danoeh.antennapod.activity.OrganizeQueueActivity; @@ -156,7 +155,7 @@ public class EpisodesFragment extends Fragment { @Override protected Void doInBackground(Void... voids) { - if (AppConfig.DEBUG) Log.d(TAG, "Starting to load list data"); + if (BuildConfig.DEBUG) Log.d(TAG, "Starting to load list data"); Context context = EpisodesFragment.this.getActivity(); if (context != null) { queueRef = DBReader.getQueue(context); @@ -169,7 +168,7 @@ public class EpisodesFragment extends Fragment { protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); if (queueRef != null && unreadItemsRef != null) { - if (AppConfig.DEBUG) Log.d(TAG, "Done loading list data"); + if (BuildConfig.DEBUG) Log.d(TAG, "Done loading list data"); queue = queueRef; unreadItems = unreadItemsRef; if (adapter != null) { @@ -193,7 +192,7 @@ public class EpisodesFragment extends Fragment { @Override public void update(EventDistributor eventDistributor, Integer arg) { if ((EVENTS & arg) != 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent."); loadData(); } diff --git a/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index 56e6ee4b8..47cd3f244 100644 --- a/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -10,8 +10,7 @@ import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.ImageLoader; import de.danoeh.antennapod.service.playback.PlaybackService; @@ -57,7 +56,7 @@ public class ExternalPlayerFragment extends Fragment { @Override public void onClick(View v) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "layoutInfo was clicked"); if (controller.getMedia() != null) { @@ -196,7 +195,7 @@ public class ExternalPlayerFragment extends Fragment { @Override public void onDestroy() { super.onDestroy(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Fragment is about to be destroyed"); if (controller != null) { controller.release(); @@ -212,7 +211,7 @@ public class ExternalPlayerFragment extends Fragment { } private boolean loadMediaInfo() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading media info"); if (controller.serviceAvailable()) { Playable media = controller.getMedia(); diff --git a/src/de/danoeh/antennapod/fragment/FeedlistFragment.java b/src/de/danoeh/antennapod/fragment/FeedlistFragment.java index d0e07b194..0d2f0d079 100644 --- a/src/de/danoeh/antennapod/fragment/FeedlistFragment.java +++ b/src/de/danoeh/antennapod/fragment/FeedlistFragment.java @@ -5,7 +5,6 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.AsyncTask; -import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; @@ -13,7 +12,7 @@ import android.support.v7.view.ActionMode; import android.util.Log; import android.view.*; import android.widget.*; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.FeedItemlistActivity; import de.danoeh.antennapod.adapter.FeedlistAdapter; @@ -85,7 +84,7 @@ public class FeedlistFragment extends Fragment implements @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating"); fla = new FeedlistAdapter(getActivity(), itemAccess); loadFeeds(); @@ -143,14 +142,14 @@ public class FeedlistFragment extends Fragment implements listView.setOnItemLongClickListener(this); listView.setAdapter(fla); listView.setEmptyView(emptyView); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Using ListView"); } else { gridView.setOnItemClickListener(this); gridView.setOnItemLongClickListener(this); gridView.setAdapter(fla); gridView.setEmptyView(emptyView); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Using GridView"); } setEmptyViewIfListIsEmpty(); @@ -159,7 +158,7 @@ public class FeedlistFragment extends Fragment implements @Override public void onResume() { super.onResume(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Resuming"); EventDistributor.getInstance().register(contentUpdate); } @@ -183,7 +182,7 @@ public class FeedlistFragment extends Fragment implements @Override public void update(EventDistributor eventDistributor, Integer arg) { if ((EVENTS & arg) != 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent."); loadFeeds(); } @@ -266,7 +265,7 @@ public class FeedlistFragment extends Fragment implements int position, long id) { Feed selection = fla.getItem(position); if (selection != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Selected Feed with title " + selection.getTitle()); if (mActionMode != null) { mActionMode.finish(); diff --git a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index c996f497e..48c544457 100644 --- a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -1,39 +1,32 @@ package de.danoeh.antennapod.fragment; -import android.content.*; -import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBarActivity; -import de.danoeh.antennapod.feed.FeedItem; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.ShownotesProvider; -import org.apache.commons.lang3.StringEscapeUtils; - import android.annotation.SuppressLint; import android.app.Activity; +import android.content.*; import android.content.res.TypedArray; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.util.TypedValue; -import android.view.ContextMenu; +import android.view.*; import android.view.ContextMenu.ContextMenuInfo; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; +import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.storage.DBReader; import de.danoeh.antennapod.util.ShareUtils; +import de.danoeh.antennapod.util.ShownotesProvider; import de.danoeh.antennapod.util.playback.Playable; +import org.apache.commons.lang3.StringEscapeUtils; import java.util.concurrent.Callable; @@ -93,7 +86,7 @@ public class ItemDescriptionFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating view"); webvDescription = new WebView(getActivity()); if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) { @@ -126,7 +119,7 @@ public class ItemDescriptionFragment extends Fragment { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Page finished"); // Restoring the scroll position might not always work view.postDelayed(new Runnable() { @@ -153,14 +146,14 @@ public class ItemDescriptionFragment extends Fragment { @Override public void onAttach(Activity activity) { super.onAttach(activity); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Fragment attached"); } @Override public void onDetach() { super.onDetach(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Fragment detached"); if (webViewLoader != null) { webViewLoader.cancel(true); @@ -170,7 +163,7 @@ public class ItemDescriptionFragment extends Fragment { @Override public void onDestroy() { super.onDestroy(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Fragment destroyed"); if (webViewLoader != null) { webViewLoader.cancel(true); @@ -181,7 +174,7 @@ public class ItemDescriptionFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating fragment"); Bundle args = getArguments(); saveState = args.getBoolean(ARG_SAVE_STATE, false); @@ -258,7 +251,7 @@ public class ItemDescriptionFragment extends Fragment { WebView.HitTestResult r = webvDescription.getHitTestResult(); if (r != null && r.getType() == WebView.HitTestResult.SRC_ANCHOR_TYPE) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Link of webview was long-pressed. Extra: " + r.getExtra()); @@ -352,7 +345,7 @@ public class ItemDescriptionFragment extends Fragment { ((ActionBarActivity) getActivity()) .setSupportProgressBarIndeterminateVisibility(false); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Webview loaded"); webViewLoader = null; } @@ -368,7 +361,7 @@ public class ItemDescriptionFragment extends Fragment { @Override protected Void doInBackground(Void... params) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading Webview"); try { Callable<String> shownotesLoadTask = shownotesProvider.loadShownotes(); @@ -407,13 +400,13 @@ public class ItemDescriptionFragment extends Fragment { private void savePreference() { if (saveState) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Saving preferences"); SharedPreferences prefs = getActivity().getSharedPreferences(PREF, Activity.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); if (media != null && webvDescription != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Saving scroll position: " + webvDescription.getScrollY()); @@ -421,7 +414,7 @@ public class ItemDescriptionFragment extends Fragment { editor.putString(PREF_PLAYABLE_ID, media.getIdentifier() .toString()); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "savePreferences was called while media or webview was null"); editor.putInt(PREF_SCROLL_Y, -1); @@ -433,7 +426,7 @@ public class ItemDescriptionFragment extends Fragment { private boolean restoreFromPreference() { if (saveState) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Restoring from preferences"); Activity activity = getActivity(); if (activity != null) { @@ -444,7 +437,7 @@ public class ItemDescriptionFragment extends Fragment { if (scrollY != -1 && media != null && id.equals(media.getIdentifier().toString()) && webvDescription != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Restored scroll Position: " + scrollY); webvDescription.scrollTo(webvDescription.getScrollX(), scrollY); diff --git a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java index 436210a70..e5845dd76 100644 --- a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -8,17 +8,11 @@ import android.os.Bundle; import android.support.v4.app.ListFragment; import android.support.v7.app.ActionBarActivity; import android.util.Log; -import android.view.ContextMenu; +import android.view.*; import android.view.ContextMenu.ContextMenuInfo; -import android.view.LayoutInflater; -import android.view.MenuInflater; -import android.view.View; -import android.view.ViewGroup; import android.widget.ListView; - import android.widget.TextView; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.ItemviewActivity; import de.danoeh.antennapod.adapter.ActionButtonCallback; @@ -34,7 +28,6 @@ import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.util.QueueAccess; import de.danoeh.antennapod.util.menuhandler.FeedItemMenuHandler; -import java.util.Iterator; import java.util.List; /** Displays a list of FeedItems. */ @@ -229,7 +222,7 @@ public class ItemlistFragment extends ListFragment { @Override public void update(EventDistributor eventDistributor, Integer arg) { if ((EVENTS & arg) != 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent."); if ((EventDistributor.DOWNLOAD_QUEUED & arg) != 0) { updateProgressBarVisibility(); diff --git a/src/de/danoeh/antennapod/fragment/MiroGuideChannellistFragment.java b/src/de/danoeh/antennapod/fragment/MiroGuideChannellistFragment.java index c6901ad17..53910b673 100644 --- a/src/de/danoeh/antennapod/fragment/MiroGuideChannellistFragment.java +++ b/src/de/danoeh/antennapod/fragment/MiroGuideChannellistFragment.java @@ -1,8 +1,5 @@ package de.danoeh.antennapod.fragment; -import java.util.ArrayList; -import java.util.List; - import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.Context; @@ -17,8 +14,7 @@ import android.view.View; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.ListView; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MiroGuideChannelViewActivity; import de.danoeh.antennapod.adapter.MiroGuideChannelListAdapter; @@ -26,6 +22,9 @@ import de.danoeh.antennapod.miroguide.conn.MiroGuideException; import de.danoeh.antennapod.miroguide.conn.MiroGuideService; import de.danoeh.antennapod.miroguide.model.MiroGuideChannel; +import java.util.ArrayList; +import java.util.List; + /** * Displays a list of MiroGuideChannel objects that were results of a certain * MiroGuideService query. If the user reaches the bottom of the list, more @@ -139,7 +138,7 @@ public class MiroGuideChannellistFragment extends ListFragment { int visibleItemCount, int totalItemCount) { int lastVisibleItem = firstVisibleItem + visibleItemCount; if (lastVisibleItem == totalItemCount) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) loadChannels(); } } @@ -177,13 +176,13 @@ public class MiroGuideChannellistFragment extends ListFragment { @Override protected void onCancelled() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Channel loader was cancelled"); } @Override protected void onPostExecute(List<MiroGuideChannel> result) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Channel loading finished"); if (exception == null) { getListView().removeFooterView(footer); @@ -195,13 +194,13 @@ public class MiroGuideChannellistFragment extends ListFragment { // check if fragment should not send any more // queries if (result.size() < CHANNELS_PER_QUERY) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Query result was less than requested number of channels. Stopping to send any more queries"); stopLoading = true; } if (offset >= MAX_CHANNELS) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Maximum number of feeds has been reached. Stopping to send any more queries"); stopLoading = true; @@ -236,7 +235,7 @@ public class MiroGuideChannellistFragment extends ListFragment { @Override protected List<MiroGuideChannel> doInBackground( Void... params) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Background channel loader started"); MiroGuideService service = new MiroGuideService(); try { @@ -260,7 +259,7 @@ public class MiroGuideChannellistFragment extends ListFragment { } } } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Channels are already being loaded"); } } diff --git a/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java b/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java index d20cb63c4..d6524853f 100644 --- a/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java +++ b/src/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java @@ -4,13 +4,12 @@ import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.adapter.InternalFeedItemlistAdapter; import de.danoeh.antennapod.feed.EventDistributor; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.storage.DBReader; -import java.util.Iterator; import java.util.List; public class PlaybackHistoryFragment extends ItemlistFragment { @@ -64,7 +63,7 @@ public class PlaybackHistoryFragment extends ItemlistFragment { @Override public void update(EventDistributor eventDistributor, Integer arg) { if ((EventDistributor.PLAYBACK_HISTORY_UPDATE & arg) != 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received content update"); loadData(); } diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java b/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java index 3014d28cc..4164429b2 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java +++ b/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java @@ -10,7 +10,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.*; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity; import de.danoeh.antennapod.activity.OnlineFeedViewActivity; @@ -60,7 +60,7 @@ public abstract class PodcastListFragment extends Fragment { } protected void onPodcastSelected(GpodnetPodcast selection) { - if (AppConfig.DEBUG) Log.d(TAG, "Selected podcast: " + selection.toString()); + if (BuildConfig.DEBUG) Log.d(TAG, "Selected podcast: " + selection.toString()); Intent intent = new Intent(getActivity(), DefaultOnlineFeedViewActivity.class); intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, selection.getUrl()); intent.putExtra(DefaultOnlineFeedViewActivity.ARG_TITLE, getString(R.string.gpodnet_main_label)); diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java b/src/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java index 7007d0b9a..5717a74e7 100644 --- a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java +++ b/src/de/danoeh/antennapod/fragment/gpodnet/PodcastTopListFragment.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.fragment.gpodnet; -import android.util.Log; -import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.gpoddernet.GpodnetService; import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast; diff --git a/src/de/danoeh/antennapod/miroguide/conn/MiroGuideConnector.java b/src/de/danoeh/antennapod/miroguide/conn/MiroGuideConnector.java index ee1a3ea21..b4c06c340 100644 --- a/src/de/danoeh/antennapod/miroguide/conn/MiroGuideConnector.java +++ b/src/de/danoeh/antennapod/miroguide/conn/MiroGuideConnector.java @@ -1,10 +1,7 @@ package de.danoeh.antennapod.miroguide.conn; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - +import android.net.Uri; +import de.danoeh.antennapod.util.LangUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; @@ -14,9 +11,9 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -import android.net.Uri; - -import de.danoeh.antennapod.util.LangUtils; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; /** Executes HTTP requests and returns the results. */ public class MiroGuideConnector { diff --git a/src/de/danoeh/antennapod/miroguide/conn/MiroGuideService.java b/src/de/danoeh/antennapod/miroguide/conn/MiroGuideService.java index 5cb137574..bdb4ec5dd 100644 --- a/src/de/danoeh/antennapod/miroguide/conn/MiroGuideService.java +++ b/src/de/danoeh/antennapod/miroguide/conn/MiroGuideService.java @@ -1,5 +1,11 @@ package de.danoeh.antennapod.miroguide.conn; +import de.danoeh.antennapod.miroguide.model.MiroGuideChannel; +import de.danoeh.antennapod.miroguide.model.MiroGuideItem; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -7,13 +13,6 @@ import java.util.Date; import java.util.List; import java.util.Locale; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import de.danoeh.antennapod.miroguide.model.MiroGuideChannel; -import de.danoeh.antennapod.miroguide.model.MiroGuideItem; - /** Provides methods to communicate with the Miroguide API on an abstract level. */ public class MiroGuideService { diff --git a/src/de/danoeh/antennapod/opml/OpmlReader.java b/src/de/danoeh/antennapod/opml/OpmlReader.java index 61a00742c..19a980dee 100644 --- a/src/de/danoeh/antennapod/opml/OpmlReader.java +++ b/src/de/danoeh/antennapod/opml/OpmlReader.java @@ -1,15 +1,14 @@ package de.danoeh.antennapod.opml; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; - +import android.util.Log; +import de.danoeh.antennapod.BuildConfig; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; -import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import java.io.IOException; +import java.io.Reader; +import java.util.ArrayList; /** Reads OPML documents. */ public class OpmlReader { @@ -38,16 +37,16 @@ public class OpmlReader { while (eventType != XmlPullParser.END_DOCUMENT) { switch (eventType) { case XmlPullParser.START_DOCUMENT: - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Reached beginning of document"); break; case XmlPullParser.START_TAG: if (xpp.getName().equals(OpmlSymbols.OPML)) { isInOpml = true; - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Reached beginning of OPML tree."); } else if (isInOpml && xpp.getName().equals(OpmlSymbols.OUTLINE)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Found new Opml element"); OpmlElement element = new OpmlElement(); @@ -69,7 +68,7 @@ public class OpmlReader { } elementList.add(element); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Skipping element because of missing xml url"); } @@ -79,7 +78,7 @@ public class OpmlReader { eventType = xpp.next(); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Parsing finished."); return elementList; diff --git a/src/de/danoeh/antennapod/opml/OpmlWriter.java b/src/de/danoeh/antennapod/opml/OpmlWriter.java index 955c4f2f1..405a5e35a 100644 --- a/src/de/danoeh/antennapod/opml/OpmlWriter.java +++ b/src/de/danoeh/antennapod/opml/OpmlWriter.java @@ -1,15 +1,14 @@ package de.danoeh.antennapod.opml; -import java.io.IOException; -import java.io.Writer; -import java.util.List; - -import org.xmlpull.v1.XmlSerializer; - import android.util.Log; import android.util.Xml; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.Feed; +import org.xmlpull.v1.XmlSerializer; + +import java.io.IOException; +import java.io.Writer; +import java.util.List; /** Writes OPML documents. */ public class OpmlWriter { @@ -28,7 +27,7 @@ public class OpmlWriter { */ public void writeDocument(List<Feed> feeds, Writer writer) throws IllegalArgumentException, IllegalStateException, IOException { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting to write document"); XmlSerializer xs = Xml.newSerializer(); xs.setOutput(writer); @@ -60,7 +59,7 @@ public class OpmlWriter { xs.endTag(null, OpmlSymbols.BODY); xs.endTag(null, OpmlSymbols.OPML); xs.endDocument(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Finished writing document"); } } diff --git a/src/de/danoeh/antennapod/preferences/GpodnetPreferences.java b/src/de/danoeh/antennapod/preferences/GpodnetPreferences.java index 0130a4a87..bdfe297a6 100644 --- a/src/de/danoeh/antennapod/preferences/GpodnetPreferences.java +++ b/src/de/danoeh/antennapod/preferences/GpodnetPreferences.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.preferences; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.gpoddernet.GpodnetService; import de.danoeh.antennapod.service.GpodnetSyncService; @@ -206,7 +206,7 @@ public class GpodnetPreferences { } public static synchronized void logout() { - if (AppConfig.DEBUG) Log.d(TAG, "Logout: Clearing preferences"); + if (BuildConfig.DEBUG) Log.d(TAG, "Logout: Clearing preferences"); setUsername(null); setPassword(null); setDeviceID(null); diff --git a/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java b/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java index 9ae0f8f2f..80e0768dd 100644 --- a/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java +++ b/src/de/danoeh/antennapod/preferences/PlaybackPreferences.java @@ -4,7 +4,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; /** * Provides access to preferences set by the playback service. A private @@ -64,7 +64,7 @@ public class PlaybackPreferences implements * if context is null * */ public static void createInstance(Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating new instance of UserPreferences"); if (context == null) throw new IllegalArgumentException("Context must not be null"); diff --git a/src/de/danoeh/antennapod/preferences/UserPreferences.java b/src/de/danoeh/antennapod/preferences/UserPreferences.java index 2b4b66362..3662b646e 100644 --- a/src/de/danoeh/antennapod/preferences/UserPreferences.java +++ b/src/de/danoeh/antennapod/preferences/UserPreferences.java @@ -1,16 +1,5 @@ package de.danoeh.antennapod.preferences; -import java.io.File; -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import de.danoeh.antennapod.gpoddernet.GpodnetService; -import org.apache.commons.lang3.StringUtils; -import org.json.JSONArray; -import org.json.JSONException; - import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; @@ -18,10 +7,19 @@ import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.OpmlImportFromPathActivity; import de.danoeh.antennapod.receiver.FeedUpdateReceiver; +import org.apache.commons.lang3.StringUtils; +import org.json.JSONArray; +import org.json.JSONException; + +import java.io.File; +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.TimeUnit; /** * Provides access to preferences set by the user in the settings screen. A @@ -89,7 +87,7 @@ public class UserPreferences implements * if context is null * */ public static void createInstance(Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating new instance of UserPreferences"); if (context == null) throw new IllegalArgumentException("Context must not be null"); @@ -286,7 +284,7 @@ public class UserPreferences implements @Override public void onSharedPreferenceChanged(SharedPreferences sp, String key) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Registered change of user preferences. Key: " + key); if (key.equals(PREF_DOWNLOAD_MEDIA_ON_WIFI_ONLY)) { @@ -392,7 +390,7 @@ public class UserPreferences implements .getDefaultSharedPreferences(context.getApplicationContext()); String strDir = prefs.getString(PREF_DATA_FOLDER, null); if (strDir == null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Using default data folder"); return context.getExternalFilesDir(type); } else { @@ -437,7 +435,7 @@ public class UserPreferences implements } public static void setDataFolder(String dir) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Result from DirectoryChooser: " + dir); instanceAvailable(); SharedPreferences prefs = PreferenceManager @@ -459,7 +457,7 @@ public class UserPreferences implements Log.e(TAG, "Could not create .nomedia file"); e.printStackTrace(); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, ".nomedia file created"); } } @@ -473,15 +471,15 @@ public class UserPreferences implements OpmlImportFromPathActivity.IMPORT_DIR); if (importDir != null) { if (importDir.exists()) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Import directory already exists"); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating import directory"); importDir.mkdir(); } } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Could not access external storage."); } } @@ -495,7 +493,7 @@ public class UserPreferences implements * */ public static void restartUpdateAlarm(long millis) { instanceAvailable(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Restarting update alarm. New value: " + millis); AlarmManager alarmManager = (AlarmManager) instance.context .getSystemService(Context.ALARM_SERVICE); @@ -506,10 +504,10 @@ public class UserPreferences implements if (millis != 0) { alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, millis, millis, updateIntent); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Changed alarm to new interval"); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Automatic update was deactivated"); } } diff --git a/src/de/danoeh/antennapod/receiver/AlarmUpdateReceiver.java b/src/de/danoeh/antennapod/receiver/AlarmUpdateReceiver.java index 63a03b9e6..7b8879f21 100644 --- a/src/de/danoeh/antennapod/receiver/AlarmUpdateReceiver.java +++ b/src/de/danoeh/antennapod/receiver/AlarmUpdateReceiver.java @@ -4,7 +4,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.preferences.UserPreferences; /** Listens for events that make it necessary to reset the update alarm. */ @@ -13,13 +13,13 @@ public class AlarmUpdateReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received intent"); if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Resetting update alarm after reboot"); } else if (intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Resetting update alarm after app upgrade"); } diff --git a/src/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java b/src/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java index c1dd30be7..31c053386 100644 --- a/src/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java +++ b/src/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java @@ -6,7 +6,7 @@ import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.storage.DBTasks; import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.util.NetworkUtils; @@ -17,11 +17,11 @@ public class ConnectivityActionReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received intent"); if (NetworkUtils.autodownloadNetworkAvailable(context)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "auto-dl network available, starting auto-download"); DBTasks.autodownloadUndownloadedItems(context); @@ -31,7 +31,7 @@ public class ConnectivityActionReceiver extends BroadcastReceiver { .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni == null || ni.getType() != ConnectivityManager.TYPE_WIFI) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.i(TAG, "Device is no longer connected to Wi-Fi. Cancelling ongoing downloads"); DownloadRequester.getInstance().cancelAllDownloads(context); diff --git a/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java b/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java index fdbaa97f0..a7482fbf4 100644 --- a/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java +++ b/src/de/danoeh/antennapod/receiver/FeedUpdateReceiver.java @@ -6,7 +6,7 @@ import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.storage.DBTasks; @@ -18,13 +18,13 @@ public class FeedUpdateReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(ACTION_REFRESH_FEEDS)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received intent"); boolean mobileUpdate = UserPreferences.isAllowMobileUpdate(); if (mobileUpdate || connectedToWifi(context)) { DBTasks.refreshExpiredFeeds(context); } else { - if (AppConfig.DEBUG) + 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 a53ad486a..1edebd275 100644 --- a/src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java +++ b/src/de/danoeh/antennapod/receiver/MediaButtonReceiver.java @@ -5,7 +5,7 @@ import android.content.Context; import android.content.Intent; import android.util.Log; import android.view.KeyEvent; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.service.playback.PlaybackService; /** Receives media button events. */ @@ -17,7 +17,7 @@ public class MediaButtonReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (AppConfig.DEBUG) 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 25bb53475..5748ced3b 100644 --- a/src/de/danoeh/antennapod/receiver/PlayerWidget.java +++ b/src/de/danoeh/antennapod/receiver/PlayerWidget.java @@ -5,7 +5,7 @@ import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.service.playback.PlayerWidgetService; public class PlayerWidget extends AppWidgetProvider { @@ -26,7 +26,7 @@ public class PlayerWidget extends AppWidgetProvider { @Override public void onEnabled(Context context) { super.onEnabled(context); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Widget enabled"); } diff --git a/src/de/danoeh/antennapod/receiver/SPAReceiver.java b/src/de/danoeh/antennapod/receiver/SPAReceiver.java index c378f74e1..b0430d170 100644 --- a/src/de/danoeh/antennapod/receiver/SPAReceiver.java +++ b/src/de/danoeh/antennapod/receiver/SPAReceiver.java @@ -5,7 +5,7 @@ import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.Toast; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.storage.DownloadRequestException; @@ -28,11 +28,11 @@ public class SPAReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { if (StringUtils.equals(intent.getAction(), ACTION_SP_APPS_QUERY_FEEDS_REPSONSE)) { - if (AppConfig.DEBUG) Log.d(TAG, "Received SP_APPS_QUERY_RESPONSE"); + if (BuildConfig.DEBUG) Log.d(TAG, "Received SP_APPS_QUERY_RESPONSE"); if (intent.hasExtra(ACTION_SP_APPS_QUERY_FEEDS_REPSONSE_FEEDS_EXTRA)) { String[] feedUrls = intent.getStringArrayExtra(ACTION_SP_APPS_QUERY_FEEDS_REPSONSE_FEEDS_EXTRA); if (feedUrls != null) { - if (AppConfig.DEBUG) Log.d(TAG, "Received feeds list: " + Arrays.toString(feedUrls)); + if (BuildConfig.DEBUG) Log.d(TAG, "Received feeds list: " + Arrays.toString(feedUrls)); for (String url : feedUrls) { Feed f = new Feed(url, new Date()); try { diff --git a/src/de/danoeh/antennapod/service/GpodnetSyncService.java b/src/de/danoeh/antennapod/service/GpodnetSyncService.java index 71e128b55..4cb0e4cc8 100644 --- a/src/de/danoeh/antennapod/service/GpodnetSyncService.java +++ b/src/de/danoeh/antennapod/service/GpodnetSyncService.java @@ -8,7 +8,7 @@ import android.content.Intent; import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.gpoddernet.GpodnetService; @@ -56,7 +56,7 @@ public class GpodnetSyncService extends Service { @Override public void onDestroy() { super.onDestroy(); - if (AppConfig.DEBUG) Log.d(TAG, "onDestroy"); + if (BuildConfig.DEBUG) Log.d(TAG, "onDestroy"); syncWaiterThread.interrupt(); } @@ -85,14 +85,14 @@ public class GpodnetSyncService extends Service { // first sync: download all subscriptions... GpodnetSubscriptionChange changes = service.getSubscriptionChanges(GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID(), 0); - if (AppConfig.DEBUG) Log.d(TAG, "Downloaded subscription changes: " + changes); + if (BuildConfig.DEBUG) Log.d(TAG, "Downloaded subscription changes: " + changes); processSubscriptionChanges(localSubscriptions, changes); // ... then upload all local subscriptions - if (AppConfig.DEBUG) Log.d(TAG, "Uploading subscription list: " + localSubscriptions); + if (BuildConfig.DEBUG) Log.d(TAG, "Uploading subscription list: " + localSubscriptions); GpodnetUploadChangesResponse uploadChangesResponse = service.uploadChanges(GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID(), localSubscriptions, new LinkedList<String>()); - if (AppConfig.DEBUG) Log.d(TAG, "Uploading changes response: " + uploadChangesResponse); + if (BuildConfig.DEBUG) Log.d(TAG, "Uploading changes response: " + uploadChangesResponse); DBWriter.updateFeedDownloadURLs(GpodnetSyncService.this, uploadChangesResponse.updatedUrls).get(); GpodnetPreferences.removeAddedFeeds(localSubscriptions); GpodnetPreferences.removeRemovedFeeds(GpodnetPreferences.getRemovedFeedsCopy()); @@ -103,14 +103,14 @@ public class GpodnetSyncService extends Service { // download remote changes first... GpodnetSubscriptionChange subscriptionChanges = service.getSubscriptionChanges(GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID(), timestamp); - if (AppConfig.DEBUG) Log.d(TAG, "Downloaded subscription changes: " + subscriptionChanges); + if (BuildConfig.DEBUG) Log.d(TAG, "Downloaded subscription changes: " + subscriptionChanges); processSubscriptionChanges(localSubscriptions, subscriptionChanges); // ... then upload changes local changes - if (AppConfig.DEBUG) Log.d(TAG, String.format("Uploading subscriptions, Added: %s\nRemoved: %s", + if (BuildConfig.DEBUG) Log.d(TAG, String.format("Uploading subscriptions, Added: %s\nRemoved: %s", added.toString(), removed)); GpodnetUploadChangesResponse uploadChangesResponse = service.uploadChanges(GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID(), added, removed); - if (AppConfig.DEBUG) Log.d(TAG, "Upload subscriptions response: " + uploadChangesResponse); + if (BuildConfig.DEBUG) Log.d(TAG, "Upload subscriptions response: " + uploadChangesResponse); GpodnetPreferences.removeAddedFeeds(added); GpodnetPreferences.removeRemovedFeeds(removed); @@ -151,7 +151,7 @@ public class GpodnetSyncService extends Service { } private void updateErrorNotification(GpodnetServiceException exception) { - if (AppConfig.DEBUG) Log.d(TAG, "Posting error notification"); + if (BuildConfig.DEBUG) Log.d(TAG, "Posting error notification"); NotificationCompat.Builder builder = new NotificationCompat.Builder(this); final String title; diff --git a/src/de/danoeh/antennapod/service/download/APRedirectHandler.java b/src/de/danoeh/antennapod/service/download/APRedirectHandler.java index 8a31c9390..ddf8d605d 100644 --- a/src/de/danoeh/antennapod/service/download/APRedirectHandler.java +++ b/src/de/danoeh/antennapod/service/download/APRedirectHandler.java @@ -1,14 +1,13 @@ package de.danoeh.antennapod.service.download; -import java.net.URI; - +import android.util.Log; +import de.danoeh.antennapod.BuildConfig; import org.apache.http.Header; import org.apache.http.HttpResponse; import org.apache.http.impl.client.DefaultRedirectHandler; import org.apache.http.protocol.HttpContext; -import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import java.net.URI; public class APRedirectHandler extends DefaultRedirectHandler { // Identifier for logger @@ -39,12 +38,12 @@ public class APRedirectHandler extends DefaultRedirectHandler { // If anything had to be fixed, then replace the header if (!s.equals(h[0].getValue())) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Original URL: " + h[0].getValue()); response.setHeader(LOC, s); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Fixed URL: " + s); } } diff --git a/src/de/danoeh/antennapod/service/download/AntennapodHttpClient.java b/src/de/danoeh/antennapod/service/download/AntennapodHttpClient.java index 7e1c9178a..7b3f014e8 100644 --- a/src/de/danoeh/antennapod/service/download/AntennapodHttpClient.java +++ b/src/de/danoeh/antennapod/service/download/AntennapodHttpClient.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.service.download; import android.util.Log; import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import org.apache.http.client.HttpClient; import org.apache.http.client.params.HttpClientParams; import org.apache.http.conn.ClientConnectionManager; @@ -42,7 +43,7 @@ public class AntennapodHttpClient { */ public static synchronized HttpClient getHttpClient() { if (httpClient == null) { - if (AppConfig.DEBUG) Log.d(TAG, "Creating new instance of HTTP client"); + if (BuildConfig.DEBUG) Log.d(TAG, "Creating new instance of HTTP client"); HttpParams params = new BasicHttpParams(); params.setParameter(CoreProtocolPNames.USER_AGENT, AppConfig.USER_AGENT); diff --git a/src/de/danoeh/antennapod/service/download/DownloadService.java b/src/de/danoeh/antennapod/service/download/DownloadService.java index d08c4ab6d..72e0852bb 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadService.java +++ b/src/de/danoeh/antennapod/service/download/DownloadService.java @@ -18,7 +18,7 @@ import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.webkit.URLUtil; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.DownloadActivity; import de.danoeh.antennapod.activity.DownloadAuthenticationActivity; @@ -135,11 +135,11 @@ public class DownloadService extends Service { @Override public void run() { - if (AppConfig.DEBUG) Log.d(TAG, "downloadCompletionThread was started"); + if (BuildConfig.DEBUG) Log.d(TAG, "downloadCompletionThread was started"); while (!isInterrupted()) { try { Downloader downloader = downloadExecutor.take().get(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received 'Download Complete' - message."); removeDownload(downloader); DownloadStatus status = downloader.getResult(); @@ -169,13 +169,13 @@ public class DownloadService extends Service { queryDownloadsAsync(); } } catch (InterruptedException e) { - if (AppConfig.DEBUG) Log.d(TAG, "DownloadCompletionThread was interrupted"); + if (BuildConfig.DEBUG) Log.d(TAG, "DownloadCompletionThread was interrupted"); } catch (ExecutionException e) { e.printStackTrace(); numberOfDownloads.decrementAndGet(); } } - if (AppConfig.DEBUG) Log.d(TAG, "End of downloadCompletionThread"); + if (BuildConfig.DEBUG) Log.d(TAG, "End of downloadCompletionThread"); } }; @@ -192,7 +192,7 @@ public class DownloadService extends Service { @SuppressLint("NewApi") @Override public void onCreate() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Service started"); isRunning = true; handler = new Handler(); @@ -256,7 +256,7 @@ public class DownloadService extends Service { @Override public void onDestroy() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Service shutting down"); isRunning = false; updateReport(); @@ -294,7 +294,7 @@ public class DownloadService extends Service { .setLargeIcon(icon) .setSmallIcon(R.drawable.stat_notify_sync); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Notification set up"); } @@ -371,7 +371,7 @@ public class DownloadService extends Service { throw new IllegalArgumentException( "ACTION_CANCEL_DOWNLOAD intent needs download url extra"); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Cancelling download with url " + url); Downloader d = getDownloader(url); if (d != null) { @@ -383,7 +383,7 @@ public class DownloadService extends Service { } else if (intent.getAction().equals(ACTION_CANCEL_ALL_DOWNLOADS)) { for (Downloader d : downloads) { d.cancel(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Cancelled all downloads"); } sendBroadcast(new Intent(ACTION_DOWNLOADS_CONTENT_CHANGED)); @@ -395,7 +395,7 @@ public class DownloadService extends Service { }; private void onDownloadQueued(Intent intent) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received enqueue request"); DownloadRequest request = intent.getParcelableExtra(EXTRA_REQUEST); if (request == null) { @@ -434,11 +434,11 @@ public class DownloadService extends Service { handler.post(new Runnable() { @Override public void run() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Removing downloader: " + d.getDownloadRequest().getSource()); boolean rc = downloads.remove(d); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Result of downloads.remove: " + rc); DownloadRequester.getInstance().removeDownload(d.getDownloadRequest()); sendBroadcast(new Intent(ACTION_DOWNLOADS_CONTENT_CHANGED)); @@ -488,7 +488,7 @@ public class DownloadService extends Service { } if (createReport) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating report"); // create notification object Notification notification = new NotificationCompat.Builder(this) @@ -514,7 +514,7 @@ public class DownloadService extends Service { NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(REPORT_ID, notification); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "No report is created"); } completedDownloads.clear(); @@ -537,12 +537,12 @@ public class DownloadService extends Service { * Check if there's something else to download, otherwise stop */ void queryDownloads() { - if (AppConfig.DEBUG) { + if (BuildConfig.DEBUG) { Log.d(TAG, numberOfDownloads.get() + " downloads left"); } if (numberOfDownloads.get() <= 0 && DownloadRequester.getInstance().hasNoDownloads()) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Number of downloads is " + numberOfDownloads.get() + ", attempting shutdown"); stopSelf(); } else { @@ -584,7 +584,7 @@ public class DownloadService extends Service { * Is called whenever a Feed is downloaded */ private void handleCompletedFeedDownload(DownloadRequest request) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed Feed Download"); syncExecutor.execute(new FeedSyncThread(request)); @@ -594,7 +594,7 @@ public class DownloadService extends Service { * Is called whenever a Feed-Image is downloaded */ private void handleCompletedImageDownload(DownloadStatus status, DownloadRequest request) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed Image Download"); syncExecutor.execute(new ImageHandlerThread(status, request)); } @@ -603,7 +603,7 @@ public class DownloadService extends Service { * Is called whenever a FeedMedia is downloaded. */ private void handleCompletedFeedMediaDownload(DownloadStatus status, DownloadRequest request) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed FeedMedia Download"); syncExecutor.execute(new MediaHandlerThread(status, request)); } @@ -643,7 +643,7 @@ public class DownloadService extends Service { try { feed = feedHandler.parseFeed(feed); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, feed.getTitle() + " parsed"); if (checkFeedData(feed) == false) { throw new InvalidFeedException(); @@ -656,7 +656,7 @@ public class DownloadService extends Service { // Download Feed Image if provided and not downloaded if (savedFeed.getImage() != null && savedFeed.getImage().isDownloaded() == false) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Feed has image; Downloading...."); savedFeed.getImage().setOwner(savedFeed); final Feed savedFeedRef = savedFeed; @@ -681,7 +681,7 @@ public class DownloadService extends Service { // download FeedItem images if provided and not downloaded for (FeedItem item : savedFeed.getItems()) { if (item.hasItemImage() && (!item.getImage().isDownloaded())) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Item has image; Downloading...."); try { requester.downloadImage(DownloadService.this, @@ -756,7 +756,7 @@ public class DownloadService extends Service { Log.e(TAG, "Feed has invalid items"); return false; } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Feed appears to be valid."); return true; } @@ -805,12 +805,12 @@ public class DownloadService extends Service { private void cleanup(Feed feed) { if (feed.getFile_url() != null) { if (new File(feed.getFile_url()).delete()) - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Successfully deleted cache file."); else Log.e(TAG, "Failed to delete cache file."); feed.setFile_url(null); - } else if (AppConfig.DEBUG) { + } else if (BuildConfig.DEBUG) { Log.d(TAG, "Didn't delete cache file: File url is not set."); } } @@ -893,7 +893,7 @@ public class DownloadService extends Service { mmr.setDataSource(media.getFile_url()); String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); media.setDuration(Integer.parseInt(durationStr)); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Duration of file is " + media.getDuration()); } catch (NumberFormatException e) { e.printStackTrace(); @@ -940,7 +940,7 @@ public class DownloadService extends Service { * Schedules the notification updater task if it hasn't been scheduled yet. */ private void setupNotificationUpdater() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Setting up notification updater"); if (notificationUpdater == null) { notificationUpdater = new NotificationUpdater(); diff --git a/src/de/danoeh/antennapod/service/download/DownloadStatus.java b/src/de/danoeh/antennapod/service/download/DownloadStatus.java index 487c3b3de..b240cddbc 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadStatus.java +++ b/src/de/danoeh/antennapod/service/download/DownloadStatus.java @@ -1,10 +1,10 @@ package de.danoeh.antennapod.service.download; -import java.util.Date; - import de.danoeh.antennapod.feed.FeedFile; import de.danoeh.antennapod.util.DownloadError; +import java.util.Date; + /** Contains status attributes for one download */ public class DownloadStatus { /** diff --git a/src/de/danoeh/antennapod/service/download/HttpDownloader.java b/src/de/danoeh/antennapod/service/download/HttpDownloader.java index 6c685b2d5..84bafb027 100644 --- a/src/de/danoeh/antennapod/service/download/HttpDownloader.java +++ b/src/de/danoeh/antennapod/service/download/HttpDownloader.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.service.download; import android.net.http.AndroidHttpClient; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.FeedImage; @@ -20,7 +20,9 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.auth.BasicScheme; import java.io.*; -import java.net.*; +import java.net.HttpURLConnection; +import java.net.SocketTimeoutException; +import java.net.UnknownHostException; public class HttpDownloader extends Downloader { private static final String TAG = "HttpDownloader"; @@ -70,7 +72,7 @@ public class HttpDownloader extends Downloader { final boolean isGzip = contentEncodingHeader != null && contentEncodingHeader.getValue().equalsIgnoreCase("gzip"); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Response code is " + responseCode); if (responseCode != HttpURLConnection.HTTP_OK || httpEntity == null) { @@ -99,17 +101,17 @@ public class HttpDownloader extends Downloader { byte[] buffer = new byte[BUFFER_SIZE]; int count = 0; request.setStatusMsg(R.string.download_running); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Getting size of download"); request.setSize(httpEntity.getContentLength()); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Size is " + request.getSize()); if (request.getSize() < 0) { request.setSize(DownloadStatus.SIZE_UNKNOWN); } long freeSpace = StorageUtils.getFreeSpaceAvailable(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Free space is " + freeSpace); if (request.getSize() != DownloadStatus.SIZE_UNKNOWN @@ -118,7 +120,7 @@ public class HttpDownloader extends Downloader { return; } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting download"); while (!cancelled && (count = connection.read(buffer)) != -1) { @@ -170,13 +172,13 @@ public class HttpDownloader extends Downloader { } private void onSuccess() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Download was successful"); result.setSuccessful(); } private void onFail(DownloadError reason, String reasonDetailed) { - if (AppConfig.DEBUG) { + if (BuildConfig.DEBUG) { Log.d(TAG, "Download failed"); } result.setFailed(reason, reasonDetailed); @@ -184,7 +186,7 @@ public class HttpDownloader extends Downloader { } private void onCancelled() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Download was cancelled"); result.setCancelled(); cleanup(); @@ -198,11 +200,11 @@ public class HttpDownloader extends Downloader { File dest = new File(request.getDestination()); if (dest.exists()) { boolean rc = dest.delete(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Deleted file " + dest.getName() + "; Result: " + rc); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "cleanup() didn't delete file: does not exist."); } } diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackService.java b/src/de/danoeh/antennapod/service/playback/PlaybackService.java index 14b249262..fb2569bfd 100644 --- a/src/de/danoeh/antennapod/service/playback/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/playback/PlaybackService.java @@ -22,7 +22,7 @@ import android.util.Log; import android.util.Pair; import android.view.KeyEvent; import android.view.SurfaceHolder; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.AudioplayerActivity; @@ -153,7 +153,7 @@ public class PlaybackService extends Service { @Override public boolean onUnbind(Intent intent) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received onUnbind event"); return super.onUnbind(intent); } @@ -196,7 +196,7 @@ public class PlaybackService extends Service { @Override public void onCreate() { super.onCreate(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Service created."); isRunning = true; @@ -218,7 +218,7 @@ public class PlaybackService extends Service { @Override public void onDestroy() { super.onDestroy(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Service is about to be destroyed"); isRunning = false; started = false; @@ -234,7 +234,7 @@ public class PlaybackService extends Service { @Override public IBinder onBind(Intent intent) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received onBind event"); return mBinder; } @@ -243,7 +243,7 @@ public class PlaybackService extends Service { public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "OnStartCommand called"); final int keycode = intent.getIntExtra(MediaButtonReceiver.EXTRA_KEYCODE, -1); final Playable playable = intent.getParcelableExtra(EXTRA_PLAYABLE); @@ -253,12 +253,12 @@ public class PlaybackService extends Service { } if ((flags & Service.START_FLAG_REDELIVERY) != 0) { - if (AppConfig.DEBUG) Log.d(TAG, "onStartCommand is a redelivered intent, calling stopForeground now."); + if (BuildConfig.DEBUG) Log.d(TAG, "onStartCommand is a redelivered intent, calling stopForeground now."); stopForeground(true); } else { if (keycode != -1) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received media button event"); handleKeycode(keycode); } else { @@ -279,7 +279,7 @@ public class PlaybackService extends Service { * Handles media button events */ private void handleKeycode(int keycode) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Handling keycode: " + keycode); final PlayerStatus status = mediaPlayer.getPSMPInfo().playerStatus; @@ -326,7 +326,7 @@ public class PlaybackService extends Service { * mediaplayer. */ public void setVideoSurface(SurfaceHolder sh) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Setting display"); mediaPlayer.setVideoSurface(sh); } @@ -394,9 +394,9 @@ public class PlaybackService extends Service { break; case PLAYING: - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Audiofocus successfully requested"); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Resuming/Starting playback"); taskManager.startPositionSaver(); @@ -472,7 +472,7 @@ public class PlaybackService extends Service { }; private void endPlayback(boolean playNextEpisode) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Playback ended"); final Playable media = mediaPlayer.getPSMPInfo().playable; @@ -512,7 +512,7 @@ public class PlaybackService extends Service { playNextEpisode = playNextEpisode && loadNextItem && UserPreferences.isFollowQueue(); if (loadNextItem) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading next item in queue"); nextMedia = nextItem.getMedia(); } @@ -521,11 +521,11 @@ public class PlaybackService extends Service { final boolean stream; if (playNextEpisode) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Playback of next episode will start immediately."); prepareImmediately = startWhenPrepared = true; } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "No more episodes available to play"); prepareImmediately = startWhenPrepared = false; @@ -546,7 +546,7 @@ public class PlaybackService extends Service { } public void setSleepTimer(long waitingTime) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Setting sleep timer to " + Long.toString(waitingTime) + " milliseconds"); taskManager.setSleepTimer(waitingTime); @@ -573,7 +573,7 @@ public class PlaybackService extends Service { private void writePlaybackPreferences() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Writing playback preferences"); SharedPreferences.Editor editor = PreferenceManager @@ -657,7 +657,7 @@ public class PlaybackService extends Service { @Override protected Void doInBackground(Void... params) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting background work"); if (android.os.Build.VERSION.SDK_INT >= 11) { if (info.playable != null) { @@ -717,7 +717,7 @@ public class PlaybackService extends Service { notification = notificationBuilder.getNotification(); } startForeground(NOTIFICATION_ID, notification); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Notification set up"); } } @@ -744,7 +744,7 @@ public class PlaybackService extends Service { float playbackSpeed = getCurrentPlaybackSpeed(); final Playable playable = mediaPlayer.getPSMPInfo().playable; if (position != INVALID_TIME && duration != INVALID_TIME && playable != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Saving current position to " + position); if (updatePlayedDuration && playable instanceof FeedMedia) { FeedMedia m = (FeedMedia) playable; @@ -754,7 +754,7 @@ public class PlaybackService extends Service { if (FlattrUtils.hasToken() && UserPreferences.isAutoFlattr() && item.getPaymentLink() != null && item.getFlattrStatus().getUnflattred() && (m.getPlayedDuration() > UserPreferences.getPlayedDurationAutoflattrThreshold() * duration)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "saveCurrentPosition: performing auto flattr since played duration " + Integer.toString(m.getPlayedDuration()) + " is " + UserPreferences.getPlayedDurationAutoflattrThreshold() * 100 + "% of file duration " + Integer.toString(duration)); item.getFlattrStatus().setFlattrQueue(); @@ -848,7 +848,7 @@ public class PlaybackService extends Service { editor.apply(); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "RemoteControlClient state was refreshed"); } } @@ -892,10 +892,10 @@ public class PlaybackService extends Service { intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) { int state = intent.getIntExtra("state", -1); if (state != -1) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Headset plug event. State is " + state); if (state == UNPLUGGED) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Headset was unplugged during playback."); pauseIfPauseOnDisconnect(); } @@ -911,7 +911,7 @@ public class PlaybackService extends Service { @Override public void onReceive(Context context, Intent intent) { // sound is about to change, eg. bluetooth -> speaker - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Pausing playback because audio is becoming noisy"); pauseIfPauseOnDisconnect(); } @@ -944,7 +944,7 @@ public class PlaybackService extends Service { public void onReceive(Context context, Intent intent) { if (intent.getAction() != null && intent.getAction().equals(ACTION_SKIP_CURRENT_EPISODE)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received SKIP_CURRENT_EPISODE intent"); mediaPlayer.endPlayback(); } diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java b/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java index 89be5e5ee..82759a902 100644 --- a/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java +++ b/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java @@ -7,7 +7,7 @@ import android.media.RemoteControlClient; import android.util.Log; import android.util.Pair; import android.view.SurfaceHolder; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.feed.MediaType; import de.danoeh.antennapod.preferences.UserPreferences; @@ -75,7 +75,7 @@ public class PlaybackServiceMediaPlayer { new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { - if (AppConfig.DEBUG) Log.d(TAG, "Rejected execution of runnable"); + if (BuildConfig.DEBUG) Log.d(TAG, "Rejected execution of runnable"); } }); @@ -116,7 +116,7 @@ public class PlaybackServiceMediaPlayer { public void playMediaObject(final Playable playable, final boolean stream, final boolean startWhenPrepared, final boolean prepareImmediately) { if (playable == null) throw new IllegalArgumentException("playable = null"); - if (AppConfig.DEBUG) Log.d(TAG, "Play media object."); + if (BuildConfig.DEBUG) Log.d(TAG, "Play media object."); executor.submit(new Runnable() { @Override public void run() { @@ -245,10 +245,10 @@ public class PlaybackServiceMediaPlayer { media.onPlaybackStart(); } else { - if (AppConfig.DEBUG) Log.e(TAG, "Failed to request audio focus"); + if (BuildConfig.DEBUG) Log.e(TAG, "Failed to request audio focus"); } } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Call to resume() was ignored because current state of PSMP object is " + playerStatus); } } @@ -271,7 +271,7 @@ public class PlaybackServiceMediaPlayer { playerLock.lock(); if (playerStatus == PlayerStatus.PLAYING) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Pausing playback."); mediaPlayer.pause(); setPlayerStatus(PlayerStatus.PAUSED, media); @@ -284,7 +284,7 @@ public class PlaybackServiceMediaPlayer { reinit(); } } else { - if (AppConfig.DEBUG) Log.d(TAG, "Ignoring call to pause: Player is in " + playerStatus + " state"); + if (BuildConfig.DEBUG) Log.d(TAG, "Ignoring call to pause: Player is in " + playerStatus + " state"); } playerLock.unlock(); @@ -305,7 +305,7 @@ public class PlaybackServiceMediaPlayer { playerLock.lock(); if (playerStatus == PlayerStatus.INITIALIZED) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Preparing media player"); setPlayerStatus(PlayerStatus.PREPARING, media); try { @@ -333,7 +333,7 @@ public class PlaybackServiceMediaPlayer { throw new IllegalStateException("Player is not in PREPARING state"); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Resource prepared"); if (mediaType == MediaType.VIDEO) { @@ -346,7 +346,7 @@ public class PlaybackServiceMediaPlayer { } if (media.getDuration() == 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Setting duration of media"); media.setDuration(mediaPlayer.getDuration()); } @@ -375,7 +375,7 @@ public class PlaybackServiceMediaPlayer { } else if (mediaPlayer != null) { mediaPlayer.reset(); } else { - if (AppConfig.DEBUG) Log.d(TAG, "Call to reinit was ignored: media and mediaPlayer were null"); + if (BuildConfig.DEBUG) Log.d(TAG, "Call to reinit was ignored: media and mediaPlayer were null"); } playerLock.unlock(); } @@ -534,7 +534,7 @@ public class PlaybackServiceMediaPlayer { if (media != null && media.getMediaType() == MediaType.AUDIO) { if (mediaPlayer.canSetSpeed()) { mediaPlayer.setPlaybackSpeed((float) speed); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Playback speed was set to " + speed); callback.playbackSpeedChanged(speed); } @@ -610,7 +610,7 @@ public class PlaybackServiceMediaPlayer { @Override public void run() { playerLock.lock(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Resetting video surface"); mediaPlayer.setDisplay(null); reinit(); @@ -665,7 +665,7 @@ public class PlaybackServiceMediaPlayer { private synchronized void setPlayerStatus(PlayerStatus newStatus, Playable newMedia) { if (newStatus == null) throw new IllegalArgumentException("newStatus = null"); - if (AppConfig.DEBUG) Log.d(TAG, "Setting player status to " + newStatus); + if (BuildConfig.DEBUG) Log.d(TAG, "Setting player status to " + newStatus); this.playerStatus = newStatus; this.media = newMedia; @@ -696,13 +696,13 @@ public class PlaybackServiceMediaPlayer { switch (focusChange) { case AudioManager.AUDIOFOCUS_LOSS: - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus"); pause(true, false); callback.shouldStop(); break; case AudioManager.AUDIOFOCUS_GAIN: - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Gained audio focus"); if (pausedBecauseOfTransientAudiofocusLoss) // we paused => play now resume(); @@ -713,13 +713,13 @@ public class PlaybackServiceMediaPlayer { case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK: if (playerStatus == PlayerStatus.PLAYING) { if (!UserPreferences.shouldPauseForFocusLoss()) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Ducking..."); audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, 0); pausedBecauseOfTransientAudiofocusLoss = false; } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Could duck, but won't, pausing..."); pause(false, false); pausedBecauseOfTransientAudiofocusLoss = true; @@ -728,7 +728,7 @@ public class PlaybackServiceMediaPlayer { break; case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: if (playerStatus == PlayerStatus.PLAYING) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Pausing..."); pause(false, false); pausedBecauseOfTransientAudiofocusLoss = true; diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java b/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java index 0c1878e18..3ab06910a 100644 --- a/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java +++ b/src/de/danoeh/antennapod/service/playback/PlaybackServiceTaskManager.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.service.playback; import android.content.Context; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.EventDistributor; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.storage.DBReader; @@ -144,9 +144,9 @@ public class PlaybackServiceTaskManager { positionSaverFuture = schedExecutor.scheduleWithFixedDelay(positionSaver, POSITION_SAVER_WAITING_INTERVAL, POSITION_SAVER_WAITING_INTERVAL, TimeUnit.MILLISECONDS); - if (AppConfig.DEBUG) Log.d(TAG, "Started PositionSaver"); + if (BuildConfig.DEBUG) Log.d(TAG, "Started PositionSaver"); } else { - if (AppConfig.DEBUG) Log.d(TAG, "Call to startPositionSaver was ignored."); + if (BuildConfig.DEBUG) Log.d(TAG, "Call to startPositionSaver was ignored."); } } @@ -163,7 +163,7 @@ public class PlaybackServiceTaskManager { public synchronized void cancelPositionSaver() { if (isPositionSaverActive()) { positionSaverFuture.cancel(false); - if (AppConfig.DEBUG) Log.d(TAG, "Cancelled PositionSaver"); + if (BuildConfig.DEBUG) Log.d(TAG, "Cancelled PositionSaver"); } } @@ -181,9 +181,9 @@ public class PlaybackServiceTaskManager { widgetUpdaterFuture = schedExecutor.scheduleWithFixedDelay(widgetUpdater, WIDGET_UPDATER_NOTIFICATION_INTERVAL, WIDGET_UPDATER_NOTIFICATION_INTERVAL, TimeUnit.MILLISECONDS); - if (AppConfig.DEBUG) Log.d(TAG, "Started WidgetUpdater"); + if (BuildConfig.DEBUG) Log.d(TAG, "Started WidgetUpdater"); } else { - if (AppConfig.DEBUG) Log.d(TAG, "Call to startWidgetUpdater was ignored."); + if (BuildConfig.DEBUG) Log.d(TAG, "Call to startWidgetUpdater was ignored."); } } @@ -198,7 +198,7 @@ public class PlaybackServiceTaskManager { if (waitingTime <= 0) throw new IllegalArgumentException("waitingTime <= 0"); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Setting sleep timer to " + Long.toString(waitingTime) + " milliseconds"); if (isSleepTimerActive()) { @@ -220,7 +220,7 @@ public class PlaybackServiceTaskManager { */ public synchronized void disableSleepTimer() { if (isSleepTimerActive()) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Disabling sleep timer"); sleepTimerFuture.cancel(true); } @@ -251,7 +251,7 @@ public class PlaybackServiceTaskManager { public synchronized void cancelWidgetUpdater() { if (isWidgetUpdaterActive()) { widgetUpdaterFuture.cancel(false); - if (AppConfig.DEBUG) Log.d(TAG, "Cancelled WidgetUpdater"); + if (BuildConfig.DEBUG) Log.d(TAG, "Cancelled WidgetUpdater"); } } @@ -281,7 +281,7 @@ public class PlaybackServiceTaskManager { Runnable chapterLoader = new Runnable() { @Override public void run() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Chapter loader started"); if (media.getChapters() == null) { media.loadChapterMarks(); @@ -289,7 +289,7 @@ public class PlaybackServiceTaskManager { callback.onChapterLoaded(media); } } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Chapter loader stopped"); } }; @@ -335,7 +335,7 @@ public class PlaybackServiceTaskManager { @Override public void run() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting"); while (waitingTime > 0) { try { @@ -343,7 +343,7 @@ public class PlaybackServiceTaskManager { waitingTime -= UPDATE_INTERVALL; if (waitingTime <= 0) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Waiting completed"); postExecute(); if (!Thread.currentThread().isInterrupted()) { diff --git a/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java b/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java index 90ad7a9fa..71bc40c2a 100644 --- a/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java +++ b/src/de/danoeh/antennapod/service/playback/PlayerWidgetService.java @@ -12,7 +12,7 @@ import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.RemoteViews; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.receiver.MediaButtonReceiver; import de.danoeh.antennapod.receiver.PlayerWidget; @@ -33,7 +33,7 @@ public class PlayerWidgetService extends Service { @Override public void onCreate() { super.onCreate(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Service created"); isUpdating = false; } @@ -41,7 +41,7 @@ public class PlayerWidgetService extends Service { @Override public void onDestroy() { super.onDestroy(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Service is about to be destroyed"); try { unbindService(mConnection); @@ -65,7 +65,7 @@ public class PlayerWidgetService extends Service { startViewUpdaterIfNotRunning(); } } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Service was called while updating. Ignoring update request"); } @@ -146,7 +146,7 @@ public class PlayerWidgetService extends Service { private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Connection to service established"); playbackService = ((PlaybackService.LocalBinder) service) .getService(); @@ -156,7 +156,7 @@ public class PlayerWidgetService extends Service { @Override public void onServiceDisconnected(ComponentName name) { playbackService = null; - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Disconnected from service"); } diff --git a/src/de/danoeh/antennapod/spa/SPAUtil.java b/src/de/danoeh/antennapod/spa/SPAUtil.java index 7720f7064..0d83741ed 100644 --- a/src/de/danoeh/antennapod/spa/SPAUtil.java +++ b/src/de/danoeh/antennapod/spa/SPAUtil.java @@ -5,7 +5,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.receiver.SPAReceiver; /** @@ -39,7 +39,7 @@ public class SPAUtil { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext); if (!prefs.getBoolean(PREF_HAS_QUERIED_SP_APPS, false)) { appContext.sendBroadcast(new Intent(SPAReceiver.ACTION_SP_APPS_QUERY_FEEDS)); - if (AppConfig.DEBUG) Log.d(TAG, "Sending SP_APPS_QUERY_FEEDS intent"); + if (BuildConfig.DEBUG) Log.d(TAG, "Sending SP_APPS_QUERY_FEEDS intent"); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(PREF_HAS_QUERIED_SP_APPS, true); @@ -55,7 +55,7 @@ public class SPAUtil { * Resets all preferences created by this class. Should only be used for debug purposes. */ public static void resetSPAPreferences(Context c) { - if (AppConfig.DEBUG) { + if (BuildConfig.DEBUG) { if (c == null) throw new IllegalArgumentException("c = null"); SharedPreferences.Editor editor = PreferenceManager .getDefaultSharedPreferences(c.getApplicationContext()).edit(); diff --git a/src/de/danoeh/antennapod/storage/DBReader.java b/src/de/danoeh/antennapod/storage/DBReader.java index 2ebb8f719..8d4785bd4 100644 --- a/src/de/danoeh/antennapod/storage/DBReader.java +++ b/src/de/danoeh/antennapod/storage/DBReader.java @@ -4,15 +4,15 @@ import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.*; import de.danoeh.antennapod.service.download.DownloadStatus; import de.danoeh.antennapod.util.DownloadError; import de.danoeh.antennapod.util.comparator.DownloadStatusComparator; import de.danoeh.antennapod.util.comparator.FeedItemPubdateComparator; +import de.danoeh.antennapod.util.comparator.PlaybackCompletionDateComparator; import de.danoeh.antennapod.util.flattr.FlattrStatus; import de.danoeh.antennapod.util.flattr.FlattrThing; -import de.danoeh.antennapod.util.comparator.PlaybackCompletionDateComparator; import java.util.ArrayList; import java.util.Collections; @@ -51,7 +51,7 @@ public final class DBReader { * can be loaded separately with {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.feed.Feed)}. */ public static List<Feed> getFeedList(final Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Extracting Feedlist"); PodDBAdapter adapter = new PodDBAdapter(context); @@ -103,7 +103,7 @@ public final class DBReader { * can be loaded separately with {@link #getFeedItemList(android.content.Context, de.danoeh.antennapod.feed.Feed)}. */ public static List<Feed> getExpiredFeedsList(final Context context, final long expirationTime) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, String.format("getExpiredFeedsList(%d)", expirationTime)); PodDBAdapter adapter = new PodDBAdapter(context); @@ -157,7 +157,7 @@ public final class DBReader { */ public static List<FeedItem> getFeedItemList(Context context, final Feed feed) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle()); PodDBAdapter adapter = new PodDBAdapter(context); @@ -368,7 +368,7 @@ public final class DBReader { } static List<FeedItem> getQueue(Context context, PodDBAdapter adapter) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Extracting queue"); Cursor itemlistCursor = adapter.getQueueCursor(); @@ -421,7 +421,7 @@ public final class DBReader { * list in a {@link de.danoeh.antennapod.util.QueueAccess} object for easier access to the queue's properties. */ public static List<FeedItem> getQueue(Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Extracting queue"); PodDBAdapter adapter = new PodDBAdapter(context); @@ -438,7 +438,7 @@ public final class DBReader { * @return A list of FeedItems whose episdoe has been downloaded. */ public static List<FeedItem> getDownloadedItems(Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Extracting downloaded items"); PodDBAdapter adapter = new PodDBAdapter(context); @@ -464,7 +464,7 @@ public final class DBReader { * consider using {@link #getUnreadItemIds(android.content.Context)} instead. */ public static List<FeedItem> getUnreadItemsList(Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Extracting unread items list"); PodDBAdapter adapter = new PodDBAdapter(context); @@ -513,7 +513,7 @@ public final class DBReader { * The size of the returned list is limited by {@link #PLAYBACK_HISTORY_SIZE}. */ public static List<FeedItem> getPlaybackHistory(final Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading playback history"); final int PLAYBACK_HISTORY_SIZE = 50; @@ -544,7 +544,7 @@ public final class DBReader { * The size of the returned list is limited by {@link #DOWNLOAD_LOG_SIZE}. */ public static List<DownloadStatus> getDownloadLog(Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Extracting DownloadLog"); PodDBAdapter adapter = new PodDBAdapter(context); @@ -619,7 +619,7 @@ public final class DBReader { * database and the items-attribute will be set correctly. */ public static Feed getFeed(final Context context, final long feedId) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading feed with id " + feedId); Feed feed = null; @@ -638,7 +638,7 @@ public final class DBReader { } static FeedItem getFeedItem(final Context context, final long itemId, PodDBAdapter adapter) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading feeditem with id " + itemId); FeedItem item = null; @@ -663,7 +663,7 @@ public final class DBReader { * also be loaded from the database. */ public static FeedItem getFeedItem(final Context context, final long itemId) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Loading feeditem with id " + itemId); PodDBAdapter adapter = new PodDBAdapter(context); diff --git a/src/de/danoeh/antennapod/storage/DBTasks.java b/src/de/danoeh/antennapod/storage/DBTasks.java index f221c61b6..92efeea62 100644 --- a/src/de/danoeh/antennapod/storage/DBTasks.java +++ b/src/de/danoeh/antennapod/storage/DBTasks.java @@ -4,7 +4,7 @@ import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.asynctask.FlattrClickWorker; import de.danoeh.antennapod.asynctask.FlattrStatusFetcher; import de.danoeh.antennapod.feed.*; @@ -155,10 +155,10 @@ public final class DBTasks { isRefreshing.set(false); if (FlattrUtils.hasToken()) { - if (AppConfig.DEBUG) Log.d(TAG, "Flattring all pending things."); + if (BuildConfig.DEBUG) Log.d(TAG, "Flattring all pending things."); new FlattrClickWorker(context, FlattrClickWorker.FLATTR_NOTIFICATION).executeAsync(); // flattr pending things - if (AppConfig.DEBUG) Log.d(TAG, "Fetching flattr status."); + if (BuildConfig.DEBUG) Log.d(TAG, "Fetching flattr status."); new FlattrStatusFetcher(context).start(); } @@ -167,7 +167,7 @@ public final class DBTasks { } }.start(); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Ignoring request to refresh all feeds: Refresh lock is locked"); } @@ -205,7 +205,7 @@ public final class DBTasks { * @param context Used for DB access. */ public static void refreshExpiredFeeds(final Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Refreshing expired feeds"); new Thread() { @@ -388,7 +388,7 @@ public final class DBTasks { return autodownloadExec.submit(new Runnable() { @Override public void run() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Performing auto-dl of undownloaded episodes"); if (NetworkUtils.autodownloadNetworkAvailable(context) && UserPreferences.isEnableAutodownload()) { @@ -442,7 +442,7 @@ public final class DBTasks { } } } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Enqueueing " + itemsToDownload.size() + " items for download"); @@ -537,7 +537,7 @@ public final class DBTasks { int counter = delete.size(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, String.format( "Auto-delete deleted %d episodes (%d requested)", counter, episodeNumber)); @@ -635,7 +635,7 @@ public final class DBTasks { final Feed savedFeed = searchFeedByIdentifyingValue(context, newFeed.getIdentifyingValue()); if (savedFeed == null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Found no existing Feed with title " + newFeed.getTitle() + ". Adding as new one."); @@ -649,20 +649,20 @@ public final class DBTasks { } return newFeed; } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Feed with title " + newFeed.getTitle() + " already exists. Syncing new with existing one."); Collections.sort(newFeed.getItems(), new FeedItemPubdateComparator()); savedFeed.setItems(DBReader.getFeedItemList(context, savedFeed)); if (savedFeed.compareWithOther(newFeed)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Feed has updated attribute values. Updating old feed's attributes"); savedFeed.updateFromOther(newFeed); } if (savedFeed.getPreferences().compareWithOther(newFeed.getPreferences())) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Feed has updated preferences. Updating old feed's preferences"); savedFeed.getPreferences().updateFromOther(newFeed.getPreferences()); } diff --git a/src/de/danoeh/antennapod/storage/DBWriter.java b/src/de/danoeh/antennapod/storage/DBWriter.java index 9699230c7..c1ce9da36 100644 --- a/src/de/danoeh/antennapod/storage/DBWriter.java +++ b/src/de/danoeh/antennapod/storage/DBWriter.java @@ -6,7 +6,7 @@ import android.content.SharedPreferences; import android.database.Cursor; import android.preference.PreferenceManager; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.asynctask.FlattrClickWorker; import de.danoeh.antennapod.feed.*; import de.danoeh.antennapod.preferences.GpodnetPreferences; @@ -110,7 +110,7 @@ public class DBWriter { } } } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Deleting File. Result: " + result); EventDistributor.getInstance().sendQueueUpdateBroadcast(); EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); @@ -235,7 +235,7 @@ public class DBWriter { return dbExec.submit(new Runnable() { @Override public void run() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Adding new item to playback history"); media.setPlaybackCompletionDate(new Date()); // reset played_duration to 0 so that it behaves correctly when the episode is played again @@ -254,7 +254,7 @@ public class DBWriter { private static void cleanupDownloadLog(final PodDBAdapter adapter) { final long logSize = adapter.getDownloadLogSize(); if (logSize > DBReader.DOWNLOAD_LOG_SIZE) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Cleaning up download log"); adapter.removeDownloadLogItems(logSize - DBReader.DOWNLOAD_LOG_SIZE); } @@ -807,7 +807,7 @@ public class DBWriter { PodDBAdapter adapter = new PodDBAdapter(context); adapter.open(); for (String key : urls.keySet()) { - if (AppConfig.DEBUG) Log.d(TAG, "Replacing URL " + key + " with url " + urls.get(key)); + if (BuildConfig.DEBUG) Log.d(TAG, "Replacing URL " + key + " with url " + urls.get(key)); adapter.setFeedDownloadUrl(key, urls.get(key)); } diff --git a/src/de/danoeh/antennapod/storage/DownloadRequester.java b/src/de/danoeh/antennapod/storage/DownloadRequester.java index 357f44faa..0a1747253 100644 --- a/src/de/danoeh/antennapod/storage/DownloadRequester.java +++ b/src/de/danoeh/antennapod/storage/DownloadRequester.java @@ -4,7 +4,7 @@ import android.content.Context; import android.content.Intent; import android.util.Log; import android.webkit.URLUtil; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.*; import de.danoeh.antennapod.preferences.UserPreferences; import de.danoeh.antennapod.service.download.DownloadRequest; @@ -59,7 +59,7 @@ public class DownloadRequester { if (context == null) throw new IllegalArgumentException("context = null"); if (request == null) throw new IllegalArgumentException("request = null"); if (downloads.containsKey(request.getSource())) { - if (AppConfig.DEBUG) Log.i(TAG, "DownloadRequest is already stored."); + if (BuildConfig.DEBUG) Log.i(TAG, "DownloadRequest is already stored."); return false; } downloads.put(request.getSource(), request); @@ -75,11 +75,11 @@ public class DownloadRequester { boolean overwriteIfExists, String username, String password) { if (!isDownloadingFile(item)) { if (!isFilenameAvailable(dest.toString()) || dest.exists()) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Filename already used."); if (isFilenameAvailable(dest.toString()) && overwriteIfExists) { boolean result = dest.delete(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Deleting file. Result: " + result); } else { // find different name @@ -91,12 +91,12 @@ public class DownloadRequester { + i + FilenameUtils.EXTENSION_SEPARATOR + FilenameUtils.getExtension(dest.getName()); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Testing filename " + newName); newDest = new File(dest.getParent(), newName); if (!newDest.exists() && isFilenameAvailable(newDest.toString())) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "File doesn't exist yet. Using " + newName); break; @@ -107,7 +107,7 @@ public class DownloadRequester { } } } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Requesting download of url " + item.getDownload_url()); item.setDownload_url(URLChecker.prepareURL(item.getDownload_url())); @@ -131,13 +131,13 @@ public class DownloadRequester { for (String key : downloads.keySet()) { DownloadRequest r = downloads.get(key); if (StringUtils.equals(r.getDestination(), path)) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, path + " is already used by another requested download"); return false; } } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, path + " is available as a download destination"); return true; } @@ -198,7 +198,7 @@ public class DownloadRequester { * Cancels a running download. */ public void cancelDownload(final Context context, final String downloadUrl) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Cancelling download with url " + downloadUrl); Intent cancelIntent = new Intent(DownloadService.ACTION_CANCEL_DOWNLOAD); cancelIntent.putExtra(DownloadService.EXTRA_DOWNLOAD_URL, downloadUrl); @@ -209,7 +209,7 @@ public class DownloadRequester { * Cancels all running downloads */ public void cancelAllDownloads(Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Cancelling all running downloads"); context.sendBroadcast(new Intent( DownloadService.ACTION_CANCEL_ALL_DOWNLOADS)); diff --git a/src/de/danoeh/antennapod/storage/PodDBAdapter.java b/src/de/danoeh/antennapod/storage/PodDBAdapter.java index d62986187..825b5ac30 100644 --- a/src/de/danoeh/antennapod/storage/PodDBAdapter.java +++ b/src/de/danoeh/antennapod/storage/PodDBAdapter.java @@ -10,7 +10,7 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.*; import de.danoeh.antennapod.service.download.DownloadStatus; import de.danoeh.antennapod.util.flattr.FlattrStatus; @@ -321,7 +321,7 @@ public class PodDBAdapter { public PodDBAdapter open() { if (db == null || !db.isOpen() || db.isReadOnly()) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Opening DB"); try { db = helper.getWritableDatabase(); @@ -334,7 +334,7 @@ public class PodDBAdapter { } public void close() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Closing DB"); //db.close(); } @@ -378,11 +378,11 @@ public class PodDBAdapter { values.put(KEY_FLATTR_STATUS, feed.getFlattrStatus().toLong()); if (feed.getId() == 0) { // Create new entry - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(this.toString(), "Inserting new Feed into db"); feed.setId(db.insert(TABLE_NAME_FEEDS, null, values)); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(this.toString(), "Updating existing Feed in db"); db.update(TABLE_NAME_FEEDS, values, KEY_ID + "=?", new String[]{String.valueOf(feed.getId())}); diff --git a/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java b/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java index 9b25d16c4..5576603b6 100644 --- a/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java +++ b/src/de/danoeh/antennapod/syndication/handler/FeedHandler.java @@ -1,18 +1,16 @@ package de.danoeh.antennapod.syndication.handler; -import java.io.File; -import java.io.IOException; -import java.io.Reader; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - +import de.danoeh.antennapod.feed.Feed; import org.apache.commons.io.input.XmlStreamReader; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import de.danoeh.antennapod.feed.Feed; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import java.io.File; +import java.io.IOException; +import java.io.Reader; public class FeedHandler { diff --git a/src/de/danoeh/antennapod/syndication/handler/HandlerState.java b/src/de/danoeh/antennapod/syndication/handler/HandlerState.java index e8687858b..a9a8bb934 100644 --- a/src/de/danoeh/antennapod/syndication/handler/HandlerState.java +++ b/src/de/danoeh/antennapod/syndication/handler/HandlerState.java @@ -1,14 +1,14 @@ package de.danoeh.antennapod.syndication.handler; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Stack; - import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.syndication.namespace.Namespace; import de.danoeh.antennapod.syndication.namespace.SyndElement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Stack; + /** * Contains all relevant information to describe the current state of a * SyndHandler. diff --git a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java index c51d054d4..15dc94d65 100644 --- a/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java +++ b/src/de/danoeh/antennapod/syndication/handler/SyndHandler.java @@ -1,20 +1,13 @@ package de.danoeh.antennapod.syndication.handler; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.Feed; -import de.danoeh.antennapod.syndication.namespace.NSContent; -import de.danoeh.antennapod.syndication.namespace.NSITunes; -import de.danoeh.antennapod.syndication.namespace.NSMedia; -import de.danoeh.antennapod.syndication.namespace.NSRSS20; -import de.danoeh.antennapod.syndication.namespace.NSSimpleChapters; -import de.danoeh.antennapod.syndication.namespace.Namespace; -import de.danoeh.antennapod.syndication.namespace.SyndElement; +import de.danoeh.antennapod.syndication.namespace.*; import de.danoeh.antennapod.syndication.namespace.atom.NSAtom; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; /** Superclass for all SAX Handlers which process Syndication formats */ public class SyndHandler extends DefaultHandler { @@ -84,28 +77,28 @@ public class SyndHandler extends DefaultHandler { state.defaultNamespaces.push(new NSAtom()); } else if (prefix.equals(NSAtom.NSTAG)) { state.namespaces.put(uri, new NSAtom()); - if (AppConfig.DEBUG) + 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()); - if (AppConfig.DEBUG) + 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()); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Recognized ITunes namespace"); } else if (uri.equals(NSSimpleChapters.NSURI) && prefix.matches(NSSimpleChapters.NSTAG)) { state.namespaces.put(uri, new NSSimpleChapters()); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Recognized SimpleChapters namespace"); } else if (uri.equals(NSMedia.NSURI) && prefix.equals(NSMedia.NSTAG)) { state.namespaces.put(uri, new NSMedia()); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Recognized media namespace"); } } diff --git a/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java b/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java index d2454f2b9..0ac1b7ae2 100644 --- a/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java +++ b/src/de/danoeh/antennapod/syndication/handler/TypeGetter.java @@ -1,18 +1,17 @@ package de.danoeh.antennapod.syndication.handler; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.Reader; - +import android.util.Log; +import de.danoeh.antennapod.BuildConfig; +import de.danoeh.antennapod.feed.Feed; import org.apache.commons.io.input.XmlStreamReader; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; -import android.util.Log; -import de.danoeh.antennapod.AppConfig; -import de.danoeh.antennapod.feed.Feed; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.Reader; /** Gets the type of a specific feed by reading the root element. */ public class TypeGetter { @@ -40,7 +39,7 @@ public class TypeGetter { String tag = xpp.getName(); if (tag.equals(ATOM_ROOT)) { feed.setType(Feed.TYPE_ATOM1); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Recognized type Atom"); return Type.ATOM; } else if (tag.equals(RSS_ROOT)) { @@ -50,12 +49,12 @@ public class TypeGetter { if (strVersion.equals("2.0")) { feed.setType(Feed.TYPE_RSS2); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Recognized type RSS 2.0"); return Type.RSS20; } else if (strVersion.equals("0.91") || strVersion.equals("0.92")) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Recognized type RSS 0.91/0.92"); return Type.RSS091; @@ -63,7 +62,7 @@ public class TypeGetter { } throw new UnsupportedFeedtypeException(Type.INVALID); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Type is invalid"); throw new UnsupportedFeedtypeException(Type.INVALID); } @@ -78,7 +77,7 @@ public class TypeGetter { e.printStackTrace(); } } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Type is invalid"); throw new UnsupportedFeedtypeException(Type.INVALID); } diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSContent.java b/src/de/danoeh/antennapod/syndication/namespace/NSContent.java index 7f2a3e87d..9ad3026be 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/NSContent.java +++ b/src/de/danoeh/antennapod/syndication/namespace/NSContent.java @@ -1,8 +1,7 @@ package de.danoeh.antennapod.syndication.namespace; -import org.xml.sax.Attributes; - import de.danoeh.antennapod.syndication.handler.HandlerState; +import org.xml.sax.Attributes; public class NSContent extends Namespace { public static final String NSTAG = "content"; diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java b/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java index 053a81270..cc23167c1 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java +++ b/src/de/danoeh/antennapod/syndication/namespace/NSMedia.java @@ -1,14 +1,13 @@ package de.danoeh.antennapod.syndication.namespace; -import java.util.concurrent.TimeUnit; - -import org.xml.sax.Attributes; - import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.syndication.handler.HandlerState; import de.danoeh.antennapod.syndication.util.SyndTypeUtils; +import org.xml.sax.Attributes; + +import java.util.concurrent.TimeUnit; /** Processes tags from the http://search.yahoo.com/mrss/ namespace. */ public class NSMedia extends Namespace { @@ -38,7 +37,7 @@ public class NSMedia extends Namespace { try { size = Long.parseLong(attributes.getValue(SIZE)); } catch (NumberFormatException e) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Length attribute could not be parsed."); } @@ -50,7 +49,7 @@ public class NSMedia extends Namespace { Long.parseLong(durationStr), TimeUnit.SECONDS); } } catch (NumberFormatException e) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Duration attribute could not be parsed"); } diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java b/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java index 3eb49172d..9572f87ae 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java +++ b/src/de/danoeh/antennapod/syndication/namespace/NSRSS20.java @@ -1,15 +1,14 @@ package de.danoeh.antennapod.syndication.namespace; -import org.xml.sax.Attributes; - import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.FeedImage; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.syndication.handler.HandlerState; import de.danoeh.antennapod.syndication.util.SyndDateUtils; import de.danoeh.antennapod.syndication.util.SyndTypeUtils; +import org.xml.sax.Attributes; /** * SAX-Parser for reading RSS-Feeds @@ -57,7 +56,7 @@ public class NSRSS20 extends Namespace { try { size = Long.parseLong(attributes.getValue(ENC_LEN)); } catch (NumberFormatException e) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Length attribute could not be parsed."); } state.getCurrentItem().setMedia( diff --git a/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java b/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java index 55c26e812..3f983ee88 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java +++ b/src/de/danoeh/antennapod/syndication/namespace/NSSimpleChapters.java @@ -1,13 +1,12 @@ package de.danoeh.antennapod.syndication.namespace; -import java.util.ArrayList; - -import org.xml.sax.Attributes; - import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.feed.SimpleChapter; import de.danoeh.antennapod.syndication.handler.HandlerState; import de.danoeh.antennapod.syndication.util.SyndDateUtils; +import org.xml.sax.Attributes; + +import java.util.ArrayList; public class NSSimpleChapters extends Namespace { public static final String NSTAG = "psc|sc"; diff --git a/src/de/danoeh/antennapod/syndication/namespace/Namespace.java b/src/de/danoeh/antennapod/syndication/namespace/Namespace.java index 9eafef71e..910131feb 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/Namespace.java +++ b/src/de/danoeh/antennapod/syndication/namespace/Namespace.java @@ -1,8 +1,7 @@ package de.danoeh.antennapod.syndication.namespace; -import org.xml.sax.Attributes; - import de.danoeh.antennapod.syndication.handler.HandlerState; +import org.xml.sax.Attributes; public abstract class Namespace { diff --git a/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java b/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java index fec20de2f..86b80d2ed 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java +++ b/src/de/danoeh/antennapod/syndication/namespace/atom/AtomText.java @@ -1,9 +1,8 @@ package de.danoeh.antennapod.syndication.namespace.atom; -import org.apache.commons.lang3.StringEscapeUtils; - import de.danoeh.antennapod.syndication.namespace.Namespace; import de.danoeh.antennapod.syndication.namespace.SyndElement; +import org.apache.commons.lang3.StringEscapeUtils; /** Represents Atom Element which contains text (content, title, summary). */ public class AtomText extends SyndElement { diff --git a/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java b/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java index bc68d6f6a..383b29fc8 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java +++ b/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.syndication.namespace.atom; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.FeedImage; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedMedia; @@ -84,7 +84,7 @@ public class NSAtom extends Namespace { size = Long.parseLong(strSize); } } catch (NumberFormatException e) { - if (AppConfig.DEBUG) Log.d(TAG, "Length attribute could not be parsed."); + if (BuildConfig.DEBUG) Log.d(TAG, "Length attribute could not be parsed."); } String type = attributes.getValue(LINK_TYPE); if (SyndTypeUtils.enclosureTypeValid(type) diff --git a/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java b/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java index a1ed01354..2c1cff914 100644 --- a/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java +++ b/src/de/danoeh/antennapod/syndication/util/SyndDateUtils.java @@ -1,12 +1,12 @@ package de.danoeh.antennapod.syndication.util; +import android.util.Log; + import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; -import android.util.Log; - /** Parses several date formats. */ public class SyndDateUtils { private static final String TAG = "DateUtils"; diff --git a/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java b/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java index fe7836d37..d0fa3a5fc 100644 --- a/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java +++ b/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java @@ -1,8 +1,7 @@ package de.danoeh.antennapod.syndication.util; -import org.apache.commons.io.FilenameUtils; - import android.webkit.MimeTypeMap; +import org.apache.commons.io.FilenameUtils; /** Utility class for handling MIME-Types of enclosures */ public class SyndTypeUtils { diff --git a/src/de/danoeh/antennapod/util/BitmapDecoder.java b/src/de/danoeh/antennapod/util/BitmapDecoder.java index e9423c3f7..5296d675a 100644 --- a/src/de/danoeh/antennapod/util/BitmapDecoder.java +++ b/src/de/danoeh/antennapod/util/BitmapDecoder.java @@ -1,15 +1,14 @@ package de.danoeh.antennapod.util; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Rect; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.asynctask.ImageLoader; +import org.apache.commons.io.IOUtils; + +import java.io.InputStream; public class BitmapDecoder { private static final String TAG = "BitmapDecoder"; @@ -33,7 +32,7 @@ public class BitmapDecoder { int srcHeight = options.outHeight; int length = Math.max(srcWidth, srcHeight); int sampleSize = calculateSampleSize(preferredLength, length); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Using samplesize " + sampleSize); options.inJustDecodeBounds = false; options.inSampleSize = sampleSize; diff --git a/src/de/danoeh/antennapod/util/ChapterUtils.java b/src/de/danoeh/antennapod/util/ChapterUtils.java index 521bfebea..9e1c50674 100644 --- a/src/de/danoeh/antennapod/util/ChapterUtils.java +++ b/src/de/danoeh/antennapod/util/ChapterUtils.java @@ -1,20 +1,7 @@ package de.danoeh.antennapod.util; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.io.IOUtils; - import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.util.comparator.ChapterStartTimeComparator; import de.danoeh.antennapod.util.id3reader.ChapterReader; @@ -22,6 +9,13 @@ import de.danoeh.antennapod.util.id3reader.ID3ReaderException; import de.danoeh.antennapod.util.playback.Playable; import de.danoeh.antennapod.util.vorbiscommentreader.VorbisCommentChapterReader; import de.danoeh.antennapod.util.vorbiscommentreader.VorbisCommentReaderException; +import org.apache.commons.io.IOUtils; + +import java.io.*; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; +import java.util.List; /** Utility class for getting chapter data from media files. */ public class ChapterUtils { @@ -36,7 +30,7 @@ public class ChapterUtils { */ public static void readID3ChaptersFromPlayableStreamUrl(Playable p) { if (p != null && p.getStreamUrl() != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Reading id3 chapters from item " + p.getEpisodeTitle()); InputStream in = null; try { @@ -87,7 +81,7 @@ public class ChapterUtils { */ public static void readID3ChaptersFromPlayableFileUrl(Playable p) { if (p != null && p.localFileAvailable() && p.getLocalMediaUrl() != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Reading id3 chapters from item " + p.getEpisodeTitle()); File source = new File(p.getLocalMediaUrl()); if (source.exists()) { @@ -170,7 +164,7 @@ public class ChapterUtils { private static void readOggChaptersFromInputStream(Playable p, InputStream input) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Trying to read chapters from item with title " + p.getEpisodeTitle()); @@ -243,14 +237,14 @@ public class ChapterUtils { } public static void loadChaptersFromStreamUrl(Playable media) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Starting chapterLoader thread"); ChapterUtils.readID3ChaptersFromPlayableStreamUrl(media); if (media.getChapters() == null) { ChapterUtils.readOggChaptersFromPlayableStreamUrl(media); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "ChapterLoaderThread has finished"); } diff --git a/src/de/danoeh/antennapod/util/EpisodeFilter.java b/src/de/danoeh/antennapod/util/EpisodeFilter.java index ee627b161..115913bca 100644 --- a/src/de/danoeh/antennapod/util/EpisodeFilter.java +++ b/src/de/danoeh/antennapod/util/EpisodeFilter.java @@ -1,10 +1,10 @@ package de.danoeh.antennapod.util; +import de.danoeh.antennapod.feed.FeedItem; + import java.util.ArrayList; import java.util.List; -import de.danoeh.antennapod.feed.FeedItem; - public class EpisodeFilter { private EpisodeFilter() { diff --git a/src/de/danoeh/antennapod/util/FeedtitleComparator.java b/src/de/danoeh/antennapod/util/FeedtitleComparator.java index e334268b1..112b6678d 100644 --- a/src/de/danoeh/antennapod/util/FeedtitleComparator.java +++ b/src/de/danoeh/antennapod/util/FeedtitleComparator.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.util; -import java.util.Comparator; - import de.danoeh.antennapod.feed.Feed; +import java.util.Comparator; + /** Compares the title of two feeds for sorting. */ public class FeedtitleComparator implements Comparator<Feed> { diff --git a/src/de/danoeh/antennapod/util/NetworkUtils.java b/src/de/danoeh/antennapod/util/NetworkUtils.java index 278f7ad7a..0c8065e94 100644 --- a/src/de/danoeh/antennapod/util/NetworkUtils.java +++ b/src/de/danoeh/antennapod/util/NetworkUtils.java @@ -1,17 +1,17 @@ package de.danoeh.antennapod.util; -import java.util.Arrays; -import java.util.List; - import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.preferences.UserPreferences; +import java.util.Arrays; +import java.util.List; + public class NetworkUtils { private static final String TAG = "NetworkUtils"; @@ -31,11 +31,11 @@ public class NetworkUtils { NetworkInfo networkInfo = cm.getActiveNetworkInfo(); if (networkInfo != null) { if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Device is connected to Wi-Fi"); if (networkInfo.isConnected()) { if (!UserPreferences.isEnableAutodownloadWifiFilter()) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Auto-dl filter is disabled"); return true; } else { @@ -47,7 +47,7 @@ public class NetworkUtils { .getAutodownloadSelectedNetworks()); if (selectedNetworks.contains(Integer.toString(wifiInfo .getNetworkId()))) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Current network is on the selected networks list"); return true; @@ -56,7 +56,7 @@ public class NetworkUtils { } } } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Network for auto-dl is not available"); return false; } diff --git a/src/de/danoeh/antennapod/util/ShownotesProvider.java b/src/de/danoeh/antennapod/util/ShownotesProvider.java index d273e0b8f..8345ca34d 100644 --- a/src/de/danoeh/antennapod/util/ShownotesProvider.java +++ b/src/de/danoeh/antennapod/util/ShownotesProvider.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod.util; import java.util.concurrent.Callable; -import java.util.concurrent.FutureTask; /** * Created by daniel on 04.08.13. diff --git a/src/de/danoeh/antennapod/util/StorageUtils.java b/src/de/danoeh/antennapod/util/StorageUtils.java index 52a12f6a6..ff0bde280 100644 --- a/src/de/danoeh/antennapod/util/StorageUtils.java +++ b/src/de/danoeh/antennapod/util/StorageUtils.java @@ -1,18 +1,18 @@ package de.danoeh.antennapod.util; -import java.io.File; - import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.StatFs; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.activity.StorageErrorActivity; import de.danoeh.antennapod.preferences.UserPreferences; +import java.io.File; + /** Utility functions for handling storage errors */ public class StorageUtils { private static final String TAG = "StorageUtils"; @@ -22,7 +22,7 @@ public class StorageUtils { if (dir != null) { return dir.exists() && dir.canRead() && dir.canWrite(); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Storage not available: data folder is null"); return false; } diff --git a/src/de/danoeh/antennapod/util/URIUtil.java b/src/de/danoeh/antennapod/util/URIUtil.java index ed68a01d7..5af40d591 100644 --- a/src/de/danoeh/antennapod/util/URIUtil.java +++ b/src/de/danoeh/antennapod/util/URIUtil.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.util; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import java.net.MalformedURLException; import java.net.URI; @@ -21,7 +21,7 @@ public class URIUtil { try { return new URI(source); } catch (URISyntaxException e) { - if (AppConfig.DEBUG) Log.d(TAG, "Source is not encoded, encoding now"); + if (BuildConfig.DEBUG) Log.d(TAG, "Source is not encoded, encoding now"); } try { URL url = new URL(source); diff --git a/src/de/danoeh/antennapod/util/URLChecker.java b/src/de/danoeh/antennapod/util/URLChecker.java index 13668d4a9..a3c675899 100644 --- a/src/de/danoeh/antennapod/util/URLChecker.java +++ b/src/de/danoeh/antennapod/util/URLChecker.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.util; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; /** Provides methods for checking and editing a URL.*/ public final class URLChecker { @@ -20,10 +20,10 @@ public final class URLChecker { public static String prepareURL(String url) { StringBuilder builder = new StringBuilder(); if (url.startsWith("feed://")) { - if (AppConfig.DEBUG) Log.d(TAG, "Replacing feed:// with http://"); + if (BuildConfig.DEBUG) Log.d(TAG, "Replacing feed:// with http://"); url = url.replace("feed://", "http://"); } else if (!(url.startsWith("http://") || url.startsWith("https://"))) { - if (AppConfig.DEBUG) Log.d(TAG, "Adding http:// at the beginning of the URL"); + if (BuildConfig.DEBUG) Log.d(TAG, "Adding http:// at the beginning of the URL"); builder.append("http://"); } builder.append(url); diff --git a/src/de/danoeh/antennapod/util/UndoBarController.java b/src/de/danoeh/antennapod/util/UndoBarController.java index a0240e7ce..332cc22e0 100644 --- a/src/de/danoeh/antennapod/util/UndoBarController.java +++ b/src/de/danoeh/antennapod/util/UndoBarController.java @@ -26,10 +26,10 @@ import com.nineoldandroids.animation.Animator; import com.nineoldandroids.animation.AnimatorListenerAdapter; import com.nineoldandroids.view.ViewHelper; import com.nineoldandroids.view.ViewPropertyAnimator; -import static com.nineoldandroids.view.ViewPropertyAnimator.animate; - import de.danoeh.antennapod.R; +import static com.nineoldandroids.view.ViewPropertyAnimator.animate; + public class UndoBarController { private View mBarView; private TextView mMessageView; diff --git a/src/de/danoeh/antennapod/util/comparator/ChapterStartTimeComparator.java b/src/de/danoeh/antennapod/util/comparator/ChapterStartTimeComparator.java index 7cc6fa458..bfc2fd057 100644 --- a/src/de/danoeh/antennapod/util/comparator/ChapterStartTimeComparator.java +++ b/src/de/danoeh/antennapod/util/comparator/ChapterStartTimeComparator.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.util.comparator; -import java.util.Comparator; - import de.danoeh.antennapod.feed.Chapter; +import java.util.Comparator; + public class ChapterStartTimeComparator implements Comparator<Chapter> { @Override diff --git a/src/de/danoeh/antennapod/util/comparator/DownloadStatusComparator.java b/src/de/danoeh/antennapod/util/comparator/DownloadStatusComparator.java index d0561252f..14b8f1194 100644 --- a/src/de/danoeh/antennapod/util/comparator/DownloadStatusComparator.java +++ b/src/de/danoeh/antennapod/util/comparator/DownloadStatusComparator.java @@ -1,8 +1,8 @@ package de.danoeh.antennapod.util.comparator; -import java.util.Comparator; +import de.danoeh.antennapod.service.download.DownloadStatus; -import de.danoeh.antennapod.service.download.*; +import java.util.Comparator; /** Compares the completion date of two Downloadstatus objects. */ public class DownloadStatusComparator implements Comparator<DownloadStatus> { diff --git a/src/de/danoeh/antennapod/util/comparator/FeedItemPubdateComparator.java b/src/de/danoeh/antennapod/util/comparator/FeedItemPubdateComparator.java index c95c0833c..f92c23d05 100644 --- a/src/de/danoeh/antennapod/util/comparator/FeedItemPubdateComparator.java +++ b/src/de/danoeh/antennapod/util/comparator/FeedItemPubdateComparator.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.util.comparator; -import java.util.Comparator; - import de.danoeh.antennapod.feed.FeedItem; +import java.util.Comparator; + /** Compares the pubDate of two FeedItems for sorting*/ public class FeedItemPubdateComparator implements Comparator<FeedItem> { diff --git a/src/de/danoeh/antennapod/util/comparator/PlaybackCompletionDateComparator.java b/src/de/danoeh/antennapod/util/comparator/PlaybackCompletionDateComparator.java index 434a5a956..0147e0cdc 100644 --- a/src/de/danoeh/antennapod/util/comparator/PlaybackCompletionDateComparator.java +++ b/src/de/danoeh/antennapod/util/comparator/PlaybackCompletionDateComparator.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.util.comparator; -import java.util.Comparator; - import de.danoeh.antennapod.feed.FeedItem; +import java.util.Comparator; + public class PlaybackCompletionDateComparator implements Comparator<FeedItem> { public int compare(FeedItem lhs, FeedItem rhs) { diff --git a/src/de/danoeh/antennapod/util/comparator/SearchResultValueComparator.java b/src/de/danoeh/antennapod/util/comparator/SearchResultValueComparator.java index ab7d47673..02b084a01 100644 --- a/src/de/danoeh/antennapod/util/comparator/SearchResultValueComparator.java +++ b/src/de/danoeh/antennapod/util/comparator/SearchResultValueComparator.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.util.comparator; -import java.util.Comparator; - import de.danoeh.antennapod.feed.SearchResult; +import java.util.Comparator; + public class SearchResultValueComparator implements Comparator<SearchResult> { @Override diff --git a/src/de/danoeh/antennapod/util/flattr/FlattrServiceCreator.java b/src/de/danoeh/antennapod/util/flattr/FlattrServiceCreator.java index b7e77e158..eda83b7aa 100644 --- a/src/de/danoeh/antennapod/util/flattr/FlattrServiceCreator.java +++ b/src/de/danoeh/antennapod/util/flattr/FlattrServiceCreator.java @@ -1,12 +1,11 @@ package de.danoeh.antennapod.util.flattr; +import android.util.Log; +import de.danoeh.antennapod.BuildConfig; import org.shredzone.flattr4j.FlattrFactory; import org.shredzone.flattr4j.FlattrService; import org.shredzone.flattr4j.oauth.AccessToken; -import android.util.Log; -import de.danoeh.antennapod.AppConfig; - /** Ensures that only one instance of the FlattrService class exists at a time */ public class FlattrServiceCreator { @@ -19,7 +18,7 @@ public class FlattrServiceCreator { } public static void deleteFlattrService() { - if (AppConfig.DEBUG) 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/flattr/FlattrThing.java b/src/de/danoeh/antennapod/util/flattr/FlattrThing.java index 872132517..f17ef1d83 100644 --- a/src/de/danoeh/antennapod/util/flattr/FlattrThing.java +++ b/src/de/danoeh/antennapod/util/flattr/FlattrThing.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.util.flattr; -import de.danoeh.antennapod.util.flattr.FlattrStatus; - public interface FlattrThing { public String getTitle(); public String getPaymentLink(); diff --git a/src/de/danoeh/antennapod/util/flattr/FlattrUtils.java b/src/de/danoeh/antennapod/util/flattr/FlattrUtils.java index 423e98891..9809f69a3 100644 --- a/src/de/danoeh/antennapod/util/flattr/FlattrUtils.java +++ b/src/de/danoeh/antennapod/util/flattr/FlattrUtils.java @@ -1,21 +1,5 @@ package de.danoeh.antennapod.util.flattr; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.EnumSet; -import java.util.List; -import java.util.ListIterator; -import java.util.TimeZone; - -import org.shredzone.flattr4j.FlattrService; -import org.shredzone.flattr4j.exception.FlattrException; -import org.shredzone.flattr4j.model.Flattr; -import org.shredzone.flattr4j.model.Thing; -import org.shredzone.flattr4j.oauth.AccessToken; -import org.shredzone.flattr4j.oauth.AndroidAuthenticator; -import org.shredzone.flattr4j.oauth.Scope; - import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; @@ -25,12 +9,21 @@ import android.content.SharedPreferences; import android.net.Uri; import android.preference.PreferenceManager; import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.FlattrAuthActivity; import de.danoeh.antennapod.asynctask.FlattrTokenFetcher; import de.danoeh.antennapod.storage.DBWriter; +import org.shredzone.flattr4j.FlattrService; +import org.shredzone.flattr4j.exception.FlattrException; +import org.shredzone.flattr4j.model.Flattr; +import org.shredzone.flattr4j.model.Thing; +import org.shredzone.flattr4j.oauth.AccessToken; +import org.shredzone.flattr4j.oauth.AndroidAuthenticator; +import org.shredzone.flattr4j.oauth.Scope; + +import java.util.*; /** Utility methods for doing something with flattr. */ @@ -63,17 +56,17 @@ public class FlattrUtils { private static AccessToken retrieveToken() { if (cachedToken == null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Retrieving access token"); String token = PreferenceManager.getDefaultSharedPreferences( PodcastApp.getInstance()) .getString(PREF_ACCESS_TOKEN, null); if (token != null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Found access token. Caching."); cachedToken = new AccessToken(token); } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "No access token found"); return null; } @@ -87,7 +80,7 @@ public class FlattrUtils { } public static void storeToken(AccessToken token) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Storing token"); SharedPreferences.Editor editor = PreferenceManager .getDefaultSharedPreferences(PodcastApp.getInstance()).edit(); @@ -101,7 +94,7 @@ public class FlattrUtils { } public static void deleteToken() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Deleting flattr token"); storeToken(null); } @@ -159,7 +152,7 @@ public class FlattrUtils { } } - if (AppConfig.DEBUG) { + if (BuildConfig.DEBUG) { Log.d(TAG, "Got my flattrs list of length " + Integer.toString(myFlattrs.size()) + " comparison date" + firstOfMonthDate); for (Flattr fl: myFlattrs) { @@ -181,7 +174,7 @@ public class FlattrUtils { } public static void revokeAccessToken(Context context) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Revoking access token"); deleteToken(); FlattrServiceCreator.deleteFlattrService(); @@ -206,7 +199,7 @@ public class FlattrUtils { } public static void showNoTokenDialog(final Context context, final String url) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Creating showNoTokenDialog"); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.no_flattr_token_title); diff --git a/src/de/danoeh/antennapod/util/id3reader/ChapterReader.java b/src/de/danoeh/antennapod/util/id3reader/ChapterReader.java index f897f886c..257635129 100644 --- a/src/de/danoeh/antennapod/util/id3reader/ChapterReader.java +++ b/src/de/danoeh/antennapod/util/id3reader/ChapterReader.java @@ -1,19 +1,18 @@ package de.danoeh.antennapod.util.id3reader; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.List; - import android.util.Log; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.feed.ID3Chapter; import de.danoeh.antennapod.util.id3reader.model.FrameHeader; import de.danoeh.antennapod.util.id3reader.model.TagHeader; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.List; + public class ChapterReader extends ID3Reader { private static final String TAG = "ID3ChapterReader"; @@ -39,7 +38,7 @@ public class ChapterReader extends ID3Reader { if (currentChapter != null) { if (!hasId3Chapter(currentChapter)) { chapters.add(currentChapter); - if (AppConfig.DEBUG) Log.d(TAG, "Found chapter: " + currentChapter); + if (BuildConfig.DEBUG) Log.d(TAG, "Found chapter: " + currentChapter); currentChapter = null; } } @@ -58,7 +57,7 @@ public class ChapterReader extends ID3Reader { readString(title, input, header.getSize()); currentChapter .setTitle(title.toString()); - if (AppConfig.DEBUG) Log.d(TAG, "Found title: " + currentChapter.getTitle()); + if (BuildConfig.DEBUG) Log.d(TAG, "Found title: " + currentChapter.getTitle()); return ID3Reader.ACTION_DONT_SKIP; } @@ -72,7 +71,7 @@ public class ChapterReader extends ID3Reader { currentChapter.setLink(decodedLink); - if (AppConfig.DEBUG) Log.d(TAG, "Found link: " + currentChapter.getLink()); + if (BuildConfig.DEBUG) Log.d(TAG, "Found link: " + currentChapter.getLink()); return ID3Reader.ACTION_DONT_SKIP; } } else if (header.getId().equals("APIC")) { diff --git a/src/de/danoeh/antennapod/util/id3reader/ID3Reader.java b/src/de/danoeh/antennapod/util/id3reader/ID3Reader.java index 92f817363..252d64107 100644 --- a/src/de/danoeh/antennapod/util/id3reader/ID3Reader.java +++ b/src/de/danoeh/antennapod/util/id3reader/ID3Reader.java @@ -1,15 +1,14 @@ package de.danoeh.antennapod.util.id3reader; +import de.danoeh.antennapod.util.id3reader.model.FrameHeader; +import de.danoeh.antennapod.util.id3reader.model.TagHeader; +import org.apache.commons.io.IOUtils; + import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.charset.Charset; -import org.apache.commons.io.IOUtils; - -import de.danoeh.antennapod.util.id3reader.model.FrameHeader; -import de.danoeh.antennapod.util.id3reader.model.TagHeader; - /** * Reads the ID3 Tag of a given file. In order to use this class, you should * create a subclass of it and overwrite the onStart* - or onEnd* - methods. diff --git a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java b/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java index 615c1c93e..6733430da 100644 --- a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java +++ b/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.util.menuhandler; import android.content.Context; import android.content.Intent; import android.net.Uri; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.service.playback.PlaybackService; @@ -95,7 +95,7 @@ public class FeedItemMenuHandler { mi.setItemVisibility(R.id.share_link_item, false); } - if (!AppConfig.DEBUG + if (!BuildConfig.DEBUG || !(state == FeedItem.State.IN_PROGRESS || state == FeedItem.State.READ)) { mi.setItemVisibility(R.id.mark_unread_item, false); } diff --git a/src/de/danoeh/antennapod/util/menuhandler/FeedMenuHandler.java b/src/de/danoeh/antennapod/util/menuhandler/FeedMenuHandler.java index 537335618..ae8b3ac1e 100644 --- a/src/de/danoeh/antennapod/util/menuhandler/FeedMenuHandler.java +++ b/src/de/danoeh/antennapod/util/menuhandler/FeedMenuHandler.java @@ -4,18 +4,12 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.util.Log; - import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.FeedInfoActivity; -import de.danoeh.antennapod.asynctask.FlattrClickWorker; import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.service.download.DownloadService; import de.danoeh.antennapod.storage.DBTasks; @@ -23,7 +17,6 @@ import de.danoeh.antennapod.storage.DBWriter; import de.danoeh.antennapod.storage.DownloadRequestException; import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.util.ShareUtils; -import de.danoeh.antennapod.util.flattr.FlattrStatus; /** Handles interactions with the FeedItemMenu. */ public class FeedMenuHandler { @@ -39,7 +32,7 @@ public class FeedMenuHandler { return true; } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Preparing options menu"); menu.findItem(R.id.mark_all_read_item).setVisible( selectedFeed.hasNewItems(true)); diff --git a/src/de/danoeh/antennapod/util/playback/AudioPlayer.java b/src/de/danoeh/antennapod/util/playback/AudioPlayer.java index 0945303e4..bd49b0d18 100644 --- a/src/de/danoeh/antennapod/util/playback/AudioPlayer.java +++ b/src/de/danoeh/antennapod/util/playback/AudioPlayer.java @@ -3,7 +3,6 @@ package de.danoeh.antennapod.util.playback; import android.content.Context; import android.util.Log; import android.view.SurfaceHolder; - import com.aocate.media.MediaPlayer; public class AudioPlayer extends MediaPlayer implements IPlayer { diff --git a/src/de/danoeh/antennapod/util/playback/ExternalMedia.java b/src/de/danoeh/antennapod/util/playback/ExternalMedia.java index e937ee437..390498cea 100644 --- a/src/de/danoeh/antennapod/util/playback/ExternalMedia.java +++ b/src/de/danoeh/antennapod/util/playback/ExternalMedia.java @@ -1,9 +1,5 @@ package de.danoeh.antennapod.util.playback; -import java.io.InputStream; -import java.util.List; -import java.util.concurrent.Callable; - import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.media.MediaMetadataRetriever; @@ -13,6 +9,10 @@ import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.feed.MediaType; import de.danoeh.antennapod.util.ChapterUtils; +import java.io.InputStream; +import java.util.List; +import java.util.concurrent.Callable; + /** Represents a media file that is stored on the local storage device. */ public class ExternalMedia implements Playable { diff --git a/src/de/danoeh/antennapod/util/playback/IPlayer.java b/src/de/danoeh/antennapod/util/playback/IPlayer.java index 8c1cf4ef4..99f53fb52 100644 --- a/src/de/danoeh/antennapod/util/playback/IPlayer.java +++ b/src/de/danoeh/antennapod/util/playback/IPlayer.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.util.playback; -import java.io.IOException; - import android.view.SurfaceHolder; +import java.io.IOException; + public interface IPlayer { boolean canSetPitch(); diff --git a/src/de/danoeh/antennapod/util/playback/Playable.java b/src/de/danoeh/antennapod/util/playback/Playable.java index 98d5fbb36..8eefb0be5 100644 --- a/src/de/danoeh/antennapod/util/playback/Playable.java +++ b/src/de/danoeh/antennapod/util/playback/Playable.java @@ -1,15 +1,6 @@ package de.danoeh.antennapod.util.playback; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.List; -import java.util.concurrent.FutureTask; - import android.content.Context; -import de.danoeh.antennapod.storage.DBReader; -import de.danoeh.antennapod.util.ShownotesProvider; -import org.apache.commons.io.IOUtils; - import android.content.SharedPreferences; import android.media.MediaMetadataRetriever; import android.os.Parcelable; @@ -18,6 +9,13 @@ import de.danoeh.antennapod.asynctask.ImageLoader; import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.feed.MediaType; +import de.danoeh.antennapod.storage.DBReader; +import de.danoeh.antennapod.util.ShownotesProvider; +import org.apache.commons.io.IOUtils; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.List; /** * Interface for objects that can be played by the PlaybackService. diff --git a/src/de/danoeh/antennapod/util/playback/PlaybackController.java b/src/de/danoeh/antennapod/util/playback/PlaybackController.java index 2e1abecd6..1992fce2c 100644 --- a/src/de/danoeh/antennapod/util/playback/PlaybackController.java +++ b/src/de/danoeh/antennapod/util/playback/PlaybackController.java @@ -15,7 +15,7 @@ import android.view.View.OnClickListener; import android.widget.ImageButton; import android.widget.SeekBar; import android.widget.TextView; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.feed.FeedMedia; @@ -114,7 +114,7 @@ public abstract class PlaybackController { * example in the activity's onStop() method. */ public void release() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Releasing PlaybackController"); try { @@ -160,7 +160,7 @@ public abstract class PlaybackController { * as the arguments of the launch intent. */ private void bindToService() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Trying to connect to service"); AsyncTask<Void, Void, Intent> intentLoader = new AsyncTask<Void, Void, Intent>() { @Override @@ -173,7 +173,7 @@ public abstract class PlaybackController { boolean bound = false; if (!PlaybackService.started) { if (serviceIntent != null) { - if (AppConfig.DEBUG) Log.d(TAG, "Calling start service"); + if (BuildConfig.DEBUG) Log.d(TAG, "Calling start service"); activity.startService(serviceIntent); bound = activity.bindService(serviceIntent, mConnection, 0); } else { @@ -182,13 +182,13 @@ public abstract class PlaybackController { handleStatus(); } } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "PlaybackService is running, trying to connect without start command."); bound = activity.bindService(new Intent(activity, PlaybackService.class), mConnection, 0); } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Result for service binding: " + bound); } }; @@ -200,7 +200,7 @@ public abstract class PlaybackController { * played media or null if no last played media could be found. */ private Intent getPlayLastPlayedMediaIntent() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Trying to restore last played media"); SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(activity.getApplicationContext()); @@ -229,7 +229,7 @@ public abstract class PlaybackController { return serviceIntent; } } - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "No last played media found"); return null; } @@ -242,7 +242,7 @@ public abstract class PlaybackController { || (positionObserverFuture != null && positionObserverFuture .isDone()) || positionObserverFuture == null) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Setting up position observer"); positionObserver = new MediaPositionObserver(); positionObserverFuture = schedExecutor.scheduleWithFixedDelay( @@ -255,7 +255,7 @@ public abstract class PlaybackController { private void cancelPositionObserver() { if (positionObserverFuture != null) { boolean result = positionObserverFuture.cancel(true); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "PositionObserver cancelled. Result: " + result); } } @@ -268,7 +268,7 @@ public abstract class PlaybackController { .getService(); if (!released) { queryService(); - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Connection to Service established"); } else { Log.i(TAG, "Connection to playback service has been established, but controller has already been released"); @@ -278,7 +278,7 @@ public abstract class PlaybackController { @Override public void onServiceDisconnected(ComponentName name) { playbackService = null; - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Disconnected from Service"); } @@ -287,7 +287,7 @@ public abstract class PlaybackController { protected BroadcastReceiver statusUpdate = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Received statusUpdate Intent."); if (isConnectedToPlaybackService()) { PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo(); @@ -345,7 +345,7 @@ public abstract class PlaybackController { } } else { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Bad arguments. Won't handle intent"); } } else { @@ -491,7 +491,7 @@ public abstract class PlaybackController { * information has to be refreshed */ void queryService() { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Querying service info"); if (playbackService != null) { status = playbackService.getStatus(); diff --git a/src/de/danoeh/antennapod/util/vorbiscommentreader/OggInputStream.java b/src/de/danoeh/antennapod/util/vorbiscommentreader/OggInputStream.java index c11125abf..767034ed2 100644 --- a/src/de/danoeh/antennapod/util/vorbiscommentreader/OggInputStream.java +++ b/src/de/danoeh/antennapod/util/vorbiscommentreader/OggInputStream.java @@ -1,10 +1,11 @@ package de.danoeh.antennapod.util.vorbiscommentreader; + +import org.apache.commons.io.IOUtils; + import java.io.IOException; import java.io.InputStream; import java.util.Arrays; -import org.apache.commons.io.IOUtils; - public class OggInputStream extends InputStream { private InputStream input; diff --git a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentChapterReader.java b/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentChapterReader.java index c78977652..b2f149ddd 100644 --- a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentChapterReader.java +++ b/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentChapterReader.java @@ -1,13 +1,13 @@ package de.danoeh.antennapod.util.vorbiscommentreader; -import java.util.ArrayList; -import java.util.List; - import android.util.Log; -import de.danoeh.antennapod.AppConfig; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.feed.Chapter; import de.danoeh.antennapod.feed.VorbisCommentChapter; +import java.util.ArrayList; +import java.util.List; + public class VorbisCommentChapterReader extends VorbisCommentReader { private static final String TAG = "VorbisCommentChapterReader"; @@ -39,7 +39,7 @@ public class VorbisCommentChapterReader extends VorbisCommentReader { @Override public void onContentVectorValue(String key, String value) throws VorbisCommentReaderException { - if (AppConfig.DEBUG) + if (BuildConfig.DEBUG) Log.d(TAG, "Key: " + key + ", value: " + value); String attribute = VorbisCommentChapter.getAttributeTypeFromKey(key); int id = VorbisCommentChapter.getIDFromKey(key); diff --git a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReader.java b/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReader.java index 06a3911ab..718a4f30f 100644 --- a/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReader.java +++ b/src/de/danoeh/antennapod/util/vorbiscommentreader/VorbisCommentReader.java @@ -1,5 +1,8 @@ package de.danoeh.antennapod.util.vorbiscommentreader; +import org.apache.commons.io.EndianUtils; +import org.apache.commons.io.IOUtils; + import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; @@ -7,9 +10,6 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.Arrays; -import org.apache.commons.io.EndianUtils; -import org.apache.commons.io.IOUtils; - public abstract class VorbisCommentReader { /** Length of first page in an ogg file in bytes. */ |