Replaced buildconfig condition with appconfig condition
This commit is contained in:
parent
f0edc0558b
commit
4a7b6d439e
|
@ -39,6 +39,7 @@ public class PodcastApp extends Application implements
|
|||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.i(TAG, "AppConfig is " + AppConfig.DEBUG);
|
||||
singleton = this;
|
||||
LOGICAL_DENSITY = getResources().getDisplayMetrics().density;
|
||||
SharedPreferences prefs = PreferenceManager
|
||||
|
@ -60,7 +61,7 @@ public class PodcastApp extends Application implements
|
|||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
|
||||
String key) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Registered change of application preferences");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Registered change of application preferences");
|
||||
if (key.equals(PREF_UPDATE_INTERVALL)) {
|
||||
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||
int hours = Integer.parseInt(sharedPreferences.getString(
|
||||
|
@ -72,9 +73,9 @@ public class PodcastApp extends Application implements
|
|||
long newIntervall = TimeUnit.HOURS.toMillis(hours);
|
||||
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
|
||||
newIntervall, newIntervall, updateIntent);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Changed alarm to new intervall");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Changed alarm to new intervall");
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Automatic update was deactivated");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Automatic update was deactivated");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.DownloadObserver;
|
||||
import de.danoeh.antennapod.asynctask.DownloadStatus;
|
||||
|
@ -104,12 +104,12 @@ public class AddFeedActivity extends SherlockActivity {
|
|||
StorageUtils.checkStorageAvailability(this);
|
||||
Intent intent = getIntent();
|
||||
if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_SEND)) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Was started with ACTION_SEND intent");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Was started with ACTION_SEND intent");
|
||||
String text = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
if (text != null) {
|
||||
etxtFeedurl.setText(text);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "No text was sent");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "No text was sent");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ public class AddFeedActivity extends SherlockActivity {
|
|||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Stopping Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,7 @@ import de.danoeh.antennapod.feed.FeedFile;
|
|||
import de.danoeh.antennapod.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.service.DownloadService;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import com.actionbarsherlock.app.SherlockListActivity;
|
||||
import com.actionbarsherlock.view.ActionMode;
|
||||
|
@ -43,7 +43,7 @@ public class DownloadActivity extends SherlockListActivity implements
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Creating Activity");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Creating Activity");
|
||||
requester = DownloadRequester.getInstance();
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
@ -61,14 +61,14 @@ public class DownloadActivity extends SherlockListActivity implements
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Trying to bind service");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Trying to bind service");
|
||||
bindService(new Intent(this, DownloadService.class), mConnection, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Stopping Activity");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,7 +162,7 @@ public class DownloadActivity extends SherlockListActivity implements
|
|||
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||
downloadService = ((DownloadService.LocalBinder) service)
|
||||
.getService();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Connection to service established");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Connection to service established");
|
||||
dla = new DownloadlistAdapter(DownloadActivity.this, 0,
|
||||
downloadService.getDownloadObserver().getStatusList());
|
||||
setListAdapter(dla);
|
||||
|
@ -184,7 +184,7 @@ public class DownloadActivity extends SherlockListActivity implements
|
|||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Observer has finished, clearing adapter");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Observer has finished, clearing adapter");
|
||||
dla.clear();
|
||||
dla.notifyDataSetInvalidated();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import de.danoeh.antennapod.feed.Feed;
|
|||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.util.FeedMenuHandler;
|
||||
import de.danoeh.antennapod.util.LangUtils;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Displays information about a feed. */
|
||||
|
@ -41,8 +41,8 @@ public class FeedInfoActivity extends SherlockActivity {
|
|||
FeedManager manager = FeedManager.getInstance();
|
||||
feed = manager.getFeed(feedId);
|
||||
if (feed != null) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Language is " + feed.getLanguage());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Author is " + feed.getAuthor());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Language is " + feed.getLanguage());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Author is " + feed.getAuthor());
|
||||
imgvCover = (ImageView) findViewById(R.id.imgvCover);
|
||||
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
|
||||
txtvDescription = (TextView) findViewById(R.id.txtvDescription);
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.actionbarsherlock.view.Menu;
|
|||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.util.FlattrUtils;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Guides the user through the authentication process */
|
||||
|
@ -36,7 +36,7 @@ public class FlattrAuthActivity extends SherlockActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
singleton = this;
|
||||
authSuccessful = false;
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Activity created");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Activity created");
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.flattr_auth);
|
||||
txtvExplanation = (TextView) findViewById(R.id.txtvExplanation);
|
||||
|
@ -70,10 +70,10 @@ public class FlattrAuthActivity extends SherlockActivity {
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Activity resumed");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Activity resumed");
|
||||
Uri uri = getIntent().getData();
|
||||
if (uri != null) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received uri");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received uri");
|
||||
FlattrUtils.handleCallback(this, uri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import de.danoeh.antennapod.fragment.ItemDescriptionFragment;
|
|||
import de.danoeh.antennapod.fragment.ItemlistFragment;
|
||||
import de.danoeh.antennapod.util.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Displays a single FeedItem and provides various actions */
|
||||
|
@ -59,7 +59,7 @@ public class ItemviewActivity extends SherlockFragmentActivity {
|
|||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Stopping Activity");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Stopping Activity");
|
||||
}
|
||||
|
||||
/** Extracts FeedItem object the activity is supposed to display */
|
||||
|
@ -73,8 +73,8 @@ public class ItemviewActivity extends SherlockFragmentActivity {
|
|||
}
|
||||
Feed feed = manager.getFeed(feedId);
|
||||
item = manager.getFeedItem(itemId, feed);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Title of item is " + item.getTitle());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Title of feed is " + item.getFeed().getTitle());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Title of item is " + item.getTitle());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Title of feed is " + item.getFeed().getTitle());
|
||||
}
|
||||
|
||||
private void populateUI() {
|
||||
|
|
|
@ -25,7 +25,7 @@ import de.danoeh.antennapod.fragment.UnreadItemlistFragment;
|
|||
import de.danoeh.antennapod.service.DownloadService;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
public class MainActivity extends SherlockFragmentActivity {
|
||||
|
@ -72,7 +72,7 @@ public class MainActivity extends SherlockFragmentActivity {
|
|||
private BroadcastReceiver contentUpdate = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
|
||||
updateProgressBarVisibility();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.actionbarsherlock.view.MenuInflater;
|
|||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.viewpagerindicator.TabPageIndicator;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
|
@ -98,7 +98,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Activity stopped");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Activity stopped");
|
||||
try {
|
||||
unregisterReceiver(statusUpdate);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
@ -157,7 +157,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Resuming Activity");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Resuming Activity");
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
bindToService();
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Configuration changed");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Configuration changed");
|
||||
orientation = newConfig.orientation;
|
||||
if (positionObserver != null) {
|
||||
positionObserver.cancel(true);
|
||||
|
@ -192,7 +192,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Creating Activity");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Creating Activity");
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
|
||||
orientation = getResources().getConfiguration().orientation;
|
||||
|
@ -206,7 +206,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
Intent serviceIntent = new Intent(this, PlaybackService.class);
|
||||
boolean bound = false;
|
||||
if (!PlaybackService.isRunning) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Trying to restore last played media");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Trying to restore last played media");
|
||||
SharedPreferences prefs = getApplicationContext()
|
||||
.getSharedPreferences(PodcastApp.PREF_NAME, 0);
|
||||
long mediaId = prefs.getLong(PlaybackService.PREF_LAST_PLAYED_ID,
|
||||
|
@ -225,7 +225,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
bound = bindService(serviceIntent, mConnection,
|
||||
Context.BIND_AUTO_CREATE);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "No last played media found");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "No last played media found");
|
||||
status = PlayerStatus.STOPPED;
|
||||
setupGUI();
|
||||
handleStatus();
|
||||
|
@ -233,7 +233,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
} else {
|
||||
bound = bindService(serviceIntent, mConnection, 0);
|
||||
}
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Result for service binding: " + bound);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Result for service binding: " + bound);
|
||||
}
|
||||
|
||||
private void handleStatus() {
|
||||
|
@ -273,7 +273,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
setStatusMsg(R.string.player_seeking_msg, View.VISIBLE);
|
||||
break;
|
||||
case AWAITING_VIDEO_SURFACE:
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Preparing video playback");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Preparing video playback");
|
||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
}
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
@SuppressLint("NewApi")
|
||||
private void setupPositionObserver() {
|
||||
if (positionObserver == null || positionObserver.isCancelled()) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Setting up position observer");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Setting up position observer");
|
||||
positionObserver = new MediaPositionObserver() {
|
||||
|
||||
@Override
|
||||
|
@ -318,7 +318,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
}
|
||||
|
||||
private void updateProgressbarPosition() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Updating progressbar info");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Updating progressbar info");
|
||||
MediaPlayer player = playbackService.getPlayer();
|
||||
float progress = ((float) player.getCurrentPosition())
|
||||
/ player.getDuration();
|
||||
|
@ -327,7 +327,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
|
||||
private void loadMediaInfo() {
|
||||
if (!mediaInfoLoaded) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Loading media info");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Loading media info");
|
||||
if (media != null) {
|
||||
getSupportActionBar().setSubtitle(media.getItem().getTitle());
|
||||
getSupportActionBar().setTitle(
|
||||
|
@ -525,13 +525,13 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
PlaybackService.ACTION_PLAYER_NOTIFICATION));
|
||||
|
||||
queryService();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Connection to Service established");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Connection to Service established");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
playbackService = null;
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Disconnected from Service");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Disconnected from Service");
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -541,7 +541,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
* information has to be refreshed
|
||||
*/
|
||||
private void queryService() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Querying service info");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Querying service info");
|
||||
if (playbackService != null) {
|
||||
int requestedOrientation;
|
||||
status = playbackService.getStatus();
|
||||
|
@ -558,11 +558,11 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
// check if orientation is correct
|
||||
if ((requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||
|| (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT && orientation == Configuration.ORIENTATION_PORTRAIT)) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Orientation correct");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Orientation correct");
|
||||
setupGUI();
|
||||
handleStatus();
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG,
|
||||
if (AppConfig.DEBUG) Log.d(TAG,
|
||||
"Orientation incorrect, waiting for orientation change");
|
||||
}
|
||||
} else {
|
||||
|
@ -574,7 +574,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
private BroadcastReceiver statusUpdate = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received statusUpdate Intent.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received statusUpdate Intent.");
|
||||
status = playbackService.getStatus();
|
||||
handleStatus();
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
}
|
||||
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Bad arguments. Won't handle intent");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Bad arguments. Won't handle intent");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
holderCreated = true;
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Videoview holder created");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Videoview holder created");
|
||||
if (status == PlayerStatus.AWAITING_VIDEO_SURFACE) {
|
||||
if (playbackService != null) {
|
||||
playbackService.setVideoSurface(holder);
|
||||
|
@ -719,19 +719,19 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Task was cancelled");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Task was cancelled");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(MediaPlayer... p) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Background Task started");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Background Task started");
|
||||
player = p[0];
|
||||
try {
|
||||
while (player.isPlaying() && !isCancelled()) {
|
||||
try {
|
||||
Thread.sleep(WAITING_INTERVALL);
|
||||
} catch (InterruptedException e) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG,
|
||||
if (AppConfig.DEBUG) Log.d(TAG,
|
||||
"Thread was interrupted while waiting. Finishing now");
|
||||
return null;
|
||||
}
|
||||
|
@ -739,9 +739,9 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
|
||||
}
|
||||
} catch (IllegalStateException e) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "player is in illegal state, exiting now");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "player is in illegal state, exiting now");
|
||||
}
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Background Task finished");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Background Task finished");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||
@Override
|
||||
protected void onProgressUpdate(Void... values) {
|
||||
if (videoControlsShowing) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Hiding video controls");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Hiding video controls");
|
||||
getSupportActionBar().hide();
|
||||
videoOverlay.setVisibility(View.GONE);
|
||||
videoControlsShowing = false;
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.util.Log;
|
|||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
public class StorageErrorActivity extends SherlockActivity {
|
||||
|
@ -54,10 +54,10 @@ public class StorageErrorActivity extends SherlockActivity {
|
|||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED)) {
|
||||
if (intent.getBooleanExtra("read-only", true)) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Media was mounted; Finishing activity");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Media was mounted; Finishing activity");
|
||||
leaveErrorState();
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Media seemed to have been mounted read only");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Media seemed to have been mounted read only");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.os.AsyncTask;
|
|||
import android.util.Log;
|
||||
import de.danoeh.antennapod.feed.FeedFile;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Observes the status of a specific Download */
|
||||
|
@ -45,7 +45,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Task was cancelled.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Task was cancelled.");
|
||||
statusList.clear();
|
||||
for (DownloadObserver.Callback callback : observer) {
|
||||
callback.onFinish();
|
||||
|
@ -54,7 +54,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Background task has finished");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Background task has finished");
|
||||
statusList.clear();
|
||||
for (DownloadObserver.Callback callback : observer) {
|
||||
callback.onFinish();
|
||||
|
@ -62,7 +62,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
|
|||
}
|
||||
|
||||
protected Void doInBackground(Void... params) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Background Task started.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Background Task started.");
|
||||
while (downloadsLeft() && !isCancelled()) {
|
||||
refreshStatuslist();
|
||||
publishProgress();
|
||||
|
@ -72,7 +72,7 @@ public class DownloadObserver extends AsyncTask<Void, Void, Void> {
|
|||
Log.w(TAG, "Thread was interrupted while waiting.");
|
||||
}
|
||||
}
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Background Task finished.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Background Task finished.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.danoeh.antennapod.asynctask;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.feed.FeedImage;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
|
@ -36,7 +36,7 @@ public class FeedImageLoader {
|
|||
private LruCache<Long, Bitmap> imageCache;
|
||||
|
||||
private FeedImageLoader() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Creating cache with size " + cacheSize);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Creating cache with size " + cacheSize);
|
||||
imageCache = new LruCache<Long, Bitmap>(cacheSize) {
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
|
@ -166,7 +166,7 @@ public class FeedImageLoader {
|
|||
PREFERRED_LENGTH, PREFERRED_LENGTH, false);
|
||||
|
||||
addBitmapToCache(params[0].getId(), bitmap);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Finished loading bitmaps");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Finished loading bitmaps");
|
||||
} else {
|
||||
Log.e(TAG,
|
||||
"FeedImage has no valid file url. Using default image");
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.content.Context;
|
|||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.util.FlattrUtils;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class FlattrClickWorker extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Exit code was " + exitCode);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Exit code was " + exitCode);
|
||||
if (progDialog != null) {
|
||||
progDialog.dismiss();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class FlattrClickWorker extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Starting background work");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Starting background work");
|
||||
if (FlattrUtils.hasToken()) {
|
||||
try {
|
||||
FlattrUtils.clickUrl(context, url);
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.content.Context;
|
|||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.FlattrAuthActivity;
|
||||
import de.danoeh.antennapod.util.FlattrUtils;
|
||||
|
@ -72,7 +72,7 @@ public class FlattrTokenFetcher extends AsyncTask<Void, Void, AccessToken> {
|
|||
return null;
|
||||
}
|
||||
if (token != null) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Successfully got token");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Successfully got token");
|
||||
FlattrUtils.storeToken(token);
|
||||
return token;
|
||||
} else {
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.activity.MediaplayerActivity;
|
||||
import de.danoeh.antennapod.asynctask.DownloadStatus;
|
||||
import de.danoeh.antennapod.service.PlaybackService;
|
||||
|
@ -110,7 +110,7 @@ public class FeedManager {
|
|||
media.setFile_url(null);
|
||||
setFeedMedia(context, media);
|
||||
}
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Deleting File. Result: " + result);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Deleting File. Result: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class FeedManager {
|
|||
* instead of the setters of FeedItem.
|
||||
*/
|
||||
public void markItemRead(Context context, FeedItem item, boolean read) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Setting item with title " + item.getTitle()
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Setting item with title " + item.getTitle()
|
||||
+ " as read/unread");
|
||||
item.read = read;
|
||||
setFeedItem(context, item);
|
||||
|
@ -197,7 +197,7 @@ public class FeedManager {
|
|||
|
||||
/** Marks all items in the unread items list as read */
|
||||
public void markAllItemsRead(Context context) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "marking all items as read");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "marking all items as read");
|
||||
PodDBAdapter adapter = new PodDBAdapter(context);
|
||||
adapter.open();
|
||||
for (FeedItem item : unreadItems) {
|
||||
|
@ -210,7 +210,7 @@ public class FeedManager {
|
|||
}
|
||||
|
||||
public void refreshAllFeeds(Context context) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Refreshing all feeds.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Refreshing all feeds.");
|
||||
for (Feed feed : feeds) {
|
||||
refreshFeed(context, feed);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ public class FeedManager {
|
|||
|
||||
/** Removes all items in queue */
|
||||
public void clearQueue(Context context) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Clearing queue");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Clearing queue");
|
||||
PodDBAdapter adapter = new PodDBAdapter(context);
|
||||
adapter.open();
|
||||
queue.clear();
|
||||
|
@ -287,7 +287,7 @@ public class FeedManager {
|
|||
}
|
||||
|
||||
public void moveQueueItem(Context context, FeedItem item, int delta) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Moving queue item");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Moving queue item");
|
||||
int itemIndex = queue.indexOf(item);
|
||||
int newIndex = itemIndex + delta;
|
||||
if (newIndex >= 0 && newIndex < queue.size()) {
|
||||
|
@ -331,7 +331,7 @@ public class FeedManager {
|
|||
// Look up feed in the feedslist
|
||||
final Feed savedFeed = searchFeedByLink(newFeed.getLink());
|
||||
if (savedFeed == null) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG,
|
||||
if (AppConfig.DEBUG) Log.d(TAG,
|
||||
"Found no existing Feed with title " + newFeed.getTitle()
|
||||
+ ". Adding as new one.");
|
||||
// Add a new Feed
|
||||
|
@ -340,7 +340,7 @@ public class FeedManager {
|
|||
|
||||
return newFeed;
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Feed with title " + newFeed.getTitle()
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Feed with title " + newFeed.getTitle()
|
||||
+ " already exists. Syncing new with existing one.");
|
||||
// Look for new or updated Items
|
||||
for (int idx = 0; idx < newFeed.getItems().size(); idx++) {
|
||||
|
@ -561,7 +561,7 @@ public class FeedManager {
|
|||
}
|
||||
|
||||
private void extractFeedlistFromCursor(Context context, PodDBAdapter adapter) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Extracting Feedlist");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Extracting Feedlist");
|
||||
Cursor feedlistCursor = adapter.getAllFeedsCursor();
|
||||
if (feedlistCursor.moveToFirst()) {
|
||||
do {
|
||||
|
@ -596,7 +596,7 @@ public class FeedManager {
|
|||
|
||||
private ArrayList<FeedItem> extractFeedItemsFromCursor(Context context,
|
||||
Feed feed, Cursor itemlistCursor, PodDBAdapter adapter) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle());
|
||||
ArrayList<FeedItem> items = new ArrayList<FeedItem>();
|
||||
ArrayList<String> mediaIds = new ArrayList<String>();
|
||||
|
||||
|
@ -690,7 +690,7 @@ public class FeedManager {
|
|||
|
||||
private void extractDownloadLogFromCursor(Context context,
|
||||
PodDBAdapter adapter) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Extracting DownloadLog");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Extracting DownloadLog");
|
||||
Cursor logCursor = adapter.getDownloadLogCursor();
|
||||
if (logCursor.moveToFirst()) {
|
||||
do {
|
||||
|
@ -722,7 +722,7 @@ public class FeedManager {
|
|||
}
|
||||
|
||||
private void extractQueueFromCursor(Context context, PodDBAdapter adapter) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Extracting Queue");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Extracting Queue");
|
||||
Cursor cursor = adapter.getQueueCursor();
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
|
|
|
@ -7,7 +7,7 @@ import de.danoeh.antennapod.feed.*;
|
|||
import de.danoeh.antennapod.service.DownloadService;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.util.FeedMenuHandler;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
@ -59,7 +59,7 @@ public class FeedlistFragment extends SherlockListFragment implements
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Creating");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Creating");
|
||||
manager = FeedManager.getInstance();
|
||||
fla = new FeedlistAdapter(pActivity, 0, manager.getFeeds());
|
||||
setListAdapter(fla);
|
||||
|
@ -82,7 +82,7 @@ public class FeedlistFragment extends SherlockListFragment implements
|
|||
public boolean onItemLongClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
Feed selection = fla.getItem(position);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Selected Feed with title " + selection.getTitle());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Selected Feed with title " + selection.getTitle());
|
||||
if (selection != null) {
|
||||
if (mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
|
@ -124,7 +124,7 @@ public class FeedlistFragment extends SherlockListFragment implements
|
|||
private BroadcastReceiver contentUpdate = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
|
||||
fla.notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ import android.webkit.WebView;
|
|||
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
|
@ -132,7 +132,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||
"utf-8", "about:blank");
|
||||
getSherlockActivity()
|
||||
.setSupportProgressBarIndeterminateVisibility(false);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Webview loaded");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Webview loaded");
|
||||
webViewLoader = null;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Loading Webview");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Loading Webview");
|
||||
data = "";
|
||||
if (item.getContentEncoded() == null
|
||||
&& item.getDescription() != null) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import de.danoeh.antennapod.feed.FeedManager;
|
|||
import de.danoeh.antennapod.service.DownloadService;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.util.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Displays a list of FeedItems. */
|
||||
|
@ -140,7 +140,7 @@ public class ItemlistFragment extends SherlockListFragment implements
|
|||
private BroadcastReceiver contentUpdate = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received contentUpdate Intent.");
|
||||
fila.notifyDataSetChanged();
|
||||
updateProgressBarVisibility();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package de.danoeh.antennapod.receiver;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
@ -19,7 +19,7 @@ public class FeedUpdateReceiver extends BroadcastReceiver {
|
|||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals(ACTION_REFRESH_FEEDS)) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received intent");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received intent");
|
||||
boolean mobileUpdate = PreferenceManager
|
||||
.getDefaultSharedPreferences(
|
||||
context.getApplicationContext()).getBoolean(
|
||||
|
@ -27,7 +27,7 @@ public class FeedUpdateReceiver extends BroadcastReceiver {
|
|||
if (mobileUpdate || connectedToWifi(context)) {
|
||||
FeedManager.getInstance().refreshAllFeeds(context);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG,
|
||||
if (AppConfig.DEBUG) Log.d(TAG,
|
||||
"Blocking automatic update: no wifi available / no mobile updates allowed");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package de.danoeh.antennapod.receiver;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.service.PlaybackService;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
|
@ -20,7 +20,7 @@ public class MediaButtonReceiver extends BroadcastReceiver {
|
|||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received intent");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received intent");
|
||||
KeyEvent event = (KeyEvent) intent.getExtras().get(
|
||||
Intent.EXTRA_KEY_EVENT);
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package de.danoeh.antennapod.receiver;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.service.PlayerWidgetService;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
|
@ -25,7 +25,7 @@ public class PlayerWidget extends AppWidgetProvider {
|
|||
@Override
|
||||
public void onEnabled(Context context) {
|
||||
super.onEnabled(context);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Widget enabled");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Widget enabled");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.activity.DownloadActivity;
|
||||
import de.danoeh.antennapod.activity.MediaplayerActivity;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
|
@ -101,7 +101,7 @@ public class DownloadService extends Service {
|
|||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onCreate() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Service started");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Service started");
|
||||
isRunning = true;
|
||||
completedDownloads = new ArrayList<DownloadStatus>();
|
||||
registerReceiver(downloadReceiver, createIntentFilter());
|
||||
|
@ -126,7 +126,7 @@ public class DownloadService extends Service {
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Service shutting down");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Service shutting down");
|
||||
isRunning = false;
|
||||
sendBroadcast(new Intent(ACTION_FEED_SYNC_COMPLETED));
|
||||
mediaplayer.release();
|
||||
|
@ -143,17 +143,17 @@ public class DownloadService extends Service {
|
|||
|
||||
/** Shuts down Executor service and prepares for shutdown */
|
||||
private void initiateShutdown() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Initiating shutdown");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Initiating shutdown");
|
||||
// Wait until PoolExecutor is done
|
||||
Thread waiter = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
syncExecutor.shutdown();
|
||||
try {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Starting to wait for termination");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Starting to wait for termination");
|
||||
boolean b = syncExecutor.awaitTermination(20L,
|
||||
TimeUnit.SECONDS);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Stopping waiting for termination; Result : "
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Stopping waiting for termination; Result : "
|
||||
+ b);
|
||||
|
||||
stopSelf();
|
||||
|
@ -180,7 +180,7 @@ public class DownloadService extends Service {
|
|||
.setSmallIcon(android.R.drawable.stat_notify_sync_noanim);
|
||||
|
||||
startForeground(NOTIFICATION_ID, notificationBuilder.getNotification());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Notification set up");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Notification set up");
|
||||
}
|
||||
|
||||
private BroadcastReceiver downloadReceiver = new BroadcastReceiver() {
|
||||
|
@ -189,7 +189,7 @@ public class DownloadService extends Service {
|
|||
int status = -1;
|
||||
boolean successful = false;
|
||||
int reason = 0;
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received 'Download Complete' - message.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received 'Download Complete' - message.");
|
||||
long downloadId = intent.getLongExtra(
|
||||
DownloadManager.EXTRA_DOWNLOAD_ID, 0);
|
||||
// get status
|
||||
|
@ -283,7 +283,7 @@ public class DownloadService extends Service {
|
|||
}
|
||||
}
|
||||
if (createReport) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Creating report");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Creating report");
|
||||
int successfulDownloads = 0;
|
||||
int failedDownloads = 0;
|
||||
for (DownloadStatus status : completedDownloads) {
|
||||
|
@ -314,7 +314,7 @@ public class DownloadService extends Service {
|
|||
nm.notify(REPORT_ID, notification);
|
||||
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "No report is created");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "No report is created");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,21 +335,21 @@ public class DownloadService extends Service {
|
|||
|
||||
/** Is called whenever a Feed is downloaded */
|
||||
private void handleCompletedFeedDownload(Context context, Feed feed) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed Feed Download");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Handling completed Feed Download");
|
||||
syncExecutor.execute(new FeedSyncThread(feed, this));
|
||||
|
||||
}
|
||||
|
||||
/** Is called whenever a Feed-Image is downloaded */
|
||||
private void handleCompletedImageDownload(Context context, FeedImage image) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed Image Download");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Handling completed Image Download");
|
||||
syncExecutor.execute(new ImageHandlerThread(image, this));
|
||||
}
|
||||
|
||||
/** Is called whenever a FeedMedia is downloaded. */
|
||||
private void handleCompletedFeedMediaDownload(Context context,
|
||||
FeedMedia media) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Handling completed FeedMedia Download");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Handling completed FeedMedia Download");
|
||||
syncExecutor.execute(new MediaHandlerThread(media, this));
|
||||
}
|
||||
|
||||
|
@ -381,14 +381,14 @@ public class DownloadService extends Service {
|
|||
|
||||
try {
|
||||
feed = handler.parseFeed(feed);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, feed.getTitle() + " parsed");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, feed.getTitle() + " parsed");
|
||||
|
||||
feed.setDownloadId(0);
|
||||
// Save information of feed in DB
|
||||
savedFeed = manager.updateFeed(service, feed);
|
||||
// Download Feed Image if provided and not downloaded
|
||||
if (savedFeed.getImage().isDownloaded() == false) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Feed has image; Downloading....");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Feed has image; Downloading....");
|
||||
imageId = requester.downloadImage(service, feed.getImage());
|
||||
hasImage = true;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ public class DownloadService extends Service {
|
|||
/** Delete files that aren't needed anymore */
|
||||
private void cleanup() {
|
||||
if (new File(feed.getFile_url()).delete())
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Successfully deleted cache file.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Successfully deleted cache file.");
|
||||
else
|
||||
Log.e(TAG, "Failed to delete cache file.");
|
||||
feed.setFile_url(null);
|
||||
|
@ -481,7 +481,7 @@ public class DownloadService extends Service {
|
|||
e.printStackTrace();
|
||||
}
|
||||
media.setDuration(mediaplayer.getDuration());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Duration of file is " + media.getDuration());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Duration of file is " + media.getDuration());
|
||||
mediaplayer.reset();
|
||||
long statusId = saveDownloadStatus(new DownloadStatus(media, 0,
|
||||
true));
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.support.v4.app.NotificationCompat;
|
|||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MediaplayerActivity;
|
||||
|
@ -111,7 +111,7 @@ public class PlaybackService extends Service {
|
|||
isRunning = true;
|
||||
pausedBecauseOfTransientAudiofocusLoss = false;
|
||||
status = PlayerStatus.STOPPED;
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Service created.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Service created.");
|
||||
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
manager = FeedManager.getInstance();
|
||||
player = new MediaPlayer();
|
||||
|
@ -133,7 +133,7 @@ public class PlaybackService extends Service {
|
|||
super.onDestroy();
|
||||
isRunning = false;
|
||||
unregisterReceiver(headsetDisconnected);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Service is about to be destroyed");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Service is about to be destroyed");
|
||||
audioManager.unregisterMediaButtonEventReceiver(mediaButtonReceiver);
|
||||
audioManager.abandonAudioFocus(audioFocusChangeListener);
|
||||
player.release();
|
||||
|
@ -152,24 +152,24 @@ public class PlaybackService extends Service {
|
|||
public void onAudioFocusChange(int focusChange) {
|
||||
switch (focusChange) {
|
||||
case AudioManager.AUDIOFOCUS_LOSS:
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Lost audio focus");
|
||||
pause(true);
|
||||
stopSelf();
|
||||
break;
|
||||
case AudioManager.AUDIOFOCUS_GAIN:
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Gained audio focus");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Gained audio focus");
|
||||
if (pausedBecauseOfTransientAudiofocusLoss) {
|
||||
play();
|
||||
}
|
||||
break;
|
||||
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Ducking...");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Ducking...");
|
||||
audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
|
||||
AudioManager.ADJUST_LOWER, 0);
|
||||
pausedBecauseOfTransientAudiofocusLoss = true;
|
||||
break;
|
||||
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Pausing...");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Pausing...");
|
||||
pause(false);
|
||||
pausedBecauseOfTransientAudiofocusLoss = true;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class PlaybackService extends Service {
|
|||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
int keycode = intent.getIntExtra(MediaButtonReceiver.EXTRA_KEYCODE, -1);
|
||||
if (keycode != -1) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Received media button event");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Received media button event");
|
||||
handleKeycode(keycode);
|
||||
} else {
|
||||
|
||||
|
@ -257,7 +257,7 @@ public class PlaybackService extends Service {
|
|||
* mediaplayer.
|
||||
*/
|
||||
public void setVideoSurface(SurfaceHolder sh) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Setting display");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Setting display");
|
||||
player.setDisplay(null);
|
||||
player.setDisplay(sh);
|
||||
if (status == PlayerStatus.STOPPED
|
||||
|
@ -360,7 +360,7 @@ public class PlaybackService extends Service {
|
|||
private MediaPlayer.OnPreparedListener preparedListener = new MediaPlayer.OnPreparedListener() {
|
||||
@Override
|
||||
public void onPrepared(MediaPlayer mp) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Resource prepared");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Resource prepared");
|
||||
mp.seekTo(media.getPosition());
|
||||
setStatus(PlayerStatus.PREPARED);
|
||||
if (startWhenPrepared) {
|
||||
|
@ -399,7 +399,7 @@ public class PlaybackService extends Service {
|
|||
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mp) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Playback completed");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Playback completed");
|
||||
// Save state
|
||||
positionSaver.cancel(true);
|
||||
media.setPosition(0);
|
||||
|
@ -416,14 +416,14 @@ public class PlaybackService extends Service {
|
|||
.getBoolean(PodcastApp.PREF_FOLLOW_QUEUE, false);
|
||||
FeedItem nextItem = manager.getFirstQueueItem();
|
||||
if (isInQueue && followQueue && nextItem != null) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Loading next item in queue");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Loading next item in queue");
|
||||
media = nextItem.getMedia();
|
||||
feed = nextItem.getFeed();
|
||||
shouldStream = !media.isDownloaded();
|
||||
resetVideoSurface();
|
||||
sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, 0);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Stopping playback");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Stopping playback");
|
||||
stopWidgetUpdater();
|
||||
setStatus(PlayerStatus.STOPPED);
|
||||
stopForeground(true);
|
||||
|
@ -449,7 +449,7 @@ public class PlaybackService extends Service {
|
|||
*/
|
||||
public void pause(boolean abandonFocus) {
|
||||
if (player.isPlaying()) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Pausing playback.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Pausing playback.");
|
||||
player.pause();
|
||||
if (abandonFocus) {
|
||||
audioManager.abandonAudioFocus(audioFocusChangeListener);
|
||||
|
@ -478,8 +478,8 @@ public class PlaybackService extends Service {
|
|||
AudioManager.AUDIOFOCUS_GAIN);
|
||||
|
||||
if (focusGained == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Audiofocus successfully requested");
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Resuming/Starting playback");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Audiofocus successfully requested");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Resuming/Starting playback");
|
||||
SharedPreferences.Editor editor = getApplicationContext()
|
||||
.getSharedPreferences(PodcastApp.PREF_NAME, 0).edit();
|
||||
editor.putLong(PREF_LAST_PLAYED_ID, media.getId());
|
||||
|
@ -495,13 +495,13 @@ public class PlaybackService extends Service {
|
|||
setupNotification();
|
||||
pausedBecauseOfTransientAudiofocusLoss = false;
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Failed to request Audiofocus");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Failed to request Audiofocus");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setStatus(PlayerStatus newStatus) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Setting status to " + newStatus);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Setting status to " + newStatus);
|
||||
status = newStatus;
|
||||
sendBroadcast(new Intent(ACTION_PLAYER_STATUS_CHANGED));
|
||||
updateWidget();
|
||||
|
@ -529,7 +529,7 @@ public class PlaybackService extends Service {
|
|||
.setSmallIcon(R.drawable.ic_stat_antenna);
|
||||
|
||||
startForeground(NOTIFICATION_ID, notificationBuilder.getNotification());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Notification set up");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Notification set up");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -543,7 +543,7 @@ public class PlaybackService extends Service {
|
|||
}
|
||||
|
||||
public void seek(int i) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Seeking position " + i);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Seeking position " + i);
|
||||
if (shouldStream) {
|
||||
statusBeforeSeek = status;
|
||||
setStatus(PlayerStatus.SEEKING);
|
||||
|
@ -554,7 +554,7 @@ public class PlaybackService extends Service {
|
|||
|
||||
/** Saves the current position of the media file to the DB */
|
||||
private synchronized void saveCurrentPosition() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Saving current position to " + player.getCurrentPosition());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Saving current position to " + player.getCurrentPosition());
|
||||
media.setPosition(player.getCurrentPosition());
|
||||
manager.setFeedMedia(this, media);
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ public class PlaybackService extends Service {
|
|||
}
|
||||
|
||||
private void updateWidget() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Sending widget update request");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Sending widget update request");
|
||||
PlaybackService.this.sendBroadcast(new Intent(
|
||||
PlayerWidget.FORCE_WIDGET_UPDATE));
|
||||
}
|
||||
|
@ -595,18 +595,18 @@ public class PlaybackService extends Service {
|
|||
if (intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) {
|
||||
int state = intent.getIntExtra("state", -1);
|
||||
if (state != -1) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Headset plug event. State is " + state);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Headset plug event. State is " + state);
|
||||
boolean pauseOnDisconnect = PreferenceManager
|
||||
.getDefaultSharedPreferences(
|
||||
getApplicationContext())
|
||||
.getBoolean(
|
||||
PodcastApp.PREF_PAUSE_ON_HEADSET_DISCONNECT,
|
||||
false);
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "pauseOnDisconnect preference is "
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "pauseOnDisconnect preference is "
|
||||
+ pauseOnDisconnect);
|
||||
if (state == UNPLUGGED && pauseOnDisconnect
|
||||
&& status == PlayerStatus.PLAYING) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG,
|
||||
if (AppConfig.DEBUG) Log.d(TAG,
|
||||
"Pausing playback because headset was disconnected");
|
||||
pause(true);
|
||||
}
|
||||
|
@ -628,11 +628,11 @@ public class PlaybackService extends Service {
|
|||
Thread.sleep(WAITING_INTERVALL);
|
||||
saveCurrentPosition();
|
||||
} catch (InterruptedException e) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG,
|
||||
if (AppConfig.DEBUG) Log.d(TAG,
|
||||
"Thread was interrupted while waiting. Finishing now...");
|
||||
return null;
|
||||
} catch (IllegalStateException e) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Player is in illegal state. Finishing now");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Player is in illegal state. Finishing now");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import de.danoeh.antennapod.feed.FeedMedia;
|
|||
import de.danoeh.antennapod.receiver.MediaButtonReceiver;
|
||||
import de.danoeh.antennapod.receiver.PlayerWidget;
|
||||
import de.danoeh.antennapod.util.Converter;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Updates the state of the player widget */
|
||||
|
@ -34,7 +34,7 @@ public class PlayerWidgetService extends Service {
|
|||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Service created");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Service created");
|
||||
isUpdating = false;
|
||||
}
|
||||
|
||||
|
@ -55,14 +55,14 @@ public class PlayerWidgetService extends Service {
|
|||
isUpdating = false;
|
||||
}
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG,
|
||||
if (AppConfig.DEBUG) Log.d(TAG,
|
||||
"Service was called while updating. Ignoring update request");
|
||||
}
|
||||
return Service.START_NOT_STICKY;
|
||||
}
|
||||
|
||||
private void updateViews() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Updating widget views");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Updating widget views");
|
||||
ComponentName playerWidget = new ComponentName(this, PlayerWidget.class);
|
||||
AppWidgetManager manager = AppWidgetManager.getInstance(this);
|
||||
RemoteViews views = new RemoteViews(getPackageName(),
|
||||
|
@ -88,7 +88,7 @@ public class PlayerWidgetService extends Service {
|
|||
views.setOnClickPendingIntent(R.id.butPlay,
|
||||
createMediaButtonIntent());
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "No media playing. Displaying defaultt views");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "No media playing. Displaying defaultt views");
|
||||
views.setViewVisibility(R.id.txtvProgress, View.INVISIBLE);
|
||||
views.setTextViewText(R.id.txtvTitle,
|
||||
this.getString(R.string.no_media_playing_label));
|
||||
|
@ -118,7 +118,7 @@ public class PlayerWidgetService extends Service {
|
|||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Connection to service established");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Connection to service established");
|
||||
playbackService = ((PlaybackService.LocalBinder) service)
|
||||
.getService();
|
||||
updateViews();
|
||||
|
@ -128,7 +128,7 @@ public class PlayerWidgetService extends Service {
|
|||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
playbackService = null;
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Disconnected from service");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Disconnected from service");
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.concurrent.Callable;
|
|||
import de.danoeh.antennapod.feed.*;
|
||||
import de.danoeh.antennapod.service.DownloadService;
|
||||
import de.danoeh.antennapod.util.NumberGenerator;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
import android.util.Log;
|
||||
|
@ -61,15 +61,15 @@ public class DownloadRequester {// TODO handle externalstorage missing
|
|||
private long download(Context context, FeedFile item, File dest) {
|
||||
if (!isDownloadingFile(item)) {
|
||||
if (dest.exists()) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "File already exists. Deleting !");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "File already exists. Deleting !");
|
||||
dest.delete();
|
||||
}
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Requesting download of url " + item.getDownload_url());
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Requesting download of url " + item.getDownload_url());
|
||||
downloads.add(item);
|
||||
DownloadManager.Request request = new DownloadManager.Request(
|
||||
Uri.parse(item.getDownload_url())).setDestinationUri(Uri
|
||||
.fromFile(dest));
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Version is " + currentApi);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Version is " + currentApi);
|
||||
if (currentApi >= 11) {
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
|
||||
} else {
|
||||
|
@ -118,7 +118,7 @@ public class DownloadRequester {// TODO handle externalstorage missing
|
|||
* ID of the download to cancel
|
||||
* */
|
||||
public void cancelDownload(final Context context, final long id) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Cancelling download with id " + id);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Cancelling download with id " + id);
|
||||
DownloadManager dm = (DownloadManager) context
|
||||
.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
int removed = dm.remove(id);
|
||||
|
@ -135,7 +135,7 @@ public class DownloadRequester {// TODO handle externalstorage missing
|
|||
|
||||
/** Cancels all running downloads */
|
||||
public void cancelAllDownloads(Context context) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Cancelling all running downloads");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Cancelling all running downloads");
|
||||
DownloadManager dm = (DownloadManager) context
|
||||
.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
for (FeedFile f : downloads) {
|
||||
|
@ -230,7 +230,7 @@ public class DownloadRequester {// TODO handle externalstorage missing
|
|||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||
mService = ((DownloadService.LocalBinder) service).getService();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Connection to service established");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Connection to service established");
|
||||
mService.queryDownloads();
|
||||
mContext.unbindService(mConnection);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.danoeh.antennapod.storage;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.asynctask.DownloadStatus;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedCategory;
|
||||
|
@ -197,7 +197,7 @@ public class PodDBAdapter {
|
|||
|
||||
public PodDBAdapter open() {
|
||||
if (db == null || !db.isOpen() || db.isReadOnly()) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Opening DB");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Opening DB");
|
||||
try {
|
||||
db = helper.getWritableDatabase();
|
||||
} catch (SQLException ex) {
|
||||
|
@ -209,7 +209,7 @@ public class PodDBAdapter {
|
|||
}
|
||||
|
||||
public void close() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Closing DB");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Closing DB");
|
||||
db.close();
|
||||
}
|
||||
|
||||
|
@ -239,10 +239,10 @@ public class PodDBAdapter {
|
|||
values.put(KEY_LASTUPDATE, feed.getLastUpdate().getTime());
|
||||
if (feed.getId() == 0) {
|
||||
// Create new entry
|
||||
if (BuildConfig.DEBUG) Log.d(this.toString(), "Inserting new Feed into db");
|
||||
if (AppConfig.DEBUG) Log.d(this.toString(), "Inserting new Feed into db");
|
||||
feed.setId(db.insert(TABLE_NAME_FEEDS, null, values));
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(this.toString(), "Updating existing Feed in db");
|
||||
if (AppConfig.DEBUG) Log.d(this.toString(), "Updating existing Feed in db");
|
||||
db.update(TABLE_NAME_FEEDS, values, KEY_ID + "=?",
|
||||
new String[] { Long.toString(feed.getId()) });
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.xml.sax.helpers.DefaultHandler;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.syndication.namespace.Namespace;
|
||||
import de.danoeh.antennapod.syndication.namespace.SyndElement;
|
||||
|
@ -83,17 +83,17 @@ public class SyndHandler extends DefaultHandler {
|
|||
state.defaultNamespaces.push(new NSAtom());
|
||||
} else if (prefix.equals(NSAtom.NSTAG)) {
|
||||
state.namespaces.put(uri, new NSAtom());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Recognized Atom namespace");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Recognized Atom namespace");
|
||||
}
|
||||
} else if (uri.equals(NSContent.NSURI) && prefix.equals(NSContent.NSTAG)) {
|
||||
state.namespaces.put(uri, new NSContent());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Recognized Content namespace");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Recognized Content namespace");
|
||||
} else if (uri.equals(NSITunes.NSURI) && prefix.equals(NSITunes.NSTAG)) {
|
||||
state.namespaces.put(uri, new NSITunes());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Recognized ITunes namespace");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Recognized ITunes namespace");
|
||||
} else if (uri.equals(NSSimpleChapters.NSURI) && prefix.equals(NSSimpleChapters.NSTAG)) {
|
||||
state.namespaces.put(uri, new NSSimpleChapters());
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Recognized SimpleChapters namespace");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Recognized SimpleChapters namespace");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.xmlpull.v1.XmlPullParserFactory;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
|
||||
/** Gets the type of a specific feed by reading the root element. */
|
||||
|
@ -39,15 +39,15 @@ public class TypeGetter {
|
|||
if (eventType == XmlPullParser.START_TAG) {
|
||||
String tag = xpp.getName();
|
||||
if (tag.equals(ATOM_ROOT)) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Recognized type Atom");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Recognized type Atom");
|
||||
return Type.ATOM;
|
||||
} else if (tag.equals(RSS_ROOT)
|
||||
&& (xpp.getAttributeValue(null, "version")
|
||||
.equals("2.0"))) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Recognized type RSS 2.0");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Recognized type RSS 2.0");
|
||||
return Type.RSS20;
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Type is invalid");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Type is invalid");
|
||||
throw new UnsupportedFeedtypeException(Type.INVALID);
|
||||
}
|
||||
} else {
|
||||
|
@ -60,7 +60,7 @@ public class TypeGetter {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Type is invalid");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Type is invalid");
|
||||
throw new UnsupportedFeedtypeException(Type.INVALID);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
@ -34,22 +34,22 @@ public class ConnectionTester implements Runnable {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Testing connection");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Testing connection");
|
||||
try {
|
||||
URL url = new URL(strUrl);
|
||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||
con.connect();
|
||||
callback.onConnectionSuccessful();
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Connection seems to work");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Connection seems to work");
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
reason = DownloadError.ERROR_CONNECTION_ERROR;
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Connection failed");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Connection failed");
|
||||
callback.onConnectionFailure();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
reason = DownloadError.ERROR_CONNECTION_ERROR;
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Connection failed");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Connection failed");
|
||||
callback.onConnectionFailure();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import de.danoeh.antennapod.feed.FeedItem;
|
|||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.service.DownloadService;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Handles interactions with the FeedItemMenu. */
|
||||
|
@ -30,7 +30,7 @@ public class FeedMenuHandler {
|
|||
}
|
||||
|
||||
public static boolean onPrepareOptionsMenu(Menu menu, Feed selectedFeed) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Preparing options menu");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Preparing options menu");
|
||||
if (selectedFeed.getPaymentLink() != null) {
|
||||
menu.findItem(R.id.support_item).setVisible(true);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.shredzone.flattr4j.FlattrFactory;
|
|||
import org.shredzone.flattr4j.FlattrService;
|
||||
import org.shredzone.flattr4j.oauth.AccessToken;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class FlattrServiceCreator {
|
|||
|
||||
public static FlattrService getService(AccessToken token) {
|
||||
if (flattrService == null) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Creating new instance of Flattr Service");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Creating new instance of Flattr Service");
|
||||
FlattrFactory factory = FlattrFactory.getInstance();
|
||||
flattrService = factory.createFlattrService(token);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class FlattrServiceCreator {
|
|||
}
|
||||
|
||||
public static void deleteFlattrService() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Deleting service instance");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Deleting service instance");
|
||||
flattrService = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import android.os.AsyncTask;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.activity.FlattrAuthActivity;
|
||||
import de.danoeh.antennapod.asynctask.FlattrTokenFetcher;
|
||||
|
@ -64,15 +64,15 @@ public class FlattrUtils {
|
|||
*/
|
||||
private static AccessToken retrieveToken() {
|
||||
if (cachedToken == null) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Retrieving access token");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Retrieving access token");
|
||||
String token = PreferenceManager.getDefaultSharedPreferences(
|
||||
PodcastApp.getInstance())
|
||||
.getString(PREF_ACCESS_TOKEN, null);
|
||||
if (token != null) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Found access token. Caching.");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Found access token. Caching.");
|
||||
cachedToken = new AccessToken(token);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "No access token found");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "No access token found");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class FlattrUtils {
|
|||
|
||||
/** Stores the token as a preference */
|
||||
public static void storeToken(AccessToken token) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Storing token");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Storing token");
|
||||
SharedPreferences.Editor editor = PreferenceManager
|
||||
.getDefaultSharedPreferences(PodcastApp.getInstance()).edit();
|
||||
if (token != null) {
|
||||
|
@ -100,7 +100,7 @@ public class FlattrUtils {
|
|||
}
|
||||
|
||||
public static void deleteToken() {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Deleting flattr token");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Deleting flattr token");
|
||||
storeToken(null);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class FlattrUtils {
|
|||
}
|
||||
|
||||
public static void revokeAccessToken(Context context) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Revoking access token");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Revoking access token");
|
||||
deleteToken();
|
||||
FlattrServiceCreator.deleteFlattrService();
|
||||
showRevokeDialog(context);
|
||||
|
@ -156,7 +156,7 @@ public class FlattrUtils {
|
|||
}
|
||||
|
||||
public static void showNoTokenDialog(final Context context, final String url) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Creating showNoTokenDialog");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Creating showNoTokenDialog");
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.no_flattr_token_title);
|
||||
builder.setMessage(R.string.no_flattr_token_msg);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package de.danoeh.antennapod.util;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import android.util.Log;
|
||||
|
||||
/** Provides methods for checking and editing a URL.*/
|
||||
|
@ -26,12 +26,12 @@ public final class URLChecker {
|
|||
|
||||
if (!url.startsWith("http")) {
|
||||
builder.append("http://");
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Missing http; appending");
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Missing http; appending");
|
||||
}
|
||||
builder.append(url);
|
||||
|
||||
if (url.contains(FEEDBURNER_URL)) {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG,
|
||||
if (AppConfig.DEBUG) Log.d(TAG,
|
||||
"URL seems to be Feedburner URL; appending prefix");
|
||||
builder.append(FEEDBURNER_PREFIX);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue