当前位置: 首页>>代码示例>>Java>>正文


Java Fragment.isHidden方法代码示例

本文整理汇总了Java中android.support.v4.app.Fragment.isHidden方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.isHidden方法的具体用法?Java Fragment.isHidden怎么用?Java Fragment.isHidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.Fragment的用法示例。


在下文中一共展示了Fragment.isHidden方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setCurrentItem

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public void setCurrentItem(int itemId) {
    String name = makeFragmentName(containerId, itemId);
    Fragment fragment = manager.findFragmentByTag(name);
    FragmentTransaction fragmentTransaction = manager.beginTransaction();

    if (fragment != null) {
        fragmentTransaction.attach(fragment);
        if (fragment.isHidden()) {
            fragmentTransaction.show(fragment);
        }
    } else {
        fragment = getItem(itemId);
        fragmentTransaction.add(containerId, fragment, name);
    }
    if (fragment != current && current != null) {
        fragmentTransaction.hide(current);
    }
    current = fragment;
    fragmentTransaction.commit();
}
 
开发者ID:jonashao,项目名称:Samantha,代码行数:21,代码来源:FragmentTransactionHelper.java

示例2: onBackPressed

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    FragmentManager supportFragmentManager = view.getMainActivity().getSupportFragmentManager();
    Fragment fragment = supportFragmentManager.findFragmentByTag(TYPE_LIST_TAG);
    if (listFragment == null && collectionFragment != null && !collectionFragment.isHidden()) {
        view.setToolBar();
        supportFragmentManager.beginTransaction().remove(collectionFragment).commit();
        onMainDestroy();
        return;
    }
    if (fragment != null && fragment.isHidden()) {
        setSelectFragment(TYPE_LIST_TAG);
    } else {
        view.onBack();
    }
}
 
开发者ID:7449,项目名称:JsoupSample,代码行数:17,代码来源:MainPresenterImpl.java

示例3: setCurrentItem

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public void setCurrentItem(int itemId, boolean addToStack) {
    String name = makeFragmentName(containerId, itemId);
    Fragment fragment = manager.findFragmentByTag(name);
    FragmentTransaction fragmentTransaction = manager.beginTransaction();

    if (fragment != null) {
        fragmentTransaction.attach(fragment);
        if (fragment.isHidden()) {
            fragmentTransaction.show(fragment);
        }
    } else {
        fragment = getItem(itemId);
        fragmentTransaction.add(containerId, fragment, name);
    }
    if (fragment != current && current != null) {
        fragmentTransaction.hide(current);
    }
    current = fragment;
    if (addToStack) {
        fragmentTransaction.addToBackStack(name);
    }
    fragmentTransaction.commit();
}
 
开发者ID:jonashao,项目名称:Samantha,代码行数:24,代码来源:FragmentTransactionHelper.java

示例4: onBackPressed

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    Fragment fragment = view.getMainActivity().getSupportFragmentManager().findFragmentByTag(TYPE_DYTT_TAG);
    if (fragment != null && fragment.isHidden()) {
        setSelectFragment(TYPE_DYTT_FRAGMENT);
        view.selectMenuFirst();
    } else {
        view.onBack();
    }
}
 
开发者ID:7449,项目名称:JsoupSample,代码行数:11,代码来源:MainPresenterImpl.java

示例5: onBackPressed

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    Fragment fragment = view.getMainActivity().getSupportFragmentManager().findFragmentByTag(TYPE_ZW_TAG);
    if (fragment != null && fragment.isHidden()) {
        setSelectFragment(TYPE_ZW_FRAGMENT);
        view.selectMenuFirst();
    } else {
        view.onBack();
    }
}
 
开发者ID:7449,项目名称:JsoupSample,代码行数:11,代码来源:MainPresenterImpl.java

示例6: onBackPressed

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    Fragment fragment = view.getMainActivity().getSupportFragmentManager().findFragmentByTag(TYPE_DB_TAG);
    if (fragment != null && fragment.isHidden()) {
        setSelectFragment(TYPE_DB_FRAGMENT);
        view.selectMenuFirst();
    } else {
        view.onBack();
    }
}
 
开发者ID:7449,项目名称:JsoupSample,代码行数:11,代码来源:MainPresenterImpl.java

