Search in sources :

Example 1 with DebugWrapperAdapter

use of com.h6ah4i.android.widget.advrecyclerview.utils.DebugWrapperAdapter 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 DebugWrapperAdapter

use of com.h6ah4i.android.widget.advrecyclerview.utils.DebugWrapperAdapter 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)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 OnListItemClickMessageListener (com.h6ah4i.android.example.advrecyclerview.common.adapter.OnListItemClickMessageListener)2 SimpleDemoItemAdapter (com.h6ah4i.android.example.advrecyclerview.common.adapter.SimpleDemoItemAdapter)2 DebugWrapperAdapter (com.h6ah4i.android.widget.advrecyclerview.utils.DebugWrapperAdapter)2