Made startup loading more stable

This commit is contained in:
daniel oeh 2012-06-26 17:56:47 +02:00
parent f4fa5dce5f
commit 81295bc07f
3 changed files with 33 additions and 7 deletions

View File

@ -12,14 +12,26 @@
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:textSize="16dp" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:textStyle="italic"
android:textColor="@color/gray" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="@color/gray"
android:textColor="@color/white"
android:textStyle="bold"
android:gravity="center_horizontal"
android:text="@string/description_label"/>
<WebView
android:id="@+id/webvDescription"
android:layout_width="match_parent"

View File

@ -122,6 +122,9 @@ public class FeedManager {
if (!item.isRead()) {
unreadItems.remove(item);
}
if (queue.contains(item)) {
removeQueueItem(context, item);
}
if (item.getMedia() != null && item.getMedia().isDownloaded()) {
File mediaFile = new File(item.getMedia().getFile_url());
mediaFile.delete();
@ -375,7 +378,7 @@ public class FeedManager {
}
private void extractFeedlistFromCursor(Context context, PodDBAdapter adapter) {
Log.d(TAG, "Extracting Feedlist");
Cursor feedlistCursor = adapter.getAllFeedsCursor();
if (feedlistCursor.moveToFirst()) {
do {
@ -416,6 +419,7 @@ public class FeedManager {
private ArrayList<FeedItem> extractFeedItemsFromCursor(Context context,
Feed feed, Cursor itemlistCursor, PodDBAdapter adapter) {
Log.d(TAG, "Extracting Feeditems of feed " + feed.getTitle());
ArrayList<FeedItem> items = new ArrayList<FeedItem>();
if (itemlistCursor.moveToFirst()) {
do {
@ -453,6 +457,7 @@ public class FeedManager {
private void extractDownloadLogFromCursor(Context context,
PodDBAdapter adapter) {
Log.d(TAG, "Extracting DownloadLog");
Cursor logCursor = adapter.getDownloadLogCursor();
if (logCursor.moveToFirst()) {
do {
@ -490,6 +495,7 @@ public class FeedManager {
}
private void extractQueueFromCursor(Context context, PodDBAdapter adapter) {
Log.d(TAG, "Extracting Downloadqueue");
Cursor cursor = adapter.getQueueCursor();
if (cursor.moveToFirst()) {
do {
@ -497,9 +503,15 @@ public class FeedManager {
.getColumnIndex(PodDBAdapter.KEY_ID));
Feed feed = getFeed(cursor.getLong(cursor
.getColumnIndex(PodDBAdapter.KEY_FEED)));
FeedItem item = getFeedItem(
cursor.getColumnIndex(PodDBAdapter.KEY_FEEDITEM), feed);
queue.add(index, item);
if (feed != null) {
FeedItem item = getFeedItem(
cursor.getColumnIndex(PodDBAdapter.KEY_FEEDITEM), feed);
if (item != null) {
queue.add(index, item);
}
}
} while (cursor.moveToNext());
}
cursor.close();

View File

@ -472,6 +472,7 @@ public class PodDBAdapter {
.getColumnIndex(KEY_FILE_URL)), cursor.getString(cursor
.getColumnIndex(KEY_DOWNLOAD_URL)), cursor.getInt(cursor
.getColumnIndex(KEY_DOWNLOADED)) > 0);
cursor.close();
return media;
}
@ -492,6 +493,7 @@ public class PodDBAdapter {
.getColumnIndex(KEY_FILE_URL)), cursor.getString(cursor
.getColumnIndex(KEY_DOWNLOAD_URL)), cursor.getInt(cursor
.getColumnIndex(KEY_DOWNLOADED)) > 0);
cursor.close();
return image;
}