Search in sources :

Example 6 with UltimateRecyclerView

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

Example 7 with UltimateRecyclerView

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;
}
Also used : SliderLayout(com.hkm.slider.SliderLayout) LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) BaseSliderView(com.hkm.slider.SliderTypes.BaseSliderView) TextSliderView(com.hkm.slider.SliderTypes.TextSliderView) UltimateRecyclerView(com.marshalchen.ultimaterecyclerview.UltimateRecyclerView) View(android.view.View) ViewTreeObserver(android.view.ViewTreeObserver) TargetApi(android.annotation.TargetApi)

Aggregations

UltimateRecyclerView (com.marshalchen.ultimaterecyclerview.UltimateRecyclerView)7 View (android.view.View)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 Handler (android.os.Handler)3 RecyclerView (android.support.v7.widget.RecyclerView)3 AdapterView (android.widget.AdapterView)3 Drawable (android.graphics.drawable.Drawable)2 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)2 ArrayAdapter (android.widget.ArrayAdapter)2 ImageView (android.widget.ImageView)2 Spinner (android.widget.Spinner)2 ObservableScrollViewCallbacks (com.marshalchen.ultimaterecyclerview.ObservableScrollViewCallbacks)2 StickyRecyclerHeadersDecoration (com.marshalchen.ultimaterecyclerview.stickyheadersrecyclerview.StickyRecyclerHeadersDecoration)2 ArrayList (java.util.ArrayList)2 TargetApi (android.annotation.TargetApi)1 Fragment (android.support.v4.app.Fragment)1 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)1 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)1 ViewGroup (android.view.ViewGroup)1