Search in sources :

Example 1 with ThreadPreviewRecyclerViewAdapter

use of io.github.hidroh.materialistic.widget.ThreadPreviewRecyclerViewAdapter in project materialistic by hidroh.

the class ThreadPreviewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Item item = getIntent().getParcelableExtra(EXTRA_ITEM);
    if (item == null) {
        finish();
        return;
    }
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_thread_preview);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    recyclerView.setLayoutManager(new SnappyLinearLayoutManager(this, false));
    recyclerView.addItemDecoration(new CommentItemDecoration(this));
    recyclerView.setAdapter(new ThreadPreviewRecyclerViewAdapter(mItemManager, item));
    mKeyDelegate.setScrollable(new KeyDelegate.RecyclerViewHelper(recyclerView, KeyDelegate.RecyclerViewHelper.SCROLL_ITEM), null);
}
Also used : Item(io.github.hidroh.materialistic.data.Item) MenuItem(android.view.MenuItem) SnappyLinearLayoutManager(io.github.hidroh.materialistic.widget.SnappyLinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) CommentItemDecoration(io.github.hidroh.materialistic.widget.CommentItemDecoration) ThreadPreviewRecyclerViewAdapter(io.github.hidroh.materialistic.widget.ThreadPreviewRecyclerViewAdapter)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1 MenuItem (android.view.MenuItem)1 Item (io.github.hidroh.materialistic.data.Item)1 CommentItemDecoration (io.github.hidroh.materialistic.widget.CommentItemDecoration)1 SnappyLinearLayoutManager (io.github.hidroh.materialistic.widget.SnappyLinearLayoutManager)1 ThreadPreviewRecyclerViewAdapter (io.github.hidroh.materialistic.widget.ThreadPreviewRecyclerViewAdapter)1