Search in sources :

Example 96 with Fragment

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

Example 97 with 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");
    }
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) BaseFragment(it.gmariotti.cardslib.demo.fragment.BaseFragment) GridBaseFragment(it.gmariotti.cardslib.demo.fragment.v1.GridBaseFragment) ListGplayCursorCardCABFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCursorCardCABFragment) GridGplayCABFragment(it.gmariotti.cardslib.demo.fragment.v1.GridGplayCABFragment) ListSectionedCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListSectionedCardFragment) BirthDayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.BirthDayCardFragment) GridGplayFragment(it.gmariotti.cardslib.demo.fragment.v1.GridGplayFragment) NativeCardFragment(it.gmariotti.cardslib.demo.fragment.nativeview.NativeCardFragment) DismissAnimFragment(it.gmariotti.cardslib.demo.fragment.v1.DismissAnimFragment) ShadowFragment(it.gmariotti.cardslib.demo.fragment.v1.ShadowFragment) ListCursorCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListCursorCardFragment) ListColorFragment(it.gmariotti.cardslib.demo.fragment.v1.ListColorFragment) ListDifferentInnerBaseFragment(it.gmariotti.cardslib.demo.fragment.v1.ListDifferentInnerBaseFragment) NativeListBaseFragment(it.gmariotti.cardslib.demo.fragment.nativeview.NativeListBaseFragment) GPlayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.GPlayCardFragment) NativeHeaderFragment(it.gmariotti.cardslib.demo.fragment.nativeview.NativeHeaderFragment) ListGplayCardCABFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCardCABFragment) StockCardFragment(it.gmariotti.cardslib.demo.fragment.v1.StockCardFragment) ListGplayUndoCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayUndoCardFragment) GridCursorCardFragment(it.gmariotti.cardslib.demo.fragment.v1.GridCursorCardFragment) CardExpandFragment(it.gmariotti.cardslib.demo.fragment.v1.CardExpandFragment) CardWithListFragment(it.gmariotti.cardslib.demo.fragment.v1.CardWithListFragment) DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) MiscCardFragment(it.gmariotti.cardslib.demo.fragment.v1.MiscCardFragment) ListExpandCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListExpandCardFragment) NativeThumbnailFragment(it.gmariotti.cardslib.demo.fragment.nativeview.NativeThumbnailFragment) ListGplayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCardFragment) TodoNativeCardFragment(it.gmariotti.cardslib.demo.fragment.nativeview.TodoNativeCardFragment) ChangeValueCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ChangeValueCardFragment)

Example 98 with Fragment

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

Example 99 with Fragment

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");
    }
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) CroutonFragment(it.gmariotti.cardslib.demo.extras.fragment.CroutonFragment) UniversalImageLoaderFragment(it.gmariotti.cardslib.demo.extras.fragment.UniversalImageLoaderFragment) ListViewAnimationsFragment(it.gmariotti.cardslib.demo.extras.fragment.ListViewAnimationsFragment) DragDropListFragment(it.gmariotti.cardslib.demo.extras.fragment.DragDropListFragment) StickyListHeadersFragment(it.gmariotti.cardslib.demo.extras.fragment.StickyListHeadersFragment) ListViewGridAnimationsFragment(it.gmariotti.cardslib.demo.extras.fragment.ListViewGridAnimationsFragment) DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) PicassoFragment(it.gmariotti.cardslib.demo.extras.fragment.PicassoFragment) BaseStaggeredGridFragment(it.gmariotti.cardslib.demo.extras.fragment.BaseStaggeredGridFragment) ExpandPicassoFragment(it.gmariotti.cardslib.demo.extras.fragment.ExpandPicassoFragment) GoogleProgressFragment(it.gmariotti.cardslib.demo.extras.fragment.nativeview.GoogleProgressFragment) CardWithListFragment(it.gmariotti.cardslib.demo.extras.fragment.CardWithListFragment) AnimateStaggeredGridFragment(it.gmariotti.cardslib.demo.extras.fragment.AnimateStaggeredGridFragment) IonFragment(it.gmariotti.cardslib.demo.extras.fragment.IonFragment) TwoWayViewFragment(it.gmariotti.cardslib.demo.extras.fragment.TwoWayViewFragment) ActionbarpullFragment(it.gmariotti.cardslib.demo.extras.fragment.ActionbarpullFragment) BaseFragment(it.gmariotti.cardslib.demo.extras.fragment.BaseFragment) StaggeredGridFragment(it.gmariotti.cardslib.demo.extras.fragment.StaggeredGridFragment)

Example 100 with Fragment

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();
}
Also used : PlacePickerFragment(com.example.scrumptious.picker.PlacePickerFragment) Bundle(android.os.Bundle) Fragment(android.app.Fragment) PlacePickerFragment(com.example.scrumptious.picker.PlacePickerFragment) PickerFragment(com.example.scrumptious.picker.PickerFragment) FriendPickerFragment(com.example.scrumptious.picker.FriendPickerFragment) Uri(android.net.Uri) FragmentManager(android.app.FragmentManager) FacebookException(com.facebook.FacebookException) PlacePickerFragment(com.example.scrumptious.picker.PlacePickerFragment) PickerFragment(com.example.scrumptious.picker.PickerFragment) FriendPickerFragment(com.example.scrumptious.picker.FriendPickerFragment) FriendPickerFragment(com.example.scrumptious.picker.FriendPickerFragment)

Aggregations

Fragment (android.app.Fragment)183 FragmentTransaction (android.app.FragmentTransaction)65 DialogFragment (android.app.DialogFragment)42 FragmentManager (android.app.FragmentManager)34 Bundle (android.os.Bundle)18 PreferenceFragment (android.support.v14.preference.PreferenceFragment)12 Intent (android.content.Intent)11 View (android.view.View)11 BizFragment (org.aisen.weibo.sina.ui.fragment.base.BizFragment)8 TextView (android.widget.TextView)6 ABaseFragment (org.aisen.android.ui.fragment.ABaseFragment)6 Uri (android.net.Uri)5 PreferenceFragment (android.preference.PreferenceFragment)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 SuppressLint (android.annotation.SuppressLint)3 ViewGroup (android.view.ViewGroup)3 FrameLayout (android.widget.FrameLayout)3 Method (java.lang.reflect.Method)3 APagingFragment (org.aisen.android.ui.fragment.APagingFragment)3