|
| 1 | +# StarWars.Android |
| 2 | + |
| 3 | +[](https://github.com/Yalantis/Side-Menu.iOS/blob/master/LICENSE) |
| 4 | +[](https://yalantis.com/?utm_source=github) |
| 5 | + |
| 6 | +This component implements transition animation to crumble view into tiny pieces. |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +<img src="https://yalantis.com/media/content/ckeditor/2015/10/20/star_wars-shot.gif" /> |
| 11 | +<br>Check this <a href="https://dribbble.com/shots/2109991-Star-Wars-App-concept">project on dribbble</a>. |
| 12 | + |
| 13 | +Also, read how it was done in [our blog](https://yalantis.com/blog/) |
| 14 | + |
| 15 | +##Requirements |
| 16 | +- Android SDK 15+ |
| 17 | +- OpenGL ES 2.0+ |
| 18 | + |
| 19 | +##Usage |
| 20 | + |
| 21 | +1. Wrap your fragment or activity main view in TilesFrameLayout: |
| 22 | + |
| 23 | +``` |
| 24 | +<com.yalantis.starwars.TilesFrameLayout |
| 25 | + android:id="@+id/tiles_frame_layout" |
| 26 | + android:layout_height="match_parent" |
| 27 | + android:layout_width="match_parent" |
| 28 | + app:sw_animationDuration="1500" |
| 29 | + app:sw_numberOfTilesX="35"> |
| 30 | +
|
| 31 | + <!-- Your views go here --> |
| 32 | + |
| 33 | +</com.yalantis.starwars.TilesFrameLayout> |
| 34 | +``` |
| 35 | + |
| 36 | + |
| 37 | +2. Adjust animation with these parameters: |
| 38 | + |
| 39 | +```app:sw_animationDuration``` – duration in milliseconds |
| 40 | +```app:sw_numberOfTilesX``` – the number of square tiles the plane is tessellated into broadwise |
| 41 | + |
| 42 | +``` |
| 43 | +mTilesFrameLayout = (TilesFrameLayout) findViewById(R.id.tiles_frame); |
| 44 | +mTilesFrameLayout.setOnAnimationFinishedListener(this); |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +3. In your activity or fragment’s onPause() and onResume() it’s important to call the corresponding methods: |
| 50 | +``` |
| 51 | +@Override |
| 52 | +public void onResume() { |
| 53 | + super.onResume(); |
| 54 | + mTilesFrameLayout.onResume(); |
| 55 | +} |
| 56 | +
|
| 57 | +@Override |
| 58 | +public void onPause() { |
| 59 | + super.onPause(); |
| 60 | + mTilesFrameLayout.onPause(); |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +4. To start the animation simply call: |
| 65 | + |
| 66 | +``` |
| 67 | +mTilesFrameLayout.startAnimation(); |
| 68 | +``` |
| 69 | + |
| 70 | +5. Your callback will be called when the animation ends: |
| 71 | + |
| 72 | +``` |
| 73 | +@Override |
| 74 | +public void onAnimationFinished() { |
| 75 | + // Hide or remove your view/fragment/activity here |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +Have fun! :) |
| 80 | + |
| 81 | +#### Let us know! |
| 82 | + |
| 83 | +We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation. |
| 84 | + |
| 85 | +P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned! |
| 86 | + |
| 87 | +## License |
| 88 | + |
| 89 | + The MIT License (MIT) |
| 90 | + |
| 91 | + Copyright © 2015 Yalantis |
| 92 | + |
| 93 | + Permission is hereby granted, free of charge, to any person obtaining a copy |
| 94 | + of this software and associated documentation files (the "Software"), to deal |
| 95 | + in the Software without restriction, including without limitation the rights |
| 96 | + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 97 | + copies of the Software, and to permit persons to whom the Software is |
| 98 | + furnished to do so, subject to the following conditions: |
| 99 | + |
| 100 | + The above copyright notice and this permission notice shall be included in |
| 101 | + all copies or substantial portions of the Software. |
| 102 | + |
| 103 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 104 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 105 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 106 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 107 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 108 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 109 | + THE SOFTWARE. |
| 110 | + |
0 commit comments