Giter Site home page Giter Site logo

jfeinstein10 / jazzyviewpager Goto Github PK

View Code? Open in Web Editor NEW
2.7K 2.7K 815.0 995 KB

An easy to use ViewPager that adds an awesome set of custom swiping animations. Just change your ViewPagers to JazzyViewPagers, two more steps, and you're good to go!

License: Apache License 2.0

Java 100.00%

jazzyviewpager's People

Contributors

jfeinstein10 avatar makovkastar avatar mimminito avatar zaki50 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jazzyviewpager's Issues

Animation duration

Is there a way to establish the duration of the animation? I don't see that the the ViewHelper class has any method for the purpose.

Thanks

M.

JazzyViewPager & ActionBarSherlock ?

Thanks a lot for this great library, very useful 👍

However, I'm running into problems when trying to implement it into my existing app which uses ActionBarSherlock.
I changed my ViewPagers to JazzyViewPagers in both the layout and the java, I added ActionBarSherlock to JazzyViewPager (it would throw me a jar mismatch error otherwise).
I also added the Object InstantiateItem() method as my viewpager contains more than 3 views

Anyway, when I launch my app, I swipe through the views, the effects are displayed correctly but as soon as I release the swipe I get a force close due to a NullPointer exception, see the following logcat : http://pastebin.com/raw.php?i=EpGC7Nem

For some reason, when I use the tabs to navigate the app doesn't crash but as soon as I release a swipe to change view it crashes...

I really don't see where the problem is, here is my ViewPager code : http://pastebin.com/j5Diwgmv, and here is my xml layout : http://pastebin.com/1t8E8zNV

Please point me to the right direction, this is driving me nuts

When change view pager width and height through ViewGroup.LayoutParams,Animation doesn't work!

when I add this code to change the view pager width and height,the animation dosent work !

    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);

    int w = dm.widthPixels;
    int h = dm.heightPixels;
    ViewGroup.LayoutParams layoutParams = mJazzy.getLayoutParams();
    layoutParams.width = w - h / 4;
    layoutParams.height = layoutParams.width * 3 / 2;

Override onTouchEvent()

Hi, adding code below will successfully disable paging on API = 14 as well

@OverRide
public boolean onTouchEvent(MotionEvent event) {
return mEnabled ? super.onTouchEvent(event) : false;
}

View does not animate when setPagerMargin has negative value

I've used this library to implement a carousel kind of effect. For this I have set the pager margin to a negative value using- pager.setPageMargin(-100), so that there is a partial view of the left and right views.

However the view on the right do not animate, unless I travel at least once from the first view to the last. The image below highlights mt problemIs there any way to work around this issue?

Thanks
carousel_problem_image

Suggestion: add "isInEditMode" for the CTOR of JazzyViewPager

Currently, the view causes errors while showing itself via the UI designer.

I suggest using isInEditMode() command, maybe like so:

public JazzyViewPager(final Context context, final AttributeSet attrs) {
    super(context, attrs);
    setClipChildren(false);
    // now style everything!
    final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.JazzyViewPager);
    final int effect = ta.getInt(R.styleable.JazzyViewPager_style, 0);
    if (!isInEditMode()) {
        final String[] transitions = getResources().getStringArray(R.array.jazzy_effects);
        setTransitionEffect(TransitionEffect.valueOf(transitions[effect]));
    }
    setFadeEnabled(ta.getBoolean(R.styleable.JazzyViewPager_fadeEnabled, false));
            ...

JazzyViewpager Not working Properly

I added library , xml block for jazzypager like this :
<com.jfeinstein.jazzyviewpager.JazzyViewPager
android:id="@+id/viewpager"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

Added Code in Main activity

JazzyViewPager viewPager = (JazzyViewPager)findViewById(R.id.viewpager);

Then transition effect :
viewPager.setTransitionEffect(TransitionEffect.); ( - any effect)
yet my pages working normally .

How to implement when adding viewpager by xml

I replace all references to viewpager to jazzyviewpager but i get this error:

02-07 13:59:45.909: E/ViewPager(14015): java.lang.ClassCastException: android.support.v4.view.ViewPager cannot be cast to com.jfeinstein.jazzyviewpager.JazzyViewPager

my xml has :

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_horizontal|center_vertical"
    android:background="@drawable/bg"
   />

NPE on isViewFromObject when I scroll

