本文整理汇总了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();
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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));
}
}
示例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()]);
}
示例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();
}
示例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();
}
}
示例14: isFragmentVisible
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private boolean isFragmentVisible(Fragment fragment) {
return !fragment.isHidden() && fragment.getUserVisibleHint();
}
示例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();
}