Added TAGs for Logging
This commit is contained in:
parent
55418a92f2
commit
ba7759607d
|
@ -4,6 +4,7 @@ import de.podfetcher.activity.PodfetcherActivity;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
|
||||||
public class PodcastApp extends Application {
|
public class PodcastApp extends Application {
|
||||||
|
private static final String TAG = "PodcastApp";
|
||||||
|
|
||||||
private static PodcastApp singleton;
|
private static PodcastApp singleton;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import de.podfetcher.storage.DownloadRequester;
|
||||||
|
|
||||||
/** Activity for adding/editing a Feed */
|
/** Activity for adding/editing a Feed */
|
||||||
public class AddFeedActivity extends Activity {
|
public class AddFeedActivity extends Activity {
|
||||||
|
private static final String TAG = "AddFeedActivity";
|
||||||
|
|
||||||
private EditText etxtFeedurl;
|
private EditText etxtFeedurl;
|
||||||
private Button butConfirm;
|
private Button butConfirm;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
|
|
||||||
public class FeedlistActivity extends SherlockListActivity {
|
public class FeedlistActivity extends SherlockListActivity {
|
||||||
|
private static final String TAG = "FeedlistActivity";
|
||||||
|
|
||||||
private FeedManager manager;
|
private FeedManager manager;
|
||||||
private FeedlistAdapter fla;
|
private FeedlistAdapter fla;
|
||||||
|
|
|
@ -19,6 +19,8 @@ import com.actionbarsherlock.app.SherlockListActivity;
|
||||||
|
|
||||||
|
|
||||||
public class PodfetcherActivity extends SherlockListActivity {
|
public class PodfetcherActivity extends SherlockListActivity {
|
||||||
|
private static final String TAG = "PodfetcherActivity";
|
||||||
|
|
||||||
private final String[] ITEMS = {"Feeds", "Settings"};
|
private final String[] ITEMS = {"Feeds", "Settings"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.database.Cursor;
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
public class FeedManager {
|
public class FeedManager {
|
||||||
|
private static final String TAG = "FeedManager";
|
||||||
|
|
||||||
private static FeedManager singleton;
|
private static FeedManager singleton;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class DownloadService extends Service {
|
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 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";
|
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
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
Log.d(this.toString(), "Service started");
|
Log.d(TAG, "Service started");
|
||||||
registerReceiver(downloadReceiver, createIntentFilter());
|
registerReceiver(downloadReceiver, createIntentFilter());
|
||||||
syncExecutor = Executors.newSingleThreadExecutor();
|
syncExecutor = Executors.newSingleThreadExecutor();
|
||||||
manager = FeedManager.getInstance();
|
manager = FeedManager.getInstance();
|
||||||
|
@ -46,7 +47,7 @@ public class DownloadService extends Service {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
Log.d(this.toString(), "Service shutting down");
|
Log.d(TAG, "Service shutting down");
|
||||||
sendBroadcast(new Intent(ACTION_FEED_SYNC_COMPLETED));
|
sendBroadcast(new Intent(ACTION_FEED_SYNC_COMPLETED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,16 +59,16 @@ public class DownloadService extends Service {
|
||||||
|
|
||||||
/** Shuts down Executor service and prepares for shutdown */
|
/** Shuts down Executor service and prepares for shutdown */
|
||||||
private void initiateShutdown() {
|
private void initiateShutdown() {
|
||||||
Log.d(this.toString(), "Initiating shutdown");
|
Log.d(TAG, "Initiating shutdown");
|
||||||
// Wait until PoolExecutor is done
|
// Wait until PoolExecutor is done
|
||||||
Thread waiter = new Thread() {
|
Thread waiter = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
syncExecutor.shutdown();
|
syncExecutor.shutdown();
|
||||||
try {
|
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);
|
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();
|
stopSelf();
|
||||||
}catch(InterruptedException e) {
|
}catch(InterruptedException e) {
|
||||||
|
@ -103,7 +104,7 @@ public class DownloadService extends Service {
|
||||||
|
|
||||||
/** Is called whenever a Feed is downloaded */
|
/** Is called whenever a Feed is downloaded */
|
||||||
private void handleCompletedFeedDownload(Context context, Feed feed) {
|
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
|
// Get Feed Information
|
||||||
//feed.setFile_url((new File(requester.getFeedfilePath(context), requester.getFeedfileName(feed.getId()))).toString());
|
//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 */
|
/** Is called whenever a Feed-Image is downloaded */
|
||||||
private void handleCompletedImageDownload(Context context, FeedImage image) {
|
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);
|
requester.removeFeedImage(image);
|
||||||
//image.setFile_url(requester.getImagefilePath(context) + requester.getImagefileName(image.getId()));
|
//image.setFile_url(requester.getImagefilePath(context) + requester.getImagefileName(image.getId()));
|
||||||
manager.setFeedImage(this, image);
|
manager.setFeedImage(this, image);
|
||||||
|
@ -137,17 +138,17 @@ public class DownloadService extends Service {
|
||||||
FeedHandler handler = new FeedHandler();
|
FeedHandler handler = new FeedHandler();
|
||||||
|
|
||||||
feed = handler.parseFeed(feed);
|
feed = handler.parseFeed(feed);
|
||||||
Log.d(this.toString(), feed.getTitle() + " parsed");
|
Log.d(TAG, feed.getTitle() + " parsed");
|
||||||
// Download Feed Image if provided
|
// Download Feed Image if provided
|
||||||
if(feed.getImage() != null) {
|
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.downloadImage(service, feed.getImage());
|
||||||
}
|
}
|
||||||
requester.removeFeed(feed);
|
requester.removeFeed(feed);
|
||||||
// Save information of feed in DB
|
// Save information of feed in DB
|
||||||
manager.updateFeed(service, feed);
|
manager.updateFeed(service, feed);
|
||||||
Log.d(this.toString(), "Walking through " + feed.getItems().size() + " feeditems");
|
Log.d(TAG, "Walking through " + feed.getItems().size() + " feeditems");
|
||||||
Log.d(this.toString(), "Done.");
|
Log.d(TAG, "Done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.util.Log;
|
||||||
|
|
||||||
|
|
||||||
public class FeedSyncService extends Service {
|
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";
|
public static final String ACTION_FEED_SYNC_COMPLETED = "action.de.podfetcher.service.feed_sync_completed";
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ public class FeedSyncService extends Service {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
Log.d(this.toString(), "Service started");
|
Log.d(TAG, "Service started");
|
||||||
executor = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors() + 2);
|
executor = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors() + 2);
|
||||||
manager = FeedManager.getInstance();
|
manager = FeedManager.getInstance();
|
||||||
requester = DownloadRequester.getInstance();
|
requester = DownloadRequester.getInstance();
|
||||||
|
@ -65,7 +66,7 @@ public class FeedSyncService extends Service {
|
||||||
|
|
||||||
/** Prepares itself for stopping */
|
/** Prepares itself for stopping */
|
||||||
private void initiateShutdown() {
|
private void initiateShutdown() {
|
||||||
Log.d(this.toString(), "Initiating shutdown");
|
Log.d(TAG, "Initiating shutdown");
|
||||||
// Wait until PoolExecutor is done
|
// Wait until PoolExecutor is done
|
||||||
Thread waiter = new Thread() {
|
Thread waiter = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -104,7 +105,7 @@ public class FeedSyncService extends Service {
|
||||||
FeedHandler handler = new FeedHandler();
|
FeedHandler handler = new FeedHandler();
|
||||||
|
|
||||||
feed = handler.parseFeed(feed);
|
feed = handler.parseFeed(feed);
|
||||||
Log.d(this.toString(), feed.getTitle() + " parsed");
|
Log.d(TAG, feed.getTitle() + " parsed");
|
||||||
// Add Feeditems to the database
|
// Add Feeditems to the database
|
||||||
for(FeedItem item : feed.getItems()) {
|
for(FeedItem item : feed.getItems()) {
|
||||||
manager.addFeedItem(service, item);
|
manager.addFeedItem(service, item);
|
||||||
|
|
|
@ -15,6 +15,8 @@ import android.net.Uri;
|
||||||
|
|
||||||
|
|
||||||
public class DownloadRequester {
|
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_DOWNLOAD_ID = "extra.de.podfetcher.storage.download_id";
|
||||||
public static String EXTRA_ITEM_ID = "extra.de.podfetcher.storage.item_id";
|
public static String EXTRA_ITEM_ID = "extra.de.podfetcher.storage.item_id";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue