use of com.marshalchen.ultimaterecyclerview.UltimateRecyclerView 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();
}
use of com.marshalchen.ultimaterecyclerview.UltimateRecyclerView in project UltimateRecyclerView by cymcsg.
the class SliderHeader method initSlider.
private View initSlider(UltimateRecyclerView listview) {
final View view = LayoutInflater.from(getApplication()).inflate(R.layout.list_item_header, null, false);
final ViewTreeObserver vto = listview.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onGlobalLayout() {
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
//Log.d("vto", "globallayout");
final SliderLayout sl = (SliderLayout) view.findViewById(R.id.header_slider);
try {
sl.setOffscreenPageLimit(1);
sl.setSliderTransformDuration(500, new LinearOutSlowInInterpolator());
sl.setPresetTransformer(TransformerL.Default);
sl.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
sl.getPagerIndicator().setDefaultIndicatorColor(R.color.accent, R.color.primaryDark);
sl.getPagerIndicator().setVisibility(View.GONE);
setup_double_faces(sl);
} catch (Exception e) {
e.printStackTrace();
}
}
});
return view;
}
Aggregations