mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Initial work on navigating from shared story activity.
This commit is contained in:
parent
ac79788e45
commit
56c5f388f8
3 changed files with 26 additions and 2 deletions
|
@ -779,6 +779,16 @@ public class BlurDatabaseHelper {
|
||||||
return query(false, DatabaseConstants.SOCIALFEED_TABLE, null, DatabaseConstants.getBlogSelectionFromState(stateFilter), null, null, null, "UPPER(" + DatabaseConstants.SOCIAL_FEED_TITLE + ") ASC", null, cancellationSignal);
|
return query(false, DatabaseConstants.SOCIALFEED_TABLE, null, DatabaseConstants.getBlogSelectionFromState(stateFilter), null, null, null, "UPPER(" + DatabaseConstants.SOCIAL_FEED_TITLE + ") ASC", null, cancellationSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SocialFeed getSocialFeed(String feedId) {
|
||||||
|
Cursor c = dbRO.query(DatabaseConstants.SOCIALFEED_TABLE, null, DatabaseConstants.SOCIAL_FEED_ID + " = ?", new String[] {feedId}, null, null, null);
|
||||||
|
SocialFeed result = null;
|
||||||
|
while (c.moveToNext()) {
|
||||||
|
result = SocialFeed.fromCursor(c);
|
||||||
|
}
|
||||||
|
c.close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public Loader<Cursor> getFoldersLoader() {
|
public Loader<Cursor> getFoldersLoader() {
|
||||||
return new QueryCursorLoader(context) {
|
return new QueryCursorLoader(context) {
|
||||||
protected Cursor createCursor() {return getFoldersCursor(cancellationSignal);}
|
protected Cursor createCursor() {return getFoldersCursor(cancellationSignal);}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.newsblur.activity.ItemsList;
|
||||||
import com.newsblur.activity.Profile;
|
import com.newsblur.activity.Profile;
|
||||||
import com.newsblur.activity.Reading;
|
import com.newsblur.activity.Reading;
|
||||||
import com.newsblur.activity.SavedStoriesReading;
|
import com.newsblur.activity.SavedStoriesReading;
|
||||||
|
import com.newsblur.activity.SocialFeedReading;
|
||||||
import com.newsblur.domain.Feed;
|
import com.newsblur.domain.Feed;
|
||||||
import com.newsblur.domain.UserDetails;
|
import com.newsblur.domain.UserDetails;
|
||||||
import com.newsblur.domain.ActivityDetails;
|
import com.newsblur.domain.ActivityDetails;
|
||||||
|
@ -141,6 +142,15 @@ public class ProfileActivityFragment extends Fragment implements AdapterView.OnI
|
||||||
i.putExtra(Reading.EXTRA_STORY_HASH, activity.storyHash);
|
i.putExtra(Reading.EXTRA_STORY_HASH, activity.storyHash);
|
||||||
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, PrefsUtils.getDefaultFeedViewForFolder(context, PrefConstants.SAVED_STORIES_FOLDER_NAME));
|
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, PrefsUtils.getDefaultFeedViewForFolder(context, PrefConstants.SAVED_STORIES_FOLDER_NAME));
|
||||||
context.startActivity(i);
|
context.startActivity(i);
|
||||||
|
} else if (activity.category == Category.SHARED_STORY) {
|
||||||
|
Intent i = new Intent(context, SocialFeedReading.class);
|
||||||
|
i.putExtra(Reading.EXTRA_FEEDSET, FeedSet.singleSocialFeed(user.id, user.username));
|
||||||
|
i.putExtra(Reading.EXTRA_SOCIAL_FEED, FeedUtils.getSocialFeed(user.id));
|
||||||
|
i.putExtra(ItemsList.EXTRA_STATE, PrefsUtils.getStateFilter(context));
|
||||||
|
// TODO what if story doesn't exist?
|
||||||
|
i.putExtra(Reading.EXTRA_STORY_HASH, activity.storyHash);
|
||||||
|
i.putExtra(Reading.EXTRA_DEFAULT_FEED_VIEW, PrefsUtils.getDefaultFeedViewForFeed(context, user.id));
|
||||||
|
context.startActivity(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,8 +196,8 @@ public class FeedUtils {
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||||
intent.putExtra(Intent.EXTRA_SUBJECT, Html.fromHtml(story.title));
|
intent.putExtra(Intent.EXTRA_SUBJECT, Html.fromHtml(story.title));
|
||||||
final String shareString = context.getResources().getString(R.string.share);
|
final String shareString = context.getResources().getString(R.string.share);
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, String.format(shareString, new Object[] { Html.fromHtml(story.title),
|
intent.putExtra(Intent.EXTRA_TEXT, String.format(shareString, new Object[]{Html.fromHtml(story.title),
|
||||||
story.permalink }));
|
story.permalink}));
|
||||||
context.startActivity(Intent.createChooser(intent, "Send using"));
|
context.startActivity(Intent.createChooser(intent, "Send using"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,4 +272,8 @@ public class FeedUtils {
|
||||||
return dbHelper.getFeed(feedId);
|
return dbHelper.getFeed(feedId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SocialFeed getSocialFeed(String feedId) {
|
||||||
|
return dbHelper.getSocialFeed(feedId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue