use of android.support.v4.app.ListFragment in project android_frameworks_base by ResurrectionRemix.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra(EXTRA_PATH);
if (path == null) {
path = "";
} else {
// not root level, display where we are in the hierarchy
setTitle(path);
}
FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentById(android.R.id.content) == null) {
ListFragment listFragment = new TestListFragment();
listFragment.setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
fm.beginTransaction().add(android.R.id.content, listFragment).commit();
}
}
use of android.support.v4.app.ListFragment in project android_frameworks_base by DirtyUnicorns.
the class CompatListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentById(android.R.id.content) == null) {
ListFragment listFragment = new ListFragment();
listFragment.setListAdapter(createListAdapter());
fm.beginTransaction().add(android.R.id.content, listFragment).commit();
}
}
use of android.support.v4.app.ListFragment in project android_frameworks_base by crdroidandroid.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra(EXTRA_PATH);
if (path == null) {
path = "";
} else {
// not root level, display where we are in the hierarchy
setTitle(path);
}
FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentById(android.R.id.content) == null) {
ListFragment listFragment = new TestListFragment();
listFragment.setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
fm.beginTransaction().add(android.R.id.content, listFragment).commit();
}
}
use of android.support.v4.app.ListFragment in project android_frameworks_base by crdroidandroid.
the class CompatListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentById(android.R.id.content) == null) {
ListFragment listFragment = new ListFragment();
listFragment.setListAdapter(createListAdapter());
fm.beginTransaction().add(android.R.id.content, listFragment).commit();
}
}
use of android.support.v4.app.ListFragment in project philm by chrisbanes.
the class BasePhilmTabFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_viewpager, container, false);
mAdapter = new TabPagerAdapter(getChildFragmentManager());
mViewPager = (ViewPager) view.findViewById(R.id.viewpager);
mViewPager.setAdapter(mAdapter);
mViewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.spacing_minor));
mTabLayout = (TabLayout) view.findViewById(R.id.viewpager_tabs);
mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
final Fragment fragment = mAdapter.getItem(tab.getPosition());
if (fragment instanceof ListFragment) {
((ListFragment) fragment).smoothScrollTo(0);
}
}
});
if (savedInstanceState != null) {
mCurrentItem = savedInstanceState.getInt(SAVE_SELECTED_TAB);
}
return view;
}
Aggregations