mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Refactor story list / reading activity configs for future support of independent Activity launching.
This commit is contained in:
parent
49149d75e6
commit
b7cfdbb93b
29 changed files with 113 additions and 251 deletions
|
@ -28,7 +28,7 @@ public class AllSharedStoriesItemsList extends ItemsList {
|
|||
|
||||
itemListFragment = (AllSharedStoriesItemListFragment) fragmentManager.findFragmentByTag(AllSharedStoriesItemListFragment.class.getName());
|
||||
if (itemListFragment == null) {
|
||||
itemListFragment = AllSharedStoriesItemListFragment.newInstance(currentState, getDefaultFeedView());
|
||||
itemListFragment = AllSharedStoriesItemListFragment.newInstance();
|
||||
itemListFragment.setRetainInstance(true);
|
||||
FragmentTransaction listTransaction = fragmentManager.beginTransaction();
|
||||
listTransaction.add(R.id.activity_itemlist_container, itemListFragment, AllSharedStoriesItemListFragment.class.getName());
|
||||
|
@ -68,11 +68,6 @@ public class AllSharedStoriesItemsList extends ItemsList {
|
|||
return PrefsUtils.getReadFilterForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultFeedView getDefaultFeedView() {
|
||||
return PrefsUtils.getDefaultFeedViewForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultFeedViewChanged(DefaultFeedView value) {
|
||||
PrefsUtils.setDefaultFeedViewForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME, value);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class AllStoriesItemsList extends ItemsList implements MarkAllReadDialogL
|
|||
|
||||
itemListFragment = (AllStoriesItemListFragment) fragmentManager.findFragmentByTag(AllStoriesItemListFragment.class.getName());
|
||||
if (itemListFragment == null) {
|
||||
itemListFragment = AllStoriesItemListFragment.newInstance(currentState, getDefaultFeedView());
|
||||
itemListFragment = AllStoriesItemListFragment.newInstance();
|
||||
itemListFragment.setRetainInstance(true);
|
||||
FragmentTransaction listTransaction = fragmentManager.beginTransaction();
|
||||
listTransaction.add(R.id.activity_itemlist_container, itemListFragment, AllStoriesItemListFragment.class.getName());
|
||||
|
@ -84,11 +84,6 @@ public class AllStoriesItemsList extends ItemsList implements MarkAllReadDialogL
|
|||
return PrefsUtils.getReadFilterForFolder(this, PrefConstants.ALL_STORIES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultFeedView getDefaultFeedView() {
|
||||
return PrefsUtils.getDefaultFeedViewForFolder(this, PrefConstants.ALL_STORIES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultFeedViewChanged(DefaultFeedView value) {
|
||||
PrefsUtils.setDefaultFeedViewForFolder(this, PrefConstants.ALL_STORIES_FOLDER_NAME, value);
|
||||
|
|
|
@ -37,7 +37,7 @@ public class FeedItemsList extends ItemsList {
|
|||
|
||||
itemListFragment = (FeedItemListFragment) fragmentManager.findFragmentByTag(FeedItemListFragment.class.getName());
|
||||
if (itemListFragment == null) {
|
||||
itemListFragment = FeedItemListFragment.newInstance(feed, currentState, getDefaultFeedView());
|
||||
itemListFragment = FeedItemListFragment.newInstance(feed);
|
||||
itemListFragment.setRetainInstance(true);
|
||||
FragmentTransaction listTransaction = fragmentManager.beginTransaction();
|
||||
listTransaction.add(R.id.activity_itemlist_container, itemListFragment, FeedItemListFragment.class.getName());
|
||||
|
@ -97,11 +97,6 @@ public class FeedItemsList extends ItemsList {
|
|||
return PrefsUtils.getReadFilterForFeed(this, feed.feedId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultFeedView getDefaultFeedView() {
|
||||
return PrefsUtils.getDefaultFeedViewForFeed(this, feed.feedId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultFeedViewChanged(DefaultFeedView value) {
|
||||
PrefsUtils.setDefaultFeedViewForFeed(this, feed.feedId, value);
|
||||
|
|
|
@ -11,13 +11,11 @@ import com.newsblur.util.UIUtils;
|
|||
|
||||
public class FeedReading extends Reading {
|
||||
|
||||
Feed feed;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceBundle) {
|
||||
feed = (Feed) getIntent().getSerializableExtra(EXTRA_FEED);
|
||||
super.onCreate(savedInstanceBundle);
|
||||
|
||||
Feed feed = FeedUtils.dbHelper.getFeed(fs.getSingleFeed());
|
||||
Classifier classifier = FeedUtils.dbHelper.getClassifierForFeed(feed.feedId);
|
||||
|
||||
UIUtils.setCustomActionBar(this, feed.faviconUrl, feed.title);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class FolderItemsList extends ItemsList implements MarkAllReadDialogListe
|
|||
|
||||
itemListFragment = (FolderItemListFragment) fragmentManager.findFragmentByTag(FolderItemListFragment.class.getName());
|
||||
if (itemListFragment == null) {
|
||||
itemListFragment = FolderItemListFragment.newInstance(folderName, currentState, getDefaultFeedView());
|
||||
itemListFragment = FolderItemListFragment.newInstance();
|
||||
itemListFragment.setRetainInstance(true);
|
||||
FragmentTransaction listTransaction = fragmentManager.beginTransaction();
|
||||
listTransaction.add(R.id.activity_itemlist_container, itemListFragment, FolderItemListFragment.class.getName());
|
||||
|
@ -95,11 +95,6 @@ public class FolderItemsList extends ItemsList implements MarkAllReadDialogListe
|
|||
return PrefsUtils.getReadFilterForFolder(this, folderName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultFeedView getDefaultFeedView() {
|
||||
return PrefsUtils.getDefaultFeedViewForFolder(this, folderName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultFeedViewChanged(DefaultFeedView value) {
|
||||
PrefsUtils.setDefaultFeedViewForFolder(this, folderName, value);
|
||||
|
|
|
@ -8,14 +8,11 @@ import com.newsblur.util.UIUtils;
|
|||
|
||||
public class FolderReading extends Reading {
|
||||
|
||||
private String folderName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceBundle) {
|
||||
super.onCreate(savedInstanceBundle);
|
||||
|
||||
folderName = getIntent().getStringExtra(Reading.EXTRA_FOLDERNAME);
|
||||
UIUtils.setCustomActionBar(this, R.drawable.g_icn_folder_rss, folderName);
|
||||
UIUtils.setCustomActionBar(this, R.drawable.g_icn_folder_rss, fs.getFolderName());
|
||||
|
||||
readingAdapter = new MixedFeedsReadingAdapter(getFragmentManager(), defaultFeedView, null);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class GlobalSharedStoriesItemsList extends ItemsList {
|
|||
|
||||
itemListFragment = (GlobalSharedStoriesItemListFragment) fragmentManager.findFragmentByTag(GlobalSharedStoriesItemListFragment.class.getName());
|
||||
if (itemListFragment == null) {
|
||||
itemListFragment = GlobalSharedStoriesItemListFragment.newInstance(getDefaultFeedView(), currentState);
|
||||
itemListFragment = GlobalSharedStoriesItemListFragment.newInstance();
|
||||
itemListFragment.setRetainInstance(true);
|
||||
FragmentTransaction listTransaction = fragmentManager.beginTransaction();
|
||||
listTransaction.add(R.id.activity_itemlist_container, itemListFragment, GlobalSharedStoriesItemListFragment.class.getName());
|
||||
|
@ -50,11 +50,6 @@ public class GlobalSharedStoriesItemsList extends ItemsList {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultFeedView getDefaultFeedView() {
|
||||
return PrefsUtils.getDefaultFeedViewForFolder(this, PrefConstants.GLOBAL_SHARED_STORIES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultFeedViewChanged(DefaultFeedView value) {
|
||||
PrefsUtils.setDefaultFeedViewForFolder(this, PrefConstants.GLOBAL_SHARED_STORIES_FOLDER_NAME, value);
|
||||
|
|
|
@ -21,16 +21,15 @@ import com.newsblur.util.DefaultFeedView;
|
|||
import com.newsblur.util.DefaultFeedViewChangedListener;
|
||||
import com.newsblur.util.FeedSet;
|
||||
import com.newsblur.util.FeedUtils;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.ReadFilter;
|
||||
import com.newsblur.util.ReadFilterChangedListener;
|
||||
import com.newsblur.util.StateFilter;
|
||||
import com.newsblur.util.StoryOrder;
|
||||
import com.newsblur.util.StoryOrderChangedListener;
|
||||
import com.newsblur.view.StateToggleButton.StateChangedListener;
|
||||
|
||||
public abstract class ItemsList extends NbActivity implements StateChangedListener, StoryOrderChangedListener, ReadFilterChangedListener, DefaultFeedViewChangedListener {
|
||||
public abstract class ItemsList extends NbActivity implements StoryOrderChangedListener, ReadFilterChangedListener, DefaultFeedViewChangedListener {
|
||||
|
||||
public static final String EXTRA_STATE = "currentIntelligenceState";
|
||||
private static final String STORY_ORDER = "storyOrder";
|
||||
private static final String READ_FILTER = "readFilter";
|
||||
private static final String DEFAULT_FEED_VIEW = "defaultFeedView";
|
||||
|
@ -39,7 +38,7 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
protected ItemListFragment itemListFragment;
|
||||
protected FragmentManager fragmentManager;
|
||||
private TextView overlayStatusText;
|
||||
protected StateFilter currentState;
|
||||
protected StateFilter intelState;
|
||||
|
||||
private FeedSet fs;
|
||||
|
||||
|
@ -49,8 +48,7 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
|
||||
overridePendingTransition(R.anim.slide_in_from_right, R.anim.slide_out_to_left);
|
||||
|
||||
// our intel state is entirely determined by the state of the Main view
|
||||
currentState = (StateFilter) getIntent().getSerializableExtra(EXTRA_STATE);
|
||||
intelState = PrefsUtils.getStateFilter(this);
|
||||
this.fs = createFeedSet();
|
||||
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
|
@ -59,6 +57,12 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
fragmentManager = getFragmentManager();
|
||||
|
||||
this.overlayStatusText = (TextView) findViewById(R.id.itemlist_sync_status);
|
||||
|
||||
if (PrefsUtils.isAutoOpenFirstUnread(this)) {
|
||||
if (FeedUtils.dbHelper.getUnreadCount(fs, intelState) > 0) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract FeedSet createFeedSet();
|
||||
|
@ -113,7 +117,7 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
readFilter.show(getFragmentManager(), READ_FILTER);
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.menu_default_view) {
|
||||
DefaultFeedView currentValue = getDefaultFeedView();
|
||||
DefaultFeedView currentValue = PrefsUtils.getDefaultFeedView(this, fs);
|
||||
DefaultFeedViewDialogFragment readFilter = DefaultFeedViewDialogFragment.newInstance(currentValue);
|
||||
readFilter.show(getFragmentManager(), DEFAULT_FEED_VIEW);
|
||||
return true;
|
||||
|
@ -127,8 +131,6 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
|
||||
protected abstract ReadFilter getReadFilter();
|
||||
|
||||
protected abstract DefaultFeedView getDefaultFeedView();
|
||||
|
||||
@Override
|
||||
public void handleUpdate(int updateType) {
|
||||
if ((updateType & UPDATE_REBUILD) != 0) {
|
||||
|
@ -161,11 +163,6 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedState(StateFilter state) {
|
||||
itemListFragment.changeState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storyOrderChanged(StoryOrder newValue) {
|
||||
updateStoryOrderPreference(newValue);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ReadStoriesItemsList extends ItemsList {
|
|||
|
||||
itemListFragment = (ReadStoriesItemListFragment) fragmentManager.findFragmentByTag(ReadStoriesItemListFragment.class.getName());
|
||||
if (itemListFragment == null) {
|
||||
itemListFragment = ReadStoriesItemListFragment.newInstance(getDefaultFeedView());
|
||||
itemListFragment = ReadStoriesItemListFragment.newInstance();
|
||||
itemListFragment.setRetainInstance(true);
|
||||
FragmentTransaction listTransaction = fragmentManager.beginTransaction();
|
||||
listTransaction.add(R.id.activity_itemlist_container, itemListFragment, ReadStoriesItemListFragment.class.getName());
|
||||
|
@ -53,11 +53,6 @@ public class ReadStoriesItemsList extends ItemsList {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultFeedView getDefaultFeedView() {
|
||||
return PrefsUtils.getDefaultFeedViewForFolder(this, PrefConstants.READ_STORIES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultFeedViewChanged(DefaultFeedView value) {
|
||||
PrefsUtils.setDefaultFeedViewForFolder(this, PrefConstants.READ_STORIES_FOLDER_NAME, value);
|
||||
|
|
|
@ -52,13 +52,8 @@ import com.newsblur.view.NonfocusScrollview.ScrollChangeListener;
|
|||
public abstract class Reading extends NbActivity implements OnPageChangeListener, OnSeekBarChangeListener, ScrollChangeListener, LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
public static final String EXTRA_FEEDSET = "feed_set";
|
||||
public static final String EXTRA_FEED = "feed";
|
||||
public static final String EXTRA_SOCIAL_FEED = "social_feed";
|
||||
public static final String EXTRA_POSITION = "feed_position";
|
||||
public static final String EXTRA_FOLDERNAME = "foldername";
|
||||
public static final String EXTRA_DEFAULT_FEED_VIEW = "default_feed_view";
|
||||
public static final String EXTRA_STORY_HASH = "story_hash";
|
||||
private static final String TEXT_SIZE = "textsize";
|
||||
private static final String BUNDLE_POSITION = "position";
|
||||
private static final String BUNDLE_STARTING_UNREAD = "starting_unread";
|
||||
private static final String BUNDLE_SELECTED_FEED_VIEW = "selectedFeedView";
|
||||
|
@ -70,7 +65,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
|||
/** The minimum screen width (in DP) needed to show all the overlay controls. */
|
||||
private static final int OVERLAY_MIN_WIDTH_DP = 355;
|
||||
|
||||
protected StateFilter currentState;
|
||||
protected StateFilter intelState;
|
||||
protected StoryOrder storyOrder;
|
||||
protected ReadFilter readFilter;
|
||||
|
||||
|
@ -136,7 +131,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
|||
storyHash = savedInstanceBundle.getString(EXTRA_STORY_HASH);
|
||||
}
|
||||
|
||||
currentState = (StateFilter) getIntent().getSerializableExtra(ItemsList.EXTRA_STATE);
|
||||
intelState = PrefsUtils.getStateFilter(this);
|
||||
storyOrder = PrefsUtils.getStoryOrder(this, fs);
|
||||
readFilter = PrefsUtils.getReadFilter(this, fs);
|
||||
volumeKeyNavigation = PrefsUtils.getVolumeKeyNavigation(this);
|
||||
|
@ -144,7 +139,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
|||
if ((savedInstanceBundle != null) && savedInstanceBundle.containsKey(BUNDLE_SELECTED_FEED_VIEW)) {
|
||||
defaultFeedView = (DefaultFeedView)savedInstanceBundle.getSerializable(BUNDLE_SELECTED_FEED_VIEW);
|
||||
} else {
|
||||
defaultFeedView = (DefaultFeedView) getIntent().getSerializableExtra(EXTRA_DEFAULT_FEED_VIEW);
|
||||
defaultFeedView = PrefsUtils.getDefaultFeedView(this, fs);
|
||||
}
|
||||
|
||||
// were we fullscreen before rotation?
|
||||
|
@ -219,7 +214,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
|||
finish();
|
||||
return null;
|
||||
}
|
||||
return FeedUtils.dbHelper.getStoriesLoader(fs, currentState);
|
||||
return FeedUtils.dbHelper.getStoriesLoader(fs, intelState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -312,7 +307,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
|||
private int getUnreadCount() {
|
||||
// saved stories and global shared stories don't have unreads
|
||||
if (fs.isAllSaved() || fs.isGlobalShared()) return 0;
|
||||
return FeedUtils.dbHelper.getUnreadCount(fs, currentState);
|
||||
return FeedUtils.dbHelper.getUnreadCount(fs, intelState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -358,7 +353,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
|||
return true;
|
||||
} else if (item.getItemId() == R.id.menu_textsize) {
|
||||
TextSizeDialogFragment textSize = TextSizeDialogFragment.newInstance(PrefsUtils.getTextSize(this));
|
||||
textSize.show(getFragmentManager(), TEXT_SIZE);
|
||||
textSize.show(getFragmentManager(), TextSizeDialogFragment.class.getName());
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.menu_reading_save) {
|
||||
if (story.starred) {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class SavedStoriesItemsList extends ItemsList {
|
|||
|
||||
itemListFragment = (SavedStoriesItemListFragment) fragmentManager.findFragmentByTag(SavedStoriesItemListFragment.class.getName());
|
||||
if (itemListFragment == null) {
|
||||
itemListFragment = SavedStoriesItemListFragment.newInstance(getDefaultFeedView());
|
||||
itemListFragment = SavedStoriesItemListFragment.newInstance();
|
||||
itemListFragment.setRetainInstance(true);
|
||||
FragmentTransaction listTransaction = fragmentManager.beginTransaction();
|
||||
listTransaction.add(R.id.activity_itemlist_container, itemListFragment, SavedStoriesItemListFragment.class.getName());
|
||||
|
@ -53,11 +53,6 @@ public class SavedStoriesItemsList extends ItemsList {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultFeedView getDefaultFeedView() {
|
||||
return PrefsUtils.getDefaultFeedViewForFolder(this, PrefConstants.SAVED_STORIES_FOLDER_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultFeedViewChanged(DefaultFeedView value) {
|
||||
PrefsUtils.setDefaultFeedViewForFolder(this, PrefConstants.SAVED_STORIES_FOLDER_NAME, value);
|
||||
|
|
|
@ -35,7 +35,7 @@ public class SocialFeedItemsList extends ItemsList {
|
|||
UIUtils.setCustomActionBar(this, socialFeed.photoUrl, socialFeed.feedTitle);
|
||||
|
||||
if (itemListFragment == null) {
|
||||
itemListFragment = SocialFeedItemListFragment.newInstance(socialFeed, currentState, getDefaultFeedView());
|
||||
itemListFragment = SocialFeedItemListFragment.newInstance();
|
||||
itemListFragment.setRetainInstance(true);
|
||||
FragmentTransaction listTransaction = fragmentManager.beginTransaction();
|
||||
listTransaction.add(R.id.activity_itemlist_container, itemListFragment, SocialFeedItemListFragment.class.getName());
|
||||
|
@ -76,11 +76,6 @@ public class SocialFeedItemsList extends ItemsList {
|
|||
return PrefsUtils.getReadFilterForFeed(this, socialFeed.userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultFeedView getDefaultFeedView() {
|
||||
return PrefsUtils.getDefaultFeedViewForFeed(this, socialFeed.userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultFeedViewChanged(DefaultFeedView value) {
|
||||
PrefsUtils.setDefaultFeedViewForFeed(this, socialFeed.userId, value);
|
||||
|
|
|
@ -11,22 +11,16 @@ import com.newsblur.util.UIUtils;
|
|||
|
||||
public class SocialFeedReading extends Reading {
|
||||
|
||||
public static final String EXTRA_NAVIGATE_FROM_PROFILE = "navigate_from_profile";
|
||||
private SocialFeed socialFeed;
|
||||
|
||||
private boolean openedFromProfile;
|
||||
public static final String EXTRA_IGNORE_FILTERS = "ignore_filters";
|
||||
private boolean ignoreFilters;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceBundle) {
|
||||
super.onCreate(savedInstanceBundle);
|
||||
|
||||
socialFeed = (SocialFeed) getIntent().getSerializableExtra(EXTRA_SOCIAL_FEED);
|
||||
openedFromProfile = getIntent().hasExtra(EXTRA_NAVIGATE_FROM_PROFILE);
|
||||
|
||||
ignoreFilters = getIntent().hasExtra(EXTRA_IGNORE_FILTERS);
|
||||
SocialFeed socialFeed = FeedUtils.dbHelper.getSocialFeed(fs.getSingleSocialFeed().getKey());
|
||||
UIUtils.setCustomActionBar(this, socialFeed.photoUrl, socialFeed.feedTitle);
|
||||
|
||||
readingAdapter = new MixedFeedsReadingAdapter(getFragmentManager(), defaultFeedView, socialFeed.userId);
|
||||
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
|
@ -34,7 +28,7 @@ public class SocialFeedReading extends Reading {
|
|||
public Loader<Cursor> onCreateLoader(int loaderId, Bundle bundle) {
|
||||
// If we have navigated from the profile we want to ignore the StateFilter and ReadFilter settings
|
||||
// for the feed to ensure we can find the story.
|
||||
if (openedFromProfile) {
|
||||
if (ignoreFilters) {
|
||||
return FeedUtils.dbHelper.getStoriesLoaderIgnoreFilters(fs);
|
||||
} else {
|
||||
return super.onCreateLoader(loaderId, bundle);
|
||||
|
|
|
@ -112,7 +112,6 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(context, GlobalSharedStoriesItemsList.class);
|
||||
i.putExtra(GlobalSharedStoriesItemsList.EXTRA_STATE, currentState);
|
||||
context.startActivity(i);
|
||||
}
|
||||
});
|
||||
|
@ -122,7 +121,6 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(context, AllSharedStoriesItemsList.class);
|
||||
i.putExtra(AllStoriesItemsList.EXTRA_STATE, currentState);
|
||||
context.startActivity(i);
|
||||
}
|
||||
});
|
||||
|
@ -164,7 +162,6 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
|
|||
public void onClick(View v) {
|
||||
Intent i = new Intent(v.getContext(), FolderItemsList.class);
|
||||
i.putExtra(FolderItemsList.EXTRA_FOLDER_NAME, canonicalFolderName);
|
||||
i.putExtra(FolderItemsList.EXTRA_STATE, currentState);
|
||||
context.startActivity(i);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -32,24 +32,11 @@ public class AllSharedStoriesItemListFragment extends ItemListFragment {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
public static ItemListFragment newInstance(StateFilter currentState, DefaultFeedView defaultFeedView) {
|
||||
public static ItemListFragment newInstance() {
|
||||
ItemListFragment everythingFragment = new AllSharedStoriesItemListFragment();
|
||||
Bundle arguments = new Bundle();
|
||||
arguments.putSerializable("currentState", currentState);
|
||||
arguments.putSerializable("defaultFeedView", defaultFeedView);
|
||||
everythingFragment.setArguments(arguments);
|
||||
|
||||
return everythingFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick_(String storyHash) {
|
||||
Intent i = new Intent(getActivity(), AllSharedStoriesReading.class);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, storyHash);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, getFeedSet());
|
||||
i.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, defaultFeedView);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,24 +32,11 @@ public class AllStoriesItemListFragment extends ItemListFragment {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
public static ItemListFragment newInstance(StateFilter currentState, DefaultFeedView defaultFeedView) {
|
||||
public static ItemListFragment newInstance() {
|
||||
ItemListFragment everythingFragment = new AllStoriesItemListFragment();
|
||||
Bundle arguments = new Bundle();
|
||||
arguments.putSerializable("currentState", currentState);
|
||||
arguments.putSerializable("defaultFeedView", defaultFeedView);
|
||||
everythingFragment.setArguments(arguments);
|
||||
|
||||
return everythingFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick_(String storyHash) {
|
||||
Intent i = new Intent(getActivity(), AllStoriesReading.class);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, storyHash);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, getFeedSet());
|
||||
i.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, defaultFeedView);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,15 +23,11 @@ public class FeedItemListFragment extends ItemListFragment {
|
|||
|
||||
private Feed feed;
|
||||
|
||||
public static FeedItemListFragment newInstance(Feed feed, StateFilter currentState, DefaultFeedView defaultFeedView) {
|
||||
public static FeedItemListFragment newInstance(Feed feed) {
|
||||
FeedItemListFragment feedItemFragment = new FeedItemListFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("currentState", currentState);
|
||||
args.putSerializable("feed", feed);
|
||||
args.putSerializable("defaultFeedView", defaultFeedView);
|
||||
feedItemFragment.setArguments(args);
|
||||
|
||||
return feedItemFragment;
|
||||
}
|
||||
|
||||
|
@ -53,15 +49,4 @@ public class FeedItemListFragment extends ItemListFragment {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick_(String storyHash) {
|
||||
Intent i = new Intent(getActivity(), FeedReading.class);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, storyHash);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, getFeedSet());
|
||||
i.putExtra(Reading.EXTRA_FEED, feed);
|
||||
i.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, defaultFeedView);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,26 +20,13 @@ import com.newsblur.view.FeedItemViewBinder;
|
|||
|
||||
public class FolderItemListFragment extends ItemListFragment {
|
||||
|
||||
private String folderName;
|
||||
|
||||
public static FolderItemListFragment newInstance(String folderName, StateFilter currentState, DefaultFeedView defaultFeedView) {
|
||||
public static FolderItemListFragment newInstance() {
|
||||
FolderItemListFragment feedItemFragment = new FolderItemListFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("currentState", currentState);
|
||||
args.putString("folderName", folderName);
|
||||
args.putSerializable("defaultFeedView", defaultFeedView);
|
||||
feedItemFragment.setArguments(args);
|
||||
|
||||
return feedItemFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
folderName = getArguments().getString("folderName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||
if ((adapter == null) && (cursor != null)) {
|
||||
|
@ -52,15 +39,4 @@ public class FolderItemListFragment extends ItemListFragment {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick_(String storyHash) {
|
||||
Intent i = new Intent(getActivity(), FolderReading.class);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, storyHash);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, getFeedSet());
|
||||
i.putExtra(FeedReading.EXTRA_FOLDERNAME, folderName);
|
||||
i.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, defaultFeedView);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -283,7 +283,6 @@ public class FolderListFragment extends NbFragment implements OnCreateContextMen
|
|||
@OnGroupClick(R.id.folderfeed_list) boolean onGroupClick(ExpandableListView list, View group, int groupPosition, long id) {
|
||||
if (adapter.isFolderRoot(groupPosition)) {
|
||||
Intent i = new Intent(getActivity(), AllStoriesItemsList.class);
|
||||
i.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
startActivity(i);
|
||||
return true;
|
||||
} else if (adapter.isRowReadStories(groupPosition)) {
|
||||
|
@ -345,7 +344,6 @@ public class FolderListFragment extends NbFragment implements OnCreateContextMen
|
|||
SocialFeed socialFeed = adapter.getSocialFeed(childName);
|
||||
Intent intent = new Intent(getActivity(), SocialFeedItemsList.class);
|
||||
intent.putExtra(SocialFeedItemsList.EXTRA_SOCIAL_FEED, socialFeed);
|
||||
intent.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
getActivity().startActivity(intent);
|
||||
} else {
|
||||
Feed feed = adapter.getFeed(childName);
|
||||
|
@ -353,7 +351,6 @@ public class FolderListFragment extends NbFragment implements OnCreateContextMen
|
|||
Intent intent = new Intent(getActivity(), FeedItemsList.class);
|
||||
intent.putExtra(FeedItemsList.EXTRA_FEED, feed);
|
||||
intent.putExtra(FeedItemsList.EXTRA_FOLDER_NAME, folderName);
|
||||
intent.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
getActivity().startActivity(intent);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -21,11 +21,9 @@ import com.newsblur.view.SocialItemViewBinder;
|
|||
|
||||
public class GlobalSharedStoriesItemListFragment extends ItemListFragment {
|
||||
|
||||
public static ItemListFragment newInstance(DefaultFeedView defaultFeedView, StateFilter currentState) {
|
||||
public static ItemListFragment newInstance() {
|
||||
ItemListFragment fragment = new GlobalSharedStoriesItemListFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("defaultFeedView", defaultFeedView);
|
||||
args.putSerializable("currentState", currentState);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -42,16 +40,6 @@ public class GlobalSharedStoriesItemListFragment extends ItemListFragment {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick_(String storyHash) {
|
||||
Intent i = new Intent(getActivity(), GlobalSharedStoriesReading.class);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, storyHash);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, getFeedSet());
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, defaultFeedView);
|
||||
i.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
|
|
|
@ -41,6 +41,7 @@ import com.newsblur.util.FeedUtils;
|
|||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.StateFilter;
|
||||
import com.newsblur.util.StoryOrder;
|
||||
import com.newsblur.util.UIUtils;
|
||||
import com.newsblur.util.ViewUtils;
|
||||
import com.newsblur.view.ProgressThrobber;
|
||||
|
||||
|
@ -52,7 +53,7 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
@FindView(R.id.itemlistfragment_list) ListView itemList;
|
||||
protected StoryItemsAdapter adapter;
|
||||
protected DefaultFeedView defaultFeedView;
|
||||
protected StateFilter currentState;
|
||||
protected StateFilter intelState;
|
||||
private boolean cursorSeenYet = false;
|
||||
private boolean firstStorySeenYet = false;
|
||||
private boolean stopLoading = false;
|
||||
|
@ -67,7 +68,7 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
currentState = (StateFilter) getArguments().getSerializable("currentState");
|
||||
intelState = PrefsUtils.getStateFilter(getActivity());
|
||||
defaultFeedView = (DefaultFeedView)getArguments().getSerializable("defaultFeedView");
|
||||
activity = (ItemsList) getActivity();
|
||||
}
|
||||
|
@ -210,11 +211,6 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) { }
|
||||
|
||||
public void changeState(StateFilter state) {
|
||||
currentState = state;
|
||||
hasUpdated();
|
||||
}
|
||||
|
||||
protected FeedSet getFeedSet() {
|
||||
return activity.getFeedSet();
|
||||
}
|
||||
|
@ -234,7 +230,7 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
try { getActivity().finish(); } catch (Exception e) {;}
|
||||
return null;
|
||||
}
|
||||
return FeedUtils.dbHelper.getStoriesLoader(getFeedSet(), currentState);
|
||||
return FeedUtils.dbHelper.getStoriesLoader(getFeedSet(), intelState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -344,11 +340,9 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
int truePosition = position - 1;
|
||||
Story story = adapter.getStory(truePosition);
|
||||
if (getActivity().isFinishing()) return;
|
||||
onItemClick_(story.storyHash);
|
||||
UIUtils.startReadingActivity(getFeedSet(), story.storyHash, getActivity(), false);
|
||||
}
|
||||
|
||||
public abstract void onItemClick_(String storyHash);
|
||||
|
||||
protected void setupBezelSwipeDetector(View v) {
|
||||
final GestureDetector gestureDetector = new GestureDetector(getActivity(), new BezelSwipeDetector());
|
||||
v.setOnTouchListener(new OnTouchListener() {
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.newsblur.util.FeedSet;
|
|||
import com.newsblur.util.FeedUtils;
|
||||
import com.newsblur.util.PrefConstants;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.UIUtils;
|
||||
import com.newsblur.view.ActivityDetailsAdapter;
|
||||
import com.newsblur.view.ProgressThrobber;
|
||||
|
||||
|
@ -146,15 +147,10 @@ public abstract class ProfileActivityDetailsFragment extends Fragment implements
|
|||
} else {
|
||||
Intent intent = new Intent(context, FeedItemsList.class);
|
||||
intent.putExtra(FeedItemsList.EXTRA_FEED, feed);
|
||||
intent.putExtra(ItemsList.EXTRA_STATE, PrefsUtils.getStateFilter(context));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
} else if (activity.category == Category.STAR) {
|
||||
Intent i = new Intent(context, SavedStoriesReading.class);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, FeedSet.allSaved());
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, activity.storyHash);
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, PrefsUtils.getDefaultFeedViewForFolder(context, PrefConstants.SAVED_STORIES_FOLDER_NAME));
|
||||
context.startActivity(i);
|
||||
UIUtils.startReadingActivity(FeedSet.allSaved(), activity.storyHash, context, false);
|
||||
} else if (isSocialFeedCategory(activity)) {
|
||||
// Strip the social: prefix from feedId
|
||||
String socialFeedId = activity.feedId.substring(7);
|
||||
|
@ -162,14 +158,7 @@ public abstract class ProfileActivityDetailsFragment extends Fragment implements
|
|||
if (feed == null) {
|
||||
Toast.makeText(context, R.string.profile_do_not_follow, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Intent i = new Intent(context, SocialFeedReading.class);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, FeedSet.singleSocialFeed(feed.userId, feed.username));
|
||||
i.putExtra(Reading.EXTRA_SOCIAL_FEED, feed);
|
||||
i.putExtra(ItemsList.EXTRA_STATE, PrefsUtils.getStateFilter(context));
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, activity.storyHash);
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, PrefsUtils.getDefaultFeedViewForFeed(context, socialFeedId));
|
||||
i.putExtra(SocialFeedReading.EXTRA_NAVIGATE_FROM_PROFILE, true);
|
||||
context.startActivity(i);
|
||||
UIUtils.startReadingActivity(FeedSet.singleSocialFeed(feed.userId, feed.username), activity.storyHash, context, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,10 +26,9 @@ public class ReadStoriesItemListFragment extends ItemListFragment {
|
|||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public static ItemListFragment newInstance(DefaultFeedView defaultFeedView) {
|
||||
public static ItemListFragment newInstance() {
|
||||
ItemListFragment fragment = new ReadStoriesItemListFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("defaultFeedView", defaultFeedView);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -46,15 +45,6 @@ public class ReadStoriesItemListFragment extends ItemListFragment {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick_(String storyHash) {
|
||||
Intent i = new Intent(getActivity(), ReadStoriesReading.class);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, storyHash);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, getFeedSet());
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, defaultFeedView);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
|
|
|
@ -26,10 +26,9 @@ public class SavedStoriesItemListFragment extends ItemListFragment {
|
|||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public static ItemListFragment newInstance(DefaultFeedView defaultFeedView) {
|
||||
public static ItemListFragment newInstance() {
|
||||
ItemListFragment fragment = new SavedStoriesItemListFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("defaultFeedView", defaultFeedView);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -46,15 +45,6 @@ public class SavedStoriesItemListFragment extends ItemListFragment {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick_(String storyHash) {
|
||||
Intent i = new Intent(getActivity(), SavedStoriesReading.class);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, storyHash);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, getFeedSet());
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, defaultFeedView);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
|
|
|
@ -20,21 +20,9 @@ import com.newsblur.view.SocialItemViewBinder;
|
|||
|
||||
public class SocialFeedItemListFragment extends ItemListFragment {
|
||||
|
||||
private SocialFeed socialFeed;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
socialFeed = (SocialFeed) getArguments().getSerializable("social_feed");
|
||||
super.onCreate(savedInstanceState);
|
||||
getLoaderManager().initLoader(ITEMLIST_LOADER , null, this);
|
||||
}
|
||||
|
||||
public static SocialFeedItemListFragment newInstance(SocialFeed socialFeed, StateFilter currentState, DefaultFeedView defaultFeedView) {
|
||||
public static SocialFeedItemListFragment newInstance() {
|
||||
SocialFeedItemListFragment fragment = new SocialFeedItemListFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("currentState", currentState);
|
||||
args.putSerializable("social_feed", socialFeed);
|
||||
args.putSerializable("defaultFeedView", defaultFeedView);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -51,15 +39,4 @@ public class SocialFeedItemListFragment extends ItemListFragment {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick_(String storyHash) {
|
||||
Intent i = new Intent(getActivity(), SocialFeedReading.class);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, storyHash);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, getFeedSet());
|
||||
i.putExtra(Reading.EXTRA_SOCIAL_FEED, socialFeed);
|
||||
i.putExtra(ItemsList.EXTRA_STATE, currentState);
|
||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, defaultFeedView);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -214,6 +214,10 @@ public class FeedSet implements Serializable {
|
|||
return this.folderName;
|
||||
}
|
||||
|
||||
public boolean isFolder() {
|
||||
return (this.folderName != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a flat set of feed IDs that can be passed to API calls that take raw numeric IDs or
|
||||
* social IDs prefixed with "social:". Returns an empty set for feed sets that don't track
|
||||
|
|
|
@ -47,6 +47,7 @@ public class PrefConstants {
|
|||
public static final String SAVED_STORIES_FOLDER_NAME = "saved_stories";
|
||||
public static final String READING_ENTER_IMMERSIVE_SINGLE_TAP = "immersive_enter_single_tap";
|
||||
|
||||
public static final String STORIES_AUTO_OPEN_FIRST = "pref_auto_open_first_unread";
|
||||
public static final String STORIES_SHOW_PREVIEWS = "pref_show_content_preview";
|
||||
|
||||
public static final String ENABLE_OFFLINE = "enable_offline";
|
||||
|
|
|
@ -368,6 +368,28 @@ public class PrefsUtils {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public static DefaultFeedView getDefaultFeedView(Context context, FeedSet fs) {
|
||||
if (fs.isAllSaved()) {
|
||||
return getDefaultFeedViewForFolder(context, PrefConstants.SAVED_STORIES_FOLDER_NAME);
|
||||
} else if (fs.isGlobalShared()) {
|
||||
return getDefaultFeedViewForFolder(context, PrefConstants.GLOBAL_SHARED_STORIES_FOLDER_NAME);
|
||||
} else if (fs.isAllSocial()) {
|
||||
return getDefaultFeedViewForFolder(context, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME);
|
||||
} else if (fs.isAllNormal()) {
|
||||
return getDefaultFeedViewForFolder(context, PrefConstants.ALL_STORIES_FOLDER_NAME);
|
||||
} else if (fs.isFolder()) {
|
||||
return getDefaultFeedViewForFolder(context, fs.getFolderName());
|
||||
} else if (fs.getSingleFeed() != null) {
|
||||
return getDefaultFeedViewForFeed(context, fs.getSingleFeed());
|
||||
} else if (fs.getSingleSocialFeed() != null) {
|
||||
return getDefaultFeedViewForFeed(context, fs.getSingleSocialFeed().getKey());
|
||||
} else if (fs.isAllRead()) {
|
||||
return getDefaultFeedViewForFolder(context, PrefConstants.READ_STORIES_FOLDER_NAME);
|
||||
} else {
|
||||
return DefaultFeedView.STORY;
|
||||
}
|
||||
}
|
||||
|
||||
public static StoryOrder getStoryOrder(Context context, FeedSet fs) {
|
||||
if (fs.isAllNormal()) {
|
||||
return getStoryOrderForFolder(context, PrefConstants.ALL_STORIES_FOLDER_NAME);
|
||||
|
@ -456,6 +478,11 @@ public class PrefsUtils {
|
|||
return prefs.getBoolean(PrefConstants.STORIES_SHOW_PREVIEWS, true);
|
||||
}
|
||||
|
||||
public static boolean isAutoOpenFirstUnread(Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
return prefs.getBoolean(PrefConstants.STORIES_AUTO_OPEN_FIRST, true);
|
||||
}
|
||||
|
||||
public static boolean isOfflineEnabled(Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
return prefs.getBoolean(PrefConstants.ENABLE_OFFLINE, false);
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.graphics.drawable.BitmapDrawable;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -27,7 +28,7 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.activity.NewsBlurApplication;
|
||||
import com.newsblur.activity.*;
|
||||
|
||||
public class UIUtils {
|
||||
|
||||
|
@ -166,4 +167,35 @@ public class UIUtils {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void startReadingActivity(FeedSet fs, String startingHash, Context context, boolean ignoreFilters) {
|
||||
Class activityClass;
|
||||
if (fs.isAllSaved()) {
|
||||
activityClass = SavedStoriesReading.class;
|
||||
} else if (fs.isGlobalShared()) {
|
||||
activityClass = GlobalSharedStoriesReading.class;
|
||||
} else if (fs.isAllSocial()) {
|
||||
activityClass = AllSharedStoriesReading.class;
|
||||
} else if (fs.isAllNormal()) {
|
||||
activityClass = AllStoriesReading.class;
|
||||
} else if (fs.isFolder()) {
|
||||
activityClass = FolderReading.class;
|
||||
} else if (fs.getSingleFeed() != null) {
|
||||
activityClass = FeedReading.class;
|
||||
} else if (fs.getSingleSocialFeed() != null) {
|
||||
activityClass = SocialFeedReading.class;
|
||||
} else if (fs.isAllRead()) {
|
||||
activityClass = ReadStoriesReading.class;
|
||||
} else {
|
||||
Log.e(UIUtils.class.getName(), "can't launch reading activity for unknown feedset type");
|
||||
return;
|
||||
}
|
||||
Intent i = new Intent(context, activityClass);
|
||||
i.putExtra(Reading.EXTRA_FEEDSET, fs);
|
||||
i.putExtra(Reading.EXTRA_STORY_HASH, startingHash);
|
||||
if (ignoreFilters) {
|
||||
i.putExtra(SocialFeedReading.EXTRA_IGNORE_FILTERS, true);
|
||||
}
|
||||
context.startActivity(i);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue