use of com.android.contacts.group.GroupBrowseListFragment in project packages_apps_Contacts by AOKP.
the class PeopleActivity method createViewsAndFragments.
private void createViewsAndFragments(Bundle savedState) {
// Disable the ActionBar so that we can use a Toolbar. This needs to be called before
// setContentView().
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.people_activity);
final FragmentManager fragmentManager = getFragmentManager();
// Hide all tabs (the current tab will later be reshown once a tab is selected)
final FragmentTransaction transaction = fragmentManager.beginTransaction();
mTabTitles = new String[TabState.COUNT];
mTabTitles[TabState.FAVORITES] = getString(R.string.favorites_tab_label);
mTabTitles[TabState.ALL] = getString(R.string.all_contacts_tab_label);
mTabTitles[TabState.GROUPS] = getString(R.string.contacts_groups_label);
mTabPager = getView(R.id.tab_pager);
mTabPagerAdapter = new TabPagerAdapter();
mTabPager.setAdapter(mTabPagerAdapter);
mTabPager.setOnPageChangeListener(mTabPagerListener);
// Configure toolbar and toolbar tabs. If in landscape mode, we configure tabs differntly.
final Toolbar toolbar = getView(R.id.toolbar);
setActionBar(toolbar);
final ViewPagerTabs portraitViewPagerTabs = (ViewPagerTabs) findViewById(R.id.lists_pager_header);
ViewPagerTabs landscapeViewPagerTabs = null;
if (portraitViewPagerTabs == null) {
landscapeViewPagerTabs = (ViewPagerTabs) getLayoutInflater().inflate(R.layout.people_activity_tabs_lands, toolbar, /* attachToRoot = */
false);
mViewPagerTabs = landscapeViewPagerTabs;
} else {
mViewPagerTabs = portraitViewPagerTabs;
}
mViewPagerTabs.setViewPager(mTabPager);
final String FAVORITE_TAG = "tab-pager-favorite";
final String ALL_TAG = "tab-pager-all";
final String GROUPS_TAG = "tab-pager-groups";
// Create the fragments and add as children of the view pager.
// The pager adapter will only change the visibility; it'll never create/destroy
// fragments.
// However, if it's after screen rotation, the fragments have been re-created by
// the fragment manager, so first see if there're already the target fragments
// existing.
mFavoritesFragment = (ContactTileListFragment) fragmentManager.findFragmentByTag(FAVORITE_TAG);
mAllFragment = (MultiSelectContactsListFragment) fragmentManager.findFragmentByTag(ALL_TAG);
mGroupsFragment = (GroupBrowseListFragment) fragmentManager.findFragmentByTag(GROUPS_TAG);
if (mFavoritesFragment == null) {
mFavoritesFragment = new ContactTileListFragment();
mAllFragment = new MultiSelectContactsListFragment();
mGroupsFragment = new GroupBrowseListFragment();
transaction.add(R.id.tab_pager, mFavoritesFragment, FAVORITE_TAG);
transaction.add(R.id.tab_pager, mAllFragment, ALL_TAG);
transaction.add(R.id.tab_pager, mGroupsFragment, GROUPS_TAG);
}
mFavoritesFragment.setListener(mFavoritesFragmentListener);
mAllFragment.setOnContactListActionListener(new ContactBrowserActionListener());
mAllFragment.setCheckBoxListListener(new CheckBoxListListener());
mGroupsFragment.setListener(new GroupBrowserActionListener());
// Hide all fragments for now. We adjust visibility when we get onSelectedTabChanged()
// from ActionBarAdapter.
transaction.hide(mFavoritesFragment);
transaction.hide(mAllFragment);
transaction.hide(mGroupsFragment);
transaction.commitAllowingStateLoss();
fragmentManager.executePendingTransactions();
// Setting Properties after fragment is created
mFavoritesFragment.setDisplayType(DisplayType.STREQUENT);
mActionBarAdapter = new ActionBarAdapter(this, this, getActionBar(), portraitViewPagerTabs, landscapeViewPagerTabs, toolbar);
mActionBarAdapter.initialize(savedState, mRequest);
// Add shadow under toolbar
ViewUtil.addRectangularOutlineProvider(findViewById(R.id.toolbar_parent), getResources());
// Configure floating action button
mFloatingActionButtonContainer = findViewById(R.id.floating_action_button_container);
final ImageButton floatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
floatingActionButton.setOnClickListener(this);
mFloatingActionButtonController = new FloatingActionButtonController(this, mFloatingActionButtonContainer, floatingActionButton);
initializeFabVisibility();
invalidateOptionsMenuIfNeeded();
}
Aggregations