/FragmentRigger

:boom:A powerful library to manage Fragments.(一个强大的Fragment管理框架)

Primary LanguageJavaMIT LicenseMIT

FragmentRigger

R i g g e r

💥A powerful library to manage Fragments.(Wiki)
一个强大的Fragment管理框架。(中文版README

Platform Release Download SDK Build Build AsPectJ JingYeoh

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 using FragmentRigger.
Principle of library is define the pointcuts for Fragment/Activity lifecycle methods and bind to the proxy class to execute.

Feature

  • 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

Problem solved

  • Fragment view overlapping
  • Fragment Multi-level showing
  • Fragment stack manager
  • Fragment transaction commit failed
  • Commit the transaction when the host activity is not resumed
  • Multiple commits are interconnected but the fragment transaction commit does not happen immediately
  • A series of exceptions when memory restarting
  • Data saved and restored when the screen is flipped
  • Can not perform this action after onSaveInstanceState
  • Lazy loading in ViewPager and other scenarios
  • The animation does not perform in different scenarios

Getting Started

Information

Demo

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 animationsExtend the android native fragment methods.

Usage example

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 your Activity/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 class Rigger 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());
}

License

This library is available under the MIT license. See the LICENSE file for more info.