Initial work on navigating from shared story activity.

This commit is contained in:
Mark Anderson 2015-06-10 23:33:45 +01:00
parent ac79788e45
commit 56c5f388f8
3 changed files with 26 additions and 2 deletions

View file

@ -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);
}
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() {
return new QueryCursorLoader(context) {
protected Cursor createCursor() {return getFoldersCursor(cancellationSignal);}

View file

@ -20,6 +20,7 @@ import com.newsblur.activity.ItemsList;
import com.newsblur.activity.Profile;
import com.newsblur.activity.Reading;
import com.newsblur.activity.SavedStoriesReading;
import com.newsblur.activity.SocialFeedReading;
import com.newsblur.domain.Feed;
import com.newsblur.domain.UserDetails;
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_DEFAULT_FEED_VIEW, PrefsUtils.getDefaultFeedViewForFolder(context, PrefConstants.SAVED_STORIES_FOLDER_NAME));
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);
}
}

View file

@ -196,8 +196,8 @@ public class FeedUtils {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(Intent.EXTRA_SUBJECT, Html.fromHtml(story.title));
final String shareString = context.getResources().getString(R.string.share);
intent.putExtra(Intent.EXTRA_TEXT, String.format(shareString, new Object[] { Html.fromHtml(story.title),
story.permalink }));
intent.putExtra(Intent.EXTRA_TEXT, String.format(shareString, new Object[]{Html.fromHtml(story.title),
story.permalink}));
context.startActivity(Intent.createChooser(intent, "Send using"));
}
@ -272,4 +272,8 @@ public class FeedUtils {
return dbHelper.getFeed(feedId);
}
public static SocialFeed getSocialFeed(String feedId) {
return dbHelper.getSocialFeed(feedId);
}
}