/* * This file is part of Find Your Friend. * * Find Your Friend is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Find Your Friend is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Find Your Friend. If not, see <http://www.gnu.org/licenses/>. */ package com.sgu.findyourfriend.screen.tips; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.util.Log; import com.sgu.findyourfriend.R; public class BaseFragment extends Fragment { public void replaceFragment(Fragment fragment, boolean addToBackStack) { FragmentTransaction transaction = getFragmentManager() .beginTransaction(); transaction.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit); if (addToBackStack) { transaction.addToBackStack(null); } transaction.replace(R.id.container_framelayout, fragment); transaction.commit(); // getChildFragmentManager().executePendingTransactions(); } public boolean popFragment() { Log.e("test", "pop fragment: " + getFragmentManager().getBackStackEntryCount()); boolean isPop = false; if (getFragmentManager().getBackStackEntryCount() > 0) { isPop = true; getFragmentManager().popBackStack(); } return isPop; // return true; } }