Search in sources :

Example 1 with ThreadAdapter

use of com.keylesspalace.tusky.adapter.ThreadAdapter in project Tusky by Vavassor.

the class ViewThreadFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_view_thread, container, false);
    Context context = getContext();
    swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
    swipeRefreshLayout.setOnRefreshListener(this);
    recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    recyclerView.setLayoutManager(layoutManager);
    DividerItemDecoration divider = new DividerItemDecoration(context, layoutManager.getOrientation());
    Drawable drawable = ThemeUtils.getDrawable(context, R.attr.status_divider_drawable, R.drawable.status_divider_dark);
    divider.setDrawable(drawable);
    recyclerView.addItemDecoration(divider);
    recyclerView.addItemDecoration(new ConversationLineItemDecoration(context, ContextCompat.getDrawable(context, R.drawable.conversation_divider_dark)));
    adapter = new ThreadAdapter(this);
    recyclerView.setAdapter(adapter);
    mastodonApi = null;
    thisThreadsStatusId = null;
    return rootView;
}
Also used : Context(android.content.Context) StatusContext(com.keylesspalace.tusky.entity.StatusContext) ThreadAdapter(com.keylesspalace.tusky.adapter.ThreadAdapter) Drawable(android.graphics.drawable.Drawable) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) ConversationLineItemDecoration(com.keylesspalace.tusky.view.ConversationLineItemDecoration) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) Nullable(android.support.annotation.Nullable)

Aggregations

Context (android.content.Context)1 Drawable (android.graphics.drawable.Drawable)1 Nullable (android.support.annotation.Nullable)1 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ThreadAdapter (com.keylesspalace.tusky.adapter.ThreadAdapter)1 StatusContext (com.keylesspalace.tusky.entity.StatusContext)1 ConversationLineItemDecoration (com.keylesspalace.tusky.view.ConversationLineItemDecoration)1