Search in sources :

Example 1 with OnListItemClickMessageListener

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

the class CustomFilteringWrapperAdapterExampleActivity 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 = mFilteringAdapter = new MyItemFilteringAdapter(adapter);
    if (BuildConfig.DEBUG) {
        adapter = new DebugWrapperAdapter(adapter);
    }
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
Also used : DebugWrapperAdapter(com.h6ah4i.android.widget.advrecyclerview.utils.DebugWrapperAdapter) OnListItemClickMessageListener(com.h6ah4i.android.example.advrecyclerview.common.adapter.OnListItemClickMessageListener) RecyclerView(android.support.v7.widget.RecyclerView) 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)

Example 2 with OnListItemClickMessageListener

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

the class CustomInsertionWrapperAdapterExampleActivity 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 = mInsertionAdapter = new MyItemInsertionAdapter(adapter, clickListener);
    if (BuildConfig.DEBUG) {
        // NOTE: DebugWrapperAdapter checks whether the wrapPosition()
        // and unwrapPosition() methods are properly implemented
        adapter = new DebugWrapperAdapter(adapter);
    }
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
Also used : DebugWrapperAdapter(com.h6ah4i.android.widget.advrecyclerview.utils.DebugWrapperAdapter) OnListItemClickMessageListener(com.h6ah4i.android.example.advrecyclerview.common.adapter.OnListItemClickMessageListener) RecyclerView(android.support.v7.widget.RecyclerView) 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)

Example 3 with OnListItemClickMessageListener

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

the class ExpandableWithHeaderFooterExampleActivity 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);
    // Setup expandable feature and RecyclerView
    RecyclerViewExpandableItemManager expMgr = new RecyclerViewExpandableItemManager(null);
    // Create wrapped adapter:  MyItemAdapter -> expMgr.createWrappedAdapter -> MyHeaderFooterAdapter
    RecyclerView.Adapter adapter;
    adapter = new SimpleDemoExpandableItemAdapter(expMgr, clickListener);
    adapter = expMgr.createWrappedAdapter(adapter);
    adapter = new DemoHeaderFooterAdapter(adapter, clickListener);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    // NOTE: need to disable change animations to ripple effect work properly
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    expMgr.attachRecyclerView(recyclerView);
}
Also used : SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) OnListItemClickMessageListener(com.h6ah4i.android.example.advrecyclerview.common.adapter.OnListItemClickMessageListener) SimpleDemoExpandableItemAdapter(com.h6ah4i.android.example.advrecyclerview.common.adapter.SimpleDemoExpandableItemAdapter) 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) RecyclerViewExpandableItemManager(com.h6ah4i.android.widget.advrecyclerview.expandable.RecyclerViewExpandableItemManager)

Example 4 with OnListItemClickMessageListener

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

the class CompositionAllExampleActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo_minimal);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    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.setLayoutManager(new LinearLayoutManager(this));
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    RecyclerView.Adapter adapter;
    adapter = createComposedAdapter(recyclerView, clickListener);
    adapter = new DemoHeaderFooterAdapter(adapter, clickListener);
    recyclerView.setAdapter(adapter);
}
Also used : SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) OnListItemClickMessageListener(com.h6ah4i.android.example.advrecyclerview.common.adapter.OnListItemClickMessageListener) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DemoHeaderFooterAdapter(com.h6ah4i.android.example.advrecyclerview.common.adapter.DemoHeaderFooterAdapter) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 5 with OnListItemClickMessageListener

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

the class AddRemoveHeaderFooterExampleActivity 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 = mHeaderFooterAdapter = new MyHeaderFooterAdapter(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) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) 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