Search in sources :

Example 56 with Fragment

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;
}
Also used : Fragment(android.app.Fragment)

Example 57 with Fragment

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;
    }
}
Also used : Fragment(android.app.Fragment)

Example 58 with 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");
    }
}
Also used : DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) DialogFragment(android.app.DialogFragment)

Example 59 with Fragment

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();
}
Also used : DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) DialogFragment(android.app.DialogFragment)

Example 60 with Fragment

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);
}
Also used : FragmentManager(android.app.FragmentManager) Bundle(android.os.Bundle) Fragment(android.app.Fragment)

Aggregations

Fragment (android.app.Fragment)209 FragmentTransaction (android.app.FragmentTransaction)82 FragmentManager (android.app.FragmentManager)51 DialogFragment (android.app.DialogFragment)44 Bundle (android.os.Bundle)22 Intent (android.content.Intent)13 View (android.view.View)13 PreferenceFragment (android.support.v14.preference.PreferenceFragment)12 TextView (android.widget.TextView)8 BizFragment (org.aisen.weibo.sina.ui.fragment.base.BizFragment)8 Uri (android.net.Uri)6 ABaseFragment (org.aisen.android.ui.fragment.ABaseFragment)6 Activity (android.app.Activity)5 PreferenceFragment (android.preference.PreferenceFragment)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 ViewGroup (android.view.ViewGroup)3 FrameLayout (android.widget.FrameLayout)3 ContactVcardViewerFragment (com.xabber.android.ui.fragment.ContactVcardViewerFragment)3 Method (java.lang.reflect.Method)3