Example usage for android.support.v4.app FragmentTransaction hide

List of usage examples for android.support.v4.app FragmentTransaction hide

Introduction

In this page you can find the example usage for android.support.v4.app FragmentTransaction hide.

Prototype

public abstract FragmentTransaction hide(Fragment fragment);

Source Link

Document

Hides an existing fragment.

Usage

From source file:com.android.fastexample.adapter.FragmentTabAdapter.java

/**
 * ?tab//from   w  ww.  j  a  v a2 s. c  o  m
 *
 * @param idx
 */
private void showTab(int idx) {
    for (int i = 0; i < fragments.size(); i++) {
        Fragment fragment = fragments.get(i);
        FragmentTransaction ft = obtainFragmentTransaction(idx);

        if (idx == i) {
            ft.show(fragment);
        } else {
            ft.hide(fragment);
        }
        ft.commit();
    }
    currentTab = idx; // tab?tab
}

From source file:com.kinvey.scrumptious.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    uiHelper = new UiLifecycleHelper(this, callback);
    uiHelper.onCreate(savedInstanceState);

    setContentView(R.layout.main);//from w w  w. j a  v a  2 s.  c  om

    Logger.getLogger(HttpTransport.class.getName()).setLevel(LOGGING_LEVEL);

    FragmentManager fm = getSupportFragmentManager();
    fragments[SPLASH] = fm.findFragmentById(R.id.splashFragment);
    fragments[SELECTION] = fm.findFragmentById(R.id.selectionFragment);
    fragments[SETTINGS] = fm.findFragmentById(R.id.userSettingsFragment);

    FragmentTransaction transaction = fm.beginTransaction();
    for (int i = 0; i < fragments.length; i++) {
        transaction.hide(fragments[i]);
    }
    transaction.commit();
}

From source file:de.teammartens.android.wattfinder.worker.AnimationWorker.java

public static void hideImageZoom() {
    FragmentTransaction fT = fragmentManager.beginTransaction().setCustomAnimations(R.anim.fragment_slide_in,
            R.anim.fragment_slide_out, R.anim.fragment_slide_in, R.anim.fragment_slide_out);
    View v = getInstance().findViewById(R.id.imageZoomFragment);
    fadeOut(v, 0);// w  w  w  . j a va 2 s .  co  m
    Fragment dF = fragmentManager.findFragmentByTag(FLAG_DETAILS);
    if (dF != null)
        fT.show(dF);
    dF = fragmentManager.findFragmentByTag(FLAG_INFO);
    if (dF != null)
        fT.hide(dF);
    fT.addToBackStack(FLAG_DETAILS).commit();
}

From source file:com.omer727.facebook.widget.FacebookWidgetActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    uiHelper = new UiLifecycleHelper(this, callback);
    uiHelper.onCreate(savedInstanceState);

    setContentView(R.layout.main);//w  ww .  j a  v  a 2s  . co m

    FragmentManager fm = getSupportFragmentManager();
    fragments[SPLASH] = fm.findFragmentById(R.id.splashFragment);
    fragments[SELECTION] = fm.findFragmentById(R.id.selectionFragment);
    fragments[SETTINGS] = fm.findFragmentById(R.id.userSettingsFragment);

    FragmentTransaction transaction = fm.beginTransaction();
    for (int i = 0; i < fragments.length; i++) {
        transaction.hide(fragments[i]);
    }
    transaction.commit();
}

From source file:com.geekandroid.sdk.sample.ContentActivity.java

public void switchContent(Fragment from, Fragment to) {
    if (current != to) {
        current = to;//from   ww w  .  ja v  a2  s  . com
        FragmentTransaction transaction = getSupportFragmentManager()
                .beginTransaction()/*.setCustomAnimations(
                                   android.R.anim.fade_in, R.anim.fade_out)*/;
        if (!to.isAdded()) {
            transaction.hide(from).add(R.id.container, to).commit();
        } else {
            transaction.hide(from).show(to).commit();
        }
    }
}

