Added TAGs for Logging
This commit is contained in:
parent
55418a92f2
commit
ba7759607d
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -15,6 +15,7 @@ import android.database.Cursor;
|
|||
*
|
||||
* */
|
||||
public class FeedManager {
|
||||
private static final String TAG = "FeedManager";
|
||||
|
||||
private static FeedManager singleton;
|
||||
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
Loading…
Reference in New Issue