mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Removed reliance on Gridlayout. Fixed cursor management issues.
This commit is contained in:
parent
471cebf327
commit
089be33ac6
25 changed files with 75 additions and 48 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.newsblur"
|
||||
android:versionCode="4"
|
||||
android:versionName="0.9.15" >
|
||||
android:versionCode="5"
|
||||
android:versionName="0.9.20" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
|
@ -27,7 +27,6 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".activity.LoginProgress"
|
||||
android:label="@string/newsblur" />
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,7 +28,7 @@ public class AllSharedStoriesItemsList extends ItemsList {
|
|||
feedIds = new ArrayList<String>();
|
||||
|
||||
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)));
|
||||
}
|
||||
|
|
|
@ -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<String>();
|
||||
while (cursor.moveToNext()) {
|
||||
feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.FEED_ID)));
|
||||
|
|
|
@ -27,7 +27,7 @@ public class AllStoriesItemsList extends ItemsList {
|
|||
|
||||
feedIds = new ArrayList<String>();
|
||||
|
||||
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)));
|
||||
|
|
|
@ -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<String>();
|
||||
while (cursor.moveToNext()) {
|
||||
feedIds.add(cursor.getString(cursor.getColumnIndex(DatabaseConstants.FEED_ID)));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class FeedReading extends Reading {
|
|||
|
||||
Uri storiesURI = FeedProvider.FEED_STORIES_URI.buildUpon().appendPath(feedId).build();
|
||||
storiesToMarkAsRead = new HashSet<String>();
|
||||
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);
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<Cursor> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Cursor> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Cursor> 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);
|
||||
}
|
||||
|
|
|
@ -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<Cursor> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Cursor> 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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ public class SyncService extends IntentService {
|
|||
}
|
||||
}
|
||||
apiManager.refreshFeedCounts();
|
||||
cursor.close();
|
||||
break;
|
||||
|
||||
case EXTRA_TASK_MARK_STORY_READ:
|
||||
|
|
|
@ -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";
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue