Presentation:

First, an overview of the implementation:



Then a demonstration of the individual effects:

Displacement animation demonstration:

Zoom animation demo:

Transparency animation demo:

Rotation animation demo:

Global image immersion demo:

Blur background demo:

Dynamic blur demonstration:

Reverse dynamic blur demonstration

A single animation is done. Here are a few groups of composite animations



Ok, that’s all for now, because there are too many combos to do

Here’s a quick calculation:

(Displacement animation (3)* Zoom animation (2)* Transparent animation (2)* Rotation animation (6), image background effects (4)=288, in addition to zoom, transparency,3D rotation, dynamic blur can be set range, so more customizable effects.Copy the code

Next, it’s time to introduce how to use:

For testingDemoOn the demo of many effects, while the dynamic display of the current effect of the code to set the method, also contains some tips, suggest you first nextDemoTake a look at first.Download the Demo

xmlUse method in layout file:




    

    


Copy the code

The layout file is very simple and contains twoxmlLayout, the top is the menu layout, the bottom is the content layout

This setting is sufficient for the simplest use, the default is fixed slide mode

If you want to customize the parameters and effects of a slide, look at the Settings in the resource file (all annotated and easy to understand)


        
        
        
        
        
        
        
        
        
        
        
        
    Copy the code

The animation code is explained here

To facilitate the custom animation effects, use a 4 digits to represent different animation combination, bits represent the rotation of the animation sequence number, 10 representative transparency animation effects, one thousand delegates zoom animation effects, ten thousand delegates displacement animation effects, starting the locations are 1, there are several kinds of animation effects limit is how much. For example, there are three kinds of displacement animation, then the range of ten thousand bits is 1~3, and the others are followed by analogy.

Note: Because of the background, the blur effect will introduce extra components, so it is only added when needed, so it is not included in the animation code, the Settings will be explained below.

Stick a againxmlImplementation table of properties and code

Code implementation XML realize function
setStyleCode(int type) sm_type` Sets the animation effect code
setMenuOffset(int menuOffset) sm_menuoffset Sets the distance from the pull-out menu to the right border
setDragWipeOffset(int dragWipeOffset) sm_dragoffset Set the range of trigger slides, 0 is full screen
setStartScale(float minScale) sm_startscale Set initial zoom
setStartAlpha(float startAlpha) sm_startalpha Set initial transparency
setStart3DAngle(int start3DAngle) sm_start3dangle Set the starting 3D rotation Angle
setFullColor(Activity activity, int headColor) There is no Set global color
setBackImage(Activity activity, int backBitmap, int headColor) There is no Set the global image background and immerse
setBlur(Activity activity, int backBitmap, int headColor, float blur) There is no Sets the global blur background and specifies the degree of blur
setChangedBlur(Activity activity, int backBitmap, int headColor) There is no Set global dynamic blur (default range 0 to 25F)
setReverseChangedBlur(Activity activity, int backBitmap, int headColor) There is no Set reverse dynamic blur background (default range 0 to 25F)
setChangedBlur(Activity activity, int backBitmap, int headColor, float startBlur, float endBlur) There is no Sets dynamic blur for a specified range
setOnMenuShowingListener(onSwipeProgressListener listener) There is no Set slider listening, callback to get menu hidden to display progress, range (0~1.0f)
changeAllColor(int color) There is no Change global color (need to set global color first)
isMenuShowing() There is no Whether the current menu is displayed
showMenu() There is no According to the menu
hideMenu() There is no The hidden menu

There are only so many methods provided, and it is not difficult to understand, but here are a few more caveats

1. No global background or color is set by default, so if you need global color immersion and background immersion, please make relevant Settings. Both types of immersion are compatible to 4.4

2. The global color supports dynamic change, but the global picture background is not supported. I thought there should be no such requirement, of course, you can give me feedback and I will add if there is.

3. Rotation animation is actually a 3D rotation effect is better, the other are added, if you want to use it together with the transparency animation, can prevent the stuck (single center rotation stuck obviously, after all, the cost of drawing is there)

I’m doing a demo just to make it easier for you to set it upDemoAdded the effect of the parameter Settings displayed inRecyclerViewOne of the firstItem, and can be changed dynamically, and the current effect needs to be set parameters are all shown above.

In addition withRecyclerViewAnother purpose of the tooltip display is to demonstrate the handling of slide collisions. By default, both menus and contents can handle horizontal and vertical slides, and slides are triggered only when they are near the intersection of menu contents. Of course, you can also set the full screen slide and set the trigger range, the specific method to view the above table method, here will not repeat.

That’s it. Here’s how to add a dependency library:

Android StudioLike any other library, in yourAppthebuild.gradleWithin thedependenciesadd

The compile 'com. Brioal: SwipeMenu: 1.0'Copy the code

Or you can download itDemoextractmoduleadd

In addition to say a bit of other, I back-to-school senior, likeAndroidDevelopment, there is no confirmed job at present, if you have a recommendation, you can go to my other blog to view the resume:Brioal`s Blog

Most universities probably don’tAndroidDeveloped here with all self-taughtAndroidThe students together encourage ~ self-study is not easy ah!!

In addition, I built a QQ group, convenient communication, welcome all kinds of gods, novice veteran to join, group number:375276053

I almost forgot that some of the code snippets used in this library are from the Internet. Post the address and thank you for your code:

Immersion status bar

Teach you one minute to achieve dynamic blur effect