From ba7759607d5ad7d53d76b04b9d1f577e660e7927 Mon Sep 17 00:00:00 2001 From: Daniel Oeh Date: Wed, 11 Apr 2012 16:53:29 +0200 Subject: [PATCH] Added TAGs for Logging --- src/de/podfetcher/PodcastApp.java | 3 ++- .../podfetcher/activity/AddFeedActivity.java | 3 ++- .../podfetcher/activity/FeedlistActivity.java | 1 + .../activity/PodfetcherActivity.java | 2 ++ src/de/podfetcher/feed/FeedManager.java | 1 + .../podfetcher/service/DownloadService.java | 23 ++++++++++--------- .../podfetcher/service/FeedSyncService.java | 9 ++++---- .../podfetcher/storage/DownloadRequester.java | 2 ++ 8 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/de/podfetcher/PodcastApp.java b/src/de/podfetcher/PodcastApp.java index 0d60c4b37..ebaef0e43 100644 --- a/src/de/podfetcher/PodcastApp.java +++ b/src/de/podfetcher/PodcastApp.java @@ -4,7 +4,8 @@ import de.podfetcher.activity.PodfetcherActivity; import android.app.Application; public class PodcastApp extends Application { - + private static final String TAG = "PodcastApp"; + private static PodcastApp singleton; public static PodcastApp getInstance() { diff --git a/src/de/podfetcher/activity/AddFeedActivity.java b/src/de/podfetcher/activity/AddFeedActivity.java index 14cd30e54..696671b79 100644 --- a/src/de/podfetcher/activity/AddFeedActivity.java +++ b/src/de/podfetcher/activity/AddFeedActivity.java @@ -11,7 +11,8 @@ import de.podfetcher.storage.DownloadRequester; /** Activity for adding/editing a Feed */ public class AddFeedActivity extends Activity { - + private static final String TAG = "AddFeedActivity"; + private EditText etxtFeedurl; private Button butConfirm; diff --git a/src/de/podfetcher/activity/FeedlistActivity.java b/src/de/podfetcher/activity/FeedlistActivity.java index bf9411b60..c664447d1 100644 --- a/src/de/podfetcher/activity/FeedlistActivity.java +++ b/src/de/podfetcher/activity/FeedlistActivity.java @@ -18,6 +18,7 @@ import com.actionbarsherlock.view.MenuItem; public class FeedlistActivity extends SherlockListActivity { + private static final String TAG = "FeedlistActivity"; private FeedManager manager; private FeedlistAdapter fla; diff --git a/src/de/podfetcher/activity/PodfetcherActivity.java b/src/de/podfetcher/activity/PodfetcherActivity.java index 1c943656e..841e1ebb6 100644 --- a/src/de/podfetcher/activity/PodfetcherActivity.java +++ b/src/de/podfetcher/activity/PodfetcherActivity.java @@ -19,6 +19,8 @@ import com.actionbarsherlock.app.SherlockListActivity; public class PodfetcherActivity extends SherlockListActivity { + private static final String TAG = "PodfetcherActivity"; + private final String[] ITEMS = {"Feeds", "Settings"}; @Override diff --git a/src/de/podfetcher/feed/FeedManager.java b/src/de/podfetcher/feed/FeedManager.java index e8f3c2f0d..ce644dde8 100644 --- a/src/de/podfetcher/feed/FeedManager.java +++ b/src/de/podfetcher/feed/FeedManager.java @@ -15,6 +15,7 @@ import android.database.Cursor; * * */ public class FeedManager { + private static final String TAG = "FeedManager"; private static FeedManager singleton; diff --git a/src/de/podfetcher/service/DownloadService.java b/src/de/podfetcher/service/DownloadService.java index 625b4ab29..77e651a2c 100644 --- a/src/de/podfetcher/service/DownloadService.java +++ b/src/de/podfetcher/service/DownloadService.java @@ -22,6 +22,7 @@ import android.content.Context; import android.util.Log; public class DownloadService extends Service { + private static final String TAG = "DownloadService"; public static String ACTION_ALL_FEED_DOWNLOADS_COMPLETED = "action.de.podfetcher.storage.all_feed_downloads_completed"; public static final String ACTION_FEED_SYNC_COMPLETED = "action.de.podfetcher.service.feed_sync_completed"; @@ -32,7 +33,7 @@ public class DownloadService extends Service { @Override public void onCreate() { - Log.d(this.toString(), "Service started"); + Log.d(TAG, "Service started"); registerReceiver(downloadReceiver, createIntentFilter()); syncExecutor = Executors.newSingleThreadExecutor(); manager = FeedManager.getInstance(); @@ -46,7 +47,7 @@ public class DownloadService extends Service { @Override public void onDestroy() { - Log.d(this.toString(), "Service shutting down"); + Log.d(TAG, "Service shutting down"); sendBroadcast(new Intent(ACTION_FEED_SYNC_COMPLETED)); } @@ -58,16 +59,16 @@ public class DownloadService extends Service { /** Shuts down Executor service and prepares for shutdown */ private void initiateShutdown() { - Log.d(this.toString(), "Initiating shutdown"); + Log.d(TAG, "Initiating shutdown"); // Wait until PoolExecutor is done Thread waiter = new Thread() { @Override public void run() { syncExecutor.shutdown(); try { - Log.d(this.toString(), "Starting to wait for termination"); + Log.d(TAG, "Starting to wait for termination"); boolean b = syncExecutor.awaitTermination(20L, TimeUnit.SECONDS); - Log.d(this.toString(), "Stopping waiting for termination; Result : "+ b); + Log.d(TAG, "Stopping waiting for termination; Result : "+ b); stopSelf(); }catch(InterruptedException e) { @@ -103,7 +104,7 @@ public class DownloadService extends Service { /** Is called whenever a Feed is downloaded */ private void handleCompletedFeedDownload(Context context, Feed feed) { - Log.d(this.toString(), "Handling completed Feed Download"); + Log.d(TAG, "Handling completed Feed Download"); // Get Feed Information //feed.setFile_url((new File(requester.getFeedfilePath(context), requester.getFeedfileName(feed.getId()))).toString()); @@ -113,7 +114,7 @@ public class DownloadService extends Service { /** Is called whenever a Feed-Image is downloaded */ private void handleCompletedImageDownload(Context context, FeedImage image) { - Log.d(this.toString(), "Handling completed Image Download"); + Log.d(TAG, "Handling completed Image Download"); requester.removeFeedImage(image); //image.setFile_url(requester.getImagefilePath(context) + requester.getImagefileName(image.getId())); manager.setFeedImage(this, image); @@ -137,17 +138,17 @@ public class DownloadService extends Service { FeedHandler handler = new FeedHandler(); feed = handler.parseFeed(feed); - Log.d(this.toString(), feed.getTitle() + " parsed"); + Log.d(TAG, feed.getTitle() + " parsed"); // Download Feed Image if provided if(feed.getImage() != null) { - Log.d(this.toString(), "Feed has image; Downloading...."); + Log.d(TAG, "Feed has image; Downloading...."); requester.downloadImage(service, feed.getImage()); } requester.removeFeed(feed); // Save information of feed in DB manager.updateFeed(service, feed); - Log.d(this.toString(), "Walking through " + feed.getItems().size() + " feeditems"); - Log.d(this.toString(), "Done."); + Log.d(TAG, "Walking through " + feed.getItems().size() + " feeditems"); + Log.d(TAG, "Done."); } } diff --git a/src/de/podfetcher/service/FeedSyncService.java b/src/de/podfetcher/service/FeedSyncService.java index 76ca6e0d8..2b2e4927c 100644 --- a/src/de/podfetcher/service/FeedSyncService.java +++ b/src/de/podfetcher/service/FeedSyncService.java @@ -23,7 +23,8 @@ import android.util.Log; public class FeedSyncService extends Service { - + private static final String TAG = "FeedSyncService"; + public static final String ACTION_FEED_SYNC_COMPLETED = "action.de.podfetcher.service.feed_sync_completed"; private volatile ScheduledThreadPoolExecutor executor; @@ -32,7 +33,7 @@ public class FeedSyncService extends Service { @Override public void onCreate() { - Log.d(this.toString(), "Service started"); + Log.d(TAG, "Service started"); executor = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors() + 2); manager = FeedManager.getInstance(); requester = DownloadRequester.getInstance(); @@ -65,7 +66,7 @@ public class FeedSyncService extends Service { /** Prepares itself for stopping */ private void initiateShutdown() { - Log.d(this.toString(), "Initiating shutdown"); + Log.d(TAG, "Initiating shutdown"); // Wait until PoolExecutor is done Thread waiter = new Thread() { @Override @@ -104,7 +105,7 @@ public class FeedSyncService extends Service { FeedHandler handler = new FeedHandler(); feed = handler.parseFeed(feed); - Log.d(this.toString(), feed.getTitle() + " parsed"); + Log.d(TAG, feed.getTitle() + " parsed"); // Add Feeditems to the database for(FeedItem item : feed.getItems()) { manager.addFeedItem(service, item); diff --git a/src/de/podfetcher/storage/DownloadRequester.java b/src/de/podfetcher/storage/DownloadRequester.java index f25a394ab..3316e67c1 100644 --- a/src/de/podfetcher/storage/DownloadRequester.java +++ b/src/de/podfetcher/storage/DownloadRequester.java @@ -15,6 +15,8 @@ import android.net.Uri; public class DownloadRequester { + private static final String TAG = "DownloadRequester"; + public static String EXTRA_DOWNLOAD_ID = "extra.de.podfetcher.storage.download_id"; public static String EXTRA_ITEM_ID = "extra.de.podfetcher.storage.item_id";