use of com.marshalchen.ultimaterecyclerview.quickAdapter.BiAdAdapterSwitcher in project UltimateRecyclerView by cymcsg.
the class TestAdvancedAdmobActivity method imple_switch_view.
/**
* example 1 implementation of the switch view
*/
private BiAdAdapterSwitcher imple_switch_view(final UltimateRecyclerView rv) {
final adap adp1 = new adap(createadmob(), new ArrayList<String>());
final regular adp2 = new regular(new ArrayList<String>());
final BiAdAdapterSwitcher switchable = new BiAdAdapterSwitcher(rv, adp2, adp1);
return switchable;
}
use of com.marshalchen.ultimaterecyclerview.quickAdapter.BiAdAdapterSwitcher in project UltimateRecyclerView by cymcsg.
the class TestAdvancedAdmobActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loadmore);
toolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
ultimateRecyclerView.setHasFixedSize(false);
linearLayoutManager = new LinearLayoutManager(this);
ultimateRecyclerView.setLayoutManager(linearLayoutManager);
ultimateRecyclerView.setRecylerViewBackgroundColor(Color.parseColor("#ffffff"));
/**
* example 2 implementation enhancement of list view
*/
bi_sw = imple_switch_view(ultimateRecyclerView).onEnableRefresh(100).EnableAutoDisableLoadMoreByMaxPages().onEnableLoadmore(R.layout.custom_bottom_progressbar, 2000, new BiAdAdapterSwitcher.onLoadMore() {
@Override
public boolean request_start(int current_page_no, int itemsCount, int maxLastVisiblePosition, final BiAdAdapterSwitcher bi, boolean refresh) {
osh.postDelayed(new Runnable() {
@Override
public void run() {
bi.load_more_data(SampleDataboxset.newList(5));
//test the max pages
bi.setMaxPages(10);
}
}, 2000);
return true;
}
});
TextView b = (TextView) findViewById(R.id.del);
b.setText("with Ad");
TextView a = (TextView) findViewById(R.id.add);
a.setText("with out Ad");
a.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/**
* example 2 implementation enhancement of list view
* without advertisement configurations
*/
bi_sw.init(false);
}
});
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/**
* example 2 implementation enhancement of list view
* with advertisement configuration
*/
bi_sw.init(true);
}
});
setup_spinner();
}
Aggregations