Search in sources :

Example 26 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project Tusky by Vavassor.

the class NotificationsFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_timeline, container, false);
    // Setup the SwipeRefreshLayout.
    Context context = getContext();
    swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
    swipeRefreshLayout.setOnRefreshListener(this);
    // Setup the RecyclerView.
    recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    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);
    adapter = new NotificationsAdapter(this, this);
    recyclerView.setAdapter(adapter);
    TabLayout layout = (TabLayout) getActivity().findViewById(R.id.tab_layout);
    onTabSelectedListener = new TabLayout.OnTabSelectedListener() {

        @Override
        public void onTabSelected(TabLayout.Tab tab) {
        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {
        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {
            jumpToTop();
        }
    };
    layout.addOnTabSelectedListener(onTabSelectedListener);
    return rootView;
}
Also used : Context(android.content.Context) NotificationsAdapter(com.keylesspalace.tusky.adapter.NotificationsAdapter) TabLayout(android.support.design.widget.TabLayout) Drawable(android.graphics.drawable.Drawable) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) Nullable(android.support.annotation.Nullable)

Example 27 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration 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)

Example 28 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project Tusky by Vavassor.

the class ReportActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_report);
    Intent intent = getIntent();
    accountId = intent.getStringExtra("account_id");
    String accountUsername = intent.getStringExtra("account_username");
    String statusId = intent.getStringExtra("status_id");
    String statusContent = intent.getStringExtra("status_content");
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        String title = String.format(getString(R.string.report_username_format), accountUsername);
        bar.setTitle(title);
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
    }
    anyView = toolbar;
    final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.report_recycler_view);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    adapter = new ReportAdapter();
    recyclerView.setAdapter(adapter);
    DividerItemDecoration divider = new DividerItemDecoration(this, layoutManager.getOrientation());
    Drawable drawable = ThemeUtils.getDrawable(this, R.attr.report_status_divider_drawable, R.drawable.report_status_divider_dark);
    divider.setDrawable(drawable);
    recyclerView.addItemDecoration(divider);
    ReportAdapter.ReportStatus reportStatus = new ReportAdapter.ReportStatus(statusId, HtmlUtils.fromHtml(statusContent), true);
    adapter.addItem(reportStatus);
    comment = (EditText) findViewById(R.id.report_comment);
    reportAlreadyInFlight = false;
    fetchRecentStatuses(accountId);
}
Also used : ReportAdapter(com.keylesspalace.tusky.adapter.ReportAdapter) Drawable(android.graphics.drawable.Drawable) Intent(android.content.Intent) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 29 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project UltimateAndroid by cymcsg.

the class RecyclerViewItemAnimatorActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.recycler_view_activity_recycler);
    setupSpinner();
    mRecyclerView = (RecyclerView) findViewById(R.id.list);
    //mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
    mAdapter = new SimpleAdapter(this, sCheeseStrings);
    mRecyclerView.setAdapter(mAdapter);
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 30 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project RecyclerViewRenderers by Alexrs95.

the class RenderersActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.a_bender);
    ButterKnife.inject(this);
    recyclerView.setHasFixedSize(false);
    recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    adapter = new RendererAdapter(createItems(), new RendererBuilder(new Factory()));
    recyclerView.setAdapter(adapter);
}
Also used : RendererBuilder(me.alexrs.recyclerviewrenderers.builder.RendererBuilder) Factory(me.alexrs.recyclerviewrenderers.factory.Factory) DividerItemDecoration(me.alexrs.recyclerviewrenderers.decorator.DividerItemDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) RendererAdapter(me.alexrs.recyclerviewrenderers.adapter.RendererAdapter)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)73 RecyclerView (android.support.v7.widget.RecyclerView)42 View (android.view.View)36 TextView (android.widget.TextView)23 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)19 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)15 ImageView (android.widget.ImageView)14 DividerItemDecoration (com.wm.remusic.widget.DividerItemDecoration)9 Drawable (android.graphics.drawable.Drawable)8 DividerItemDecoration (de.madcyph3r.example.DividerItemDecoration)8 DividerItemDecoration (io.hefuyi.listener.widget.DividerItemDecoration)7 Nullable (android.support.annotation.Nullable)6 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)6 Context (android.content.Context)5 Toolbar (android.support.v7.widget.Toolbar)5 Intent (android.content.Intent)4 ActionBar (android.support.v7.app.ActionBar)4 DividerItemDecoration (com.lzy.demo.base.DividerItemDecoration)4 DividerItemDecoration (org.michenux.drodrolib.ui.recyclerview.DividerItemDecoration)4 TargetApi (android.annotation.TargetApi)3