Search in sources :

Example 31 with Fragment

use of android.support.v4.app.Fragment in project glimmr by brk3.

the class PhotosetGridFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_add_photos:
            FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
            ft.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);
            Fragment prev = mActivity.getSupportFragmentManager().findFragmentByTag(AddToPhotosetDialogFragment.TAG);
            if (prev != null) {
                ft.remove(prev);
            }
            ft.addToBackStack(null);
            DialogFragment newFragment = AddToPhotosetDialogFragment.newInstance(mPhotoset);
            newFragment.show(ft, AddToPhotosetDialogFragment.TAG);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment) PhotoGridFragment(com.bourke.glimmr.fragments.base.PhotoGridFragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 32 with Fragment

use of android.support.v4.app.Fragment in project glimmr by brk3.

the class GroupPoolGridFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_add_photos:
            FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
            ft.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);
            Fragment prev = mActivity.getSupportFragmentManager().findFragmentByTag(AddToGroupDialogFragment.TAG);
            if (prev != null) {
                ft.remove(prev);
            }
            ft.addToBackStack(null);
            DialogFragment newFragment = AddToGroupDialogFragment.newInstance(mGroup);
            newFragment.show(ft, AddToGroupDialogFragment.TAG);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment) PhotoGridFragment(com.bourke.glimmr.fragments.base.PhotoGridFragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 33 with Fragment

use of android.support.v4.app.Fragment in project glimmr by brk3.

the class PhotosetViewerActivity method initViewPager.

@Override
protected void initViewPager() {
    mViewPager = (ViewPager) findViewById(R.id.viewPager);
    mAdapter = new GlimmrPagerAdapter(getSupportFragmentManager(), mViewPager, mActionBar, CONTENT) {

        @Override
        public Fragment getItemImpl(int position) {
            switch(position) {
                case PHOTOSET_PAGE:
                    return PhotosetGridFragment.newInstance(mPhotoset);
            }
            return null;
        }
    };
    super.initViewPager();
}
Also used : GlimmrPagerAdapter(com.bourke.glimmr.common.GlimmrPagerAdapter) Fragment(android.support.v4.app.Fragment) PhotosetGridFragment(com.bourke.glimmr.fragments.photoset.PhotosetGridFragment)

Example 34 with Fragment

use of android.support.v4.app.Fragment in project glimmr by brk3.

the class ProfileViewerActivity method initViewPager.

@Override
protected void initViewPager() {
    mViewPager = (ViewPager) findViewById(R.id.viewPager);
    mAdapter = new GlimmrPagerAdapter(getSupportFragmentManager(), mViewPager, mActionBar, CONTENT) {

        @Override
        public Fragment getItemImpl(int position) {
            switch(position) {
                case PHOTO_STREAM_PAGE:
                    return PhotoStreamGridFragment.newInstance(mUser);
                case FAVORITES_STREAM_PAGE:
                    return FavoritesGridFragment.newInstance(mUser);
                case SETS_PAGE:
                    return PhotosetsFragment.newInstance(mUser);
                case CONTACTS_PAGE:
                    // TODO
                    return PhotoStreamGridFragment.newInstance(mUser);
            }
            return null;
        }
    };
    super.initViewPager();
}
Also used : GlimmrPagerAdapter(com.bourke.glimmr.common.GlimmrPagerAdapter) FavoritesGridFragment(com.bourke.glimmr.fragments.home.FavoritesGridFragment) Fragment(android.support.v4.app.Fragment) PhotosetsFragment(com.bourke.glimmr.fragments.home.PhotosetsFragment) PhotoStreamGridFragment(com.bourke.glimmr.fragments.home.PhotoStreamGridFragment)

Example 35 with Fragment

use of android.support.v4.app.Fragment in project glide by bumptech.

the class RequestManagerRetriever method handleMessage.

@Override
public boolean handleMessage(Message message) {
    boolean handled = true;
    Object removed = null;
    Object key = null;
    switch(message.what) {
        case ID_REMOVE_FRAGMENT_MANAGER:
            android.app.FragmentManager fm = (android.app.FragmentManager) message.obj;
            key = fm;
            removed = pendingRequestManagerFragments.remove(fm);
            break;
        case ID_REMOVE_SUPPORT_FRAGMENT_MANAGER:
            FragmentManager supportFm = (FragmentManager) message.obj;
            key = supportFm;
            removed = pendingSupportRequestManagerFragments.remove(supportFm);
            break;
        default:
            handled = false;
            break;
    }
    if (handled && removed == null && Log.isLoggable(TAG, Log.WARN)) {
        Log.w(TAG, "Failed to remove expected request manager fragment, manager: " + key);
    }
    return handled;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager)

Aggregations

Fragment (android.support.v4.app.Fragment)663 FragmentTransaction (android.support.v4.app.FragmentTransaction)233 Bundle (android.os.Bundle)149 View (android.view.View)140 FragmentManager (android.support.v4.app.FragmentManager)134 DialogFragment (android.support.v4.app.DialogFragment)80 TextView (android.widget.TextView)59 FragmentInstruction (de.madcyph3r.example.example.FragmentInstruction)48 MaterialMenu (de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu)48 MaterialItemSectionFragment (de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment)48 FragmentDummy (de.madcyph3r.example.example.FragmentDummy)43 Intent (android.content.Intent)41 ViewPager (android.support.v4.view.ViewPager)38 FragmentActivity (android.support.v4.app.FragmentActivity)34 ImageView (android.widget.ImageView)32 BaseFragment (com.waz.zclient.pages.BaseFragment)29 ArrayList (java.util.ArrayList)28 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)25 Button (android.widget.Button)24 ActionBar (android.support.v7.app.ActionBar)23