Hello,

I got an exception when I tested the JazzyViewPager when I scroll on my pages :

02-20 00:50:33.959: E/AndroidRuntime(18268): java.lang.NullPointerException
02-20 00:50:33.959: E/AndroidRuntime(18268): at android.support.v4.app.FragmentStatePagerAdapter.isViewFromObject(FragmentStatePagerAdapter.java:169)
02-20 00:50:33.959: E/AndroidRuntime(18268): at com.jfeinstein.jazzyviewpager.JazzyViewPager.findViewFromObject(JazzyViewPager.java:566)
02-20 00:50:33.959: E/AndroidRuntime(18268): at com.jfeinstein.jazzyviewpager.JazzyViewPager.onPageScrolled(JazzyViewPager.java:499)
02-20 00:50:33.959: E/AndroidRuntime(18268): at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1577)
02-20 00:50:33.959: E/AndroidRuntime(18268): at android.support.v4.view.ViewPager.computeScroll(ViewPager.java:1542)

It maybe comes from the fact that I use a FragmentStatePagerAdapter, here is the code of my adapter :

public class MyTimelinePagerAdapter extends FragmentStatePagerAdapter {

    public MyTimelinePagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
         Object obj = super.instantiateItem(container, position);
         timelinePager.setObjectForPosition(obj, position);
         return obj;
    }

    @Override
    public Fragment getItem(int position) {
        return tabFragments.get(position);
    }

    @Override
    public int getCount() {
        return tabFragments.size();
    }

    @Override
    public int getItemPosition(Object object) {
        return PagerAdapter.POSITION_NONE;
    }
}

where tabFragments is simply a List of fragments.

Thanks for your help !

Display Next child in same view.

Question

Hello, I am using JazzyViewPager. And TransitionEffet is set to standard. Everything is working fine. I have one query. what should i do if I want to display next child in same page. Like we have in standard coverflow effect. In coverflow we can see the few part of next and previous view item. Can I achieve using JazzyViewPager ?

Can JazzyViewPager can slide cycle,or any plans

That means I want the view can slide from the last to the first(while swipe right)or form the first to last(swipe left). And the animation get no diference comparing with swiping the first page to the second page.
Thanks.

Transitions not working

Ive implemented it and get no errors but none of the transitions work (no errors) and i get just the default slide.

public static String tabs[] = {"Lotto","Euromillions","Thunderball"};
private JazzyViewPager  mPager
mPager = (JazzyViewPager)findViewById(R.id.pager);
mPager.setTransitionEffect(TransitionEffect.RotateUp);
mPager.setOffscreenPageLimit(tabs.length);
mPager.setAdapter(mAdapter);

private class MyAdapter extends PagerAdapter {

    public MyAdapter(Context context) {
        views = new ArrayList<LinearLayout>();
        views.add(new Lotto(context));
        views.add(new Euro(context));
        views.add(new Thunderball(context));
        //views.add(new Health(context));
    }

    @Override
    public Object instantiateItem(View view, final int position) {

        View myView = views.get(position);
        ((ViewGroup) view).addView(myView);

        return myView;
    }

    @SuppressWarnings("unused")
    private void updateViewPager(Context context) {
        mPager.getAdapter().notifyDataSetChanged();
    }

    public void setActionBar( ActionBar bar ) {
        mActionBar = bar;
    }


    @Override
    public int getCount() {
        return views.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }



    @Override
    public Parcelable saveState() {
        return null;
    }

    @Override
    public void startUpdate(View arg0) {

    }
    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

}  

Scaled Flip animation