示例7: compatChildFragmentExitAnim

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Nullable
public Animation compatChildFragmentExitAnim(Fragment fragment) {
    if ((fragment.getTag() != null && fragment.getTag().startsWith("android:switcher:") && fragment.getUserVisibleHint()) ||
            (fragment.getParentFragment() != null && fragment.getParentFragment().isRemoving() && !fragment.isHidden())) {
        Animation animation = new Animation() {
        };
        animation.setDuration(exitAnim.getDuration());
        return animation;
    }
    return null;
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:12,代码来源:AnimatorHelper.java

示例8: dispatchSupportVisible

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private void dispatchSupportVisible(boolean visible) {
    if (mIsSupportVisible == visible) {
        mNeedDispatch = true;
        return;
    }

    mIsSupportVisible = visible;

    if (!mNeedDispatch) {
        mNeedDispatch = true;
    } else {
        if (checkAddState()) return;
        FragmentManager fragmentManager = mFragment.getChildFragmentManager();
        if (fragmentManager != null) {
            List<Fragment> childFragments = FragmentationHack.getActiveFragments(fragmentManager);
            if (childFragments != null) {
                for (Fragment child : childFragments) {
                    if (child instanceof ISupportFragment && !child.isHidden() && child.getUserVisibleHint()) {
                        ((ISupportFragment) child).getSupportDelegate().getVisibleDelegate().dispatchSupportVisible(visible);
                    }
                }
            }
        }
    }

    if (visible) {
        if (checkAddState()) return;
        mSupportF.onSupportVisible();

        if (mIsFirstVisible) {
            mIsFirstVisible = false;
            mSupportF.onLazyInitView(mSaveInstanceState);
        }
    } else {
        mSupportF.onSupportInvisible();
    }
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:38,代码来源:VisibleDelegate.java

示例9: getActiveFragment

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private static ISupportFragment getActiveFragment(FragmentManager fragmentManager, ISupportFragment parentFragment) {
    List<Fragment> fragmentList = FragmentationHack.getActiveFragments(fragmentManager);
    if (fragmentList == null) {
        return parentFragment;
    }
    for (int i = fragmentList.size() - 1; i >= 0; i--) {
        Fragment fragment = fragmentList.get(i);
        if (fragment instanceof ISupportFragment) {
            if (fragment.isResumed() && !fragment.isHidden() && fragment.getUserVisibleHint()) {
                return getActiveFragment(fragment.getChildFragmentManager(), (ISupportFragment) fragment);
            }
        }
    }
    return parentFragment;
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:16,代码来源:SupportHelper.java

示例10: showFragment

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private void showFragment(int position) {
  Fragment fragment = Rigger.getRigger(this).findFragmentByTag(mFragmentTags.get(position));
  if (fragment.isHidden()) {
    Rigger.getRigger(this).showFragment(mFragmentTags.get(position));
  } else {
    Rigger.getRigger(this).showFragment(mContainerTags.get(position));
  }
}
 
开发者ID:JustKiddingBaby,项目名称:FragmentRigger,代码行数:9,代码来源:ShowFragment.java

示例11: getVisibleFragmentTags

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Return fragments tag which the fragment's view is visible and is add onto the container view.
 *
 * @param containerViewId The container view's id to be found.
 *
 * @return The fragment tags.
 */
private String[] getVisibleFragmentTags(@IdRes int containerViewId) {
  List<String> result = new ArrayList<>();
  String[] fragmentTags = mStackManager.getFragmentTags(containerViewId);
  if (fragmentTags == null) return result.toArray(new String[result.size()]);
  for (String tag : fragmentTags) {
    Fragment fragment = mRiggerTransaction.find(tag);
    if (fragment != null && !fragment.isHidden() &&
        fragment.getView() != null && fragment.getView().getVisibility() == View.VISIBLE) {
      result.add(tag);
    }
  }
  return result.toArray(new String[result.size()]);
}
 
开发者ID:JustKiddingBaby,项目名称:FragmentRigger,代码行数:21,代码来源:_Rigger.java

示例12: showFragment

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private void showFragment(Fragment fragment, String tag, Fragment previousFragment) {
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    if (previousFragment != null && !previousFragment.isHidden()) {
        fragmentTransaction.hide(previousFragment);
    }
    if (fragment.isHidden() || fragment.isAdded()) {
        fragmentTransaction.show(fragment);
    } else {
        fragmentTransaction.add(R.id.container, fragment, tag);
    }
    fragmentTransaction.commit();
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:14,代码来源:MainActivity.java

示例13: dispatchSupportVisible

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private void dispatchSupportVisible(boolean visible) {
    mIsSupportVisible = visible;

    if (!mNeedDispatch) {
        mNeedDispatch = true;
    } else {
        FragmentManager fragmentManager = mSupportFragment.getChildFragmentManager();
        if (fragmentManager != null) {
            List<Fragment> childFragments = fragmentManager.getFragments();
            if (childFragments != null) {
                for (Fragment child : childFragments) {
                    if (child instanceof SupportFragment && !child.isHidden() && child.getUserVisibleHint()) {
                        ((SupportFragment) child).getVisibleDelegate().dispatchSupportVisible(visible);
                    }
                }
            }
        }
    }

    if (visible) {
        mSupportFragment.onSupportVisible();

        if (mIsFirstVisible) {
            mIsFirstVisible = false;
            mSupportFragment.onLazyInitView(mSaveInstanceState);
        }
    } else {
        mSupportFragment.onSupportInvisible();
    }
}
 
开发者ID:LonelyMushroom,项目名称:aarLibrary,代码行数:31,代码来源:VisibleDelegate.java

示例14: isFragmentVisible

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private boolean isFragmentVisible(Fragment fragment) {
    return !fragment.isHidden() && fragment.getUserVisibleHint();
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:4,代码来源:VisibleDelegate.java

示例15: existFragment

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * check exist Fragment
 *
 * @param fm      FragmentManager
 * @param findClz fragment class
 * @return true if exist and not hidden
 */
public static boolean existFragment(@NonNull final FragmentManager fm,
                                    final Class<? extends Fragment> findClz) {
    Fragment fragment = findFragment(fm, findClz);
    return fragment != null && !fragment.isHidden();
}
 
开发者ID:interactiveservices,项目名称:utils-android,代码行数:13,代码来源:FragmentUtils.java


注:本文中的android.support.v4.app.Fragment.isHidden方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。