Search in sources :

Example 1 with SliderLayout

use of com.hkm.slider.SliderLayout 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

TargetApi (android.annotation.TargetApi)1 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)1 View (android.view.View)1 ViewTreeObserver (android.view.ViewTreeObserver)1 SliderLayout (com.hkm.slider.SliderLayout)1 BaseSliderView (com.hkm.slider.SliderTypes.BaseSliderView)1 TextSliderView (com.hkm.slider.SliderTypes.TextSliderView)1 UltimateRecyclerView (com.marshalchen.ultimaterecyclerview.UltimateRecyclerView)1