Hey guys please help, I've been stuck for many days with this:
I am using Horizontal flip Animation. To me, animation doesn't seem perfect because the edges of the view are coming out of the screen while rotating it. Anyway, what I am trying to do is to scale the view while rotating it - make it smaller during the rotation. To me It seems, that while rotating the view scale doesn't work at all. When I don't use rotation scale is working correctly. Please help ! Here is my code:

    if (mState != State.IDLE) {
        if (left != null) {
            manageLayer(left, true);
            mRot = -180.0f * positionOffset;

            if (mRot < -90.0f) {
                left.setVisibility(View.INVISIBLE);
            } else {
                if (left.getVisibility() == View.INVISIBLE)
                    left.setVisibility(View.VISIBLE);
                mTrans = positionOffsetPixels;
                mScale = ZOOM_MAX + (1-ZOOM_MAX)*(1-positionOffset);

                ViewHelper.setPivotX(left, left.getMeasuredWidth()*0.5f);
                ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
                ViewHelper.setScaleX(left, mScale);
                ViewHelper.setScaleY(left, mScale);
                ViewHelper.setTranslationX(left, mTrans);
                ViewHelper.setRotationY(left, mRot);
            }
        }

        if (right != null) {
            manageLayer(right, true);
            mRot = 180.0f * (1-positionOffset);

            if (mRot > 90.0f) {
                right.setVisibility(View.INVISIBLE);
            } else {
                if (right.getVisibility() == View.INVISIBLE)
                    right.setVisibility(View.VISIBLE);
                mTrans = -getWidth()-getPageMargin()+positionOffsetPixels;
                mScale = ZOOM_MAX + (1-ZOOM_MAX)*positionOffset;

                ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
                ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
                ViewHelper.setScaleX(right, mScale);
                ViewHelper.setScaleY(right, mScale);
                ViewHelper.setTranslationX(right, mTrans);
                ViewHelper.setRotationY(right, mRot);
            }
        }
    }

get out nineoldandroids

hello, thanks for amazing lib!

  1. i want to drop off nineoldandroids lib, think it is too buggy/slowly, how to do it ?
  2. can you get me a jar, not src. And possibly jar without nineold depends

Wrong page indicated

I have a listview which has multiple items, each item when clicked opens a new activity with a viewpager with multiple pages and the jazzy viewpager.

The issue i have is when i go into a new listview item the viewpager indicates the page the previous viewpager was on.

Now this is ideal when coming in and back into the current viewpager but should reset when i go to a new listview viewpager activity.

Does jazzyviewpager manage multiple viewpagers positions? or will i need to save the active page and set that each time i open the viewpager?

how to close recycle?

I do not want to slide recycle, how can i do?
another question, when i slide to first page, it become small

Page outline isn't always fadded out.

When outlines are enabled and page is scrolled - outline is not always fadded out.
On the top screenshot outline is visible(isn't fadded out), on the bottom is invisible(is fadded out).

device-2013-05-31-231537
device-2013-05-31-231650

Visual problem

Hi ,

i am the developer of SNOView (https://play.google.com/store/apps/details?id=com.socialnetworkoverview.lite) and i want to add your cool ViewPager animation.

I am using the viewpager to display more than one item simultaneously.

see adapter method:

public float getPageWidth(int position)

{

 return 1f / m_messagesPerPageCount;

}

with your viewpager the animation is a little strange see the attachment.

(i setup tablet animation)

maybe you have an idea how to solve this?

Thanks in advance!

kind regards,

Mario

JazzyViewpager

JazzyViewPager FragmentStatePagerAdapter

The problem is that the transitions wont work but all over the app is working fine. It's just the transition effects that aren't working. I've already tried all of them but no luck. There are no errors in the codes too I don't know what I've done wrong so please help. This also my first app so please be kind. :)
I didn't include the instantiateitem on pageradapter because if I do there will be a nullpointerexception. :/
Main Activity:

public class MainActivity extends FragmentActivity {

//private static FragmentAdapter mAdapter;
private JazzyViewPager mJazzy;


  @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setupJazziness(TransitionEffect.CubeIn);

}

  @Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add("Toggle Fade");
    String[] effects = this.getResources().getStringArray(R.array.jazzy_effects);
    for (String effect : effects)
        menu.add(effect);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getTitle().toString().equals("Toggle Fade")) {
        mJazzy.setFadeEnabled(!mJazzy.getFadeEnabled());
    } else {
        TransitionEffect effect = TransitionEffect.valueOf(item.getTitle().toString());
        setupJazziness(effect);
    }
    return true;
}

  private void setupJazziness(TransitionEffect effect) {
      mJazzy = (JazzyViewPager) findViewById(R.id.jazzy_pager);
      mJazzy.setTransitionEffect(effect);
      mJazzy.setAdapter(new FragmentAdapter(getSupportFragmentManager()));
      mJazzy.setPageMargin(30);
  }   

}

