本文整理匯總了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();
}