use of android.app.Fragment in project UltimateAndroid by cymcsg.
the class RoundedImageViewActivity method onNavigationItemSelected.
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
Fragment newFragment;
switch(itemPosition) {
default:
case 0:
newFragment = RoundedFragment.getInstance(false);
break;
case 1:
newFragment = RoundedFragment.getInstance(true);
break;
case 2:
newFragment = new PicassoFragment();
break;
case 3:
newFragment = new ColorFragment();
break;
}
getFragmentManager().beginTransaction().replace(android.R.id.content, newFragment).commit();
return true;
}
use of android.app.Fragment in project SlidingTutorial-Android by Cleveroad.
the class FragmentPagerAdapter method setPrimaryItem.
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
Fragment fragment = (Fragment) object;
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
mCurrentPrimaryItem.setMenuVisibility(false);
setUserVisibilityHint(mCurrentPrimaryItem, false);
}
if (fragment != null) {
fragment.setMenuVisibility(true);
setUserVisibilityHint(fragment, true);
}
mCurrentPrimaryItem = fragment;
}
}
use of android.app.Fragment in project android_packages_apps_Launcher2 by CyanogenMod.
the class WallpaperChooser method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.wallpaper_chooser_base);
Fragment fragmentView = getFragmentManager().findFragmentById(R.id.wallpaper_chooser_fragment);
// needs to be revived again.
if (fragmentView == null) {
/* When the screen is XLarge, the fragment is not included in the layout, so show it
* as a dialog
*/
DialogFragment fragment = WallpaperChooserDialogFragment.newInstance();
fragment.show(getFragmentManager(), "dialog");
}
}
use of android.app.Fragment in project AndroidChromium by JackyAndroid.
the class ConfirmSyncDataStateMachine method cancelDialog.
private static void cancelDialog(FragmentManager fragmentManager, String tag) {
Fragment fragment = fragmentManager.findFragmentByTag(tag);
if (fragment == null)
return;
DialogFragment dialogFragment = (DialogFragment) fragment;
if (dialogFragment.getDialog() == null)
return;
dialogFragment.getDialog().cancel();
}
use of android.app.Fragment in project UltimateAndroid by cymcsg.
the class NavigationDrawerActivity method selectItem.
private void selectItem(int position) {
// update the main content by replacing fragments
Fragment fragment = new SampleFragment();
Bundle args = new Bundle();
args.putInt(SampleFragment.ARG_IMAGE_RES, mCityImages[position]);
args.putInt(SampleFragment.ARG_ACTION_BG_RES, R.drawable.fading_actionbar_ab_background);
fragment.setArguments(args);
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
// update selected item and title, then close the drawer
mDrawerList.setItemChecked(position, true);
setTitle(mCityNames[position]);
mDrawerLayout.closeDrawer(mDrawerList);
}
Aggregations