💥A powerful library to manage Fragments.(Wiki)
一个强大的Fragment管理框架。(中文版README)
This might is the library to manage fragments at the least cost of use.
No need to extend any class!!!No need to extend any class!!!No need to extend any class!!! the most important thing must be said for three times!!!
you just only need cost one line annotation code when you are usingFragmentRigger
.
Principle of library is define the pointcuts for Fragment/Activity lifecycle methods and bind to the proxy class to execute.
- Powerful api
- Enough English notes
- Strictest exceptions
- Resolve usual exceptions and bugs in fragments
- Never lost any fragment transaction commit
- Extend the android native fragment methods,add some usual methods such as
onBackPressed()
- Print tree for the fragment stack
- Fragment lazy load
- Fragment transition animations
- Fragment shared elements transition animations
Fragment view overlappingFragment Multi-level showingFragment stack managerFragment transaction commit failedCommit the transaction when the host activity is not resumedMultiple commits are interconnected but the fragment transaction commit does not happen immediatelyA series of exceptions when memory restartingData saved and restored when the screen is flippedCan not perform this action after onSaveInstanceStateLazy loading in ViewPager and other scenariosThe animation does not perform in different scenarios
- Installation
- Using start
- Fragments usage
- Lazy loading
- Transition animations
- Intercept onBackPressed
- startFragmentForResult
- How to use in library module
This library support usual fragment using scenes,if you found the scene that this library does not supported,you can post Issues or Email me
Stack manager | Replace | Lazy loading |
---|---|---|
![]() |
![]() |
![]() |
Support fragment level/multi-layer nesting,and show the top fragment when fragment in the stack is closed | One fragment will be showed in one container ,this library provides powerful api to let you use fragment easier |
Support the lazy loading scene such as using with ViewPager ,it's easy to use,you just need add one line annotation code |
StartFragment.java | ReplaceFragment.java | LazyLoadFragment.java |
Show | Print stack tree |
---|---|
![]() |
![]() |
show fragment by showFragment method,support pre loading,lazy loading |
The fragment stack can be printed in logcat with Fragment tag |
ShowFragment.java | StartFragment.java |
The demos are only showing some usual scenes,the main purpose is to protrude the strong api support of this library, some functions about
Fragment
can be showed in the demos,such as:Fragment transition animations
、Extend the android native fragment methods
.
At the least cost of use is this library's target,and this library provides powerful api.
this library is differ from the existed fragment library.do not need to extend any class,you just only need add one line annotation code.
you can manage fragments by proxy class,This library uses a plug-in approach to reduce the cost of use.
1、Add your class support
Add
@Puppet
annotation for yourActivity/Fragment
that need to use this library.
//MainActivity.java
@Puppet(containerViewId = R.id.atyContent)//containerViewId is the fragment to be placed in.
public class MainActivity extends AppCompatActivity
//TestFragment.java
@Puppet
public class TestFragment extends Fragment
2、Fragment usage
No need to extend any class, add
@Puppet
annotation, use the proxy classRigger
to manage fragments.
@Puppet(containerViewId = R.id.atyContent)
public class MainActivity extends AppCompatActivity{
...
//add and show a fragment and add it to the stack,this fragment is placed in the container view.
Rigger.getRigger(this).startFragment(TestFragment.newInstance());
}
This library is available under the MIT license. See the LICENSE file for more info.