naman14 / PlayNewsStandDemo

Demo app for achieving UI like the one used in latest Google Play Newsstand app.
328 stars 72 forks source link

working with both scrollview you created and listview/Recycleview #5

Closed 1abid closed 8 years ago

1abid commented 8 years ago

Hello , I have followed your step and it works for me .But For my project I need to work with both screllview and list for different tab . SO I cook my code with your project and https://github.com/kmshack/Android-ParallaxHeaderViewPager and this one . but your scroll view works with scroll and parallax perfectly but my listview is not giving the parallax effect . here are some major changes in my code . please suggest me what should I do to get both listview and scrollview up and running

public class PagerAdapter extends FragmentPagerAdapter  implements PagerSlidingTabStrip.IconTabProvider{

        private SparseArrayCompat<ScrollTabHolder> mScrollTabHolders;
        private SparseArrayCompat<ScrollTabRecycleView> mScrollTabHoldersRecycle;
       ..........

        public PagerAdapter(FragmentManager fm) {
            super(fm);
            mScrollTabHolders = new SparseArrayCompat<ScrollTabHolder>();
            mScrollTabHoldersRecycle = new SparseArrayCompat<ScrollTabRecycleView>();
        }

       public Fragment getItem(int position) {

            ScrollTabHolderFragment fragment;

            switch(position){

                case 0:
                    fragment = (ScrollTabHolderFragment) ScrollViewFragment.newInstance(position);
                    mScrollTabHolders.put(position, fragment);
                    if (mListener != null) {
                        fragment.setScrollTabHolder(mListener);
                    }
                    return fragment;

                case 1:
                    fragment = (ScrollTabHolderFragment) ScrollViewFragment.newInstance(position);
                    mScrollTabHolders.put(position, fragment);
                    if (mListener != null) {
                        fragment.setScrollTabHolder(mListener);
                    }
                    return fragment;

                case 2:
                    ScrollTabHolderFragmentRecycleView fragmentone = (ScrollTabHolderFragmentRecycleView) TriprontoHomeFragment.newInstance(position);
                    mScrollTabHoldersRecycle.put(position, fragmentone);
                    if (mListener != null) {
                        fragmentone.setScrollTabHolder(mListenerRecycle);
                    }
                    return fragmentone;