當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。