Search in sources :

Example 1 with PreCachingLayoutManagerComments

use of me.ccrama.redditslide.Views.PreCachingLayoutManagerComments in project Slide by ccrama.

the class CommentPage method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = this.getArguments();
    subreddit = bundle.getString("subreddit", "");
    fullname = bundle.getString("id", "");
    page = bundle.getInt("page", 0);
    single = bundle.getBoolean("single", false);
    context = bundle.getString("context", "");
    contextNumber = bundle.getInt("contextNumber", 5);
    np = bundle.getBoolean("np", false);
    archived = bundle.getBoolean("archived", false);
    locked = bundle.getBoolean("locked", false);
    contest = bundle.getBoolean("contest", false);
    loadMore = (!context.isEmpty() && !context.equals(Reddit.EMPTY_STRING));
    if (!single)
        loadMore = false;
    int subredditStyle = new ColorPreferences(getActivity()).getThemeSubreddit(subreddit);
    contextThemeWrapper = new ContextThemeWrapper(getActivity(), subredditStyle);
    mLayoutManager = new PreCachingLayoutManagerComments(getActivity());
}
Also used : ColorPreferences(me.ccrama.redditslide.ColorPreferences) ContextThemeWrapper(android.support.v7.view.ContextThemeWrapper) Bundle(android.os.Bundle) PreCachingLayoutManagerComments(me.ccrama.redditslide.Views.PreCachingLayoutManagerComments)

Example 2 with PreCachingLayoutManagerComments

use of me.ccrama.redditslide.Views.PreCachingLayoutManagerComments in project Slide by ccrama.

the class CommentPage method doResult.

public void doResult(Intent data) {
    if (data.hasExtra("fullname")) {
        String fullname = data.getExtras().getString("fullname");
        adapter.currentSelectedItem = fullname;
        adapter.reset(getContext(), comments, rv, comments.submission, true);
        adapter.notifyDataSetChanged();
        int i = 2;
        for (CommentObject n : comments.comments) {
            if (n instanceof CommentItem && n.comment.getComment().getFullName().contains(fullname)) {
                ((PreCachingLayoutManagerComments) rv.getLayoutManager()).scrollToPositionWithOffset(i, toolbar.getHeight());
                break;
            }
            i++;
        }
    }
}
Also used : CommentItem(me.ccrama.redditslide.Adapters.CommentItem) PreCachingLayoutManagerComments(me.ccrama.redditslide.Views.PreCachingLayoutManagerComments) CommentObject(me.ccrama.redditslide.Adapters.CommentObject)

Aggregations

PreCachingLayoutManagerComments (me.ccrama.redditslide.Views.PreCachingLayoutManagerComments)2 Bundle (android.os.Bundle)1 ContextThemeWrapper (android.support.v7.view.ContextThemeWrapper)1 CommentItem (me.ccrama.redditslide.Adapters.CommentItem)1 CommentObject (me.ccrama.redditslide.Adapters.CommentObject)1 ColorPreferences (me.ccrama.redditslide.ColorPreferences)1