Java Code Examples for android.app.Fragment#getChildFragmentManager()

The following examples show how to use android.app.Fragment#getChildFragmentManager() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LifeAttachManager.java    From Flora with MIT License 5 votes vote down vote up
public LifeListenFragment getLifeListenerFragment(Fragment fragment) {
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
        FragmentManager fm = fragment.getChildFragmentManager();
        return findFragment(fm);
    }
    return null;
}
 
Example 2
Source File: Thunder.java    From Thunder with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void registerHookToContext(@NonNull Fragment fragment) {
    FragmentManager manager = fragment.getChildFragmentManager();
    
    HookFragment hookFragment = (HookFragment) manager.findFragmentByTag(TAG_HOOK);
    if (hookFragment == null) {
        hookFragment = new HookFragment();
        manager.beginTransaction()
               .add(hookFragment, TAG_HOOK)
               .commitAllowingStateLoss();
    }
}
 
Example 3
Source File: Thunder.java    From Thunder with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void unregisterHookToContext(@NonNull Fragment fragment) {
    FragmentManager manager = fragment.getChildFragmentManager();
    
    HookFragment hookFragment = (HookFragment) manager.findFragmentByTag(TAG_HOOK);
    if (hookFragment != null) {
        hookFragment.postEnable = false;
        manager.beginTransaction()
               .remove(hookFragment)
               .commitAllowingStateLoss();
    }
}
 
Example 4
Source File: SugarTask.java    From SugarTask with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void registerHookToContext(@NonNull Fragment fragment) {
    FragmentManager manager = fragment.getChildFragmentManager();

    HookFragment hookFragment = (HookFragment) manager.findFragmentByTag(TAG_HOOK);
    if (hookFragment == null) {
        hookFragment = new HookFragment();
        manager.beginTransaction().add(hookFragment, TAG_HOOK).commitAllowingStateLoss();
    }
}
 
Example 5
Source File: SugarTask.java    From SugarTask with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void unregisterHookToContext(@NonNull Fragment fragment) {
    FragmentManager manager = fragment.getChildFragmentManager();

    HookFragment hookFragment = (HookFragment) manager.findFragmentByTag(TAG_HOOK);
    if (hookFragment != null) {
        hookFragment.postEnable = false;
        manager.beginTransaction().remove(hookFragment).commitAllowingStateLoss();
    }
}
 
Example 6
Source File: FragmentTransactionUriRequest.java    From WMRouter with Apache License 2.0 4 votes vote down vote up
/**
 * @param fragment 父fragment
 * @param uri      地址
 */
@RequiresApi(17)
public FragmentTransactionUriRequest(@NonNull Fragment fragment, String uri) {
    super(fragment.getActivity(), uri);
    mFragmentManager = fragment.getChildFragmentManager();
}
 
Example 7
Source File: BaseFragmentModule.java    From android-dagger-butterknife-mvp with Apache License 2.0 4 votes vote down vote up
@Provides
@Named(CHILD_FRAGMENT_MANAGER)
@PerFragment
static FragmentManager childFragmentManager(@Named(FRAGMENT) Fragment fragment) {
    return fragment.getChildFragmentManager();
}
 
Example 8
Source File: FragmentCompatFramework.java    From weex with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public FragmentManager getChildFragmentManager(Fragment fragment) {
  return fragment.getChildFragmentManager();
}
 
Example 9
Source File: FragmentCompatFramework.java    From stetho with MIT License 4 votes vote down vote up
@Nullable
@Override
public FragmentManager getChildFragmentManager(Fragment fragment) {
  return fragment.getChildFragmentManager();
}