Search in sources :

Example 36 with Fragment

use of android.app.Fragment in project Android-CleanArchitecture by android10.

the class UserListActivityTest method testContainsUserListFragment.

public void testContainsUserListFragment() {
    Fragment userListFragment = userListActivity.getFragmentManager().findFragmentById(R.id.fragmentContainer);
    assertThat(userListFragment, is(notNullValue()));
}
Also used : Fragment(android.app.Fragment)

Example 37 with Fragment

use of android.app.Fragment in project platform_frameworks_base by android.

the class PreferenceActivity method switchToHeaderInner.

private void switchToHeaderInner(String fragmentName, Bundle args) {
    getFragmentManager().popBackStack(BACK_STACK_PREFS, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    if (!isValidFragment(fragmentName)) {
        throw new IllegalArgumentException("Invalid fragment for this activity: " + fragmentName);
    }
    Fragment f = Fragment.instantiate(this, fragmentName, args);
    FragmentTransaction transaction = getFragmentManager().beginTransaction();
    transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    transaction.replace(com.android.internal.R.id.prefs, f);
    transaction.commitAllowingStateLoss();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment)

Example 38 with Fragment

use of android.app.Fragment in project Talon-for-Twitter by klinker24.

the class TimelinePagerAdapter method getFrag.

public Fragment getFrag(int type, long listId) {
    switch(type) {
        case AppSettings.PAGE_TYPE_LIST:
            Fragment f = new ListFragment();
            Bundle b = new Bundle();
            b.putLong("list_id", listId);
            f.setArguments(b);
            return f;
        case AppSettings.PAGE_TYPE_LINKS:
            return new LinksFragment();
        case AppSettings.PAGE_TYPE_PICS:
            return new PicFragment();
        case AppSettings.PAGE_TYPE_FAV_USERS:
            return new FavUsersFragment();
    }
    return null;
}
Also used : PicFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.PicFragment) FavUsersFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.FavUsersFragment) Bundle(android.os.Bundle) Fragment(android.app.Fragment) PicFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.PicFragment) WorldTrendsFragment(com.klinker.android.twitter.activities.main_fragments.other_fragments.trends.WorldTrendsFragment) FavUsersFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.FavUsersFragment) LinksFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.LinksFragment) LocalTrendsFragment(com.klinker.android.twitter.activities.main_fragments.other_fragments.trends.LocalTrendsFragment) HomeFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.HomeFragment) LinksFragment(com.klinker.android.twitter.activities.main_fragments.home_fragments.extentions.LinksFragment)

Example 39 with Fragment

use of android.app.Fragment in project Talon-for-Twitter by klinker24.

the class SearchPagerAdapter method getItem.

@Override
public Fragment getItem(int i) {
    Fragment f = null;
    switch(i) {
        case 0:
            f = new TimelineSearchFragment();
            f.setArguments(getTimelineBundle());
            break;
        case 1:
            f = new TwitterSearchFragment();
            f.setArguments(getTwitterBundle());
            break;
        case 2:
            f = new UserSearchFragment();
            f.setArguments(getUserBundle());
            break;
    }
    return f;
}
Also used : UserSearchFragment(com.klinker.android.twitter.activities.search.UserSearchFragment) Fragment(android.app.Fragment) TimelineSearchFragment(com.klinker.android.twitter.activities.search.TimelineSearchFragment) UserSearchFragment(com.klinker.android.twitter.activities.search.UserSearchFragment) TwitterSearchFragment(com.klinker.android.twitter.activities.search.TwitterSearchFragment) TimelineSearchFragment(com.klinker.android.twitter.activities.search.TimelineSearchFragment) TwitterSearchFragment(com.klinker.android.twitter.activities.search.TwitterSearchFragment)

Example 40 with Fragment

use of android.app.Fragment in project AppIntro by apl-devs.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar tb = (Toolbar) findViewById(R.id.toolbar);
    tb.setTitle(getResources().getString(R.string.app_name));
    tb.setTitleTextColor(Color.parseColor("#FFFFFF"));
    PrimaryDrawerItem item1 = new PrimaryDrawerItem().withIdentifier(1).withName("Home");
    PrimaryDrawerItem item2 = new PrimaryDrawerItem().withIdentifier(2).withName("Permissions");
    new DrawerBuilder().withActivity(this).withHeader(R.layout.util_drawer_hdr).withToolbar(tb).addDrawerItems(item1, item2).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

        @Override
        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
            if (drawerItem != null) {
                Fragment fragment = null;
                FragmentManager fragmentManager = getFragmentManager();
                switch((int) drawerItem.getIdentifier()) {
                    case 1:
                        fragment = new MainTabsFragment();
                        break;
                    case 2:
                        fragment = new PermissionTabsFragment();
                        break;
                }
                if (fragment != null) {
                    fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
                }
                if (drawerItem instanceof Nameable) {
                    setTitle(((Nameable) drawerItem).getName().getText(getApplicationContext()));
                }
            }
            return false;
        }
    }).withShowDrawerOnFirstLaunch(true).withFireOnInitialOnClick(true).withSavedInstance(savedInstanceState).build();
}
Also used : PrimaryDrawerItem(com.mikepenz.materialdrawer.model.PrimaryDrawerItem) IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) Drawer(com.mikepenz.materialdrawer.Drawer) View(android.view.View) Fragment(android.app.Fragment) PermissionTabsFragment(com.amqtech.opensource.appintroexample.ui.fragment.PermissionTabsFragment) MainTabsFragment(com.amqtech.opensource.appintroexample.ui.fragment.MainTabsFragment) FragmentManager(android.app.FragmentManager) Nameable(com.mikepenz.materialdrawer.model.interfaces.Nameable) MainTabsFragment(com.amqtech.opensource.appintroexample.ui.fragment.MainTabsFragment) PermissionTabsFragment(com.amqtech.opensource.appintroexample.ui.fragment.PermissionTabsFragment) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder) Toolbar(android.support.v7.widget.Toolbar)

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