Fragment Adapter:
public class FragmentAdapter extends FragmentStatePagerAdapter{

public FragmentAdapter(FragmentManager fm) {
    super(fm);
    // TODO Auto-generated constructor stub
}   

@Override
public Fragment getItem(int position) 
{
    // TODO Auto-generated method stub
    Fragment fragment = new Fragment1();
    switch(position){
    case 0:
        fragment = new Fragment1();
        break;
    case 1:
        fragment = new Fragment2();
        break;
    case 2:
        fragment = new Fragment3();
        break;
    }
    return fragment;
}


@Override
public int getCount() {
    // TODO Auto-generated method stub
    return 3;
}

@Override
public boolean isViewFromObject(View view, Object object) {
    if(object != null){
        return ((Fragment)object).getView() == view;
    }else{
        return false;
    }
}

}

Fragment1:
public class Fragment1 extends Fragment {

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
    View v = inflater.inflate(R.layout.fragment1_layout, null);
    return v;
}    

}

activity_main xml:
<com.jfeinstein.jazzyviewpager.JazzyViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:app1="http://schemas.android.com/apk/res/com.eight.yamjay"
android:id="@+id/jazzy_pager"
app1:style="cubeout"
android:layout_width="match_parent"
android:layout_height="match_parent" />

FragmentPagerAdapter-java.lang.IllegalStateException: Fragment already added

Hi Jeremy Feinstein, I am trying to use your JazzyViewPager with a FragmentPagerAdapter,but it occur a
java.lang.IllegalStateException: Fragment already added: HomeFragment{40f97560 #0 id=0x7f040012 android:switcher:2130968594:0}

here is my code:

final class FMPagerAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragments;

    public FMPagerAdapter(FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        if(object != null){
            return ((Fragment)object).getView() == view;
        }else{
            return false;
        }
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        Object obj = super.instantiateItem(container, position);
        viewPager.setObjectForPosition(obj, position);
        return super.instantiateItem(container, position);
    }


    @Override
    public Fragment getItem(int arg0) {
        // TODO Auto-generated method stub
        return fragments.get(arg0);
    }


    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return this.fragments.size();
    }

}

and if i don't overwrite instantiateItem method ,it works well ,but have no TransitionEffect..

JazzyViewPager combined with PagerContainer

Hi,

I've been trying to use the JazzyViewPager in combination with a PagerContainer as described in https://gist.github.com/8cbe094bb7a783e37ad1. This container allows for multiple items in the pager to be visible at the same time.

The problem is that when I use the ZoomIn transition effect, the effect is not applied immediately, but only after I move the page. After scrolling through all the pages the effect is applied correctly all the time. Example screenshots can be found at http://imgur.com/a/xhSgZ.

Does anyone have an idea what causes this problem, and maybe how to solve it?

Rare crash when scrolling

Hi,

I have no idea how I got this crash, but when I scrolled a page, I got a crash. It's a very rare crash and I only noticed it once.
A hint about why it happened is that inside the pages I have a zoomable imageView (from here: https://github.com/MikeOrtiz/TouchImageView ) . I let the viewpager scroll only when the zoom is 100% .

Here's the log:

07-06 16:57:50.436: E/AndroidRuntime(26532): FATAL EXCEPTION: main
07-06 16:57:50.436: E/AndroidRuntime(26532): java.lang.IllegalArgumentException: pointerIndex out of range
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.MotionEvent.nativeGetAxisValue(Native Method)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.MotionEvent.getX(MotionEvent.java:2022)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:91)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:219)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1834)
07-06 16:57:50.436: E/AndroidRuntime(26532): at com.syncme.tools.ui.customViews.jazzy_viewpager.JazzyViewPager.onInterceptTouchEvent(JazzyViewPager.java:143)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1851)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2208)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1951)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2208)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1951)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2208)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1951)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2208)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1951)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2208)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1951)
07-06 16:57:50.436: E/AndroidRuntime(26532): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2184)
07-06 16:57:50.436: E/AndroidRuntime(26532): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1614)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.app.Activity.dispatchTouchEvent(Activity.java:2497)
07-06 16:57:50.436: E/AndroidRuntime(26532): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2132)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.View.dispatchPointerEvent(View.java:7564)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewRootImpl$1.doDispatch(ViewRootImpl.java:354)
07-06 16:57:50.436: E/AndroidRuntime(26532): at com.lge.view.TouchEventFilter.dispatchFilteredTouchEvent(TouchEventFilter.java:132)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3368)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3271)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4501)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4480)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4581)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:171)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4551)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4600)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.Choreographer.doFrame(Choreographer.java:530)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.os.Handler.handleCallback(Handler.java:725)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.os.Handler.dispatchMessage(Handler.java:92)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.os.Looper.loop(Looper.java:137)
07-06 16:57:50.436: E/AndroidRuntime(26532): at android.app.ActivityThread.main(ActivityThread.java:5171)
07-06 16:57:50.436: E/AndroidRuntime(26532): at java.lang.reflect.Method.invokeNative(Native Method)
07-06 16:57:50.436: E/AndroidRuntime(26532): at java.lang.reflect.Method.invoke(Method.java:511)
07-06 16:57:50.436: E/AndroidRuntime(26532): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
07-06 16:57:50.436: E/AndroidRuntime(26532): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
07-06 16:57:50.436: E/AndroidRuntime(26532): at dalvik.system.NativeStart.main(Native Method)

