Search in sources :

Example 6 with OnListItemClickMessageListener

use of com.h6ah4i.android.example.advrecyclerview.common.adapter.OnListItemClickMessageListener in project android-advancedrecyclerview by h6ah4i.

the class MinimalHeaderFooterExampleActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo_minimal);
    OnListItemClickMessageListener clickListener = new OnListItemClickMessageListener() {

        @Override
        public void onItemClicked(String message) {
            View container = findViewById(R.id.container);
            Snackbar.make(container, message, Snackbar.LENGTH_SHORT).show();
        }
    };
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    RecyclerView.Adapter adapter;
    adapter = new SimpleDemoItemAdapter(clickListener);
    adapter = new DemoHeaderFooterAdapter(adapter, clickListener);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
Also used : OnListItemClickMessageListener(com.h6ah4i.android.example.advrecyclerview.common.adapter.OnListItemClickMessageListener) RecyclerView(android.support.v7.widget.RecyclerView) DemoHeaderFooterAdapter(com.h6ah4i.android.example.advrecyclerview.common.adapter.DemoHeaderFooterAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) SimpleDemoItemAdapter(com.h6ah4i.android.example.advrecyclerview.common.adapter.SimpleDemoItemAdapter)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 RecyclerView (android.support.v7.widget.RecyclerView)6 View (android.view.View)6 OnListItemClickMessageListener (com.h6ah4i.android.example.advrecyclerview.common.adapter.OnListItemClickMessageListener)6 SimpleDemoItemAdapter (com.h6ah4i.android.example.advrecyclerview.common.adapter.SimpleDemoItemAdapter)4 DemoHeaderFooterAdapter (com.h6ah4i.android.example.advrecyclerview.common.adapter.DemoHeaderFooterAdapter)3 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)2 DebugWrapperAdapter (com.h6ah4i.android.widget.advrecyclerview.utils.DebugWrapperAdapter)2 TextView (android.widget.TextView)1 SimpleDemoExpandableItemAdapter (com.h6ah4i.android.example.advrecyclerview.common.adapter.SimpleDemoExpandableItemAdapter)1 RecyclerViewExpandableItemManager (com.h6ah4i.android.widget.advrecyclerview.expandable.RecyclerViewExpandableItemManager)1