本文整理汇总了Java中android.support.v4.app.FragmentTransaction.setTransition方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentTransaction.setTransition方法的具体用法?Java FragmentTransaction.setTransition怎么用?Java FragmentTransaction.setTransition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.FragmentTransaction
的用法示例。
在下文中一共展示了FragmentTransaction.setTransition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean isDark = preferences.getBoolean("DARK_THEME_KEY", false);
if (isDark)
setTheme(R.style.AppThemeDarkDialog);
else
setTheme(R.style.AppThemeDialog);
super.onCreate(savedInstanceState);
setContentView(R.layout.swaping_dialog);
TextView textView = (TextView) findViewById(R.id.SwapngMainContentComment);
if (((GlobalValues) getApplication()).GetCompleteList().isEmpty())
textView.setText(R.string.OpenHint2);
else
textView.setText(null);
SwappingCompatList compatlist = new SwappingCompatList();
compatlist.setArguments(getIntent().getExtras());
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
transaction.add(R.id.SwappingMaincontent, compatlist, "SWAPPING_COMPAT_FRAGMENT");
transaction.commit();
}
示例2: onOptionsItemSelected
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_edit_home_screen: {
FragmentManager fragmentManager = getFragmentManager();
CollectionEditDialogFragmnet collectionEditDialogFragmnet = new CollectionEditDialogFragmnet();
Bundle args = new Bundle();
collectionEditDialogFragmnet.setArguments(args);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction
.add(R.id.drawer_layout, collectionEditDialogFragmnet)
.addToBackStack(null)
.commit();
}
break;
default:
return false;
}
return false;
}
示例3: start
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
void start(FragmentManager fragmentManager, SupportFragment from, SupportFragment to, String toFragmentTag, ArrayList<TransactionRecord.SharedElement> sharedElementList) {
FragmentTransaction ft = fragmentManager.beginTransaction();
Bundle bundle = to.getArguments();
if (sharedElementList == null) {
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
} else {
bundle.putBoolean(FRAGMENTATION_ARG_IS_SHARED_ELEMENT, true);
for (TransactionRecord.SharedElement item : sharedElementList) {
ft.addSharedElement(item.sharedElement, item.sharedName);
}
}
if (from == null) {
ft.add(bundle.getInt(FRAGMENTATION_ARG_CONTAINER), to, toFragmentTag);
bundle.putBoolean(FRAGMENTATION_ARG_IS_ROOT, true);
} else {
ft.add(from.getContainerId(), to, toFragmentTag);
if (from.getTag() != null) {
ft.hide(from);
}
}
ft.addToBackStack(toFragmentTag);
supportCommit(fragmentManager, ft);
}
示例4: showHistory
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
*
* @param popStack
*/
public void showHistory(final boolean popStack)
{
popBackStackFull();
FragmentTransaction ft;
ft = fm.beginTransaction();
ft.replace(R.id.fragment_content, new RMBTHistoryFragment(), AppConstants.PAGE_TITLE_HISTORY);
ft.addToBackStack(AppConstants.PAGE_TITLE_HISTORY);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
if (popStack) {
fm.popBackStack();
}
ft.commit();
refreshActionBar(AppConstants.PAGE_TITLE_HISTORY);
}
示例5: showResultsAfterTest
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public void showResultsAfterTest(String testUuid) {
popBackStackFull();
final RMBTResultPagerFragment fragment = new RMBTResultPagerFragment();
final Bundle args = new Bundle();
args.putString(RMBTResultPagerFragment.ARG_TEST_UUID, testUuid);
fragment.setArguments(args);
final FragmentManager fm = getSupportFragmentManager();
final FragmentTransaction ft;
ft = fm.beginTransaction();
ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_HISTORY_PAGER);
ft.addToBackStack(AppConstants.PAGE_TITLE_HISTORY_PAGER);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.commit();
refreshActionBar(AppConstants.PAGE_TITLE_HISTORY_PAGER);
}
示例6: initApp
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public void initApp(boolean duringCreate)
{
popBackStackFull();
FragmentTransaction ft;
ft = fm.beginTransaction();
ft.replace(R.id.fragment_content, new RMBTMainMenuFragment(), AppConstants.PAGE_TITLE_MAIN);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.commit();
checkNews(getApplicationContext());
checkSettings(false, null);
//checkIp();
waitForSettings();
//fetchMapOptions();
historyResultLimit = Config.HISTORY_RESULTLIMIT_DEFAULT;
if (! duringCreate) // only the very first time after t+c
PermissionHelper.checkPermissionAtInit(this);
if (! duringCreate && geoLocation != null)
geoLocation.start(this);
}
示例7: replaceFragment
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* 替换 Fragment
*
* @param containerViewId
* @param fragment
*/
protected void replaceFragment(int containerViewId, Fragment fragment) {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(containerViewId, fragment);
fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
示例8: showHistoryPager
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
*
* @param pos
*/
public void showHistoryPager(final int pos)
{
if (historyStorageList != null)
{
// final RMBTHistoryPagerFragment fragment = new RMBTHistoryPagerFragment();
final Bundle args = new Bundle();
final RMBTResultPagerFragment fragment = new RMBTResultPagerFragment();
String testUuid = historyStorageList.get(pos).get("test_uuid");
//testUuid = "842356d7-a863-48f9-8220-678125fb3a76";
//testUuid = "0d765559-ab16-4fa1-b776-4040e18bf134";
//testUuid = "dbf47f08-711f-4cfa-9fd9-78f06a7a7df3";
//testUuid = "7c4f961b-0807-461b-aa8b-d2ae0b89b662";
args.putString(RMBTResultPagerFragment.ARG_TEST_UUID, testUuid);
fragment.setArguments(args);
final FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_HISTORY_PAGER);
ft.addToBackStack(AppConstants.PAGE_TITLE_HISTORY_PAGER);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.commit();
refreshActionBar(AppConstants.PAGE_TITLE_HISTORY_PAGER);
}
}
示例9: removeFragment
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public void removeFragment(){
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.remove(this);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
ft.commit();
}
示例10: doneEditing
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@Override
public void doneEditing() {
CardFragment fragment = CardFragment.newInstance(cardID, false);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
transaction.replace(R.id.cardContainer, fragment).commit();
isEditing = false;
invalidateOptionsMenu();
}
示例11: viewDetails
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@Override
public void viewDetails(int position, long[] callIds) {
ListView lv = getListView();
if(mMode != null) {
lv.setItemChecked(position, !lv.isItemChecked(position));
mMode.invalidate();
// Don't see details in this case
return;
}
if (mDualPane) {
// If we are not currently showing a fragment for the new
// position, we need to create and install a new one.
CallLogDetailsFragment df = new CallLogDetailsFragment();
Bundle bundle = new Bundle();
bundle.putLongArray(CallLogDetailsFragment.EXTRA_CALL_LOG_IDS, callIds);
df.setArguments(bundle);
// Execute a transaction, replacing any existing fragment
// with this one inside the frame.
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.details, df, null);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
getListView().setItemChecked(position, true);
} else {
Intent it = new Intent(getActivity(), CallLogDetailsActivity.class);
it.putExtra(CallLogDetailsFragment.EXTRA_CALL_LOG_IDS, callIds);
getActivity().startActivity(it);
}
}
示例12: clearDetails
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void clearDetails() {
if (mDualPane && !hasClearedDetails) {
FragmentTransaction ft = SipHome.this.getSupportFragmentManager()
.beginTransaction();
ft.replace(R.id.details, new Fragment(), null);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
}
}
示例13: openFragment
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void openFragment(Fragment fragment) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.replace(R.id.content_frame, fragment);
transaction.addToBackStack(null);
transaction.commit();
}
示例14: loadShoppingList
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void loadShoppingList() {
navigationView.setCheckedItem(R.id.nav_shopping_list);
shoppingListFragment.setToolbar(toolbar);
shoppingListFragment.setTitle(getString(R.string.section_title_shopping_list));
shoppingListFragment.setFloatingActionButton(fab);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setTransition(FragmentTransaction.TRANSIT_ENTER_MASK);
transaction.replace(R.id.container, shoppingListFragment);
transaction.commit();
}
示例15: changeFragment
import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
* Change the current displayed fragment by a new one.
* - if the fragment is in backstack, it will pop it
* - if the fragment is already displayed (trying to change the fragment with the same), it will not do anything
*
* @param frag the new fragment to display
* @param saveInBackstack if we want the fragment to be in backstack
* @param animate if we want a nice animation or not
*/
private void changeFragment(Fragment frag, boolean saveInBackstack, boolean animate, String tag) {
try {
FragmentManager manager = getSupportFragmentManager();
boolean fragmentPopped = manager.popBackStackImmediate(tag, 0);
if (!fragmentPopped && manager.findFragmentByTag(tag) == null) {
//fragment not in back stack, create it.
FragmentTransaction transaction = manager.beginTransaction();
if (animate) {
Log.d(HomeActivity.class.getName(), "Change Fragment: animate");
//transaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_left, R.anim.slide_out_right);
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
}
transaction.replace(R.id.fragment_container, frag, tag);
if (saveInBackstack) {
Log.d(HomeActivity.class.getName(), "Change Fragment: addToBackTack " + tag);
transaction.addToBackStack(tag);
} else {
Log.d(HomeActivity.class.getName(), "Change Fragment: NO addToBackTack");
}
transaction.commit();
} else {
// custom effect if fragment is already instanciated
}
} catch (IllegalStateException exception) {
Log.w(HomeActivity.class.getName(), "Unable to commit fragment, could be activity as been killed in background. " + exception.toString());
}
}