use of android.app.Fragment in project coursera-android by aporter.
the class ImageAdapter method getItem.
@Override
public Fragment getItem(int i) {
Fragment fragment = new ImageHolderFragment();
Bundle args = new Bundle();
args.putInt(ImageHolderFragment.RES_ID, mImageIds[i]);
args.putString(ImageHolderFragment.POS, String.valueOf(i));
fragment.setArguments(args);
return fragment;
}
use of android.app.Fragment 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.Fragment 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");
}
use of android.app.Fragment 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.Fragment 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();
}
Aggregations