Search in sources :

Example 1 with BiAdAdapterSwitcher

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;
}
Also used : BiAdAdapterSwitcher(com.marshalchen.ultimaterecyclerview.quickAdapter.BiAdAdapterSwitcher)

Example 2 with BiAdAdapterSwitcher

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();
}
Also used : BiAdAdapterSwitcher(com.marshalchen.ultimaterecyclerview.quickAdapter.BiAdAdapterSwitcher) TextView(android.widget.TextView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) UltimateRecyclerView(com.marshalchen.ultimaterecyclerview.UltimateRecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) AdView(com.google.android.gms.ads.AdView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Aggregations

BiAdAdapterSwitcher (com.marshalchen.ultimaterecyclerview.quickAdapter.BiAdAdapterSwitcher)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 AdView (com.google.android.gms.ads.AdView)1 UltimateRecyclerView (com.marshalchen.ultimaterecyclerview.UltimateRecyclerView)1