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()));
}
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();
}
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;
}
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;
}
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();
}
Aggregations