An easy to use ViewPager that adds an awesome set of custom swiping animations. Just change your ViewPagers to JazzyViewPagers and you're good to go!
This project was inspired by CyanogenMod's Trebuchet launcher.
The JazzyViewPager
's animations are encapsulated in TransitionEffect
. I'll be adding more, but if you can think of anything
in particular, let me know by filing an "Enhancement" in the Issues section.
public enum TransitionEffect {
Standard,
Tablet,
CubeIn,
CubeOut,
Flip,
Stack,
ZoomIn,
ZoomOut,
RotateUp,
RotateDown,
Accordion
}
You can select your animation by calling
private JazzyViewPager mJazzy;
/* ... */
mJazzy.setTransitionEffect(TransitionEffect.*);
Due to the limitations of the ViewPager
class (which JazzyViewPager
is built upon) in order to get the animations to work correctly
for more than 3 Views, you'll have to add the following to the instantiateItem
method of your PagerAdapter
.
private JazzyViewPager mJazzy;
/* ... */
@Override
public Object instantiateItem(ViewGroup container, final int position) {
Object obj = super.instantiateItem(container, position);
mJazzy.setObjectForPosition(obj, position);
return obj;
}
Once your Object
is registered with the JazzyViewPager
, you're good to go!
Copyright 2013 Jeremy Feinstein
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.