Skip to content

Latest commit

 

History

History
executable file
·
99 lines (65 loc) · 3.62 KB

README_EN.md

File metadata and controls

executable file
·
99 lines (65 loc) · 3.62 KB

Fragmentation

A powerful library that manage Fragment for Android!

Fragmentation is specificly written for Android to easily implement "Single Activity + Mutilple Fragments" or "Multiple FragmentActivities + Multiple Fragments" architecture. It helps you to deal with problems that come with complicated nested Fragments. Also, it fixed a lot of bugs in Fragment class.

Demo:

"Single Activity + Mutilple Fragments" The first demo shows the basic use case of this library, the second demo shows the way to implement an app which is similar with WeChat,the third demo shows the way to implement complicated nested fragments.

FEATURES

1、Solved nested or "same-level" Fragments overlapping issue

2、Use the Fragment stack view dialog and logs to easily debug

3、add launch mode, startForResult and others that mimicking methods in Activity class

4、Add onBackPressedSupport() method to handle back button press in Fragment

5、New!!! Add onSupportVisible() ,onLazyInitView() to simplify the dev of nested-fragment

6、Now you'll be able to easily manage your Fragment transition animations

7、Fixed bugs in Fragment class when poping multiple Fragments from back stack

8、Support SwipeBack to exist(need support of Fragmentation_SwipeBack library. For more, please click here.

      

ChangeLog

0.9.X is available!!Detail

1、Solve the multi-touch problems.

2、Fix the bug that onFragmentResult() does not work when calling popTo().

3、Stronger compatibility.

4、for support-25.1.0+,perfect SharedElement!


0.8.X

1、Added onSupportVisible(),onSupportInvisible() to simplify the dev of nested-fragment;

2、Added onLazyInitView();

3、Added registerFragmentLifecycleCallbacks() to SupportActivity to monitor Fragments Lifecycle;

4、Now you can set Tag!

5、Change the commit mode to commitAllowingStateLoss().

How to use this llibrary

1. Add dependency in build.gradle file of your app module:

// appcompat v7 library is needed
compile 'me.yokeyword:fragmentation:0.9.0'
//If you want to integrate SwipeBack to exist Framgent/Activity feature, please also add this library
// compile 'me.yokeyword:fragmentation-swipeback:0.7.9'

2. Your Activity should extend SupportActivity:

public class MainActivity extends SupportActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(...);
        if (savedInstanceState == null) {
            loadRootFragment(R.id.fl_container, HomeFragment.newInstance());  
        }
    }

3. Your Fragment should extend SupportFragment:

public class HomeFragment extends SupportFragment {

    private void xxx() {
        // Launcher a Fragment, otherwise there are start(fragment,SINGTASK)、startForResult()、startWithPop() etc.
        start(DetailFragment.newInstance(HomeBean));
        // ... Other API of pop,find,anim setting etc,please check out wiki
    }
}

Last but important

If you got any problems, feel free to make an issue or send me emails. PLEASE Star, Fork, PR this project!!!