List of usage examples for android.app FragmentTransaction commit
public abstract int commit();
From source file:de.sourcestream.movieDB.controller.GenresList.java
/** * Callback method to be invoked when an item in this AdapterView has been clicked. * * @param parent The AdapterView where the click happened. * @param view The view within the AdapterView that was clicked (this will be a view provided by the adapter) * @param position The position of the view in the adapter. * @param id The row id of the item that was clicked. *///from w w w . j a v a 2 s . co m @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (movieList.getCurrentList().equals("genre/" + genresList.get(position).getId() + "/movies")) movieList.setBackState(1); else { movieList.setCurrentList("genre/" + genresList.get(position).getId() + "/movies"); movieList.setBackState(0); } movieList.setTitle(genresList.get(position).getName()); FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); Bundle args = new Bundle(); args.putString("currentList", "genresList"); movieList.setArguments(args); transaction.replace(R.id.frame_container, movieList); // add the current transaction to the back stack: transaction.addToBackStack("genresList"); transaction.commit(); backState = 1; }
From source file:net.henryco.opalette.application.MainActivity.java
@Override public void switchToFragmentOptions(Fragment fragment) { if (!optionsSwitched) { wipeTopBarButton();/* w w w . j a va 2 s. c om*/ if (fragment != null) { FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction() .add(R.id.fragmentContainer, fragment); fragmentTransaction.commit(); } findViewById(R.id.scrollOptionsView).setVisibility(View.GONE); findViewById(R.id.fragmentSuperContainer).setVisibility(View.VISIBLE); for (ToggleButton t : toggleGroup) t.setVisibility(View.GONE); optionsSwitched = true; actualFragment = fragment; } }
From source file:io.demiseq.jetreader.activities.MainActivity.java
private void GetNewMangas() { NewFragment fragment = new NewFragment(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.content_frame, fragment, "NEW"); fragmentTransaction.commit(); removeSpinner();// www . ja v a 2 s . c om setTitle(new_); }
From source file:io.demiseq.jetreader.activities.MainActivity.java
private void GetSubscription() { SubscriptionFragment fragment = new SubscriptionFragment(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.content_frame, fragment, "FEEDS"); fragmentTransaction.commit(); removeSpinner();/*www . j av a2 s . co m*/ setTitle(feeds); }
From source file:com.battlelancer.seriesguide.ui.SeriesGuidePreferences.java
public void switchToSettings(String settingsId) { Bundle args = new Bundle(); args.putString("settings", settingsId); Fragment f = new SettingsFragment(); f.setArguments(args);/* w w w .java 2 s.c om*/ FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.content_frame, f); ft.addToBackStack(null); ft.commit(); }
From source file:io.demiseq.jetreader.activities.MainActivity.java
private void GetHotMangas() { MainFragment fragment = new MainFragment(); Bundle args = new Bundle(); args.putInt("manga_type", 1); fragment.setArguments(args);//w w w. j a v a 2 s . c o m FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.content_frame, fragment, "HOT"); fragmentTransaction.commit(); removeSpinner(); setTitle(app_name); }
From source file:io.demiseq.jetreader.activities.MainActivity.java
private void GetRecentList() { RecentFragment fragment = new RecentFragment(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.content_frame, fragment, "RECENT"); fragmentTransaction.commit(); removeSpinner();/*from w w w. j ava 2 s. co m*/ setTitle(recent); }
From source file:la.marsave.fullscreentest.MainActivity.java
/** * This method is used to toggle between the two fragment states by * calling the appropriate animations between them. The entry and exit * animations of the text fragment are specified in R.animator resource * files. The entry and exit animations of the image fragment are * specified in the slideBack and slideForward methods below. The reason * for separating the animation logic in this way is because the translucent * dark hover view must fade in at the same time as the image fragment * animates into the background, which would be difficult to time * properly given that the setCustomAnimations method can only modify the * two fragments in the transaction./*from w ww. j a v a 2 s. co m*/ */ private void switchFragments() { if (mIsAnimating) { return; } mIsAnimating = true; if (mDidSlideOut) { mDidSlideOut = false; getFragmentManager().popBackStack(); } else { mDidSlideOut = true; Animator.AnimatorListener listener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator arg0) { FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.setCustomAnimations(R.animator.slide_fragment_in, 0, 0, R.animator.slide_fragment_out); transaction.add(R.id.move_to_back_container, mTextFragment); transaction.addToBackStack(null); transaction.commit(); } }; slideBack(listener); } }
From source file:com.telestax.restcomm_olympus.CallActivity.java
@Override public void onFragmentInteraction(String action) { if (action.equals("cancel")) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.hide(keypadFragment);/*from ww w. ja va 2s . c o m*/ ft.commit(); } }
From source file:com.cloudbees.gasp.activity.PlacesActivity.java
private void addPlacesFragments() { mSearchFragment = new NearbySearchFragment() { public void onSuccess(Places places) { showLocations(places);// www .j a v a2s. c om checkToken(places); } public void onFailure(String status) { Log.e(TAG, "Google Places API search failed: status = " + status); } }; mDetailsFragment = new PlaceDetailsFragment() { @Override public void onSuccess(PlaceDetails placeDetails) { showDetails(placeDetails); } @Override public void onFailure(String status) { Log.e(TAG, "Google Places API search failed: status = " + status); } }; mAddEventFragment = new AddEventFragment() { @Override public void onSuccess(EventResponse eventResponse) { Log.d(TAG, "Event Added: " + eventResponse.getEvent_id()); } @Override public void onFailure(String status) { Log.e(TAG, "Google Places API search failed: status = " + status); } }; mDeleteEventFragment = new DeleteEventFragment() { @Override public void onSuccess(EventResponse eventResponse) { Log.d(TAG, "Event Deleted"); } @Override public void onFailure(String status) { Log.e(TAG, "Google Places API search failed: status = " + status); } }; FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.add(mSearchFragment, getString(R.string.fragment_location_search)); ft.add(mDetailsFragment, getString(R.string.fragment_place_details)); ft.add(mAddEventFragment, getString(R.string.fragment_add_event)); ft.add(mDeleteEventFragment, getString(R.string.fragment_delete_event)); ft.commit(); }