From source file:eu.liveGov.libraries.livegovtoolkit.activities_fragments.DetailFragment.java

private void hideFragment() {
    if (_currentFragment != null) {
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.hide(_currentFragment);
        ft.commit();/*from   w w  w  .  j  a v a  2 s . c o m*/
    }
    _progressBar.setVisibility(View.VISIBLE);
}

From source file:sample.multithreading.ThumbnailFragment.java

@Override
public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle) {
    super.onCreateView(paramLayoutInflater, paramViewGroup, paramBundle);
    View localView = paramLayoutInflater.inflate(R.layout.gridlist, paramViewGroup, false);
    this.mAdapter = new PicasaListAdapter(getActivity());
    this.mGridView = ((GridView) localView.findViewById(android.R.id.list));
    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    int i = getResources().getDimensionPixelSize(R.dimen.thumbSize);
    int j = 2 * localDisplayMetrics.widthPixels / i;
    this.mColumnWidth = (localDisplayMetrics.widthPixels / j);
    this.mGridView.setColumnWidth(this.mColumnWidth);
    this.mGridView.setNumColumns(-1);
    this.mGridView.setAdapter(this.mAdapter);
    this.mGridView.setOnItemClickListener(this);
    this.mGridView.setEmptyView(localView.findViewById(R.id.progressRoot));
    this.mEmpty = getResources().getDrawable(R.drawable.imagenotqueued);
    getLoaderManager().initLoader(0, null, this);
    this.mServiceIntent = new Intent(getActivity(), NetworkDownloadService.class)
            .setData(Uri.parse(PICASA_RSS_URL));
    if (paramBundle == null) {
        if (!this.mLoaded) {
            getActivity().startService(this.mServiceIntent);
        }/*from   w w w . j  a va  2s  . c  o  m*/
    } else if (paramBundle.getBoolean(STATE_IS_HIDDEN, false)) {
        FragmentTransaction localFragmentTransaction = getFragmentManager().beginTransaction();
        localFragmentTransaction.hide(this);
        localFragmentTransaction.commit();
        ((ActionBarFragmentActivity) getActivity()).getCompatibleActionBar().hide();
    }
    return localView;
}

From source file:org.jraf.android.bikey.common.widget.fragmentcycler.FragmentCycler.java

/**
 * @param tabResId Optional, use 0 for no tab.
 *//*www  .j av  a  2s .c  o  m*/
public void add(FragmentActivity activity, Fragment fragment, int tabResId, int titleResId) {
    String tag = getTag(fragment);
    FragmentManager fragmentManager = activity.getSupportFragmentManager();
    Fragment foundFragment = fragmentManager.findFragmentByTag(tag);
    if (foundFragment == null) {
        FragmentTransaction t = fragmentManager.beginTransaction();
        t.add(mContainerResId, fragment, tag);
        t.hide(fragment);
        t.commit();
    } else {
        FragmentTransaction t = fragmentManager.beginTransaction();
        t.hide(foundFragment);
        t.commit();
    }
    mFragmentTags.add(tag);
    View tab = activity.findViewById(tabResId);
    if (tab != null) {
        mTabs.add((Checkable) tab);
        tab.setOnClickListener(mTabOnClickListener);
    }
    mTitles.add(titleResId);
}

From source file:com.bradenmacdonald.OverlayedMapFragment.java

public void setVisibility(boolean visible) {
    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    if (visible)/*from   ww w  .j  a  v  a 2  s. c o  m*/
        fragmentTransaction.show(mMapFragment);
    else
        fragmentTransaction.hide(mMapFragment);
    fragmentTransaction.commit();
}

From source file:net.nightwhistler.pageturner.activity.CatalogActivity.java

private void hideDetailsView() {
    if (detailsFragment != null) {
        FragmentTransaction ft = fragmentManager.beginTransaction();
        ft.hide(detailsFragment);
        ft.commitAllowingStateLoss();/*ww  w  .j a v a2 s.  c om*/
    }
}