List of usage examples for android.support.v4.app FragmentTransaction commit
public abstract int commit();
From source file:com.appybite.customer.AllowedHotels.java
public void hideFragment(Fragment fg) { if (fg == null) return;// w w w .j a va 2s . c o m FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); // ft.setCustomAnimations(R.anim.fade, R.anim.hold); ft.hide(fg); ft.commit(); }
From source file:com.appybite.customer.AllowedHotels.java
public void showFragment(Fragment fg) { if (fg == null) return;/*from w w w. j a va 2 s . com*/ FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.setCustomAnimations(R.anim.fade_short, R.anim.hold); ft.show(fg); ft.commit(); }
From source file:com.ariesmcrae.mymemories.ui.story.StoryActivityBase.java
/** * Logic required to open the appropriate Create StoryData Fragment/Activity * combination to display properly on the phone or tablet. *///from www . j av a2s . c om public void openCreateStoryFragment() { Log.d(LOG_TAG, "openCreateStoryFragment"); if (determineDualPane()) { Fragment test = getSupportFragmentManager().findFragmentById(R.id.details); // Log.d(LOG_TAG, "open view class:" + test.getClass()); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); if (test != null && test.getClass() != CreateStoryFragment.class) { CreateStoryFragment details = CreateStoryFragment.newInstance(); // Execute a transaction, replacing any existing // fragment with this one inside the frame. ft.replace(R.id.details, details); } else { // Check what fragment is shown, replace if needed. CreateStoryFragment details = (CreateStoryFragment) getSupportFragmentManager() .findFragmentById(R.id.details); if (details == null) { // Make new fragment to show this selection. details = CreateStoryFragment.newInstance(); } // Execute a transaction, replacing any existing // fragment with this one inside the frame. ft.replace(R.id.details, details); } ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } else { // Otherwise we need to launch a new activity to display // the dialog fragment with selected text. Intent intent = newCreateStoryIntent(this); startActivity(intent); } }
From source file:com.alexcruz.papuhwalls.MainActivity.java
void switchFragment(int itemId, String title, String fragment) { currentItem = itemId;// ww w . j a v a2 s .c o m getSupportActionBar().setTitle(title); FragmentTransaction tx = getSupportFragmentManager().beginTransaction(); tx.setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right); tx.replace(R.id.main, Fragment.instantiate(MainActivity.this, "com.alexcruz.papuhwalls." + fragment)); tx.commit(); }
From source file:com.alexcruz.papuhwalls.MainActivity.java
void switchWalls(int itemId, String title, String fragment) { currentItem = itemId;/*w ww . j a va2s . c om*/ getSupportActionBar().setTitle(title); FragmentTransaction tx = getSupportFragmentManager().beginTransaction(); tx.setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right); tx.replace(R.id.main, Fragment.instantiate(MainActivity.this, "com.alexcruz.papuhwalls.Walls." + fragment)); tx.commit(); }
From source file:com.appybite.customer.AllowedHotels.java
public void addFragment(Fragment fg) { if (fg == null) return;// www. j av a 2s .c o m FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.setCustomAnimations(R.anim.fade_short, R.anim.hold); ft.add(R.id.fl_fragment_corner, fg); ft.commit(); }
From source file:com.ariesmcrae.mymemories.ui.story.StoryActivityBase.java
/** * Logic required to open the appropriate Edit StoryData Fragment/Activity * combination to display properly on the phone or tablet. *//* w ww. j a v a2 s .c o m*/ public void openEditStoryFragment(final long index) { Log.d(LOG_TAG, "openEditStoryFragment(" + index + ")"); if (determineDualPane()) { Fragment test = getSupportFragmentManager().findFragmentById(R.id.details); // Log.d(LOG_TAG, "open view class:" + test.getClass()); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); if (test != null && test.getClass() != EditStoryFragment.class) { EditStoryFragment editor = EditStoryFragment.newInstance(index); // Execute a transaction, replacing any existing // fragment with this one inside the frame. ft.replace(R.id.details, editor); } else { // Check what fragment is shown, replace if needed. EditStoryFragment editor = (EditStoryFragment) getSupportFragmentManager() .findFragmentById(R.id.details); if (editor == null || editor.getUniqueKey() != index) { // Make new fragment to show this selection. editor = EditStoryFragment.newInstance(index); } // Execute a transaction, replacing any existing // fragment with this one inside the frame. ft.replace(R.id.details, editor); } ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } else { // Otherwise we need to launch a new activity to display // the dialog fragment with selected text. Intent intent = newEditStoryIntent(this, index); startActivity(intent); } }
From source file:com.awrtechnologies.carbudgetsales.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fragmentstack = new Stack<Fragment>(); // creating connection detector class instance cd = new ConnectionDetector(MainActivity.this); rl_buttons = (RelativeLayout) findViewById(R.id.relative_layout_buttons); relativeprogress = (RelativeLayout) findViewById(R.id.relativelayoutprogressbarheader); news = (ImageView) findViewById(R.id.button_news); deals = (ImageView) findViewById(R.id.button_deals); tools = (ImageView) findViewById(R.id.button_tools); inventory = (ImageView) findViewById(R.id.button_inventroy); info = (ImageView) findViewById(R.id.button_information); service = (ImageView) findViewById(R.id.button_services); facebook = (Button) findViewById(R.id.button_facebook); twitter = (Button) findViewById(R.id.button_twitter); google = (Button) findViewById(R.id.button_google); digg = (Button) findViewById(R.id.button_digg); youtube = (Button) findViewById(R.id.button_youtube); java.io.File imageFile1 = new File( (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + "/." + Constants.APPNAME + "")); imageFile1.mkdirs();/*from www . ja v a2 s . c o m*/ User user = User.getUser(); if (user != null) { if (GeneralHelper.getInstance(MainActivity.this).isIscheck() == true || GeneralHelper.getInstance(MainActivity.this).isIscheckdonetime() == true) { // openfragment(); // GeneralHelper.getInstance(com.awrtechnologies.carbudgetsales.MainActivity.this).setIscheckfragment(false); loadData(); } else if (GeneralHelper.getInstance(MainActivity.this).isIscheck() == false || GeneralHelper.getInstance(MainActivity.this).isIscheckdonetime() == false) { loadData(); } } else { // openNewFragment(new ServiceFragment()); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left); ft.replace(R.id.contanier, new Signin_fragment()); ft.commit(); } deals.setOnClickListener(this); inventory.setOnClickListener(this); news.setOnClickListener(this); tools.setOnClickListener(this); info.setOnClickListener(this); service.setOnClickListener(this); facebook.setOnClickListener(this); twitter.setOnClickListener(this); google.setOnClickListener(this); digg.setOnClickListener(this); youtube.setOnClickListener(this); }
From source file:com.ariesmcrae.mymemories.ui.story.StoryActivityBase.java
/** * Logic required to open the appropriate View StoryData Fragment/Activity * combination to display properly on the phone or tablet. *///from ww w.j a va 2 s .com public void openViewStoryFragment(long index) { Log.d(LOG_TAG, "openStoryViewFragment(" + index + ")"); if (determineDualPane()) { Fragment test = getSupportFragmentManager().findFragmentById(R.id.details); // Log.d(LOG_TAG, "open view class:" + test.getClass()); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); if (test != null && test.getClass() != StoryViewFragment.class) { StoryViewFragment details = StoryViewFragment.newInstance(index); // Execute a transaction, replacing any existing // fragment with this one inside the frame. ft.replace(R.id.details, details); } else { // Check what fragment is shown, replace if needed. StoryViewFragment details = (StoryViewFragment) getSupportFragmentManager() .findFragmentById(R.id.details); if (details == null || details.getUniqueKey() != index) { // Make new fragment to show this selection. details = StoryViewFragment.newInstance(index); } // Execute a transaction, replacing any existing // fragment with this one inside the frame. ft.replace(R.id.details, details); } ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } else { // Otherwise we need to launch a new activity to display // the dialog fragment with selected text. Intent intent = newStoryViewIntent(this, index); startActivity(intent); } }
From source file:co.vmob.sample.FragmentTabHost.java
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); final String currentTab = getCurrentTabTag(); // Go through all tabs and make sure their fragments match // the correct state. FragmentTransaction ft = null; for (int i = 0; i < mTabs.size(); i++) { final TabInfo tab = mTabs.get(i); tab.fragment = mFragmentManager.findFragmentByTag(tab.tag); if (tab.fragment != null && !tab.fragment.isDetached()) { if (tab.tag.equals(currentTab)) { // The fragment for this tab is already there and // active, and it is what we really want to have // as the current tab. Nothing to do. mLastTab = tab;//from ww w. j a v a 2 s. co m } else { // This fragment was restored in the active state, // but is not the current tab. Deactivate it. if (ft == null) { ft = mFragmentManager.beginTransaction(); } ft.detach(tab.fragment); } } } // We are now ready to go. Make sure we are switched to the // correct tab. mAttached = true; if (mTabs.size() > 0) { ft = doTabChanged(currentTab, ft); } if (ft != null) { ft.commit(); mFragmentManager.executePendingTransactions(); } }