Does anyone know when it occurs, and how can I fix it?

Possible zoom in animation in list-view ?

Hello,This view pager example is very good.
i tried to use zoom in animation in list view but here mJazzy.setTransitionEffect(effect); inbuilt method of view pager so i cant achieved zoom in animation in listview.
So is it possible to make listview item zoom in as scroll same as like in your example.

Thanks :)

CubeIn animation is not working properly

Thank you for great lib. Really awesome.
I think CubeIn transition is not working properly. Can it work like Cubeout.
Cubeout works great. It rotate whole page @some degree. but I think cubein zooms end points only so that does not looks as cubein should have.

Thanks for lib once again.

Source Code for APK

Implementation will be easy and more implementation will happen if you could upload the source code for sample APK.

Do not manage multiple pages ViewPager

Hi again,

I am using a multiple pages viewpager for my project, and I got strange transition effects as you can see on the images. Do you think there is a way to make this library work with this kind of ViewPager ?
2013-02-20 01 14 25
2013-02-20 01 14 39

swipe from the far left to the far right or vice versa, how can Implement less of a swipe

Hello,
I am using Jazzy ViewPager, how can I change the swipe style on the pictures to swipe from picture one to two? Currently I have to swipe from the far left to the far right or vice versa. How can Implement less of a swipe or a different transition all together that would be great?
Right now it's too long of a swipe
Should be more of a flick

Best Regards,
shahzad

Memory leak

My project make with this library has memory leak

and i fix that below some code

add method at JazzyViewPager.java

public void delObjectForPosition(int position)
{
mObjs.remove(Integer.vauleOf(position));
}

and modify my pageradapter

@OverRiD
public void destoryItem(View container, int position, Object obj)
{
jazzPager.removeView(View)obj);
jazzPAger.delObjectForPosition(position);
}

FragmentStatePagerAdapter - Compatability/Example (Currently Crashing)

Hi, I am trying to use your JazzyViewPager with a FragmentStatePagerAdapter, but it crashes. Do you think that you can try to get a working example using a FragmentStatePagerAdapter? I can send you working source code (without the JazzyViewPager) if you would like.

I appreciate your time on this and this awesome project :)

Adapter Class:

public class NotificationViewPagerAdapter extends FragmentStatePagerAdapter {

    public NotificationViewPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public int getCount() {
        return _notificationViewPager.getCount();
    }

    @Override
    public Fragment getItem(int position) {
        return NotificationFragment.newInstance(_context, _notificationViewPager.getNotification(position), position, _notificationViewPager.getTotalNotifications());
    }

    @Override
    public int getItemPosition(Object object) {
        int index = _notificationViewPager.getNotifications().indexOf(object);
        if(index >= 0){
            return index;
        }else{
            return PagerAdapter.POSITION_NONE;
        }
    }

    @Override
    public Object instantiateItem(ViewGroup container, final int position) {
        Object obj = super.instantiateItem(container, position);
        _notificationViewPager.setObjectForPosition(obj, position);
        return obj;
    }

}

After the 3rd view transitions, I get the following error:

