diff --git a/media/android/NewsBlur/AndroidManifest.xml b/media/android/NewsBlur/AndroidManifest.xml index 89ac6c76d..4f5657f66 100644 --- a/media/android/NewsBlur/AndroidManifest.xml +++ b/media/android/NewsBlur/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="5" + android:versionName="0.9.20" > - diff --git a/media/android/NewsBlur/project.properties b/media/android/NewsBlur/project.properties index acc8b8f8d..93257074f 100644 --- a/media/android/NewsBlur/project.properties +++ b/media/android/NewsBlur/project.properties @@ -13,6 +13,4 @@ # Project target. target=android-14 android.library.reference.1=../../../../workspace/ActionbarSherlock 4.1/library -android.library.reference.2=../../../../../Android-SDK/extras/android/support/v7/gridlayout -android.library.reference.3=../../../../../code/JakeWharton-ActionBarSherlock-88fc341/library -android.library.reference.4=../../../../../code/android-sdks/extras/android/support/v7/gridlayout +android.library.reference.2=../../../../../code/JakeWharton-ActionBarSherlock-88fc341/library diff --git a/media/android/NewsBlur/src/com/newsblur/activity/AllSharedStoriesItemsList.java b/media/android/NewsBlur/src/com/newsblur/activity/AllSharedStoriesItemsList.java index a2ca40929..ef1ff8834 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/AllSharedStoriesItemsList.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/AllSharedStoriesItemsList.java @@ -28,7 +28,7 @@ public class AllSharedStoriesItemsList extends ItemsList { feedIds = new ArrayList(); Cursor cursor = getContentResolver().query(FeedProvider.SOCIAL_FEEDS_URI, null, null, null, null); - + startManagingCursor(cursor); while (cursor.moveToNext()) { feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.SOCIAL_FEED_ID))); } diff --git a/media/android/NewsBlur/src/com/newsblur/activity/AllSharedStoriesReading.java b/media/android/NewsBlur/src/com/newsblur/activity/AllSharedStoriesReading.java index b373e0c2b..ee337be80 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/AllSharedStoriesReading.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/AllSharedStoriesReading.java @@ -37,7 +37,7 @@ public class AllSharedStoriesReading extends Reading { setupCountCursor(); - stories = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getSelectionFromState(currentState), null, null); + stories = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); setTitle(getResources().getString(R.string.all_shared_stories)); storiesToMarkAsRead = new ValueMultimap(); readingAdapter = new MixedFeedsReadingAdapter(getSupportFragmentManager(), getContentResolver(), stories); @@ -50,12 +50,15 @@ public class AllSharedStoriesReading extends Reading { private void setupCountCursor() { Cursor countCursor = contentResolver.query(FeedProvider.FEED_COUNT_URI, null, DatabaseConstants.SOCIAL_INTELLIGENCE_SOME, null, null); + startManagingCursor(countCursor); + countCursor.moveToFirst(); negativeCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_NEG)); neutralCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_NEUT)); positiveCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_POS)); - Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getSelectionFromState(currentState), null, null); + Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); + startManagingCursor(cursor); feedIds = new ArrayList(); while (cursor.moveToNext()) { feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.FEED_ID))); diff --git a/media/android/NewsBlur/src/com/newsblur/activity/AllStoriesItemsList.java b/media/android/NewsBlur/src/com/newsblur/activity/AllStoriesItemsList.java index 8fb8b9953..13ef0a5b0 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/AllStoriesItemsList.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/AllStoriesItemsList.java @@ -27,7 +27,7 @@ public class AllStoriesItemsList extends ItemsList { feedIds = new ArrayList(); - Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getSelectionFromState(currentState), null, null); + Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); while (cursor.moveToNext()) { feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.FEED_ID))); diff --git a/media/android/NewsBlur/src/com/newsblur/activity/AllStoriesReading.java b/media/android/NewsBlur/src/com/newsblur/activity/AllStoriesReading.java index 97971b767..06c157775 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/AllStoriesReading.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/AllStoriesReading.java @@ -35,7 +35,7 @@ public class AllStoriesReading extends Reading { setupCountCursor(); - stories = contentResolver.query(FeedProvider.ALL_STORIES_URI, null, FeedProvider.getSelectionFromState(currentState), null, null); + stories = contentResolver.query(FeedProvider.ALL_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); setTitle(getResources().getString(R.string.all_stories)); storiesToMarkAsRead = new ValueMultimap(); readingAdapter = new MixedFeedsReadingAdapter(getSupportFragmentManager(), getContentResolver(), stories); @@ -53,7 +53,7 @@ public class AllStoriesReading extends Reading { neutralCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_NEUT)); positiveCount = countCursor.getInt(countCursor.getColumnIndex(DatabaseConstants.SUM_POS)); - Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getSelectionFromState(currentState), null, null); + Cursor cursor = getContentResolver().query(FeedProvider.FEEDS_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); feedIds = new ArrayList(); while (cursor.moveToNext()) { feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.FEED_ID))); diff --git a/media/android/NewsBlur/src/com/newsblur/activity/FeedItemsList.java b/media/android/NewsBlur/src/com/newsblur/activity/FeedItemsList.java index 1e6d011bb..6e1b056cb 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/FeedItemsList.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/FeedItemsList.java @@ -33,7 +33,7 @@ public class FeedItemsList extends ItemsList { feedId = getIntent().getStringExtra(EXTRA_FEED); final Uri feedUri = FeedProvider.FEEDS_URI.buildUpon().appendPath(feedId).build(); - Cursor cursor = getContentResolver().query(feedUri, null, FeedProvider.getSelectionFromState(currentState), null, null); + Cursor cursor = getContentResolver().query(feedUri, null, FeedProvider.getStorySelectionFromState(currentState), null, null); cursor.moveToFirst(); Feed feed = Feed.fromCursor(cursor); setTitle(feed.title); diff --git a/media/android/NewsBlur/src/com/newsblur/activity/FeedReading.java b/media/android/NewsBlur/src/com/newsblur/activity/FeedReading.java index 5f65f1c54..2505719af 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/FeedReading.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/FeedReading.java @@ -42,7 +42,7 @@ public class FeedReading extends Reading { Uri storiesURI = FeedProvider.FEED_STORIES_URI.buildUpon().appendPath(feedId).build(); storiesToMarkAsRead = new HashSet(); - stories = contentResolver.query(storiesURI, null, FeedProvider.getSelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC"); + stories = contentResolver.query(storiesURI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC"); final Uri feedUri = FeedProvider.FEEDS_URI.buildUpon().appendPath(feedId).build(); Cursor feedCursor = contentResolver.query(feedUri, null, null, null, null); diff --git a/media/android/NewsBlur/src/com/newsblur/activity/FolderItemsList.java b/media/android/NewsBlur/src/com/newsblur/activity/FolderItemsList.java index 4d29cc3b4..fd9207fc1 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/FolderItemsList.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/FolderItemsList.java @@ -40,7 +40,7 @@ public class FolderItemsList extends ItemsList { apiManager = new APIManager(this); final Uri feedsUri = FeedProvider.FEED_FOLDER_MAP_URI.buildUpon().appendPath(folderName).build(); - Cursor cursor = getContentResolver().query(feedsUri, new String[] { DatabaseConstants.FEED_ID } , FeedProvider.getSelectionFromState(currentState), null, null); + Cursor cursor = getContentResolver().query(feedsUri, new String[] { DatabaseConstants.FEED_ID } , FeedProvider.getStorySelectionFromState(currentState), null, null); while (cursor.moveToNext()) { feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.FEED_ID))); diff --git a/media/android/NewsBlur/src/com/newsblur/activity/FolderReading.java b/media/android/NewsBlur/src/com/newsblur/activity/FolderReading.java index dcf337dd3..eaf0ff8cd 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/FolderReading.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/FolderReading.java @@ -36,7 +36,7 @@ public class FolderReading extends Reading { Uri storiesURI = FeedProvider.MULTIFEED_STORIES_URI; storiesToMarkAsRead = new ValueMultimap(); - stories = contentResolver.query(storiesURI, null, FeedProvider.getSelectionFromState(currentState), feedIds, null); + stories = contentResolver.query(storiesURI, null, FeedProvider.getStorySelectionFromState(currentState), feedIds, null); readingAdapter = new MixedFeedsReadingAdapter(getSupportFragmentManager(), getContentResolver(), stories); setupFolderCount(); diff --git a/media/android/NewsBlur/src/com/newsblur/activity/ItemsList.java b/media/android/NewsBlur/src/com/newsblur/activity/ItemsList.java index 437925de7..2ee9f9ea0 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/ItemsList.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/ItemsList.java @@ -7,7 +7,6 @@ import android.util.Log; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.Window; import com.newsblur.R; diff --git a/media/android/NewsBlur/src/com/newsblur/activity/SocialFeedReading.java b/media/android/NewsBlur/src/com/newsblur/activity/SocialFeedReading.java index 878398f4d..def23a048 100644 --- a/media/android/NewsBlur/src/com/newsblur/activity/SocialFeedReading.java +++ b/media/android/NewsBlur/src/com/newsblur/activity/SocialFeedReading.java @@ -40,7 +40,7 @@ public class SocialFeedReading extends Reading { socialFeed = SocialFeed.fromCursor(contentResolver.query(socialFeedUri, null, null, null, null)); Uri storiesURI = FeedProvider.SOCIALFEED_STORIES_URI.buildUpon().appendPath(userId).build(); - stories = contentResolver.query(storiesURI, null, FeedProvider.getSelectionFromState(currentState), null, null); + stories = contentResolver.query(storiesURI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); setTitle(getIntent().getStringExtra(EXTRA_USERNAME)); readingAdapter = new MixedFeedsReadingAdapter(getSupportFragmentManager(), getContentResolver(), stories); diff --git a/media/android/NewsBlur/src/com/newsblur/database/FeedProvider.java b/media/android/NewsBlur/src/com/newsblur/database/FeedProvider.java index acc43cafd..8b9437d61 100644 --- a/media/android/NewsBlur/src/com/newsblur/database/FeedProvider.java +++ b/media/android/NewsBlur/src/com/newsblur/database/FeedProvider.java @@ -456,7 +456,7 @@ public class FeedProvider extends ContentProvider { } } - public static String getSelectionFromState(int state) { + public static String getStorySelectionFromState(int state) { String selection = null; switch (state) { case (AppConstants.STATE_ALL): @@ -471,6 +471,23 @@ public class FeedProvider extends ContentProvider { } return selection; } + + public static String getFolderSelectionFromState(int state) { + String selection = null; + switch (state) { + case (AppConstants.STATE_ALL): + selection = DatabaseConstants.FOLDER_INTELLIGENCE_ALL; + break; + case (AppConstants.STATE_SOME): + selection = DatabaseConstants.FOLDER_INTELLIGENCE_SOME; + break; + case (AppConstants.STATE_BEST): + selection = DatabaseConstants.FOLDER_INTELLIGENCE_BEST; + break; + } + return selection; + } + } diff --git a/media/android/NewsBlur/src/com/newsblur/database/MixedExpandableListAdapter.java b/media/android/NewsBlur/src/com/newsblur/database/MixedExpandableListAdapter.java index 8a15b4602..a8cadb789 100644 --- a/media/android/NewsBlur/src/com/newsblur/database/MixedExpandableListAdapter.java +++ b/media/android/NewsBlur/src/com/newsblur/database/MixedExpandableListAdapter.java @@ -25,6 +25,7 @@ import com.newsblur.R; import com.newsblur.activity.AllSharedStoriesItemsList; import com.newsblur.activity.AllStoriesItemsList; import com.newsblur.domain.Folder; +import com.newsblur.util.AppConstants; @SuppressWarnings("deprecation") public class MixedExpandableListAdapter extends BaseExpandableListAdapter{ @@ -58,7 +59,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{ private ViewBinder groupViewBinder; private ViewBinder blogViewBinder; - public String currentState = DatabaseConstants.FOLDER_INTELLIGENCE_SOME; + public int currentState = AppConstants.STATE_SOME; private Cursor allStoriesCountCursor, sharedStoriesCountCursor; private String TAG = "MixedExpandableAdapter"; @@ -132,7 +133,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{ final Folder parentFolder = Folder.fromCursor(folderCursor); Uri uri = null; uri = FeedProvider.FEED_FOLDER_MAP_URI.buildUpon().appendPath(parentFolder.getName()).build(); - return contentResolver.query(uri, null, null, new String[] { currentState }, null); + return contentResolver.query(uri, null, null, new String[] { FeedProvider.getFolderSelectionFromState(currentState) }, null); } @Override @@ -283,6 +284,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{ @Override public void onClick(View v) { Intent i = new Intent(context, AllSharedStoriesItemsList.class); + i.putExtra(AllStoriesItemsList.EXTRA_STATE, currentState); ((Activity) context).startActivityForResult(i, Activity.RESULT_OK); } diff --git a/media/android/NewsBlur/src/com/newsblur/fragment/AllSharedStoriesItemListFragment.java b/media/android/NewsBlur/src/com/newsblur/fragment/AllSharedStoriesItemListFragment.java index 3c3115a5c..3ffe146e4 100644 --- a/media/android/NewsBlur/src/com/newsblur/fragment/AllSharedStoriesItemListFragment.java +++ b/media/android/NewsBlur/src/com/newsblur/fragment/AllSharedStoriesItemListFragment.java @@ -62,7 +62,7 @@ public class AllSharedStoriesItemListFragment extends ItemListFragment implement itemList.setEmptyView(v.findViewById(R.id.empty_view)); contentResolver = getActivity().getContentResolver(); - Cursor cursor = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getSelectionFromState(currentState), null, null); + Cursor cursor = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); calculateTotals(); @@ -112,7 +112,7 @@ public class AllSharedStoriesItemListFragment extends ItemListFragment implement public void changeState(int state) { currentState = state; calculateTotals(); - Cursor cursor = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getSelectionFromState(currentState), null, null); + Cursor cursor = contentResolver.query(FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); adapter.swapCursor(cursor); } @@ -168,7 +168,7 @@ public class AllSharedStoriesItemListFragment extends ItemListFragment implement @Override public Loader onCreateLoader(int arg0, Bundle arg1) { - CursorLoader cursorLoader = new CursorLoader(getActivity(), FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getSelectionFromState(currentState), null, null); + CursorLoader cursorLoader = new CursorLoader(getActivity(), FeedProvider.ALL_SHARED_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, null); return cursorLoader; } diff --git a/media/android/NewsBlur/src/com/newsblur/fragment/AllStoriesItemListFragment.java b/media/android/NewsBlur/src/com/newsblur/fragment/AllStoriesItemListFragment.java index 73ab043bb..6afb110b2 100644 --- a/media/android/NewsBlur/src/com/newsblur/fragment/AllStoriesItemListFragment.java +++ b/media/android/NewsBlur/src/com/newsblur/fragment/AllStoriesItemListFragment.java @@ -62,7 +62,7 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load itemList.setEmptyView(v.findViewById(R.id.empty_view)); contentResolver = getActivity().getContentResolver(); - Cursor cursor = contentResolver.query(FeedProvider.ALL_STORIES_URI, null, FeedProvider.getSelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC"); + Cursor cursor = contentResolver.query(FeedProvider.ALL_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC"); calculateTotals(); @@ -112,7 +112,7 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load public void changeState(int state) { currentState = state; calculateTotals(); - final String selection = FeedProvider.getSelectionFromState(state); + final String selection = FeedProvider.getStorySelectionFromState(state); Cursor cursor = contentResolver.query(FeedProvider.ALL_STORIES_URI, null, selection, null, DatabaseConstants.STORY_SHARED_DATE + " DESC"); adapter.swapCursor(cursor); } @@ -169,7 +169,7 @@ public class AllStoriesItemListFragment extends ItemListFragment implements Load @Override public Loader onCreateLoader(int arg0, Bundle arg1) { - CursorLoader cursorLoader = new CursorLoader(getActivity(), FeedProvider.ALL_STORIES_URI, null, FeedProvider.getSelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " DESC"); + CursorLoader cursorLoader = new CursorLoader(getActivity(), FeedProvider.ALL_STORIES_URI, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " DESC"); return cursorLoader; } diff --git a/media/android/NewsBlur/src/com/newsblur/fragment/FeedItemListFragment.java b/media/android/NewsBlur/src/com/newsblur/fragment/FeedItemListFragment.java index dbe12ff2f..b9f5d5b8c 100644 --- a/media/android/NewsBlur/src/com/newsblur/fragment/FeedItemListFragment.java +++ b/media/android/NewsBlur/src/com/newsblur/fragment/FeedItemListFragment.java @@ -81,7 +81,7 @@ public class FeedItemListFragment extends ItemListFragment implements LoaderMana contentResolver = getActivity().getContentResolver(); storiesUri = FeedProvider.FEED_STORIES_URI.buildUpon().appendPath(feedId).build(); - Cursor cursor = contentResolver.query(storiesUri, null, FeedProvider.getSelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC"); + Cursor cursor = contentResolver.query(storiesUri, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC"); setupFeed(); @@ -111,7 +111,7 @@ public class FeedItemListFragment extends ItemListFragment implements LoaderMana @Override public Loader onCreateLoader(int loaderId, Bundle bundle) { Uri uri = FeedProvider.FEED_STORIES_URI.buildUpon().appendPath(feedId).build(); - CursorLoader cursorLoader = new CursorLoader(getActivity(), uri, null, FeedProvider.getSelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC"); + CursorLoader cursorLoader = new CursorLoader(getActivity(), uri, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_DATE + " DESC"); return cursorLoader; } @@ -145,7 +145,7 @@ public class FeedItemListFragment extends ItemListFragment implements LoaderMana public void changeState(int state) { currentState = state; - final String selection = FeedProvider.getSelectionFromState(state); + final String selection = FeedProvider.getStorySelectionFromState(state); Cursor cursor = contentResolver.query(storiesUri, null, selection, null, DatabaseConstants.STORY_DATE + " DESC"); adapter.swapCursor(cursor); } diff --git a/media/android/NewsBlur/src/com/newsblur/fragment/FolderItemListFragment.java b/media/android/NewsBlur/src/com/newsblur/fragment/FolderItemListFragment.java index 2fc6427b7..d64e53a0a 100644 --- a/media/android/NewsBlur/src/com/newsblur/fragment/FolderItemListFragment.java +++ b/media/android/NewsBlur/src/com/newsblur/fragment/FolderItemListFragment.java @@ -88,6 +88,7 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa Uri individualFolderUri = FeedProvider.FOLDERS_URI.buildUpon().appendPath(folderName).build(); Cursor folderCursor = contentResolver.query(individualFolderUri, null, null, null, null); + getActivity().startManagingCursor(folderCursor); folderCursor.moveToFirst(); positiveCount = folderCursor.getInt(folderCursor.getColumnIndex(DatabaseConstants.SUM_POS)); negativeCount = folderCursor.getInt(folderCursor.getColumnIndex(DatabaseConstants.SUM_NEG)); @@ -104,8 +105,9 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa contentResolver = getActivity().getContentResolver(); storiesUri = FeedProvider.MULTIFEED_STORIES_URI; - Cursor cursor = contentResolver.query(storiesUri, null, FeedProvider.getSelectionFromState(currentState), feedIds, null); - + Cursor cursor = contentResolver.query(storiesUri, null, FeedProvider.getStorySelectionFromState(currentState), feedIds, null); + getActivity().startManagingCursor(cursor); + String[] groupFrom = new String[] { DatabaseConstants.STORY_TITLE, DatabaseConstants.FEED_TITLE, DatabaseConstants.STORY_READ, DatabaseConstants.STORY_SHORTDATE, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS, DatabaseConstants.STORY_AUTHORS }; int[] groupTo = new int[] { R.id.row_item_title, R.id.row_item_feedtitle, R.id.row_item_title, R.id.row_item_date, R.id.row_item_sidebar, R.id.row_item_author }; @@ -126,7 +128,7 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa @Override public Loader onCreateLoader(int loaderId, Bundle bundle) { Uri uri = FeedProvider.MULTIFEED_STORIES_URI; - CursorLoader cursorLoader = new CursorLoader(getActivity(), uri, null, FeedProvider.getSelectionFromState(currentState), feedIds, DatabaseConstants.STORY_DATE + " DESC"); + CursorLoader cursorLoader = new CursorLoader(getActivity(), uri, null, FeedProvider.getStorySelectionFromState(currentState), feedIds, DatabaseConstants.STORY_DATE + " DESC"); return cursorLoader; } @@ -160,8 +162,9 @@ public class FolderItemListFragment extends ItemListFragment implements LoaderMa public void changeState(int state) { currentState = state; - final String selection = FeedProvider.getSelectionFromState(state); + final String selection = FeedProvider.getStorySelectionFromState(state); Cursor cursor = contentResolver.query(storiesUri, null, selection, feedIds, DatabaseConstants.STORY_DATE + " DESC"); + getActivity().startManagingCursor(cursor); adapter.swapCursor(cursor); } diff --git a/media/android/NewsBlur/src/com/newsblur/fragment/FolderListFragment.java b/media/android/NewsBlur/src/com/newsblur/fragment/FolderListFragment.java index 17137f907..19588dc53 100644 --- a/media/android/NewsBlur/src/com/newsblur/fragment/FolderListFragment.java +++ b/media/android/NewsBlur/src/com/newsblur/fragment/FolderListFragment.java @@ -221,19 +221,19 @@ public class FolderListFragment extends Fragment implements OnGroupClickListener switch (state) { case (AppConstants.STATE_ALL): groupSelection = DatabaseConstants.FOLDER_INTELLIGENCE_ALL; - blogSelection = DatabaseConstants.SOCIAL_INTELLIGENCE_ALL; - break; + blogSelection = DatabaseConstants.SOCIAL_INTELLIGENCE_ALL; + break; case (AppConstants.STATE_SOME): groupSelection = DatabaseConstants.FOLDER_INTELLIGENCE_SOME; - blogSelection = DatabaseConstants.SOCIAL_INTELLIGENCE_SOME; - break; + blogSelection = DatabaseConstants.SOCIAL_INTELLIGENCE_SOME; + break; case (AppConstants.STATE_BEST): groupSelection = DatabaseConstants.FOLDER_INTELLIGENCE_BEST; - blogSelection = DatabaseConstants.SOCIAL_INTELLIGENCE_BEST; - break; + blogSelection = DatabaseConstants.SOCIAL_INTELLIGENCE_BEST; + break; } - folderAdapter.currentState = groupSelection; + folderAdapter.currentState = state; Cursor cursor = resolver.query(FeedProvider.FOLDERS_URI, null, null, new String[] { groupSelection }, null); Cursor blogCursor = resolver.query(FeedProvider.SOCIAL_FEEDS_URI, null, blogSelection, null, null); Cursor countCursor = resolver.query(FeedProvider.FEED_COUNT_URI, null, DatabaseConstants.SOCIAL_INTELLIGENCE_SOME, null, null); diff --git a/media/android/NewsBlur/src/com/newsblur/fragment/ReadingItemFragment.java b/media/android/NewsBlur/src/com/newsblur/fragment/ReadingItemFragment.java index b136903f2..d8859160b 100644 --- a/media/android/NewsBlur/src/com/newsblur/fragment/ReadingItemFragment.java +++ b/media/android/NewsBlur/src/com/newsblur/fragment/ReadingItemFragment.java @@ -13,7 +13,6 @@ import android.os.Bundle; import android.os.Handler; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; -import android.support.v7.widget.GridLayout; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -332,12 +331,12 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra ViewUtils.setupCommentCount(getActivity(), view, story.commentCount + 1); final ImageView image = ViewUtils.createSharebarImage(getActivity(), imageLoader, user); - ((GridLayout) view.findViewById(R.id.reading_social_commentimages)).addView(image); + ((FlowLayout) view.findViewById(R.id.reading_social_commentimages)).addView(image); } else { ViewUtils.setupShareCount(getActivity(), view, story.sharedUserIds.length + 1); final ImageView image = ViewUtils.createSharebarImage(getActivity(), imageLoader, user); - ((GridLayout) view.findViewById(R.id.reading_social_shareimages)).addView(image); + ((FlowLayout) view.findViewById(R.id.reading_social_shareimages)).addView(image); } } else { View commentViewForUser = view.findViewWithTag(SetupCommentSectionTask.COMMENT_VIEW_BY + user.id); diff --git a/media/android/NewsBlur/src/com/newsblur/fragment/SocialFeedItemListFragment.java b/media/android/NewsBlur/src/com/newsblur/fragment/SocialFeedItemListFragment.java index 3c7de1191..7bb6b0b1a 100644 --- a/media/android/NewsBlur/src/com/newsblur/fragment/SocialFeedItemListFragment.java +++ b/media/android/NewsBlur/src/com/newsblur/fragment/SocialFeedItemListFragment.java @@ -61,7 +61,8 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load setupSocialFeed(); - Cursor cursor = contentResolver.query(storiesUri, null, FeedProvider.getSelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " DESC"); + Cursor cursor = contentResolver.query(storiesUri, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " DESC"); + getActivity().startManagingCursor(cursor); String[] groupFrom = new String[] { DatabaseConstants.FEED_FAVICON_URL, DatabaseConstants.FEED_TITLE, DatabaseConstants.STORY_TITLE, DatabaseConstants.STORY_SHORTDATE, DatabaseConstants.STORY_AUTHORS, DatabaseConstants.STORY_INTELLIGENCE_AUTHORS}; int[] groupTo = new int[] { R.id.row_item_feedicon, R.id.row_item_feedtitle, R.id.row_item_title, R.id.row_item_date, R.id.row_item_author, R.id.row_item_sidebar}; @@ -98,7 +99,7 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load @Override public Loader onCreateLoader(int loaderId, Bundle bundle) { Uri uri = FeedProvider.SOCIALFEED_STORIES_URI.buildUpon().appendPath(userId).build(); - CursorLoader cursorLoader = new CursorLoader(getActivity(), uri, null, FeedProvider.getSelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " DESC"); + CursorLoader cursorLoader = new CursorLoader(getActivity(), uri, null, FeedProvider.getStorySelectionFromState(currentState), null, DatabaseConstants.STORY_SHARED_DATE + " DESC"); return cursorLoader; } @@ -160,9 +161,10 @@ public class SocialFeedItemListFragment extends ItemListFragment implements Load public void changeState(int state) { currentState = state; - final String selection = FeedProvider.getSelectionFromState(state); + final String selection = FeedProvider.getStorySelectionFromState(state); Cursor cursor = contentResolver.query(storiesUri, null, selection, null, DatabaseConstants.STORY_SHARED_DATE + " DESC"); adapter.swapCursor(cursor); + getActivity().startManagingCursor(cursor); } @Override diff --git a/media/android/NewsBlur/src/com/newsblur/fragment/SyncUpdateFragment.java b/media/android/NewsBlur/src/com/newsblur/fragment/SyncUpdateFragment.java index 5ce7e314d..adcc4d9d2 100644 --- a/media/android/NewsBlur/src/com/newsblur/fragment/SyncUpdateFragment.java +++ b/media/android/NewsBlur/src/com/newsblur/fragment/SyncUpdateFragment.java @@ -11,7 +11,7 @@ import com.newsblur.service.DetachableResultReceiver.Receiver; import com.newsblur.service.SyncService; public class SyncUpdateFragment extends Fragment implements Receiver { - public static final String TAG = "SyncReadingFragment"; + public static final String TAG = "SyncUpdateFragment"; public DetachableResultReceiver receiver; public boolean syncRunning = false; diff --git a/media/android/NewsBlur/src/com/newsblur/service/SyncService.java b/media/android/NewsBlur/src/com/newsblur/service/SyncService.java index eb919fdc3..1f3ed8b67 100644 --- a/media/android/NewsBlur/src/com/newsblur/service/SyncService.java +++ b/media/android/NewsBlur/src/com/newsblur/service/SyncService.java @@ -110,6 +110,7 @@ public class SyncService extends IntentService { } } apiManager.refreshFeedCounts(); + cursor.close(); break; case EXTRA_TASK_MARK_STORY_READ: diff --git a/media/android/NewsBlur/src/com/newsblur/util/AppConstants.java b/media/android/NewsBlur/src/com/newsblur/util/AppConstants.java index 5882fa453..1316ca315 100644 --- a/media/android/NewsBlur/src/com/newsblur/util/AppConstants.java +++ b/media/android/NewsBlur/src/com/newsblur/util/AppConstants.java @@ -10,5 +10,6 @@ public class AppConstants { public static final int REGISTRATION_COMPLETED = 1; public static final String FOLDER_PRE = "folder_collapsed"; + public static final String NEWSBLUR_URL = "http://www.newsblur.com"; } diff --git a/media/android/NewsBlur/src/com/newsblur/util/ImageLoader.java b/media/android/NewsBlur/src/com/newsblur/util/ImageLoader.java index 588a121f4..18dfc1f7b 100644 --- a/media/android/NewsBlur/src/com/newsblur/util/ImageLoader.java +++ b/media/android/NewsBlur/src/com/newsblur/util/ImageLoader.java @@ -101,6 +101,9 @@ public class ImageLoader { } try { + if (url.startsWith("/")) { + url = AppConstants.NEWSBLUR_URL + url; + } final URL imageUrl = new URL(url); final HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection(); conn.setConnectTimeout(10000);