{"action":"opened","issue":{"url":"https://api.github.com/repos/daimajia/AndroidImageSlider/issues/251","repository_url":"https://api.github.com/repos/daimajia/AndroidImageSlider","labels_url":"https://api.github.com/repos/daimajia/AndroidImageSlider/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/daimajia/AndroidImageSlider/issues/251/comments","events_url":"https://api.github.com/repos/daimajia/AndroidImageSlider/issues/251/events","html_url":"https://github.com/daimajia/AndroidImageSlider/issues/251","id":169346352,"number":251,"title":"How to make this work with PhotoView - zoom image?","user":{"login":"ericn37","id":19919208,"avatar_url":"https://avatars.githubusercontent.com/u/19919208?v=3","gravatar_id":"","url":"https://api.github.com/users/ericn37","html_url":"https://github.com/ericn37","followers_url":"https://api.github.com/users/ericn37/followers","following_url":"https://api.github.com/users/ericn37/following{/other_user}","gists_url":"https://api.github.com/users/ericn37/gists{/gist_id}","starred_url":"https://api.github.com/users/ericn37/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericn37/subscriptions","organizations_url":"https://api.github.com/users/ericn37/orgs","repos_url":"https://api.github.com/users/ericn37/repos","events_url":"https://api.github.com/users/ericn37/events{/privacy}","received_events_url":"https://api.github.com/users/ericn37/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-04T10:49:40Z","updated_at":"2016-08-04T10:49:40Z","closed_at":null,"body":"I have extended your `SliderLayout` class as follows:\r\n```java\r\npublic class CustomImageSlider extends SliderLayout {\r\n    private static final String TAG = \"CustomImageSlider\";\r\n    private  HackyViewPager mViewPager;\r\n\r\n    private Context mContext;\r\n\r\n    /**\r\n     * InfiniteViewPager adapter.\r\n     */\r\n    private SliderAdapter mSliderAdapter;\r\n\r\n    /**\r\n     * {@link com.daimajia.slider.library.Tricks.ViewPagerEx} indicator.\r\n     */\r\n    private PagerIndicator mIndicator;\r\n\r\n\r\n    /**\r\n     * A timer and a TimerTask using to cycle the {@link com.daimajia.slider.library.Tricks.ViewPagerEx}.\r\n     */\r\n    private Timer mCycleTimer;\r\n    private TimerTask mCycleTask;\r\n\r\n    /**\r\n     * For resuming the cycle, after user touch or click the {@link com.daimajia.slider.library.Tricks.ViewPagerEx}.\r\n     */\r\n    private Timer mResumingTimer;\r\n    private TimerTask mResumingTask;\r\n\r\n    /**\r\n     * If {@link com.daimajia.slider.library.Tricks.ViewPagerEx} is Cycling\r\n     */\r\n    private boolean mCycling;\r\n\r\n    /**\r\n     * Determine if auto recover after user touch the {@link com.daimajia.slider.library.Tricks.ViewPagerEx}\r\n     */\r\n    private boolean mAutoRecover = true;\r\n\r\n    private int mTransformerId;\r\n\r\n    /**\r\n     * {@link com.daimajia.slider.library.Tricks.ViewPagerEx} transformer time span.\r\n     */\r\n    private int mTransformerSpan = 1100;\r\n\r\n    private boolean mAutoCycle;\r\n\r\n    /**\r\n     * the duration between animation.\r\n     */\r\n    private long mSliderDuration = 4000;\r\n\r\n    /**\r\n     * Visibility of {@link com.daimajia.slider.library.Indicators.PagerIndicator}\r\n     */\r\n    private PagerIndicator.IndicatorVisibility mIndicatorVisibility = PagerIndicator.IndicatorVisibility.Visible;\r\n\r\n    /**\r\n     * {@link com.daimajia.slider.library.Tricks.ViewPagerEx} 's transformer\r\n     */\r\n    private BaseTransformer mViewPagerTransformer;\r\n\r\n    /**\r\n     * @see com.daimajia.slider.library.Animations.BaseAnimationInterface\r\n     */\r\n    private BaseAnimationInterface mCustomAnimation;\r\n\r\n    public CustomImageSlider(Context context) {\r\n        super(context);\r\n    }\r\n\r\n    public CustomImageSlider(Context context, AttributeSet attrs) {\r\n        super(context, attrs);\r\n    }\r\n\r\n    public CustomImageSlider(Context context, AttributeSet attrs, int defStyle) {\r\n        super(context, attrs, defStyle);\r\n        mContext = context;\r\n        LayoutInflater.from(context).inflate(com.daimajia.slider.library.R.layout.slider_layout, this, true);\r\n\r\n        final TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, com.daimajia.slider.library.R.styleable.SliderLayout,\r\n                defStyle,0);\r\n\r\n        mTransformerSpan = attributes.getInteger(com.daimajia.slider.library.R.styleable.SliderLayout_pager_animation_span, 1100);\r\n        mTransformerId = attributes.getInt(com.daimajia.slider.library.R.styleable.SliderLayout_pager_animation, Transformer.Default.ordinal());\r\n        mAutoCycle = attributes.getBoolean(com.daimajia.slider.library.R.styleable.SliderLayout_auto_cycle,true);\r\n        int visibility = attributes.getInt(com.daimajia.slider.library.R.styleable.SliderLayout_indicator_visibility,0);\r\n        for(PagerIndicator.IndicatorVisibility v: PagerIndicator.IndicatorVisibility.values()){\r\n            if(v.ordinal() == visibility){\r\n                mIndicatorVisibility = v;\r\n                break;\r\n            }\r\n        }\r\n        mSliderAdapter = new SliderAdapter(mContext);\r\n        PagerAdapter wrappedAdapter = new InfinitePagerAdapter(mSliderAdapter);\r\n\r\n        mViewPager = (HackyViewPager) findViewById(com.daimajia.slider.library.R.id.daimajia_slider_viewpager);\r\n        mViewPager.setAdapter(wrappedAdapter);\r\n\r\n        mViewPager.setOnTouchListener(new OnTouchListener() {\r\n            @Override\r\n            public boolean onTouch(View v, MotionEvent event) {\r\n                int action = event.getAction();\r\n                switch (action) {\r\n                    case MotionEvent.ACTION_UP:\r\n                        recoverCycle();\r\n                        break;\r\n                }\r\n                return false;\r\n            }\r\n        });\r\n\r\n        attributes.recycle();\r\n        setPresetIndicator(PresetIndicators.Center_Bottom);\r\n        setPresetTransformer(mTransformerId);\r\n        setSliderTransformDuration(mTransformerSpan,null);\r\n        setIndicatorVisibility(mIndicatorVisibility);\r\n        if(mAutoCycle){\r\n            startAutoCycle();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * when paused cycle, this method can weak it up.\r\n     */\r\n    private void recoverCycle(){\r\n        if(!mAutoRecover || !mAutoCycle){\r\n            return;\r\n        }\r\n\r\n        if(!mCycling){\r\n            if(mResumingTask != null && mResumingTimer!= null){\r\n                mResumingTimer.cancel();\r\n                mResumingTask.cancel();\r\n            }\r\n            mResumingTimer = new Timer();\r\n            mResumingTask = new TimerTask() {\r\n                @Override\r\n                public void run() {\r\n                    startAutoCycle();\r\n                }\r\n            };\r\n            mResumingTimer.schedule(mResumingTask, 6000);\r\n        }\r\n    }\r\n}\r\n```\r\nHackyViewPager is as follows:\r\n```java\r\npublic class HackyViewPager extends InfiniteViewPager {\r\n    private static final String TAG = \"HackyViewPager\";\r\n\r\n    public HackyViewPager(Context context) {\r\n        super(context);\r\n    }\r\n\r\n    public HackyViewPager(Context context, AttributeSet attrs) {\r\n        super(context, attrs);\r\n    }\r\n\r\n    @Override\r\n    public boolean onInterceptTouchEvent(MotionEvent ev) {\r\n        Log.v(TAG, \"onInterceptTouchEvent\");\r\n        try {\r\n            return super.onInterceptTouchEvent(ev);\r\n        } catch (IllegalArgumentException e) {\r\n            e.printStackTrace();\r\n            return false;\r\n        }\r\n    }\r\n}\r\n```\r\nHowever, `onInterceptTouchEvent` is not even triggered.\r\nThis is the fragment where I use the slider:\r\n```java\r\npublic class ImageSliderFrag extends Fragment implements BaseSliderView.OnSliderClickListener, ViewPagerEx\r\n        .OnPageChangeListener {\r\nprivate void renderSlider() {\r\n         for (int i = 0; i < mSlides.size(); i++) {\r\n                DefaultSliderView v = new DefaultSliderView(getActivity());\r\n                v.image(mSlides.get(i).getImageurl());\r\n                v.setScaleType(BaseSliderView.ScaleType.CenterInside);\r\n                mSlideShow.addSlider(v);\r\n                v.setOnSliderClickListener(this);\r\n                ImageView iv = (ImageView) v.getView().findViewById(R.id.daimajia_slider_image);\r\n                PhotoViewAttacher mAttacher = new PhotoViewAttacher(iv);\r\n            }\r\n            mSlideShow.setDuration(DURATION_AUTO_PLAY);\r\n            mSlideShow.setCustomIndicator(mPagerIndicator);\r\n            mSlideShow.addOnPageChangeListener(this);\r\n}\r\n@Override\r\n    public void onSliderClick(BaseSliderView slider) {\r\n        Log.v(TAG, \"onSliderClick\");\r\n        ImageView iv = (ImageView) slider.getView().findViewById(R.id.daimajia_slider_image);\r\n        PhotoViewAttacher mAttacher = new PhotoViewAttacher(iv);\r\n    }\r\n\r\n    @Override\r\n    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {\r\n    }\r\n\r\n    @Override\r\n    public void onPageSelected(int position) {\r\n    }\r\n\r\n    @Override\r\n    public void onPageScrollStateChanged(int state) {\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"ericn37"}}