List of usage examples for android.app Fragment onHiddenChanged
public void onHiddenChanged(boolean hidden)
From source file:com.evandroid.musica.MainLyricActivity.java
private LyricsViewFragment init(FragmentManager fragmentManager, boolean startEmpty) { LyricsViewFragment lyricsViewFragment = (LyricsViewFragment) fragmentManager .findFragmentByTag(LYRICS_FRAGMENT_TAG); if (lyricsViewFragment == null || lyricsViewFragment.isDetached()) lyricsViewFragment = new LyricsViewFragment(); lyricsViewFragment.startEmpty(startEmpty); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); if (!lyricsViewFragment.isAdded()) { fragmentTransaction.add(R.id.main_fragment_container, lyricsViewFragment, LYRICS_FRAGMENT_TAG); }/* w ww . j a va2s. com*/ Fragment[] activeFragments = getActiveFragments(); displayedFragment = getDisplayedFragment(activeFragments); for (Fragment fragment : activeFragments) if (fragment != null) { if (fragment != displayedFragment && !fragment.isHidden()) { fragmentTransaction.hide(fragment); fragment.onHiddenChanged(true); } else if (fragment == displayedFragment) fragmentTransaction.show(fragment); } fragmentTransaction.commit(); return lyricsViewFragment; }
From source file:com.geecko.QuickLyric.MainActivity.java
private LyricsViewFragment init(FragmentManager fragmentManager, boolean startEmpty) { LyricsViewFragment lyricsViewFragment = (LyricsViewFragment) fragmentManager .findFragmentByTag(LYRICS_FRAGMENT_TAG); if (lyricsViewFragment == null || lyricsViewFragment.isDetached()) lyricsViewFragment = new LyricsViewFragment(); lyricsViewFragment.startEmpty(startEmpty); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.setCustomAnimations(R.animator.slide_in_end, R.animator.slide_out_start, R.animator.slide_in_start, R.animator.slide_out_end); if (!lyricsViewFragment.isAdded()) { fragmentTransaction.add(id.main_fragment_container, lyricsViewFragment, LYRICS_FRAGMENT_TAG); }//from w ww . j av a 2 s .co m Fragment[] activeFragments = getActiveFragments(); displayedFragment = getDisplayedFragment(activeFragments); for (Fragment fragment : activeFragments) if (fragment != null) { if (fragment != displayedFragment && !fragment.isHidden()) { fragmentTransaction.hide(fragment); fragment.onHiddenChanged(true); } else if (fragment == displayedFragment) fragmentTransaction.show(fragment); } fragmentTransaction.commit(); return lyricsViewFragment; }
From source file:android.app.FragmentManager.java
public void showFragment(Fragment fragment, int transition, int transitionStyle) { if (DEBUG)/* ww w . j av a 2s.c o m*/ Log.v(TAG, "show: " + fragment); if (fragment.mHidden) { fragment.mHidden = false; if (fragment.mView != null) { Animator anim = loadAnimator(fragment, transition, true, transitionStyle); if (anim != null) { anim.setTarget(fragment.mView); anim.start(); } fragment.mView.setVisibility(View.VISIBLE); } if (fragment.mAdded && fragment.mHasMenu && fragment.mMenuVisible) { mNeedMenuInvalidate = true; } fragment.onHiddenChanged(false); } }
From source file:android.app.FragmentManager.java
public void hideFragment(Fragment fragment, int transition, int transitionStyle) { if (DEBUG)//from ww w . j a va 2 s. c o m Log.v(TAG, "hide: " + fragment); if (!fragment.mHidden) { fragment.mHidden = true; if (fragment.mView != null) { Animator anim = loadAnimator(fragment, transition, true, transitionStyle); if (anim != null) { anim.setTarget(fragment.mView); // Delay the actual hide operation until the animation finishes, otherwise // the fragment will just immediately disappear final Fragment finalFragment = fragment; anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (finalFragment.mView != null) { finalFragment.mView.setVisibility(View.GONE); } } }); anim.start(); } else { fragment.mView.setVisibility(View.GONE); } } if (fragment.mAdded && fragment.mHasMenu && fragment.mMenuVisible) { mNeedMenuInvalidate = true; } fragment.onHiddenChanged(true); } }
From source file:android.app.FragmentManager.java
public void hideFragment(Fragment fragment, int transition, int transitionStyle) { if (DEBUG)/*from w ww .j a v a 2s . c o m*/ Log.v(TAG, "hide: " + fragment); if (!fragment.mHidden) { fragment.mHidden = true; if (fragment.mView != null) { Animator anim = loadAnimator(fragment, transition, false, transitionStyle); if (anim != null) { anim.setTarget(fragment.mView); // Delay the actual hide operation until the animation finishes, otherwise // the fragment will just immediately disappear final Fragment finalFragment = fragment; anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (finalFragment.mView != null) { finalFragment.mView.setVisibility(View.GONE); } } }); anim.start(); } else { fragment.mView.setVisibility(View.GONE); } } if (fragment.mAdded && fragment.mHasMenu && fragment.mMenuVisible) { mNeedMenuInvalidate = true; } fragment.onHiddenChanged(true); } }