use of android.app.FragmentManager in project facebook-android-sdk by facebook.
the class PickerActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pickers);
Bundle args = getIntent().getExtras();
FragmentManager manager = getFragmentManager();
Fragment fragmentToShow = null;
Uri intentUri = getIntent().getData();
if (FRIEND_PICKER.equals(intentUri)) {
if (savedInstanceState == null) {
friendPickerFragment = new FriendPickerFragment();
friendPickerFragment.setSettingsFromBundle(args);
friendPickerFragment.setFriendPickerType(FriendPickerFragment.FriendPickerType.TAGGABLE_FRIENDS);
} else {
friendPickerFragment = (FriendPickerFragment) manager.findFragmentById(R.id.picker_fragment);
;
}
friendPickerFragment.setOnErrorListener(new PickerFragment.OnErrorListener() {
@Override
public void onError(PickerFragment fragment, FacebookException error) {
PickerActivity.this.onError(error);
}
});
friendPickerFragment.setOnDoneButtonClickedListener(new PickerFragment.OnDoneButtonClickedListener() {
@Override
public void onDoneButtonClicked(PickerFragment fragment) {
finishActivity();
}
});
fragmentToShow = friendPickerFragment;
} else if (PLACE_PICKER.equals(intentUri)) {
if (savedInstanceState == null) {
placePickerFragment = new PlacePickerFragment();
placePickerFragment.setSettingsFromBundle(args);
} else {
placePickerFragment = (PlacePickerFragment) manager.findFragmentById(R.id.picker_fragment);
}
placePickerFragment.setOnSelectionChangedListener(new PickerFragment.OnSelectionChangedListener() {
@Override
public void onSelectionChanged(PickerFragment fragment) {
// call finish since you can only pick one place
finishActivity();
}
});
placePickerFragment.setOnErrorListener(new PickerFragment.OnErrorListener() {
@Override
public void onError(PickerFragment fragment, FacebookException error) {
PickerActivity.this.onError(error);
}
});
placePickerFragment.setOnDoneButtonClickedListener(new PickerFragment.OnDoneButtonClickedListener() {
@Override
public void onDoneButtonClicked(PickerFragment fragment) {
finishActivity();
}
});
fragmentToShow = placePickerFragment;
} else {
// Nothing to do, finish
setResult(RESULT_CANCELED);
finish();
return;
}
manager.beginTransaction().replace(R.id.picker_fragment, fragmentToShow).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_extras_activity_main);
// The attacher should always be created in the Activity's onCreate
//mPullToRefreshAttacher = PullToRefreshAttacher.get(this);
// 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_extras);
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_extras) == null)
mBaseFragment = selectFragment(mSelectedFragment);
//if (mBaseFragment==null)
// mBaseFragment = selectFragment(mSelectedFragment);
} else {
mBaseFragment = new PicassoFragment();
openFragment(mBaseFragment);
}
//-----------------------------------------------------------------
}
use of android.app.FragmentManager in project cardslib by gabrielemariotti.
the class MainActivity method openDialogFragment.
private void openDialogFragment(DialogFragment dialogStandardFragment) {
if (dialogStandardFragment != null) {
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag("carddemo_dialog_extras");
if (prev != null) {
ft.remove(prev);
}
//ft.addToBackStack(null);
dialogStandardFragment.show(ft, "carddemo_dialog_extras");
}
}
use of android.app.FragmentManager in project cardslib by gabrielemariotti.
the class MainActivity method openFragment.
private void openFragment(BaseFragment baseFragment) {
if (baseFragment != null) {
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
//fragmentTransaction.setCustomAnimations(R.animator.carddemo_fag_fade_in,R.animator.carddemo_frag_fade_out);
fragmentTransaction.replace(R.id.fragment_main_extras, 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 TwoWayViewFragment method fragmentHelper.
private void fragmentHelper(BaseFragment fragment) {
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_main_extras, fragment);
fragmentTransaction.commit();
if (fragment.getTitleResourceId() > 0)
((MainActivity) getActivity()).mCurrentTitle = fragment.getTitleResourceId();
}
Aggregations