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));
}
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));
}
Aggregations