androidx.fragment.app.FragmentTransaction Java Examples
The following examples show how to use
androidx.fragment.app.FragmentTransaction.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DNSServersAdapter.java From InviZible with GNU General Public License v3.0 | 6 votes |
private void openDNSRelaysPref(int position) { DNSServerItem dnsServer = getItem(position); Bundle bundle = new Bundle(); bundle.putString("dnsServerName", dnsServer.getName()); bundle.putSerializable("routesCurrent", routes_current); bundle.putBoolean("dnsServerIPv6", dnsServer.isIpv6()); PreferencesDNSCryptRelays preferencesDNSCryptRelays = new PreferencesDNSCryptRelays(); preferencesDNSCryptRelays.setOnRoutesChangeListener(preferencesDNSCryptServers); preferencesDNSCryptRelays.setArguments(bundle); if (fragmentManager != null) { FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); fragmentTransaction.replace(android.R.id.content, preferencesDNSCryptRelays); fragmentTransaction.addToBackStack("preferencesDNSCryptRelaysTag"); fragmentTransaction.commit(); } }
Example #2
Source File: SlidingPanelActivity.java From mimi-reader with Apache License 2.0 | 6 votes |
@Subscribe public void openBookmark(BookmarkClickedEvent event) { this.boardName = event.getBoardName(); this.boardTitle = event.getBoardTitle(); final FragmentManager fm = getSupportFragmentManager(); final FragmentTransaction ft = fm.beginTransaction(); long threadId = event.getThreadId(); detailFragment = ThreadDetailFragment.newInstance(threadId, boardName, boardTitle, null, false, false); ft.replace(R.id.postitem_detail, detailFragment, TAG_THREAD_DETAIL); ft.commit(); if (panelLayout.isOpen()) { panelLayout.closePane(); } }
Example #3
Source File: StageActivity.java From EhViewer with Apache License 2.0 | 6 votes |
public void refreshTopScene() { int index = mSceneTagList.size() - 1; if (index < 0) { return; } String tag = mSceneTagList.get(index); FragmentManager fragmentManager = getSupportFragmentManager(); Fragment fragment = fragmentManager.findFragmentByTag(tag); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.detach(fragment); transaction.attach(fragment); transaction.commitAllowingStateLoss(); onTransactScene(); }
Example #4
Source File: AvatarSelectionActivity.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@Override public void onGalleryClicked() { if (isGalleryFirst() && popToRoot()) { return; } MediaPickerFolderFragment fragment = MediaPickerFolderFragment.newInstance(this, null); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, fragment); if (isCameraFirst()) { transaction.addToBackStack(null); } transaction.commit(); }
Example #5
Source File: MainActivity.java From ui with Apache License 2.0 | 6 votes |
@Override public void onFragmentInteraction(int which) { //going to change via the transaction manager, instead of just a simple replace. FragmentTransaction transaction = fragmentManager.beginTransaction(); //remove the current fragment... //transaction.remove(fragmentManager.findFragmentById(R.id.container)); if (which == 1) { //first fragment //replace with first fragment transaction.replace(R.id.container, FirstFragment.newInstance(String.valueOf(num_one), "Called From MainFrag")); num_one++; whichfragment = 1; } else { //must be 2 (hopefully!) //replace with first fragment transaction.replace(R.id.container, SecondFragment.newInstance(String.valueOf(num_two), "Called From MainFrag")); num_two++; whichfragment = 2; } // and add the transaction to the back stack so the user can navigate back transaction.addToBackStack(null); // Commit the transaction transaction.commit(); }
Example #6
Source File: MainActivity.java From Open-Source-Android-Weather-App with MIT License | 6 votes |
private void openCreditFragment() { // If there is at least one fragment already created. if (getSupportFragmentManager().getFragments().size() > 0) { /*Check if the CreditFragment already exists (on the top of the current backstack) (and if it's the current fragment on the screen, so we don't do anything)*/ if (isLastFragmentInBackStack(CREDIT_FRAGMENT)) return; } CreditFragment creditFragment = (CreditFragment) getSupportFragmentManager().findFragmentByTag(CREDIT_FRAGMENT); FrameLayout frameLayout = findViewById(R.id.blankFrameLayoutForFragments); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); /*this fragment isn't present on the backstack*/ if (creditFragment == null) fragmentTransaction.replace(frameLayout.getId(), CreditFragment.newInstance(), CREDIT_FRAGMENT).addToBackStack(CREDIT_FRAGMENT); /* put back the old fragment on the top of the backstack*/ else fragmentTransaction.replace(frameLayout.getId(), creditFragment, CREDIT_FRAGMENT); fragmentTransaction.commit(); }
Example #7
Source File: DonationsActivity.java From J2ME-Loader with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_donations); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(R.string.donate); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); DonationsFragment donationsFragment; if (BuildConfig.DONATIONS_GOOGLE) { donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, true, GOOGLE_PUBKEY, GOOGLE_CATALOG, getResources().getStringArray(R.array.donation_google_catalog_values), false, null, null, null, false, null, null, false, null); } else { donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, false, null, null, null, true, PAYPAL_USER, PAYPAL_CURRENCY_CODE, getString(R.string.donation_paypal_item), false, null, null, false, null); } ft.replace(R.id.donations_activity_container, donationsFragment, "donationsFragment"); ft.commit(); }
Example #8
Source File: DatabaseListActivity.java From geopaparazzi with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_databaselist); Bundle extras = getIntent().getExtras(); if (extras != null) { String sql = extras.getString(LibraryConstants.PREFS_KEY_QUERY); DatabaseListFragment databaseListFragment = new DatabaseListFragment(); Bundle bundle = new Bundle(); bundle.putString(LibraryConstants.PREFS_KEY_QUERY, sql); databaseListFragment.setArguments(bundle); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.databaseListContainer, databaseListFragment); transaction.commit(); } else { throw new IllegalArgumentException("No sql supplied to query."); } }
Example #9
Source File: SettingsActivity.java From APDE with GNU General Public License v2.0 | 6 votes |
public void selectSettingsFragment(String preferencesXml) { Bundle args = new Bundle(1); args.putString("resource", preferencesXml); StockPreferenceFragment newFragment = new StockPreferenceFragment(); newFragment.setArguments(args); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); transaction.remove(getSupportFragmentManager().findFragmentById(R.id.settings_fragment_container)); transaction.add(R.id.settings_fragment_container, newFragment); if (!isMultiPane()) { transaction.addToBackStack(null); } transaction.commit(); }
Example #10
Source File: MainActivity.java From Alarmio with Apache License 2.0 | 6 votes |
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (isActionableIntent(intent)) { FragmentManager manager = getSupportFragmentManager(); BaseFragment newFragment = createFragmentFor(intent); BaseFragment fragment = fragmentRef != null ? fragmentRef.get() : null; if (newFragment == null || newFragment.equals(fragment)) // check that fragment isn't already displayed return; if (newFragment instanceof HomeFragment && manager.getBackStackEntryCount() > 0) // clear the back stack manager.popBackStack(manager.getBackStackEntryAt(0).getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); FragmentTransaction transaction = manager.beginTransaction() .setCustomAnimations(R.anim.slide_in_up_sheet, R.anim.slide_out_up_sheet, R.anim.slide_in_down_sheet, R.anim.slide_out_down_sheet) .replace(R.id.fragment, newFragment); if (fragment instanceof HomeFragment && !(newFragment instanceof HomeFragment)) transaction.addToBackStack(null); fragmentRef = new WeakReference<>(newFragment); transaction.commit(); } }
Example #11
Source File: BoxBrowseActivity.java From box-android-browse-sdk with Apache License 2.0 | 6 votes |
@Override public void onQueryTextChange(String text) { Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.box_browsesdk_fragment_container); if (TextUtils.isEmpty(text) && !(fragment instanceof BoxSearchFragment)) { return; } mRecentSearchesListView.setVisibility(View.GONE); if (!(fragment instanceof BoxSearchFragment)) { FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); // All fragments will always navigate into folders BoxSearchFragment searchFragment = new BoxSearchFragment.Builder(mSession, text, mCurrentBoxFolder).build(); trans.replace(R.id.box_browsesdk_fragment_container, searchFragment) .addToBackStack(BoxBrowseFragment.TAG) .commit(); } else { ((BoxSearchFragment)fragment).search(text); } }
Example #12
Source File: ActivityView.java From FairEmail with GNU General Public License v3.0 | 6 votes |
private void onViewMessages(Intent intent) { if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) { getSupportFragmentManager().popBackStack("messages", FragmentManager.POP_BACK_STACK_INCLUSIVE); if (content_pane != null) getSupportFragmentManager().popBackStack("unified", 0); } Bundle args = new Bundle(); args.putString("type", intent.getStringExtra("type")); args.putLong("account", intent.getLongExtra("account", -1)); args.putLong("folder", intent.getLongExtra("folder", -1)); FragmentMessages fragment = new FragmentMessages(); fragment.setArguments(args); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("messages"); fragmentTransaction.commit(); }
Example #13
Source File: ActivityBilling.java From FairEmail with GNU General Public License v3.0 | 6 votes |
protected void onCreate(Bundle savedInstanceState, boolean standalone) { super.onCreate(savedInstanceState); if (standalone) { setContentView(R.layout.activity_billing); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro"); fragmentTransaction.commit(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportFragmentManager().addOnBackStackChangedListener(this); } if (Helper.isPlayStoreInstall()) { Log.i("IAB start"); billingClient = BillingClient.newBuilder(this) .enablePendingPurchases() .setListener(this) .build(); billingClient.startConnection(billingClientStateListener); } }
Example #14
Source File: TVShowsActivity.java From Kore with Apache License 2.0 | 6 votes |
@TargetApi(21) private void startFragment(AbstractFragment fragment) { // Replace list fragment FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); // Set up transitions if (Utils.isLollipopOrLater()) { fragment.setEnterTransition( TransitionInflater.from(this).inflateTransition(R.transition.media_details)); fragment.setReturnTransition(null); } else { fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0, R.anim.fragment_list_popenter, 0); } fragTrans.replace(R.id.fragment_container, fragment) .addToBackStack(null) .commit(); }
Example #15
Source File: NoteListFragment.java From Notepad with Apache License 2.0 | 6 votes |
public void dispatchKeyShortcutEvent(int keyCode) { if(getId() == R.id.noteViewEdit) { switch(keyCode) { // CTRL+N: New Note case KeyEvent.KEYCODE_N: ScrollPositions.getInstance().setPosition(listView.getFirstVisiblePosition()); Bundle bundle = new Bundle(); bundle.putString("filename", "new"); Fragment fragment = new NoteEditFragment(); fragment.setArguments(bundle); // Add NoteEditFragment getFragmentManager() .beginTransaction() .replace(R.id.noteViewEdit, fragment, "NoteEditFragment") .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE) .commit(); break; } } }
Example #16
Source File: OdysseyMainActivity.java From odyssey with GNU General Public License v3.0 | 6 votes |
@Override public void onPlaylistSelected(String playlistTitle, long playlistID) { // Create fragment and give it an argument for the selected playlist PlaylistTracksFragment newFragment = PlaylistTracksFragment.newInstance(playlistTitle, playlistID); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // set enter / exit animation final int layoutDirection = getResources().getConfiguration().getLayoutDirection(); newFragment.setEnterTransition(new Slide(GravityCompat.getAbsoluteGravity(GravityCompat.START, layoutDirection))); newFragment.setExitTransition(new Slide(GravityCompat.getAbsoluteGravity(GravityCompat.END, layoutDirection))); // Replace whatever is in the fragment_container view with this // fragment, // and add the transaction to the back stack so the user can navigate // back transaction.replace(R.id.fragment_container, newFragment); transaction.addToBackStack("PlaylistTracksFragment"); // Commit the transaction transaction.commit(); }
Example #17
Source File: AbsSearchBarActivity.java From call_manage with MIT License | 6 votes |
/** * Toggles the search bar according to it's current state */ public void toggleSearchBar(boolean isShow) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.slide_up, R.anim.slide_down); if (isShow) { mToggled = true; mSearchBarContainer.setVisibility(View.VISIBLE); ft.show(mSearchBarFragment); mSearchBarFragment.setFocus(); Utilities.toggleKeyboard(this, mSearchBarFragment.mSearchInput, true); } else { mToggled = false; mSearchBarContainer.setVisibility(View.GONE); ft.hide(mSearchBarFragment); Utilities.toggleKeyboard(this, mSearchBarFragment.mSearchInput, false); } ft.commit(); }
Example #18
Source File: PinIOFragment.java From Bluefruit_LE_Connect_Android_V2 with MIT License | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { FragmentActivity activity = getActivity(); //noinspection SwitchStatementWithTooFewBranches switch (item.getItemId()) { case R.id.action_help: if (activity != null) { FragmentManager fragmentManager = activity.getSupportFragmentManager(); CommonHelpFragment helpFragment = CommonHelpFragment.newInstance(getString(R.string.pinio_help_title), getString(R.string.pinio_help_text)); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction() .setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right, R.anim.slide_in_right, R.anim.slide_out_left) .replace(R.id.contentLayout, helpFragment, "Help"); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); } return true; default: return super.onOptionsItemSelected(item); } }
Example #19
Source File: FragmentRight.java From Pixiv-Shaft with MIT License | 6 votes |
@Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (isVisibleToUser && !isLoad && isAdded()) { FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); FragmentRecmdUserHorizontal recmdUser = new FragmentRecmdUserHorizontal(); transaction.add(R.id.fragment_container, recmdUser, "FragmentRecmdUserHorizontal"); FragmentEvent fragmentFollowIllust = new FragmentEvent(); transaction.add(R.id.fragment_recy, fragmentFollowIllust); transaction.commitNow(); isLoad = true; } }
Example #20
Source File: TableFragment.java From android_dbinspector with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.dbinspector_action_settings) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.dbinspector_container, PreferenceListFragment.newInstance(R.xml.dbinspector_preferences)) .addToBackStack("Settings") .commit(); getFragmentManager().executePendingTransactions(); return true; } else if (item.getItemId() == R.id.dbinspector_action_clear_table) { ClearTableAlertDialogFragment fragment = ClearTableAlertDialogFragment.newInstance(databaseFile, tableName); fragment.show(getFragmentManager(), "CONFIRM_DIALOG"); return true; } return super.onOptionsItemSelected(item); }
Example #21
Source File: MainActivity.java From TDTChannels-APP with MIT License | 6 votes |
@Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int id = item.getItemId(); Fragment fragment = null; String fragmentTAG = null; if (id == R.id.nav_tv_channels) { fragment = TVFragment.newInstance(); fragmentTAG = TVFragment.TAG; } else if (id == R.id.nav_radio_channels) { fragment = RadioFragment.newInstance(); fragmentTAG = RadioFragment.TAG; } else if (id == R.id.nav_settings) { fragment = SettingsFragment.newInstance(); fragmentTAG = SettingsFragment.TAG; } if (fragment != null) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.content_frame, fragment, fragmentTAG); ft.commit(); } return true; }
Example #22
Source File: StageActivity.java From MHViewer with Apache License 2.0 | 6 votes |
public void refreshTopScene() { int index = mSceneTagList.size() - 1; if (index < 0) { return; } String tag = mSceneTagList.get(index); FragmentManager fragmentManager = getSupportFragmentManager(); Fragment fragment = fragmentManager.findFragmentByTag(tag); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.detach(fragment); transaction.attach(fragment); transaction.commitAllowingStateLoss(); onTransactScene(); }
Example #23
Source File: InfoFragment.java From Bluefruit_LE_Connect_Android_V2 with MIT License | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { FragmentActivity activity = getActivity(); switch (item.getItemId()) { case R.id.action_help: if (activity != null) { FragmentManager fragmentManager = activity.getSupportFragmentManager(); if (fragmentManager != null) { CommonHelpFragment helpFragment = CommonHelpFragment.newInstance(getString(R.string.info_help_title), getString(R.string.info_help_text)); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction() .replace(R.id.contentLayout, helpFragment, "Help"); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); } } return true; default: return super.onOptionsItemSelected(item); } }
Example #24
Source File: GalleryDetailScene.java From MHViewer with Apache License 2.0 | 6 votes |
@Override public boolean onTransition(Context context, FragmentTransaction transaction, Fragment exit, Fragment enter) { if (!(enter instanceof GalleryListScene) && !(enter instanceof DownloadsScene) && !(enter instanceof FavoritesScene) && !(enter instanceof HistoryScene)) { return false; } String transitionName = ViewCompat.getTransitionName(mThumb); if (transitionName != null) { exit.setSharedElementReturnTransition( TransitionInflater.from(context).inflateTransition(R.transition.trans_move)); exit.setExitTransition( TransitionInflater.from(context).inflateTransition(R.transition.trans_fade)); enter.setSharedElementEnterTransition( TransitionInflater.from(context).inflateTransition(R.transition.trans_move)); enter.setEnterTransition( TransitionInflater.from(context).inflateTransition(R.transition.trans_fade)); transaction.addSharedElement(mThumb, transitionName); } return true; }
Example #25
Source File: FragmentVideoActivity.java From GSYVideoPlayer with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // 设置一个exit transition if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setEnterTransition(new Explode()); getWindow().setExitTransition(new Explode()); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment); newFragment = new VideoFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.frameLayout, newFragment); transaction.addToBackStack(null); transaction.commit(); }
Example #26
Source File: MainActivity.java From VoIpUSSD with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // ((App)getApplicationContext()).getAppComponent().inject(this); getActivityComponent().inject(this); super.onCreate(savedInstanceState); if (savedInstanceState == null) splashy(); setContentView(R.layout.activity_main_menu); appUpdateManager.registerListener(this); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(getString(R.string.title_activity_cp1)); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); FragmentTransaction fragment = getSupportFragmentManager().beginTransaction(); fragment.replace(R.id.fragment_layout, new MainFragment()) .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) .addToBackStack(null) .commit(); }
Example #27
Source File: GitHistoryActivity.java From APDE with GNU General Public License v2.0 | 5 votes |
protected void loadFragment(Fragment fragment, int id, boolean transition) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(id, fragment); if (transition) { transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); transaction.addToBackStack(null); } transaction.commit(); }
Example #28
Source File: MainChatActivity.java From twiliochat-android with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_chat); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); refreshLayout = (SwipeRefreshLayout) findViewById(R.id.refreshLayout); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); chatFragment = new MainChatFragment(); fragmentTransaction.add(R.id.fragment_container, chatFragment); fragmentTransaction.commit(); context = this; mainActivity = this; logoutButton = (Button) findViewById(R.id.buttonLogout); addChannelButton = (Button) findViewById(R.id.buttonAddChannel); usernameTextView = (TextView) findViewById(R.id.textViewUsername); channelsListView = (ListView) findViewById(R.id.listViewChannels); channelManager = ChannelManager.getInstance(); setUsernameTextView(); setUpListeners(); checkTwilioClient(); }
Example #29
Source File: SubsonicFragmentActivity.java From Audinaut with GNU General Public License v3.0 | 5 votes |
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); String id = savedInstanceState.getString(Constants.MAIN_NOW_PLAYING); FragmentManager fm = getSupportFragmentManager(); nowPlayingFragment = (NowPlayingFragment) fm.findFragmentByTag(id); String secondaryId = savedInstanceState.getString(Constants.MAIN_NOW_PLAYING_SECONDARY); if (secondaryId != null) { secondaryFragment = (SubsonicFragment) fm.findFragmentByTag(secondaryId); nowPlayingFragment.setPrimaryFragment(false); secondaryFragment.setPrimaryFragment(true); FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.hide(nowPlayingFragment); trans.commit(); } if (drawerToggle != null && backStack.size() > 0) { drawerToggle.setDrawerIndicatorEnabled(false); } if (savedInstanceState.getInt(Constants.MAIN_SLIDE_PANEL_STATE, -1) == SlidingUpPanelLayout.PanelState.EXPANDED.hashCode()) { panelSlideListener.onPanelStateChanged(null, null, PanelState.EXPANDED); } }
Example #30
Source File: PrivacyPolicyFragment.java From mimi-reader with Apache License 2.0 | 5 votes |
/** * Builds and displays a licenses fragment for you. Requires "/res/raw/licenses.html" and * "/res/layout/licenses_fragment.xml" to be present. * * @param fm A fragment manager instance used to display this LicensesFragment. */ public static void displayLicensesFragment(FragmentManager fm) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = PrivacyPolicyFragment.newInstance(); newFragment.show(ft, FRAGMENT_TAG); }