use of android.app.FragmentManager in project coursera-android by aporter.
the class QuoteViewerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the string arrays with the titles and qutoes
mTitleArray = getResources().getStringArray(R.array.Titles);
mQuoteArray = getResources().getStringArray(R.array.Quotes);
setContentView(R.layout.main);
// Get a reference to the FragmentManager
FragmentManager fragmentManager = getFragmentManager();
// Begin a new FragmentTransaction
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
// Add the TitleFragment
fragmentTransaction.add(R.id.title_frame, new TitlesFragment());
// Add the QuoteFragment
fragmentTransaction.add(R.id.quote_frame, mQuoteFragment);
// Commit the FragmentTransaction
fragmentTransaction.commit();
}
use of android.app.FragmentManager in project cardslib by gabrielemariotti.
the class MainActivity method onCreate.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.demo_activity_main);
// enable ActionBar app icon to behave as action to toggle nav drawer
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
_initMenu();
mDrawerToggle = new CustomActionBarDrawerToggle(this, mDrawer);
mDrawer.setDrawerListener(mDrawerToggle);
// ---------------------------------------------------------------
// ...
String base64EncodedPublicKey = IabUtil.key;
// compute your public key and store it in base64EncodedPublicKey
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.enableDebugLogging(true);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// Oh noes, there was a problem.
Log.d(TAG, "Problem setting up In-app Billing: " + result);
return;
}
// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null)
return;
// Hooray, IAB is fully set up!
IabUtil.getInstance().retrieveData(mHelper);
}
});
//BaseFragment baseFragment = null;
if (savedInstanceState != null) {
mSelectedFragment = savedInstanceState.getInt(BUNDLE_SELECTEDFRAGMENT);
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
if (fragmentManager.findFragmentById(R.id.fragment_main) == null)
mBaseFragment = selectFragment(mSelectedFragment);
//if (mBaseFragment==null)
// mBaseFragment = selectFragment(mSelectedFragment);
} else {
mBaseFragment = new HeaderFragment();
openFragment(mBaseFragment);
}
//-----------------------------------------------------------------
}
use of android.app.FragmentManager in project cardslib by gabrielemariotti.
the class MainNativeActivity method openDialogFragment.
private void openDialogFragment(DialogFragment dialogStandardFragment) {
if (dialogStandardFragment != null) {
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag("carddemo_dialog");
if (prev != null) {
ft.remove(prev);
}
//ft.addToBackStack(null);
dialogStandardFragment.show(ft, "carddemo_dialog");
}
}
use of android.app.FragmentManager in project cardslib by gabrielemariotti.
the class MainNativeActivity method openFragment.
private void openFragment(BaseFragment baseFragment) {
if (baseFragment != null) {
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_main, baseFragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
if (baseFragment.getTitleResourceId() > 0)
mCurrentTitle = baseFragment.getTitleResourceId();
}
}
use of android.app.FragmentManager in project cardslib by gabrielemariotti.
the class Utils method showAbout.
public static void showAbout(Activity activity) {
FragmentManager fm = activity.getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag("dialog_about");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
new AboutDialog().show(ft, "dialog_about");
}
Aggregations