use of com.android.contacts.group.GroupBrowseListAdapter.GroupListItemViewCache in project packages_apps_Contacts by AOKP.
the class GroupBrowseListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (savedInstanceState != null) {
mSelectedGroupUri = savedInstanceState.getParcelable(EXTRA_KEY_GROUP_URI);
if (mSelectedGroupUri != null) {
// The selection may be out of screen, if rotated from portrait to landscape,
// so ensure it's visible.
mSelectionToScreenRequested = true;
}
}
mRootView = inflater.inflate(R.layout.group_browse_list_fragment, null);
mEmptyView = (TextView) mRootView.findViewById(R.id.empty);
mAdapter = new GroupBrowseListAdapter(mContext);
mAdapter.setSelectionVisible(mSelectionVisible);
mAdapter.setSelectedGroup(mSelectedGroupUri);
mListView = (AutoScrollListView) mRootView.findViewById(R.id.list);
mListView.setOnFocusChangeListener(this);
mListView.setOnTouchListener(this);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
GroupListItemViewCache groupListItem = (GroupListItemViewCache) view.getTag();
if (groupListItem != null) {
viewGroup(groupListItem.getUri());
}
}
});
mListView.setEmptyView(mEmptyView);
configureVerticalScrollbar();
mAddAccountsView = mRootView.findViewById(R.id.add_accounts);
mAddAccountButton = mRootView.findViewById(R.id.add_account_button);
mAddAccountButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(Settings.EXTRA_AUTHORITIES, new String[] { ContactsContract.AUTHORITY });
ImplicitIntentsUtil.startActivityOutsideApp(getActivity(), intent);
}
});
setAddAccountsVisibility(!ContactsUtils.areGroupWritableAccountsAvailable(mContext));
return mRootView;
}
Aggregations