02-27 12:30:42.396: E/AndroidRuntime(11882): FATAL EXCEPTION: main
02-27 12:30:42.396: E/AndroidRuntime(11882): java.lang.NullPointerException
02-27 12:30:42.396: E/AndroidRuntime(11882): at apps.droidnotify.FragmentStatePagerAdapter.isViewFromObject(FragmentStatePagerAdapter.java:169)
02-27 12:30:42.396: E/AndroidRuntime(11882): at apps.droidnotify.jazzyviewpager.JazzyViewPager.findViewFromObject(JazzyViewPager.java:567)
02-27 12:30:42.396: E/AndroidRuntime(11882): at apps.droidnotify.jazzyviewpager.JazzyViewPager.onPageScrolled(JazzyViewPager.java:500)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1577)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.support.v4.view.ViewPager.computeScroll(ViewPager.java:1542)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.View.getDisplayList(View.java:10433)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2896)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.View.getDisplayList(View.java:10407)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2896)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.View.getDisplayList(View.java:10407)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2896)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.View.getDisplayList(View.java:10407)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2896)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.View.getDisplayList(View.java:10407)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:883)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2118)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1810)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2695)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.os.Looper.loop(Looper.java:156)
02-27 12:30:42.396: E/AndroidRuntime(11882): at android.app.ActivityThread.main(ActivityThread.java:4977)
02-27 12:30:42.396: E/AndroidRuntime(11882): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 12:30:42.396: E/AndroidRuntime(11882): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 12:30:42.396: E/AndroidRuntime(11882): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-27 12:30:42.396: E/AndroidRuntime(11882): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-27 12:30:42.396: E/AndroidRuntime(11882): at dalvik.system.NativeStart.main(Native Method)

Any help would be appreciated.

Stack animation is not working properly

When user starts dragging the top page - the bottom page immediately overlaps it. See attached screenshots. This bug is appearing constantly on my Nexus S (Android 4.1.2) and on emulator (Android 4.2)

screenshot_2013-05-01-14-53-54

screenshot_2013-05-01-15-16-49

Unable to use this library in Android Studio

Can I please get a guide on how to setup this library in Android Studio. Whenever, I try to run a project based on this library from Android Studio, this library itself gets built as project and runs as an app instead of the main app that I've built using this library.

setOutlineEnabled(true) breaks JazzyViewPager

I'm trying to enable outlines in the JazzyViewPager but after setting this option to true ViewPager becomes blank.

mJazzy = (JazzyViewPager) findViewById(R.id.jazzy_pager);
mJazzy.setOutlineEnabled(true);

device-2013-05-13-203422

Request: add animations as shown on Google's example

This is just a request:

Please add animations as shown on Google's example:
http://developer.android.com/training/animation/screen-slide.html#pagetransformer

Here's what I suggest, and I think it works fine :

I've added an enum value "GOOGLE_ZOOM" , and used it just like any other enum value was used on this library (BTW, why weren't they valued in capital letters, as used in the conventions of enum values, and why did you use a string array ?) .

here's what i've tried (inside JazzyViewPager.java ) :

@Override
public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) {
    ...
    case GOOGLE_ZOOM:
        animateGoogleZoom(mLeft, mRight, effectOffset);
        break;
    }
    ...


private void animateGoogleZoom(final View left, final View right, final float positionOffset) {
    for (int i = 0; i < 2; ++i) {
        final View view = i == 0 ? left : right;
        if (view == null)
            continue;
        final float position = i == 0 ? positionOffset : 1 - positionOffset;
        final int pageWidth = view.getWidth();
        final int pageHeight = view.getHeight();
        final float MIN_SCALE = 0.85f;
        final float MIN_ALPHA = 0.5f;

        if (position < -1) { // [-Infinity,-1)
            // This page is way off-screen to the left.
            ViewHelper.setAlpha(view, 0);
        } else if (position <= 1) { // [-1,1]
            // Modify the default slide transition to shrink the page as well
            final float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
            final float vertMargin = pageHeight * (1 - scaleFactor) / 2;
            final float horzMargin = pageWidth * (1 - scaleFactor) / 2;
            if (position < 0) {
                ViewHelper.setTranslationX(view, horzMargin - vertMargin / 2);
            } else {
                ViewHelper.setTranslationX(view, -horzMargin + vertMargin / 2);
            }

            // Scale the page down (between MIN_SCALE and 1)
            ViewHelper.setScaleX(view, scaleFactor);
            ViewHelper.setScaleY(view, scaleFactor);

            // Fade the page relative to its size.
            ViewHelper.setAlpha(view, MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));

        } else { // (1,+Infinity]
            // This page is way off-screen to the right.
            ViewHelper.setAlpha(view, 0);
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.